Enlightenment CVS committal

Author  : handyande
Project : e17
Module  : proto

Dir     : e17/proto/exhibit/src/bin


Modified Files:
        exhibit_comment.c exhibit_comment_jpeg.c 


Log Message:
Fix some issues with corrupt comments on certin machines
===================================================================
RCS file: /cvsroot/enlightenment/e17/proto/exhibit/src/bin/exhibit_comment.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- exhibit_comment.c   14 Mar 2006 01:01:15 -0000      1.2
+++ exhibit_comment.c   16 Mar 2006 12:42:39 -0000      1.3
@@ -65,7 +65,7 @@
 
    file = ((Ex_Tab *) e->cur_tab)->cur_file;
    if (_ex_file_is_jpg(file))
-     if (_ex_comment_jpeg_read(file, &comment, &len))
+     if (_ex_comment_jpeg_read(file, &comment, &len) && (len != 0))
        {
          etk_entry_text_set(ETK_ENTRY(e->comment.entry), comment);
          return;
@@ -76,13 +76,18 @@
 void
 _ex_comment_save(Exhibit *e)
 {
-   char *file;
+   char *file, *comment;
+   int len;
 
    file = ((Ex_Tab *) e->cur_tab)->cur_file;
+   comment = etk_entry_text_get(ETK_ENTRY(e->comment.entry));
+   if (comment)
+     len = strlen(comment);
+   else
+     len = 0;
+   
    if (_ex_file_is_jpg(file))
-     _ex_comment_jpeg_write(file,
-       etk_entry_text_get(ETK_ENTRY(e->comment.entry)),
-       strlen(etk_entry_text_get(ETK_ENTRY(e->comment.entry))));
+     _ex_comment_jpeg_write(file, comment, len);
 }
 
 void
===================================================================
RCS file: 
/cvsroot/enlightenment/e17/proto/exhibit/src/bin/exhibit_comment_jpeg.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- exhibit_comment_jpeg.c      14 Mar 2006 01:32:37 -0000      1.3
+++ exhibit_comment_jpeg.c      16 Mar 2006 12:42:39 -0000      1.4
@@ -284,7 +284,7 @@
 
    if (len != NULL)
      *len = length;
-   comment = malloc((length + 1) * sizeof(char));
+   comment = calloc(length + 1, sizeof(char));
    if (com != NULL)
      *com = comment;
 




-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to