pndevmapperd: don't do charge control too often
[pandora-libraries.git] / lib / pnd_pxml.c
index 2b597ce..934c75c 100644 (file)
@@ -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 );
@@ -315,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);
@@ -335,7 +344,6 @@ 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 );
@@ -356,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);
@@ -377,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 );