Re-apply a couple fixes that got lost somewhere .. memset after malloc in pnd_pxml...
authorskeezix <skeezix@flotsam-vm.(none)>
Thu, 19 Feb 2009 21:50:43 +0000 (16:50 -0500)
committerskeezix <skeezix@flotsam-vm.(none)>
Thu, 19 Feb 2009 21:50:43 +0000 (16:50 -0500)
TODO.txt [new file with mode: 0644]
include/pnd_discovery.h
include/pnd_pndfiles.h [new file with mode: 0644]
lib/pnd_discovery.c
lib/pnd_pndfiles.c [new file with mode: 0644]
lib/pnd_pxml.c
testdata/apps/sampleapp2/PXML.xml~ [deleted file]
testdata/apps/sampleapp3/PXML.xml~ [deleted file]

diff --git a/TODO.txt b/TODO.txt
new file mode 100644 (file)
index 0000000..58ebe01
--- /dev/null
+++ b/TODO.txt
@@ -0,0 +1,12 @@
+
+Some things to be done..
+
+- review pnd_tinyxml to ensure the PXML_FILENAME is csae insensitive as needed
+
+apps/pndnotifyd.c:// TODO: Catch HUP and reparse config
+apps/pndnotifyd.c:// TODO: Should perhaps direct all printf's through a vsprintf handler to avoid redundant "if ! g_daemon_mode"
+apps/pndnotifyd.c:// TODO: During daemon mode, should perhaps syslog or log errors
+apps/pndnotifyd.c:// TODO: Removing stale .desktop checks that .desktop was created by libpnd; see 'TBD' below
+include/pnd_discovery.h:// TODO: Copy the icon into this directory as well, if its source is a .pnd or info is in the dico struct
+include/pnd_discovery.h:// TODO: A way to release the disco-lists and reclaim RAM :)
+include/pnd_discovery.h:// TODO: A way to determine the list of excess .desktop files and remove them (ie: after poo.pnd is removed, ditch the .desktop)
index bc74aed..2bb31ea 100644 (file)
@@ -88,7 +88,6 @@ void pnd_disco_destroy ( pnd_disco_t *p ); // a function name that simply could
 unsigned char pnd_emit_dotdesktop ( char *targetpath, pnd_disco_t *p );
 
 // TODO: A way to release the disco-lists and reclaim RAM :)
-// TODO: A way to determine the list of excess .desktop files and remove them (ie: after poo.pnd is removed, ditch the .desktop)
 
 #ifdef __cplusplus
 } /* "C" */
diff --git a/include/pnd_pndfiles.h b/include/pnd_pndfiles.h
new file mode 100644 (file)
index 0000000..c603f17
--- /dev/null
@@ -0,0 +1,15 @@
+
+#ifndef h_pnd_pndfiles_h
+#define h_pnd_pndfiles_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define PND_PACKAGE_FILEEXT ".pnd" /* case insensitive due to SD FAT fs */
+
+#ifdef __cplusplus
+} /* "C" */
+#endif
+
+#endif
index a034038..bfac709 100644 (file)
 #include "pnd_discovery.h"
 #include "pnd_pathiter.h"
 #include "pnd_apps.h"
-
-#warning "PND/PNZ support is not included yet; scripts need writing"
-#warning "  /usr/pandora/bin/pnd_valid.sh"
-#warning "  /usr/pandora/bin/pnd_prepare.sh"
-#warning "  /usr/pandora/bin/pnd_unprepare.sh"
+#include "pnd_pndfiles.h"
 
 // need these 'globals' due to the way nftw and ftw work :/
 static pnd_box_handle disco_box;
@@ -61,15 +57,13 @@ static int pnd_disco_callback ( const char *fpath, const struct stat *sb,
     return ( 0 ); // skip directories and other non-regular files
   }
 
