X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=lib%2Fpnd_pxml.c;h=934c75c15263af8b1ac3a49b2923176964ccf9fa;hb=471022009f9f9ce5d41a5034aaeb48c4264c3e20;hp=2cde635d764faf33b49715bcc1eaacaaeaed0e82;hpb=f03bf767b821f2f8e0a22e5d3422f4e5dfae8a2d;p=pandora-libraries.git diff --git a/lib/pnd_pxml.c b/lib/pnd_pxml.c index 2cde635..934c75c 100644 --- a/lib/pnd_pxml.c +++ b/lib/pnd_pxml.c @@ -29,7 +29,11 @@ pnd_pxml_handle *pnd_pxml_fetch ( char *fullpath ) { fseek ( f, 0, SEEK_SET ); - b = (char*) malloc ( len ); + if ( ! len ) { + return ( NULL ); + } + + b = (char*) malloc ( len + 1 ); if ( ! b ) { fclose ( f ); @@ -176,6 +180,9 @@ void pnd_pxml_delete ( pnd_pxml_handle h ) { if ( p -> startdir ) { free ( p -> startdir ); } + if ( p -> appdata_dirname ) { + free ( p -> appdata_dirname ); + } free(p); /*very important!*/ @@ -312,6 +319,11 @@ char *pnd_pxml_get_best_localized_string(pnd_localized_string_t strings[], int s return ( NULL ); } +char *pnd_pxml_get_package_id ( pnd_pxml_handle h ) { + pnd_pxml_t *p = (pnd_pxml_t*) h; + return ( p -> package_id ); +} + char *pnd_pxml_get_app_name ( pnd_pxml_handle h, char *iso_lang ) { pnd_pxml_t *p = (pnd_pxml_t *) h; return pnd_pxml_get_best_localized_string(p->titles, p->titles_c, iso_lang); @@ -332,12 +344,16 @@ char *pnd_pxml_get_app_name_it ( pnd_pxml_handle h ) { char *pnd_pxml_get_app_name_fr ( pnd_pxml_handle h ) { return pnd_pxml_get_app_name(h, "fr"); } - char *pnd_pxml_get_unique_id ( pnd_pxml_handle h ) { pnd_pxml_t *p = (pnd_pxml_t*) h; return ( p -> unique_id ); } +char *pnd_pxml_get_appdata_dirname ( pnd_pxml_handle h ) { + pnd_pxml_t *p = (pnd_pxml_t*) h; + return ( p -> appdata_dirname ); +} + char *pnd_pxml_get_standalone ( pnd_pxml_handle h ) { pnd_pxml_t *p = (pnd_pxml_t*) h; return ( p -> standalone ); @@ -348,6 +364,10 @@ char *pnd_pxml_get_icon ( pnd_pxml_handle h ) { return ( p -> icon ); } +// this guy's func name is 'out of sync' with the family of functions below; but since it +// exists, rather than just remove it and break someones code, will add in the appropriate +// function wrapper; the header only specifies the other guy (always did), so the header +// was already on the right path. char *pnd_pxml_get_app_description ( pnd_pxml_handle h, char *iso_lang ) { pnd_pxml_t *p = (pnd_pxml_t *) h; return pnd_pxml_get_best_localized_string(p->descriptions, p->descriptions_c, iso_lang); @@ -369,6 +389,11 @@ char *pnd_pxml_get_description_fr ( pnd_pxml_handle h ) { return pnd_pxml_get_app_description(h, "fr"); } +// wrapper added so family of function names is consistent; see comment for pnd_pxml_get_app_description() above +char *pnd_pxml_get_description ( pnd_pxml_handle h, char *iso_lang) { + return ( pnd_pxml_get_app_description ( h, iso_lang ) ); +} + char *pnd_pxml_get_previewpic1 ( pnd_pxml_handle h ) { pnd_pxml_t *p = (pnd_pxml_t*) h; return ( p -> previewpic1 ); @@ -554,3 +579,33 @@ unsigned char pnd_pxml_is_affirmative ( char *v ) { return ( 0 ); } + +pnd_pxml_x11_req_e pnd_pxml_get_x11 ( char *pxmlvalue ) { + + if ( ! pxmlvalue ) { + return ( pnd_pxml_x11_ignored ); + } else if ( strcasecmp ( pxmlvalue, "req" ) == 0 ) { + return ( pnd_pxml_x11_required ); + } else if ( strcasecmp ( pxmlvalue, "stop" ) == 0 ) { + return ( pnd_pxml_x11_stop ); + } else if ( strcasecmp ( pxmlvalue, "ignore" ) == 0 ) { + return ( pnd_pxml_x11_ignored ); + } + + return ( pnd_pxml_x11_ignored ); // default +} + +char *pnd_pxml_get_info_name ( pnd_pxml_handle h ) { + pnd_pxml_t *p = (pnd_pxml_t*) h; + return ( p -> info_name ); +} + +char *pnd_pxml_get_info_type ( pnd_pxml_handle h ) { + pnd_pxml_t *p = (pnd_pxml_t*) h; + return ( p -> info_type ); +} + +char *pnd_pxml_get_info_src ( pnd_pxml_handle h ) { + pnd_pxml_t *p = (pnd_pxml_t*) h; + return ( p -> info_filename ); +}