On Thu, Nov 08, 2007 at 10:29:23PM +0100, Rafael Laboissiere wrote:

> Thanks for finding and fixing this bug.  Could you please also check whether
> version 0.2.3-1 (in experimental) is also affected by this bug?

Yes 0.2.3 has the same problem and the patch file applies cleanly
(with patch -p1 from the base directory).

> I think I will wait until the libmtp6/amarok/gnomad2 transition into
> testing is completed.

That makes sense.  Plus, I don't think any uploads are being processed
right now because of the server problems.

> Yes, it would be great if you could provide two separate patches, one for
> each problem.

I've made a patch just for the signed/unsigned issue (attached).  I
don't have a complete solution for the memory leaks yet, and it's a
much more minor issue, so it will have to wait till I have more time.

cheers

-- 
Chris Waters           |  Pneumonoultra-        osis is too long
[EMAIL PROTECTED]       |  microscopicsilico-    to fit into a single
or [EMAIL PROTECTED] |  volcaniconi-          standalone haiku
diff -ur libmtp-0.2.2.old/examples/albumart.c libmtp-0.2.2/examples/albumart.c
--- libmtp-0.2.2.old/examples/albumart.c        2007-03-28 23:00:40.000000000 
-0700
+++ libmtp-0.2.2/examples/albumart.c    2007-11-07 22:48:24.000000000 -0800
@@ -43,6 +43,7 @@
   char *imagedata = NULL;
   char *albumname = NULL;
   char *path = NULL;
+  char *rest;
   struct stat statbuff;
 
   fprintf(stdout, "libmtp version: " LIBMTP_VERSION_STRING "\n\n");
@@ -58,7 +59,7 @@
         return 1;
       }
       ids = tmp;
-      ids[(idcount-1)] = atoi(strdup(optarg));
+      ids[(idcount-1)] = strtoul(optarg, &rest, 0);
       break;
     case 'n':
       albumname = strdup(optarg);
diff -ur libmtp-0.2.2.old/examples/newplaylist.c 
libmtp-0.2.2/examples/newplaylist.c
--- libmtp-0.2.2.old/examples/newplaylist.c     2007-03-28 23:00:41.000000000 
-0700
+++ libmtp-0.2.2/examples/newplaylist.c 2007-11-07 22:46:39.000000000 -0800
@@ -39,6 +39,7 @@
   uint32_t *ids = NULL;
   uint32_t *tmp = NULL;
   char *playlistname = NULL;
+  char *rest;
  
   fprintf(stdout, "libmtp version: " LIBMTP_VERSION_STRING "\n\n");
 
@@ -53,7 +54,7 @@
         return 1;
       }
       ids = tmp;
-      ids[(idcount-1)] = atoi(strdup(optarg));
+      ids[(idcount-1)] = strtoul(optarg, &rest, 0);
       break;
     case 'n':
       playlistname = strdup(optarg);
diff -ur libmtp-0.2.2.old/examples/pathutils.c libmtp-0.2.2/examples/pathutils.c
--- libmtp-0.2.2.old/examples/pathutils.c       2007-03-16 08:19:44.000000000 
-0700
+++ libmtp-0.2.2/examples/pathutils.c   2007-11-07 22:58:01.000000000 -0800
@@ -56,9 +56,11 @@
 int
 parse_path (char * path, LIBMTP_file_t * files, LIBMTP_folder_t * folders)
 {
+  char *rest;
   // Check if path is an item_id
   if (*path != '/') {
-    int item_id = atoi(path);
+    int item_id = strtoul(path, &rest, 0);
+    // really should check contents of "rest" here...
     return item_id;
   }
   // Check if path is a folder
diff -ur libmtp-0.2.2.old/examples/thumb.c libmtp-0.2.2/examples/thumb.c
--- libmtp-0.2.2.old/examples/thumb.c   2007-03-28 23:00:41.000000000 -0700
+++ libmtp-0.2.2/examples/thumb.c       2007-11-07 23:02:36.000000000 -0800
@@ -41,6 +41,7 @@
   uint64_t filesize;
   uint8_t *imagedata = NULL;
   char *path = NULL;
+  char *rest;
   struct stat statbuff;
   int ret;
 
@@ -51,7 +52,7 @@
     case 'h':
       usage();
     case 'i':
-      id = atoi(strdup(optarg));
+      id = strtoul(optarg, &rest, 0);
       break;
     default:
       usage();

Reply via email to