+  // PND/PNZ file and others may be valid as well .. but lets leave that for now
   if ( strcasecmp ( fpath + ftwbuf -> base, PXML_FILENAME ) == 0 ) {
     valid = 1;
+  } else if ( strcasecmp ( fpath + ftwbuf -> base, PND_PACKAGE_FILEEXT "\0" ) == 0 ) {
+    valid = 2;
   }
 
-  // PND file and others may be valid as well .. but lets leave that for now
-  //
-  // PND and PNZ and whatever
-  //
-
   // if not a file of interest, just keep looking until we run out
   if ( ! valid ) {
     return ( 0 );
@@ -91,8 +85,7 @@ static int pnd_disco_callback ( const char *fpath, const struct stat *sb,
     }
 
     // look for any overrides, if requested
-#warning pnd_pxml_merge_override removed by Cpasjuste ...
-  //  pnd_pxml_merge_override ( pxmlh, disco_overrides );
+    pnd_pxml_merge_override ( pxmlh, disco_overrides );
 
     // check for validity and add to resultset if it looks executable
     if ( pnd_is_pxml_valid_app ( pxmlh ) ) {
@@ -109,9 +102,8 @@ static int pnd_disco_callback ( const char *fpath, const struct stat *sb,
     }
 
     // ditch pxml
-       pnd_pxml_delete ( pxmlh );
+    pnd_pxml_delete ( pxmlh );
 
-       return 0;
   } else if ( valid == 2 ) {
     // PND ... ??
   }
diff --git a/lib/pnd_pndfiles.c b/lib/pnd_pndfiles.c
new file mode 100644 (file)
index 0000000..1bfaa80
--- /dev/null
@@ -0,0 +1,9 @@
+
+#include <stdio.h> /* for FILE etc */
+#include <stdlib.h> /* for malloc */
+#include <string.h> /* for making ftw.h happy */
+
+#include "pnd_container.h"
+#include "pnd_pxml.h"
+#include "pnd_apps.h"
+#include "pnd_pndfiles.h"
index 2c64d42..484c418 100644 (file)
@@ -14,11 +14,13 @@ void pnd_pxml_load(const char* pFilename, pnd_pxml_t *app);
 
 pnd_pxml_handle pnd_pxml_fetch ( char *fullpath ) {
 
-       pnd_pxml_t *p = malloc ( sizeof(pnd_pxml_t) );
+  pnd_pxml_t *p = malloc ( sizeof(pnd_pxml_t) );
 
-       pnd_pxml_load(fullpath, p);
+  memset ( p, '\0', sizeof(pnd_pxml_t) );
 
-       return (p);
+  pnd_pxml_load ( fullpath, p );
+
+  return ( p );
 }
 
 void pnd_pxml_delete ( pnd_pxml_handle h ) {
diff --git a/testdata/apps/sampleapp2/PXML.xml~ b/testdata/apps/sampleapp2/PXML.xml~
deleted file mode 100644 (file)
index 776b9b7..0000000
+++ /dev/null
@@ -1,86 +0,0 @@
-<?xml version="1.0"?>
-<PXML>
-<title>
-       <en>Program Title</en>
-       <de>Program Title in German Language</de>
-       <fr>Program Title in French Language</fr>
-       <it>Program Title in Italian Language</it>
-</title>
-
-<unique_id>123shaboo</unique_id>
-
-<standalone>Yes</standalone>
-
-<icon>program.png</icon>
-
-<description>
-       <en>This is the [b]English Description[/b] of the file.
-            Can use [i]multiple lines[/i] and BBCode.</en>
-       <de>The German Description</de>
-       <it>The Italian Description</it>
-       <fr>The French Description</fr>
-</description>
-
-<previewpic>
-       <pic1>./preview/pic1.jpg</pic1>
-       <pic2>./preview/pic2.jpg</pic2>
-</previewpic>
-
-<author>
-       <name>EvilDragon</name>
-       <website>http://www.openpandora.org</website>
-</author>
-
-<version>
-       <major>1</major>
-       <minor>1</minor>
-       <release>1</release>
-       <build>2</build>
-</version>
-
-<exec>program.exe</exec>
-
-<category>
-       <main>Main category</main>
-       <subcategory1>Subcategory 1</subcategory1>
-       <subcategory2>Subcategory 2</subcategory2>
-</category>
-
-<altcategory>
-       <main>Alternate category</main>
-       <subcategory1>Alternate Subcategory 1</subcategory1>
-       <subcategory2>Alternate Subcategory 2</subcategory2>
-</altcategory>
-
-<osversion> 
-       <major>1</major>
-       <minor>1</minor>
-       <release>1</release>
-       <build>2</build>
-</osversion>
-
-<associationitem1>
-       <name>View this Picture</name>
-       <filetype>jpg,bmp,gif</filetype>
-       <parameter>­view</parameter>
-</associationitem1>
-
-<associationitem2>
-       <name>Convert this Picture</name>
-       <filetype>jpg,bmp,gif</filetype>
-       <parameter>­convert</parameter>
-</associationitem2>
-
-<associationitem3>
-       <name>Watch This Movie</name>
-       <filetype>mpg,avi,wmv</filetype>
-       <parameter>­convert</parameter>
-</associationitem3>
-
-<clockspeed>600</clockspeed>
-
-<background>Yes</background>
-
-<startdir>../differentdir</startdir>
-
-</PXML>
diff --git a/testdata/apps/sampleapp3/PXML.xml~ b/testdata/apps/sampleapp3/PXML.xml~
deleted file mode 100644 (file)
index f289130..0000000
+++ /dev/null
@@ -1,86 +0,0 @@
-<?xml version="1.0"?>
-<PXML>
-<title>
-       <en>Program Title</en>
-       <de>Program Title in German Language</de>
-       <fr>Program Title in French Language</fr>
-       <it>Program Title in Italian Language</it>
-</title>
-
-<unique_id>124bingle</unique_id>
-
-<standalone>Yes</standalone>
-
-<icon>program.png</icon>
-
-<description>
-       <en>This is the [b]English Description[/b] of the file.
-            Can use [i]multiple lines[/i] and BBCode.</en>
-       <de>The German Description</de>
-       <it>The Italian Description</it>
-       <fr>The French Description</fr>
-</description>
-
-<previewpic>
-       <pic1>./preview/pic1.jpg</pic1>
-       <pic2>./preview/pic2.jpg</pic2>
-</previewpic>
-
-<author>
-       <name>EvilDragon</name>
-       <website>http://www.openpandora.org</website>
-</author>
-
-<version>
-       <major>1</major>
-       <minor>1</minor>
-       <release>1</release>
-       <build>2</build>
-</version>
-
-<exec>program.exe</exec>
-
-<category>
-       <main>Main category</main>
-       <subcategory1>Subcategory 1</subcategory1>
-       <subcategory2>Subcategory 2</subcategory2>
-</category>
-
-<altcategory>
-       <main>Alternate category</main>
-       <subcategory1>Alternate Subcategory 1</subcategory1>
-       <subcategory2>Alternate Subcategory 2</subcategory2>
-</altcategory>
-
-<osversion> 
-       <major>1</major>
-       <minor>1</minor>
-       <release>1</release>
-       <build>2</build>
-</osversion>
-
-<associationitem1>
-       <name>View this Picture</name>
-       <filetype>jpg,bmp,gif</filetype>
-       <parameter>­view</parameter>
-</associationitem1>
-
-<associationitem2>
-       <name>Convert this Picture</name>
-       <filetype>jpg,bmp,gif</filetype>
-       <parameter>­convert</parameter>
-</associationitem2>
-
-<associationitem3>
-       <name>Watch This Movie</name>
-       <filetype>mpg,avi,wmv</filetype>
-       <parameter>­convert</parameter>
-</associationitem3>
-
-<clockspeed>600</clockspeed>
-
-<background>Yes</background>
-
-<startdir>../differentdir</startdir>
-
-</PXML>