Enlightenment CVS committal

Author  : rbdpngn
Project : misc
Module  : erss

Dir     : misc/erss/src


Modified Files:
        erss.c parse.c 


Log Message:
A few minor changes to the parsing code.

===================================================================
RCS file: /cvsroot/enlightenment/misc/erss/src/erss.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -3 -r1.14 -r1.15
--- erss.c      13 Jan 2004 21:05:16 -0000      1.14
+++ erss.c      13 Jan 2004 22:52:00 -0000      1.15
@@ -5,16 +5,16 @@
 char *time_format ();
 int set_time (void *data);
 
-Evas *evas;
-Ecore_Evas *ee;
-Ecore_Con_Server *server;
-Evas_Object *bg;
-Evas_Object *cont;
-Evas_Object *tid;
+Evas *evas = NULL;
+Ecore_Evas *ee = NULL;
+Ecore_Con_Server *server = NULL;
+Evas_Object *bg = NULL;
+Evas_Object *cont = NULL;
+Evas_Object *tid = NULL;
 Ewd_List *config_files = NULL;
 
-char *main_buffer;
-char *last_time;
+char *main_buffer = NULL;
+char *last_time = NULL;
 
 int main_bufsize = 0;
 int waiting_for_reply = FALSE;
@@ -77,7 +77,7 @@
        curtime = time(NULL);
        ts = localtime(&curtime);
 
-       str = malloc (50);
+       str = malloc (21);
        
        if (ts->tm_hour < 10 && ts->tm_min < 10 && ts->tm_sec < 10)
                snprintf (str, 20, "0%d:0%d:0%d", 
@@ -384,7 +384,7 @@
                        no_dir = TRUE;
                } else {
                        if (S_ISDIR(statbuf.st_mode)) {
-               
+
                                if ((num = scandir(ptr, &dentries, 0, erss_alphasort)) 
< 0) 
                                        perror("erss - scandir");
 
===================================================================
RCS file: /cvsroot/enlightenment/misc/erss/src/parse.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -3 -r1.11 -r1.12
--- parse.c     13 Jan 2004 21:05:16 -0000      1.11
+++ parse.c     13 Jan 2004 22:52:00 -0000      1.12
@@ -15,26 +15,31 @@
        char *ret_val = NULL;
        int size;
 
-       if (!buffer || !*buffer || !type)
+       if (!buffer || !*buffer || !**buffer || !type)
                goto err_clean_none;
 
+       /* Allocate string plus enough to add in "</>". */
        size = strlen (type) + 4;
        c = malloc (size);
        if (!c)
                goto err_clean_none;
 
-       snprintf (c, size, "<%s>", type);
+       /* Locate the opening tag of the type we're looking for. */
+       snprintf (c, size, "<%s", type);
        start_tmp = strstr (*buffer, c);
        if (!start_tmp)
                goto err_clean_c;
 
+       /* Move to the end of the found opening tag. */
        start_tmp += size - 2;
 
+       /* Locate the closing tag of the specified type. */
        snprintf (c, size, "</%s>", type);
        end_tmp = strstr (start_tmp, c);
        if (!end_tmp)
                goto err_clean_c;
 
+       /* Copy the data between the tags into a newly allocated buffer. */
        tmp_char = *end_tmp;
        *end_tmp = '\0';
        ret_val = strdup (start_tmp);
@@ -42,6 +47,8 @@
        if (!ret_val)
                goto err_clean_c;
 
+       /* We were incrementing the buffer past the found tags, may want to do
+        * this, but we must have a writable string passed in. */
        /* *buffer = end_tmp + size - 1; */
 
   err_clean_c:
@@ -144,8 +151,7 @@
                 * We have a new story, allocate an item for it
                 */
                item = malloc (sizeof (Article));
-               item->description = NULL;
-               item->url = NULL;
+               memset(item, 0, sizeof(Article));
 
                return;
        }
@@ -177,7 +183,7 @@
                item->obj = edje_object_add (evas);
                edje_object_file_set (item->obj, cfg->theme, "erss_item");
                evas_object_show (item->obj);
-               
+
                evas_object_event_callback_add (item->obj,
                                EVAS_CALLBACK_MOUSE_IN, cb_mouse_in, NULL);
                evas_object_event_callback_add (item->obj,




-------------------------------------------------------
This SF.net email is sponsored by: Perforce Software.
Perforce is the Fast Software Configuration Management System offering
advanced branching capabilities and atomic changes on 50+ platforms.
Free Eval! http://www.perforce.com/perforce/loadprog.html
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to