shithub: sox

Download patch

ref: bf1bd21a9f0f88664350862b2339e59b5947b910
parent: c4bc48dafd5c43f7cd0563f8fc326b7c752a9296
author: Ulrich Klauer <ulrich@chirlu.de>
date: Fri Jan 13 19:43:12 EST 2012

Fix prototype warnings on 64-bit architectures

--- a/src/mp3-util.h
+++ b/src/mp3-util.h
@@ -42,10 +42,11 @@
   const char* comment;
 
   p->id3tag_init(p->gfp);
-  p->id3tag_set_pad(p->gfp, ID3PADDING);
+  p->id3tag_set_pad(p->gfp, (size_t)ID3PADDING);
 
   /* Note: id3tag_set_fieldvalue is not present in LAME 3.97, so we're using
      the 3.97-compatible methods for all of the tags that 3.97 supported. */
+  /* FIXME: This is no more necessary, since support for LAME 3.97 has ended. */
   if ((comment = sox_find_comment(ft->oob.comments, "Title")))
     p->id3tag_set_title(p->gfp, comment);
   if ((comment = sox_find_comment(ft->oob.comments, "Artist")))
--- a/src/mp3.c
+++ b/src/mp3.c
@@ -694,7 +694,7 @@
   }
 
   /* read 10 bytes in case there's an ID3 version 2 header here */
-  bytes_read = fread(id3v2_header, 1, sizeof(id3v2_header), fp);
+  bytes_read = fread(id3v2_header, (size_t)1, sizeof(id3v2_header), fp);
   if (bytes_read != sizeof(id3v2_header)) {
     lsx_warn("cannot update id3 tag - failed to read id3 header");
     return SOX_EOF;      /* not readable, maybe opened Write-Only */
@@ -701,7 +701,7 @@
   }
 
   /* does the stream begin with the ID3 version 2 file identifier? */
-  if (!strncmp((char *) id3v2_header, "ID3", 3)) {
+  if (!strncmp((char *) id3v2_header, "ID3", (size_t)3)) {
     /* the tag size (minus the 10-byte header) is encoded into four
      * bytes where the most significant bit is clear in each byte */
     id3v2_size = (((id3v2_header[6] & 0x7f) << 21)
@@ -767,7 +767,7 @@
   } else {
     fseeko(fp, (off_t)0, SEEK_SET);
     /* Overwrite the Id3v2 tag (this time TLEN should be accurate) */
-    if (fwrite(buffer, id3v2_size, 1, fp) != 1) {
+    if (fwrite(buffer, id3v2_size, (size_t)1, fp) != 1) {
       lsx_debug("Rewrote Id3v2 tag (%" PRIuPTR " bytes)", id3v2_size);
     }
   }
@@ -802,7 +802,7 @@
   }
 
   if (p->vbr_tag) {
-    unsigned int lametag_size;
+    size_t lametag_size;
     uint8_t buffer[MAXFRAMESIZE];
 
     if (fseeko(fp, (off_t)id3v2_size, SEEK_SET)) {
@@ -820,10 +820,10 @@
       return;
     }
 
-    if (fwrite(buffer, lametag_size, 1, fp) != 1) {
+    if (fwrite(buffer, lametag_size, (size_t)1, fp) != 1) {
       lsx_warn("cannot write VBR tag - VBR tag write failed");
     } else {
-      lsx_debug("rewrote VBR tag (%u bytes)", lametag_size);
+      lsx_debug("rewrote VBR tag (%" PRIuPTR " bytes)", lametag_size);
     }
   }
 }
--- a/src/spectrogram.c
+++ b/src/spectrogram.c
@@ -519,7 +519,7 @@
   memset(pixels, Background, cols * rows * sizeof(*pixels));
   png_init_io(png, file);
   png_set_PLTE(png, png_info, palette, fixed_palette + p->spectrum_points);
-  png_set_IHDR(png, png_info, (size_t)cols, (size_t)rows, 8,
+  png_set_IHDR(png, png_info, (png_uint_32)cols, (png_uint_32)rows, 8,
       PNG_COLOR_TYPE_PALETTE, PNG_INTERLACE_NONE,
       PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT);
   for (j = 0; j < rows; ++j)               /* Put (0,0) at bottom-left of PNG */