~ubuntu-branches/ubuntu/trusty/gtkhtml3.14/trusty-proposed

« back to all changes in this revision

Viewing changes to gtkhtml/htmltokenizer.c

  • Committer: Bazaar Package Importer
  • Author(s): Mathieu Trudel-Lapierre
  • Date: 2010-11-02 14:34:48 UTC
  • mfrom: (1.6.8 upstream)
  • Revision ID: james.westby@ubuntu.com-20101102143448-3cxzy1h4oh5v7igz
Tags: 1:3.32.0-0ubuntu1
* New upstream release 3.32.0
  - Crash after closing inline view of text attachment (LP: #178959, #284060)
  - Translations not working in Emoticons, Find/Replace dialogs (LP: #562633)
* debian/patches/gtkhtml3.14_ftbfs.patch: dropped.
* debian/rules: append API_VER for libgtkhtml-editor chrpath as well
* debian/libgtkhtml-editor-dev.install: append api version to pkgconfig
  file name.
* debian/*.shlibs: update shlibs files for new version with same soname, also
  rename libgtkhtml-editor to libgtkhtml-editor-3.14
* debian/control: Replaces/Conflicts gtkhtml3.14 (<< 3.32.0)
* debian/control: bump libgtk2.0-dev and libgail-dev Build-Depends to 2.20
* debian/rules: disable deprecation warnings so the build completes

Show diffs side-by-side

added added

removed removed

Lines of Context:
215
215
                              G_TYPE_NONE,
216
216
                              1, G_TYPE_POINTER);
217
217
 
218
 
        html_tokenizer_signals [HTML_TOKENIZER_END_SIGNAL] =
 
218
        html_tokenizer_signals[HTML_TOKENIZER_END_SIGNAL] =
219
219
                g_signal_new ("end",
220
220
                              G_TYPE_FROM_CLASS (klass),
221
221
                              G_SIGNAL_RUN_LAST,
365
365
        /* copy token and terminate with zero */
366
366
        strncpy (buf->data + buf->used, token, len);
367
367
        buf->used += len;
368
 
        buf->data [buf->used] = 0;
369
 
        buf->used ++;
 
368
        buf->data[buf->used] = 0;
 
369
        buf->used++;
370
370
 
371
371
        dt(printf ("html_token_buffer_append_token: '%s'\n", buf->data + buf->used - 1 - len));
372
372
 
465
465
                                /*value to add*/
466
466
                                gunichar value = INVALID_ENTITY_CHARACTER_MARKER;
467
467
                                /*skip not needed &*/
468
 
                                read_pos ++;
 
468
                                read_pos++;
469
469
                                count_chars = strcspn (read_pos, ";");
470
470
                                if (count_chars < 14 && count_chars > 1) {
471
471
                                        /*save for recovery*/
483
483
                                        } else {
484
484
                                                value = html_entity_parse (read_pos, strlen (read_pos));
485
485
                                        }
486
 
                                        if (value != INVALID_ENTITY_CHARACTER_MARKER) {
 
486
                                        if (*read_pos == '#' || value != INVALID_ENTITY_CHARACTER_MARKER) {
487
487
                                                write_pos += g_unichar_to_utf8 (value, write_pos);
488
488
                                                read_pos += (count_chars + 1);
489
489
                                        } else {
532
532
                        if (currlength > 0) {
533
533
                                g_warning ("IconvError=%s", current);
534
534
                                *newbuffer = INVALID_ENTITY_CHARACTER_MARKER;
535
 
                                newbuffer ++;
536
 
                                current ++;
537
 
                                currlength --;
538
 
                                newlength --;
 
535
                                newbuffer++;
 
536
                                current++;
 
537
                                currlength--;
 
538
                                newlength--;
539
539
                        }
540
540
                }
541
541
                returnbuffer[oldlength - newlength] = '\0';
857
857
        if (c!='\0')
858
858
        {
859
859
                *(p->dest) = c;
860
 
                p->dest ++;
 
860
                p->dest++;
861
861
                *(p->dest) = 0;
862
862
        }
863
863
}
955
955
                        p->searchCount++;
956
956
        } else if (p->searchCount == 2 && (**src == '>')) {
957
957
                p->comment = FALSE;          /* We've got a "-->" sequence */
958
 
        } else if (tolower (**src) == gtkhtmlStart [p->searchGtkHTMLCount]) {
 
958
        } else if (tolower (**src) == gtkhtmlStart[p->searchGtkHTMLCount]) {
959
959
                if (p->searchGtkHTMLCount == 8) {
960
960
                        p->extension    = TRUE;
961
961
                        p->comment = FALSE;
963
963
                        p->searchExtensionEndCount = 0;
964
964
                        p->searchGtkHTMLCount = 0;
965
965
                } else
966
 
                        p->searchGtkHTMLCount ++;
 
966
                        p->searchGtkHTMLCount++;
967
967
        } else {
968
968
                p->searchGtkHTMLCount = 0;
969
969
                if (p->searchCount < 2)
991
991
        /* check for "-->" */
992
992
        if (!p->tquote && **src == '-') {
993
993
                if (p->searchExtensionEndCount < 2)
994
 
                        p->searchExtensionEndCount ++;
 
994
                        p->searchExtensionEndCount++;
995
995
                (*src) ++;
996
996
        } else if (!p->tquote && p->searchExtensionEndCount == 2 && **src == '>') {
997
997
                p->extension = FALSE;
1003
1003
 
1004
1004
                                while (p->searchExtensionEndCount) {
1005
1005
                                        extension_one_char (t, &c);
1006
 
                                        p->searchExtensionEndCount --;
 
1006
                                        p->searchExtensionEndCount--;
1007
1007
                                }
1008
1008
                        }
1009
1009
                }
1020
1020
        if (p->scriptCodeSize + 11 > p->scriptCodeMaxSize)
1021
1021
                p->scriptCode = g_realloc (p->scriptCode, p->scriptCodeMaxSize += 1024);
1022
1022
 
1023
 
        if ((**src == '>' ) && ( p->searchFor [p->searchCount] == '>')) {
 
1023
        if ((**src == '>' ) && ( p->searchFor[p->searchCount] == '>')) {
1024
1024
                (*src)++;
1025
 
                p->scriptCode [p->scriptCodeSize] = 0;
1026
 
                p->scriptCode [p->scriptCodeSize + 1] = 0;
 
1025
                p->scriptCode[p->scriptCodeSize] = 0;
 
1026
                p->scriptCode[p->scriptCodeSize + 1] = 0;
1027
1027
                if (p->script) {
1028
1028
                        p->script = FALSE;
1029
1029
                }
1036
1036
        /* Check if a </script> tag is on its way */
1037
1037
        else if (p->searchCount > 0) {
1038
1038
                gboolean put_to_script = FALSE;
1039
 
                if (tolower (**src) == p->searchFor [p->searchCount]) {
1040
 
                        p->searchBuffer [p->searchCount] = **src;
 
1039
                if (tolower (**src) == p->searchFor[p->searchCount]) {
 
1040
                        p->searchBuffer[p->searchCount] = **src;
1041
1041
                        p->searchCount++;
1042
1042
                        (*src)++;
1043
1043
                }
1044
 
                else if (p->searchFor [p->searchCount] == '>') {
 
1044
                else if (p->searchFor[p->searchCount] == '>') {
1045
1045
                        /* There can be any number of white-space characters between
1046
1046
                           tag name and closing '>' so try to move through them, if possible */
1047
1047
 
1060
1060
                if (put_to_script) {
1061
1061
                        gchar *c;
1062
1062
 
1063
 
                        p->searchBuffer [p->searchCount] = 0;
 
1063
                        p->searchBuffer[p->searchCount] = 0;
1064
1064
                        c = p->searchBuffer;
1065
1065
                        while (*c)
1066
 
                                p->scriptCode [p->scriptCodeSize++] = *c++;
1067
 
                        p->scriptCode [p->scriptCodeSize] = **src; (*src)++;
 
1066
                                p->scriptCode[p->scriptCodeSize++] = *c++;
 
1067
                        p->scriptCode[p->scriptCodeSize] = **src; (*src)++;
1068
1068
                        p->searchCount = 0;
1069
1069
                }
1070
1070
        }
1071
1071
        else if (**src == '<') {
1072
1072
                p->searchCount = 1;
1073
 
                p->searchBuffer [0] = '<';
 
1073
                p->searchBuffer[0] = '<';
1074
1074
                (*src)++;
1075
1075
        }
1076
1076
        else {
1077
 
                p->scriptCode [p->scriptCodeSize] = **src;
 
1077
                p->scriptCode[p->scriptCodeSize] = **src;
1078
1078
                (*src)++;
1079
1079
        }
1080
1080
}
1468
1468
 
1469
1469
        g_return_if_fail (t && HTML_IS_TOKENIZER (t));
1470
1470
 
1471
 
        g_signal_emit (t, html_tokenizer_signals [HTML_TOKENIZER_BEGIN_SIGNAL], 0, content_type);
 
1471
        g_signal_emit (t, html_tokenizer_signals[HTML_TOKENIZER_BEGIN_SIGNAL], 0, content_type);
1472
1472
}
1473
1473
 
1474
1474
void
1476
1476
{
1477
1477
        g_return_if_fail (t && HTML_IS_TOKENIZER (t));
1478
1478
 
1479
 
        g_signal_emit (t, html_tokenizer_signals [HTML_TOKENIZER_CHANGEENGINE_SIGNAL], 0, engine_type);
 
1479
        g_signal_emit (t, html_tokenizer_signals[HTML_TOKENIZER_CHANGEENGINE_SIGNAL], 0, engine_type);
1480
1480
}
1481
1481
 
1482
1482
void
1484
1484
{
1485
1485
        g_return_if_fail (t && HTML_IS_TOKENIZER (t));
1486
1486
 
1487
 
        g_signal_emit (t, html_tokenizer_signals [HTML_TOKENIZER_CHANGECONTENT_SIGNAL], 0, content_type);
 
1487
        g_signal_emit (t, html_tokenizer_signals[HTML_TOKENIZER_CHANGECONTENT_SIGNAL], 0, content_type);
1488
1488
}
1489
1489
 
1490
1490
void