mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Additional testing patch from James LewisMoss.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@3621 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
f6672b8490
commit
3afbeae315
@ -1,3 +1,11 @@
|
|||||||
|
2001-02-08 James LewisMoss <dres@phoenixdsl.com>
|
||||||
|
|
||||||
|
* src/engine/sixtp.c (sixtp_parse_file): Only set parse_result if
|
||||||
|
it points somewhere.
|
||||||
|
|
||||||
|
* src/engine/sixtp-to-dom-parser.c (dom_chars_handler): fix
|
||||||
|
character adding.
|
||||||
|
|
||||||
2001-02-07 James LewisMoss <dres@phoenixdsl.com>
|
2001-02-07 James LewisMoss <dres@phoenixdsl.com>
|
||||||
|
|
||||||
* make-gnucash-patch.in: Add a file ending that is ignored.
|
* make-gnucash-patch.in: Add a file ending that is ignored.
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
|
||||||
|
#include <ctype.h>
|
||||||
|
|
||||||
#include "sixtp-parsers.h"
|
#include "sixtp-parsers.h"
|
||||||
#include "sixtp-utils.h"
|
#include "sixtp-utils.h"
|
||||||
#include "sixtp.h"
|
#include "sixtp.h"
|
||||||
@ -23,23 +25,45 @@ static gboolean dom_start_handler(
|
|||||||
thing = xmlNewChild(parent_data, global_namespace, tag, NULL);
|
thing = xmlNewChild(parent_data, global_namespace, tag, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
while(*atptr != 0)
|
if(attrs != NULL)
|
||||||
{
|
{
|
||||||
xmlSetProp(thing, atptr[0], atptr[1]);
|
while(*atptr != 0)
|
||||||
atptr += 2;
|
{
|
||||||
|
xmlSetProp(thing, atptr[0], atptr[1]);
|
||||||
|
atptr += 2;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
*result = thing;
|
*result = thing;
|
||||||
|
*data_for_children = thing;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean is_whitespace(const char *text, int len)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
for(i = 0; i < len; i++)
|
||||||
|
{
|
||||||
|
if(!isspace(text[i]))
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
static gboolean dom_chars_handler(
|
static gboolean dom_chars_handler(
|
||||||
GSList *sibling_data, gpointer parent_data, gpointer global_data,
|
GSList *sibling_data, gpointer parent_data, gpointer global_data,
|
||||||
gpointer *result, const char *text, int length)
|
gpointer *result, const char *text, int length)
|
||||||
{
|
{
|
||||||
xmlNodeSetContent((xmlNodePtr)result, text);
|
if(length > 0 && !is_whitespace(text, length))
|
||||||
|
{
|
||||||
|
gchar *stuff = g_strndup(text, length);
|
||||||
|
xmlNodeSetContent((xmlNodePtr)parent_data, stuff);
|
||||||
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean dom_before_handler(
|
static gboolean dom_before_handler(
|
||||||
|
@ -606,13 +606,15 @@ sixtp_parse_file(sixtp *sixtp,
|
|||||||
|
|
||||||
if(ctxt->data.parsing_ok)
|
if(ctxt->data.parsing_ok)
|
||||||
{
|
{
|
||||||
*parse_result = ctxt->top_frame->frame_data;
|
if(parse_result)
|
||||||
|
*parse_result = ctxt->top_frame->frame_data;
|
||||||
sixtp_context_destroy(ctxt);
|
sixtp_context_destroy(ctxt);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
*parse_result = NULL;
|
if(parse_result)
|
||||||
|
*parse_result = NULL;
|
||||||
sixtp_handle_catastrophe(&ctxt->data);
|
sixtp_handle_catastrophe(&ctxt->data);
|
||||||
sixtp_context_destroy(ctxt);
|
sixtp_context_destroy(ctxt);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -653,4 +655,3 @@ sixtp_parse_buffer(sixtp *sixtp,
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user