|
|
|
|
@ -909,7 +909,8 @@ gnc_is_our_first_xml_chunk(char *chunk, gboolean *with_encoding)
|
|
|
|
|
|
|
|
|
|
if (strncmp(cursor, "<?xml", 5) == 0)
|
|
|
|
|
{
|
|
|
|
|
char *tag_compare;
|
|
|
|
|
char *tag_compare1;
|
|
|
|
|
char *tag_compare2;
|
|
|
|
|
|
|
|
|
|
if (!search_for('>', &cursor))
|
|
|
|
|
{
|
|
|
|
|
@ -921,9 +922,12 @@ gnc_is_our_first_xml_chunk(char *chunk, gboolean *with_encoding)
|
|
|
|
|
return GNC_BOOK_NOT_OURS;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
tag_compare = g_strdup_printf("<%s\n", gnc_v2_xml_version_string);
|
|
|
|
|
tag_compare1 = g_strdup_printf("<%s\n", gnc_v2_xml_version_string);
|
|
|
|
|
/* This second compare is to handle Windows end-of-line markers */
|
|
|
|
|
tag_compare2 = g_strdup_printf("<%s\r\n", gnc_v2_xml_version_string);
|
|
|
|
|
|
|
|
|
|
if (strncmp(cursor, tag_compare, strlen(tag_compare)) == 0)
|
|
|
|
|
if ((strncmp(cursor, tag_compare1, strlen(tag_compare1)) == 0)
|
|
|
|
|
|| (strncmp(cursor, tag_compare2, strlen(tag_compare2)) == 0))
|
|
|
|
|
{
|
|
|
|
|
if (with_encoding)
|
|
|
|
|
{
|
|
|
|
|
@ -938,13 +942,15 @@ gnc_is_our_first_xml_chunk(char *chunk, gboolean *with_encoding)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
g_free (tag_compare);
|
|
|
|
|
g_free (tag_compare1);
|
|
|
|
|
g_free (tag_compare2);
|
|
|
|
|
return GNC_BOOK_XML2_FILE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
g_free (tag_compare);
|
|
|
|
|
g_free (tag_compare1);
|
|
|
|
|
g_free (tag_compare2);
|
|
|
|
|
|
|
|
|
|
if (strncmp(cursor, "<gnc>\n", strlen("<gnc>\n")) == 0)
|
|
|
|
|
if (strncmp(cursor, "<gnc>", strlen("<gnc>")) == 0)
|
|
|
|
|
return GNC_BOOK_XML1_FILE;
|
|
|
|
|
|
|
|
|
|
/* If it doesn't match any of the above but has '<gnc-v...', it must */
|
|
|
|
|
|