From a7f2b2ba3f13ceb60376802f4a31e104153839e8 Mon Sep 17 00:00:00 2001 From: Marc Jeanmougin Date: Tue, 17 Feb 2015 03:00:37 +0100 Subject: At first, I was thinking "I just have to go to the selection file, and change that GSList* with a std::list, then resolve the few problems" So, i tried that. And I will continue tomorrow, and the days after, on and on. (bzr r13922.1.1) --- src/main.cpp | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index 15576109d..25dc91f14 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1156,7 +1156,7 @@ static int sp_process_file_list(GSList *fl) } if (sp_export_svg) { if (sp_export_text_to_path) { - GSList *items = NULL; + SelContainer items; SPRoot *root = doc->getRoot(); doc->ensureUpToDate(); for ( SPObject *iter = root->firstChild(); iter ; iter = iter->getNext()) { @@ -1166,17 +1166,17 @@ static int sp_process_file_list(GSList *fl) } te_update_layout_now_recursive(item); - items = g_slist_append(items, item); + items.push_back(item); } - GSList *selected = NULL; - GSList *to_select = NULL; + SelContainer selected; + SelContainer to_select; - sp_item_list_to_curves(items, &selected, &to_select); + sp_item_list_to_curves(items, selected, to_select); - g_slist_free (items); - g_slist_free (selected); - g_slist_free (to_select); + items.clear(); + selected.clear(); + to_select.clear(); } if(sp_export_id) { doc->ensureUpToDate(); @@ -1435,7 +1435,7 @@ static int sp_do_export_png(SPDocument *doc) g_warning ("--export-use-hints can only be used with --export-id or --export-area-drawing; ignored."); } - GSList *items = NULL; + SelContainer items; Geom::Rect area; if (sp_export_id || sp_export_area_drawing) { @@ -1459,7 +1459,7 @@ static int sp_do_export_png(SPDocument *doc) return 1; } - items = g_slist_prepend (items, SP_ITEM(o)); + items.push_front(SP_ITEM(o)); if (sp_export_id_only) { g_print("Exporting only object with id=\"%s\"; all other objects hidden\n", sp_export_id); @@ -1647,7 +1647,7 @@ static int sp_do_export_png(SPDocument *doc) if ((width >= 1) && (height >= 1) && (width <= PNG_UINT_31_MAX) && (height <= PNG_UINT_31_MAX)) { if( sp_export_png_file(doc, path.c_str(), area, width, height, dpi, - dpi, bgcolor, NULL, NULL, true, sp_export_id_only ? items : NULL) == 1 ) { + dpi, bgcolor, NULL, NULL, true, sp_export_id_only ? items : SelContainer()) == 1 ) { g_print("Bitmap saved as: %s\n", filename.c_str()); } else { g_warning("Bitmap failed to save to: %s", filename.c_str()); @@ -1657,7 +1657,6 @@ static int sp_do_export_png(SPDocument *doc) } } - g_slist_free (items); return retcode; } -- cgit v1.2.3 From 5fd00cab14d48beaf2279a2b8f3ad5b02b76c87b Mon Sep 17 00:00:00 2001 From: Marc Jeanmougin Date: Thu, 19 Feb 2015 04:25:21 +0100 Subject: Put a few std::vector (bzr r13922.1.5) --- src/main.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index 25dc91f14..c62b9cd25 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1156,7 +1156,7 @@ static int sp_process_file_list(GSList *fl) } if (sp_export_svg) { if (sp_export_text_to_path) { - SelContainer items; + std::vector items; SPRoot *root = doc->getRoot(); doc->ensureUpToDate(); for ( SPObject *iter = root->firstChild(); iter ; iter = iter->getNext()) { @@ -1169,8 +1169,8 @@ static int sp_process_file_list(GSList *fl) items.push_back(item); } - SelContainer selected; - SelContainer to_select; + std::vector selected; + std::vector to_select; sp_item_list_to_curves(items, selected, to_select); @@ -1435,7 +1435,7 @@ static int sp_do_export_png(SPDocument *doc) g_warning ("--export-use-hints can only be used with --export-id or --export-area-drawing; ignored."); } - SelContainer items; + std::vector items; Geom::Rect area; if (sp_export_id || sp_export_area_drawing) { @@ -1459,7 +1459,7 @@ static int sp_do_export_png(SPDocument *doc) return 1; } - items.push_front(SP_ITEM(o)); + items.push_back(SP_ITEM(o)); if (sp_export_id_only) { g_print("Exporting only object with id=\"%s\"; all other objects hidden\n", sp_export_id); @@ -1647,7 +1647,7 @@ static int sp_do_export_png(SPDocument *doc) if ((width >= 1) && (height >= 1) && (width <= PNG_UINT_31_MAX) && (height <= PNG_UINT_31_MAX)) { if( sp_export_png_file(doc, path.c_str(), area, width, height, dpi, - dpi, bgcolor, NULL, NULL, true, sp_export_id_only ? items : SelContainer()) == 1 ) { + dpi, bgcolor, NULL, NULL, true, sp_export_id_only ? items : std::vector()) == 1 ) { g_print("Bitmap saved as: %s\n", filename.c_str()); } else { g_warning("Bitmap failed to save to: %s", filename.c_str()); -- cgit v1.2.3 From 9a7fa4d1899d30ec745107823f307b2a0bf3172f Mon Sep 17 00:00:00 2001 From: Marc Jeanmougin Date: Fri, 27 Feb 2015 03:10:36 +0100 Subject: corrected the casts (hopefully) (bzr r13922.1.10) --- src/main.cpp | 3 --- 1 file changed, 3 deletions(-) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index c62b9cd25..062edcb98 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1174,9 +1174,6 @@ static int sp_process_file_list(GSList *fl) sp_item_list_to_curves(items, selected, to_select); - items.clear(); - selected.clear(); - to_select.clear(); } if(sp_export_id) { doc->ensureUpToDate(); -- cgit v1.2.3 From 60bdd590969d1c32c392a8fed15f4ceac4a678d2 Mon Sep 17 00:00:00 2001 From: Marc Jeanmougin Date: Mon, 27 Apr 2015 01:12:03 +0200 Subject: Just reread the entire diff against trunk. Given the diff size, i must have forgotten things, but hopefully, there are only very few changes of semantics: ->childList is now in the intuitive order (childList()[0] is now firstChild) -> sp_selection_paste_impl is now in the opposite order (change is local to selection-chemistry.cpp, and simplify a few things) -> selection.setReprList now takes the list in the opposite order. It was always the case (the list was always reversed before handing to it) -> a few comparison functions now work "the c++ way": the C way was to return -1 if ab, now they return (bool)(a= 1) && (height >= 1) && (width <= PNG_UINT_31_MAX) && (height <= PNG_UINT_31_MAX)) { if( sp_export_png_file(doc, path.c_str(), area, width, height, dpi, dpi, bgcolor, NULL, NULL, true, sp_export_id_only ? items : std::vector()) == 1 ) { -- cgit v1.2.3