Update of /cvsroot/gtkpod/libgpod/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18507/src

Modified Files:
        db-artwork-parser.c itdb_artwork.c itdb_itunesdb.c 
Log Message:
        * src/itdb_itunesdb.c: change g_assert to g_return_if_fail (don't
          terminate the application just because the iTunesDB was
          manipulated).

        * src/db-artwork-parser.c: change g_assert to g_return_if_fail
          (don't terminate the application just because the ArtworkDB was
          manipulated).

        * src/itdb_artwork.c: change g_assert to g_return_if_fail
          (don't terminate the application just because the ithmb file was
          manipulated).

There's a number of g_asserts left in db-parse-context.c which don't catch 
programming errors but input errors.



Index: db-artwork-parser.c
===================================================================
RCS file: /cvsroot/gtkpod/libgpod/src/db-artwork-parser.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- db-artwork-parser.c 4 Dec 2005 10:26:14 -0000       1.15
+++ db-artwork-parser.c 6 Dec 2005 13:22:35 -0000       1.16
@@ -401,7 +401,7 @@
        }
 
        /* Sanity check */
-       g_assert (GINT_FROM_LE (mhfd->total_len) == ctx->total_len);
+       g_return_val_if_fail (GINT_FROM_LE (mhfd->total_len) == ctx->total_len, 
-1);
        dump_mhfd (mhfd);
        cur_pos = ctx->header_len;
 

Index: itdb_artwork.c
===================================================================
RCS file: /cvsroot/gtkpod/libgpod/src/itdb_artwork.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- itdb_artwork.c      4 Dec 2005 07:01:27 -0000       1.3
+++ itdb_artwork.c      6 Dec 2005 13:22:35 -0000       1.4
@@ -1,4 +1,4 @@
-/* Time-stamp: <2005-12-04 15:56:23 jcs>
+/* Time-stamp: <2005-12-06 22:20:39 jcs>
 |
 |  Copyright (C) 2002-2005 Jorg Schuler <jcsjcs at users sourceforge net>
 |  Part of the gtkpod project.
@@ -219,7 +219,7 @@
        guchar *result;
        guint i;
 
-       g_assert (bytes_len < 2*(G_MAXUINT/3));
+       g_return_val_if_fail (bytes_len < 2*(G_MAXUINT/3), NULL);
        result = g_malloc ((bytes_len/2) * 3);
        if (result == NULL) {
                return NULL;

Index: itdb_itunesdb.c
===================================================================
RCS file: /cvsroot/gtkpod/libgpod/src/itdb_itunesdb.c,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -d -r1.37 -r1.38
--- itdb_itunesdb.c     4 Dec 2005 10:26:14 -0000       1.37
+++ itdb_itunesdb.c     6 Dec 2005 13:22:35 -0000       1.38
@@ -1,4 +1,4 @@
-/* Time-stamp: <2005-12-04 19:10:42 jcs>
+/* Time-stamp: <2005-12-06 22:20:40 jcs>
 |
 |  Copyright (C) 2002-2005 Jorg Schuler <jcsjcs at users sourceforge net>
 |  Part of the gtkpod project.
@@ -1020,7 +1020,7 @@
   case MHOD_ID_SUBTITLE:
       xl = get32lint (cts, seek+4);   /* length of string */
       if (cts->error) return result;  /* *ml==-1, result.valid==FALSE */
-      g_assert (xl < G_MAXUINT - 2);
+      g_return_val_if_fail (xl < G_MAXUINT - 2, result);
       entry_utf16 = g_new0 (gunichar2, (xl+2)/2);
       if (seek_get_n_bytes (cts, (gchar *)entry_utf16, seek+16, xl))
       {
@@ -1040,7 +1040,7 @@
       /* length of string */
       xl = mhod_len - header_length;
       if (cts->error) return result;  /* *ml==-1, result.valid==FALSE */
-      g_assert (xl < G_MAXUINT - 1);
+      g_return_val_if_fail (xl < G_MAXUINT - 1, result);
       result.data.string = g_new0 (gchar, xl+1);
       if (!seek_get_n_bytes (cts, result.data.string, seek, xl))
       {
@@ -1102,7 +1102,7 @@
              splr->action = get32bint (cts, seek+4);
              seek += 52;
              length = get32bint (cts, seek);
-             g_assert (length < G_MAXUINT-2);
+             g_return_val_if_fail (length < G_MAXUINT-2, result);
              if (itdb_spl_action_known (splr->action))
              {
                  gint ft = itdb_splr_get_field_type (splr);



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
gtkpod-cvs2 mailing list
gtkpod-cvs2@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gtkpod-cvs2

Reply via email to