[Refdb-cvs] CVS: refdb/src xmlhandler.c,1.22.2.1,1.22.2.2
Status: Beta
Brought to you by:
mhoenicka
From: Markus H. <mho...@us...> - 2004-07-13 20:34:42
|
Update of /cvsroot/refdb/refdb/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5994 Modified Files: Tag: Release_0_9_5_stable xmlhandler.c Log Message: use GEN as default pubtype if none is specified;fixed a couple of segfaults caused by missing attributes Index: xmlhandler.c =================================================================== RCS file: /cvsroot/refdb/refdb/src/xmlhandler.c,v retrieving revision 1.22.2.1 retrieving revision 1.22.2.2 diff -u -U2 -r1.22.2.1 -r1.22.2.2 --- xmlhandler.c 15 Jun 2004 22:30:27 -0000 1.22.2.1 +++ xmlhandler.c 13 Jul 2004 20:34:28 -0000 1.22.2.2 @@ -123,6 +123,11 @@ if (strcmp(el, "PUBTYPE") == 0) { - /* create new entry in database. PUBTYPE has only one attribute TYPE, the value of which is therefore in attr[1] */ - strcat(sql_command, ptr_attr[1]); + /* create new entry in database. PUBTYPE has only one attribute TYPE, the value of which is therefore in attr[1], if at all */ + if (ptr_attr[1] && *(ptr_attr[1])) { + strcat(sql_command, ptr_attr[1]); + } + else { + strcat(sql_command, "GEN"); /* default as per DTD */ + } } else if (strcmp(el, "INTEXTDEF") == 0) { @@ -327,5 +332,5 @@ else if (strcmp((ptr_asdata->ptr_first)->elname, "AUTHORLIST") == 0) { ptr_attr = get_ancestor_attr(ptr_asdata->ptr_first, "AUTHORLIST", "ROLE"); - if (strcmp(ptr_attr, "PRIMARY") == 0) { + if (!ptr_attr || strcmp(ptr_attr, "PRIMARY") == 0) { strcpy(concat, "AUTHORLIST"); } @@ -358,5 +363,5 @@ else if (strcmp((ptr_asdata->ptr_first)->elname, "PUBDATE") == 0) { ptr_attr = get_ancestor_attr(ptr_asdata->ptr_first, "PUBDATE", "ROLE"); - if (strcmp(ptr_attr, "PRIMARY") == 0) { + if (!ptr_attr || strcmp(ptr_attr, "PRIMARY") == 0) { strcpy(concat, "PUBDATE"); } @@ -386,5 +391,5 @@ else if (strcmp((ptr_asdata->ptr_first)->elname, "TITLE") == 0) { ptr_attr = get_ancestor_attr(ptr_asdata->ptr_first, "TITLE", "ROLE"); - if (strcmp(ptr_attr, "PRIMARY") == 0) { + if (!ptr_attr || strcmp(ptr_attr, "PRIMARY") == 0) { strcpy(concat, "TITLE"); } |