X-Git-Url: https://git.tokkee.org/?p=inkscape.git;a=blobdiff_plain;f=src%2Fsp-string.cpp;fp=src%2Fsp-string.cpp;h=c116e8dd854b3f2f1dcd6d59eaf8b074cdb20d1a;hp=b424ac3d8c318ee10e14af386b7c4b1f97fa886f;hb=9dc68827cbd515262ecb8d5ae8547d9e82c72e00;hpb=8c6aa1264d2d7b0f1d6e31a97937572068aeaaae diff --git a/src/sp-string.cpp b/src/sp-string.cpp index b424ac3d8..c116e8dd8 100644 --- a/src/sp-string.cpp +++ b/src/sp-string.cpp @@ -1,10 +1,10 @@ -#define __SP_STRING_C__ - /* * SVG and implementation * * Author: * Lauris Kaplinski + * Jon A. Cruz + * Abhishek Sharma * * Copyright (C) 1999-2002 Lauris Kaplinski * Copyright (C) 2000-2001 Ximian, Inc. @@ -116,12 +116,16 @@ sp_string_read_content(SPObject *object) SPString *string = SP_STRING(object); string->string.clear(); - gchar const *xml_string = string->repr->content(); + + //XML Tree being used directly here while it shouldn't be. + gchar const *xml_string = string->getRepr()->content(); // see algorithms described in svg 1.1 section 10.15 if (object->xml_space.value == SP_XML_SPACE_PRESERVE) { for ( ; *xml_string ; xml_string = g_utf8_next_char(xml_string) ) { gunichar c = g_utf8_get_char(xml_string); - if (c == 0xa || c == 0xd || c == '\t') c = ' '; + if ((c == 0xa) || (c == 0xd) || (c == '\t')) { + c = ' '; + } string->string += c; } } @@ -129,17 +133,22 @@ sp_string_read_content(SPObject *object) bool whitespace = false; for ( ; *xml_string ; xml_string = g_utf8_next_char(xml_string) ) { gunichar c = g_utf8_get_char(xml_string); - if (c == 0xa || c == 0xd) continue; - if (c == ' ' || c == '\t') whitespace = true; - else { - if (whitespace && (!string->string.empty() || SP_OBJECT_PREV(object) != NULL)) + if ((c == 0xa) || (c == 0xd)) { + continue; + } + if ((c == ' ') || (c == '\t')) { + whitespace = true; + } else { + if (whitespace && (!string->string.empty() || (object->getPrev() != NULL))) { string->string += ' '; + } string->string += c; whitespace = false; } } - if (whitespace && SP_OBJECT_REPR(object)->next() != NULL) // can't use SP_OBJECT_NEXT() when the SPObject tree is still being built + if (whitespace && SP_OBJECT_REPR(object)->next() != NULL) { // can't use SPObject::getNext() when the SPObject tree is still being built string->string += ' '; + } } object->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); }