From: Michael Schroeder Date: Fri, 19 Sep 2008 14:18:48 +0000 (+0000) Subject: - copy parser swtab fix from Matz into other files X-Git-Tag: BASE-SuSE-Code-12_1-Branch~499 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c58bfb8c36350fb94c6e31438418a17e1b54f189;p=platform%2Fupstream%2Flibsolv.git - copy parser swtab fix from Matz into other files --- diff --git a/tools/repo_deltainfoxml.c b/tools/repo_deltainfoxml.c index b14bb9a..2211b5d 100644 --- a/tools/repo_deltainfoxml.c +++ b/tools/repo_deltainfoxml.c @@ -290,10 +290,11 @@ startElement(void *userData, const char *name, const char **atts) } pd->depth++; + if (!pd->swtab[pd->state]) + return; for (sw = pd->swtab[pd->state]; sw->from == pd->state; sw++) /* find name in statetable */ if (!strcmp(sw->ename, name)) break; - if (sw->from != pd->state) { #if 1 diff --git a/tools/repo_patchxml.c b/tools/repo_patchxml.c index e03613f..10cc2b7 100644 --- a/tools/repo_patchxml.c +++ b/tools/repo_patchxml.c @@ -355,6 +355,8 @@ startElement(void *userData, const char *name, const char **atts) return; pd->depth++; + if (!pd->swtab[pd->state]) + return; for (sw = pd->swtab[pd->state]; sw->from == pd->state; sw++) /* find name in statetable */ if (!strcmp(sw->ename, name)) break; diff --git a/tools/repo_products.c b/tools/repo_products.c index 7e0a296..3f71fe2 100644 --- a/tools/repo_products.c +++ b/tools/repo_products.c @@ -183,22 +183,21 @@ startElement(void *userData, const char *name, const char **atts) } pd->depth++; - if (!(sw = pd->swtab[pd->state])) /* no statetable -> no substates */ + if (!pd->swtab[pd->state]) /* no statetable -> no substates */ { #if 0 - fprintf(stderr, "into unknown: [?]%s (from: ?, state %d)\n", name, pd->state); + fprintf(stderr, "into unknown: %s (from: %d)\n", name, pd->state); #endif return; } - for (; sw->from == pd->state; sw++) /* find name in statetable */ + for (sw = pd->swtab[pd->state]; sw->from == pd->state; sw++) /* find name in statetable */ if (!strcmp(sw->ename, name)) break; if (sw->from != pd->state) { #if 0 - fprintf(stderr, "into unknown: [%d]%s (from: %d, state %d)\n", sw->to, name, sw->from, pd->state); - exit( 1 ); + fprintf(stderr, "into unknown: %s (from: %d)\n", name, pd->state); #endif return; } diff --git a/tools/repo_repomdxml.c b/tools/repo_repomdxml.c index f387406..dce33c2 100644 --- a/tools/repo_repomdxml.c +++ b/tools/repo_repomdxml.c @@ -163,7 +163,7 @@ startElement(void *userData, const char *name, const char **atts) int expire = 0; #if 0 - fprintf(stderr, "start: [%d]%s\n", pd->state, name); + fprintf(stderr, "start: [%d]%s\n", pd->state, name); #endif if (pd->depth != pd->statedepth) { @@ -172,6 +172,8 @@ startElement(void *userData, const char *name, const char **atts) } pd->depth++; + if (!pd->swtab[pd->state]) + return; for (sw = pd->swtab[pd->state]; sw->from == pd->state; sw++) /* find name in statetable */ if (!strcmp(sw->ename, name)) break; @@ -179,7 +181,7 @@ startElement(void *userData, const char *name, const char **atts) if (sw->from != pd->state) { #if 1 - fprintf(stderr, "into unknown: [%d]%s (from: %d)\n", sw->to, name, sw->from); + fprintf(stderr, "into unknown: %s (from: %d)\n", name, pd->state); exit( 1 ); #endif return; diff --git a/tools/repo_rpmmd.c b/tools/repo_rpmmd.c index 80b587d..d3fe112 100644 --- a/tools/repo_rpmmd.c +++ b/tools/repo_rpmmd.c @@ -643,6 +643,8 @@ startElement(void *userData, const char *name, const char **atts) return; pd->depth++; + if (!pd->swtab[pd->state]) + return; for (sw = pd->swtab[pd->state]; sw->from == pd->state; sw++) if (!strcmp(sw->ename, name)) break; diff --git a/tools/repo_updateinfoxml.c b/tools/repo_updateinfoxml.c index b96b972..cc442fc 100644 --- a/tools/repo_updateinfoxml.c +++ b/tools/repo_updateinfoxml.c @@ -216,7 +216,7 @@ startElement(void *userData, const char *name, const char **atts) /*const char *str; */ #if 0 - fprintf(stderr, "start: [%d]%s\n", pd->state, name); + fprintf(stderr, "start: [%d]%s\n", pd->state, name); #endif if (pd->depth != pd->statedepth) { @@ -225,15 +225,16 @@ startElement(void *userData, const char *name, const char **atts) } pd->depth++; + if (!pd->swtab[pd->state]) + return; for (sw = pd->swtab[pd->state]; sw->from == pd->state; sw++) /* find name in statetable */ if (!strcmp(sw->ename, name)) break; - if (sw->from != pd->state) { #if 1 - fprintf(stderr, "into unknown: [%d]%s (from: %d)\n", sw->to, name, sw->from); + fprintf(stderr, "into unknown: %s (from: %d)\n", name, pd->state); exit( 1 ); #endif return;