Bug 45678 - EasyHack: kill hwpfilter/source/list.hxx with fire
Summary: EasyHack: kill hwpfilter/source/list.hxx with fire
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: Other All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: difficultyBeginner, easyHack, skillCpp
Depends on:
Blocks:
 
Reported: 2012-02-06 02:26 UTC by Thorsten Behrens (allotropia)
Modified: 2016-02-05 11:10 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
Removed every use of LinkedList and replaced it with std::list (54.15 KB, patch)
2012-03-02 07:37 UTC, Szabolcs Dézsi
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Thorsten Behrens (allotropia) 2012-02-06 02:26:32 UTC
Quoted class wraps std::list - why not port the code over to use std::list directly, that avoids cluttering semantics on a per-module basis.
Comment 1 Szabolcs Dézsi 2012-03-02 07:37:09 UTC
Created attachment 57921 [details]
Removed every use of LinkedList and replaced it with std::list

Hi!

I removed every use of LinkedList and replaced it with std::list
I hope everything's correct. Tested it with the .hwp file in hwpfilter/qa/cppunit/data (pass and fail). Working as expected.

LinkedList had a find(int n) method, which returned the underlying std::vector's nth element, unfortunately this isn't possible with std::list, so the calls to find(...) and replaced with iterating with a for loop i times, thus pointing the iterator to the nth element of the list.

Don't know if it's a very good solution though. The original find method had an assertion that the parameter is between 0 and the size of the underlying vector.

If something is wrong, let me know, and i try to enhance/work on it. Or feel free to improve it :)

Szabolcs
Comment 2 Szabolcs Dézsi 2012-03-02 07:45:10 UTC
(In reply to comment #1)
> Created attachment 57921 [details] [review]
> Removed every use of LinkedList and replaced it with std::list

> LinkedList had a find(int n) method, which returned the underlying
> std::vector's nth element, unfortunately this isn't possible with std::list, so
> the calls to find(...) and replaced with iterating with a for loop i times,
> thus pointing the iterator to the nth element of the list.

I mean n times :) Iterating n times...
Comment 3 Korrawit Pruegsanusak 2012-03-06 08:54:38 UTC
I see Tor's committed:

http://cgit.freedesktop.org/libreoffice/core/commit/?id=db74590950afc8def36a42abae786be5ebad85d9

Could we mark this as fixed?
Comment 4 Thorsten Behrens (allotropia) 2012-04-12 03:58:20 UTC
Indeed, thanks for the patch -> fixed.
Comment 5 Robinson Tryon (qubit) 2015-12-15 23:21:59 UTC
Migrating Whiteboard tags to Keywords: (EasyHack,DifficultyEasy,SkillCpp)
[NinjaEdit]
Comment 6 Björn Michaelsen 2016-02-05 11:10:51 UTC
difficultyEasy -> difficultyBeginner. The former never really existed and only makes the EasyHack not appear on the wiki.