From: Keith M. <kei...@us...> - 2010-08-13 16:20:15
|
Update of /cvsroot/mingw/mingw-get/src In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv16059/src Modified Files: pkgkeys.c pkgkeys.h pkgname.cpp Log Message: Improve diagnostics for invalid references to non-release XML nodes. Index: pkgkeys.h =================================================================== RCS file: /cvsroot/mingw/mingw-get/src/pkgkeys.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** pkgkeys.h 12 May 2010 18:16:27 -0000 1.8 --- pkgkeys.h 13 Aug 2010 16:20:07 -0000 1.9 *************** *** 83,86 **** --- 83,87 ---- EXTERN_C_DECL const char *value_no; EXTERN_C_DECL const char *value_none; + EXTERN_C_DECL const char *value_unknown; EXTERN_C_DECL const char *value_virtual; EXTERN_C_DECL const char *value_yes; Index: pkgkeys.c =================================================================== RCS file: /cvsroot/mingw/mingw-get/src/pkgkeys.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** pkgkeys.c 12 May 2010 18:16:27 -0000 1.8 --- pkgkeys.c 13 Aug 2010 16:20:07 -0000 1.9 *************** *** 69,72 **** --- 69,73 ---- const char *value_no = "no"; const char *value_none = "none"; + const char *value_unknown = "<<<unknown>>>"; const char *value_virtual = "virtual"; const char *value_yes = "yes"; Index: pkgname.cpp =================================================================== RCS file: /cvsroot/mingw/mingw-get/src/pkgname.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** pkgname.cpp 2 Mar 2010 22:33:24 -0000 1.4 --- pkgname.cpp 13 Aug 2010 16:20:07 -0000 1.5 *************** *** 43,51 **** if( ! rel->IsElementOfType( release_key ) ) { dmh_control( DMH_BEGIN_DIGEST ); dmh_notify( DMH_ERROR, "internal package specification error\n" ); ! dmh_notify( DMH_ERROR, "can't get 'tarname' for non-release element\n" ); dmh_notify( DMH_ERROR, "please report this to the package maintainer\n" ); dmh_control( DMH_END_DIGEST ); return NULL; } --- 43,65 ---- if( ! rel->IsElementOfType( release_key ) ) { + /* The XML element type name is not "release"; identify it... + */ + const char *reftype; + if( (reftype = rel->GetName()) == NULL ) + /* + * ...or classify as "unknown", when given a NULL element. + */ + reftype = value_unknown; + + /* Complain that this XML element type is invalid, in this context... + */ dmh_control( DMH_BEGIN_DIGEST ); dmh_notify( DMH_ERROR, "internal package specification error\n" ); ! dmh_notify( DMH_ERROR, "can't get 'tarname' for non-release element %s\n", reftype ); dmh_notify( DMH_ERROR, "please report this to the package maintainer\n" ); dmh_control( DMH_END_DIGEST ); + + /* ...and bail out, telling the caller that no archive name is available... + */ return NULL; } *************** *** 101,105 **** */ dmh_notify( DMH_WARNING, "%s: archive name reassignment ignored\n", ! rel->GetPropVal( tarname_key, "<unknown>" ) ); else --- 115,119 ---- */ dmh_notify( DMH_WARNING, "%s: archive name reassignment ignored\n", ! rel->GetPropVal( tarname_key, value_unknown ) ); else |