shithub: sox

Download patch

ref: 70291cece6edf82ddd14a33cd587bbf8db44efc1
parent: c4e5ba5bc8c35691ab75f89b6a6b77b0566fe47d
author: cbagwell <cbagwell>
date: Wed Feb 23 22:53:37 EST 2011

Fix warning message while recording.

--- a/src/coreaudio.c
+++ b/src/coreaudio.c
@@ -69,7 +69,7 @@
   sox_format_t *ft = (sox_format_t *)inClientData;
   priv_t *ac = (priv_t *)ft->priv;
   float *buf;
-  size_t buflen;
+  size_t buflen, output_buflen;
   float *destbuf = (float *)((unsigned char *)ac->buffer + ac->buf_offset);
   int i;
   unsigned int buf_num;
@@ -86,7 +86,7 @@
       }
 
       buf = inInputData->mBuffers[buf_num].mData;
-      buflen = inInputData->mBuffers[buf_num].mDataByteSize;
+      buflen = output_buflen = inInputData->mBuffers[buf_num].mDataByteSize;
 
       /* mDataByteSize may be non-zero even when mData is NULL, but that is
        * not an error.
@@ -98,7 +98,7 @@
 	  buflen = ac->buf_size - ac->buf_offset;
 
       /* FIXME: Handle buffer overrun. */
-      if (buflen < ac->buf_size)
+      if (buflen < output_buflen)
 	  lsx_warn("coreaudio: unhandled buffer overrun.  Data discarded.");
 
       for (i = 0; i < (int)(buflen / sizeof(float)); i += 2) {