Re: [libcroco-list] [Inkscape-devel] Generic cascading in libcroco



On Tue, Mar 3, 2009 at 2:02 AM, Thomas Wood <thos gnome org> wrote:
> I'd be really interested in getting some patches from you guys. I tried
> retrieving diffs from your SVN server, but it didn't want to co-operate.

Here are my fixes collected. Others in src/libcroco may be useful too,
but it's too far into the night right now to look into them closely...

Here are the comments  (sorry for profanity but i was very angry to
have to fix that bug :)

------------------------------------------------------------------------
r14470 | buliabyak | 2007-03-14 21:42:54 -0300 (Wed, 14 Mar 2007) | 1 line
Changed paths:
   M /inkscape/trunk/src/libcroco/cr-tknzr.c

gosh, what shitty coding - reading delimited string failed when it was
at the very end of buffer
------------------------------------------------------------------------
r14469 | buliabyak | 2007-03-14 20:55:00 -0300 (Wed, 14 Mar 2007) | 1 line
Changed paths:
   M /inkscape/trunk/src/libcroco/cr-declaration.c

even if one declaration is broken, try to still read all others per
http://www.w3.org/TR/CSS21/syndata.html#declaration; fixes bug 1266843
------------------------------------------------------------------------
r14467 | buliabyak | 2007-03-14 20:52:02 -0300 (Wed, 14 Mar 2007) | 1 line
Changed paths:
   M /inkscape/trunk/src/libcroco/cr-tknzr.c

typo fix from libcroco list



-- 
bulia byak
Inkscape. Draw Freely.
http://www.inkscape.org
Index: cr-declaration.c
===================================================================
--- cr-declaration.c	(revision 13355)
+++ cr-declaration.c	(revision 14470)
@@ -210,14 +210,15 @@
                 cr_parser_try_to_skip_spaces_and_comments (parser);
                 status = cr_tknzr_peek_char (tokenizer, &c);
                 if (status != CR_OK) {
-                        if (status == CR_END_OF_INPUT_ERROR)
+                        if (status == CR_END_OF_INPUT_ERROR) 
                                 status = CR_OK;
                         goto cleanup;
                 }
                 if (c == ';') {
                         status = cr_tknzr_read_char (tokenizer, &c);
                 } else {
-                        break;
+                        cr_tknzr_read_char (tokenizer, &c);
+                        continue; // try to keep reading until we reach the end or a ;
                 }
                 important = FALSE;
                 cr_parser_try_to_skip_spaces_and_comments (parser);
@@ -225,9 +226,11 @@
                                                       &value, &important);
                 if (status != CR_OK || !property) {
                         if (status == CR_END_OF_INPUT_ERROR) {
-                                status = CR_OK;
-                        }
-                        break;
+                                status = CR_OK; // simply the end of input, do not delete what we got so far, just finish
+                                break; 
+                        } else {
+                                continue; // even if one declaration is broken, it's no reason to discard others (see http://www.w3.org/TR/CSS21/syndata.html#declaration)
+								}
                 }
                 cur_decl = cr_declaration_new (NULL, property, value);
                 if (cur_decl) {
Index: cr-tknzr.c
===================================================================
--- cr-tknzr.c	(revision 13355)
+++ cr-tknzr.c	(revision 14470)
@@ -711,13 +711,14 @@
                 guchar next_chars[2] = { 0 };
 
                 PEEK_BYTE (a_this, 1, &next_chars[0]);
-                PEEK_BYTE (a_this, 2, &next_chars[1]);
 
                 if (next_chars[0] == '\\') {
                         guchar *tmp_char_ptr1 = NULL,
                                 *tmp_char_ptr2 = NULL;
                         guint32 esc_code = 0;
 
+                        PEEK_BYTE (a_this, 2, &next_chars[1]);
+
                         if (next_chars[1] == '\'' || next_chars[1] == '"') {
                                 g_string_append_unichar (str->stryng, 
                                                          next_chars[1]);
@@ -2389,7 +2390,7 @@
                                 next_bytes[0] = BYTE (input, 1, NULL);
                                 next_bytes[1] = BYTE (input, 2, NULL);
                                 next_bytes[2] = BYTE (input, 3, NULL);
-                                next_bytes[3] = BYTE (input, 3, NULL);
+                                next_bytes[3] = BYTE (input, 4, NULL);
 
                                 if (next_bytes[0] == 'e'
                                     && next_bytes[1] == 'm') {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]