[xiph-commits] r12775 - trunk/speex/libspeex
jm at svn.xiph.org
jm at svn.xiph.org
Sun Mar 18 06:00:15 PDT 2007
Author: jm
Date: 2007-03-18 06:00:10 -0700 (Sun, 18 Mar 2007)
New Revision: 12775
Modified:
trunk/speex/libspeex/bits.c
trunk/speex/libspeex/misc.c
trunk/speex/libspeex/misc.h
trunk/speex/libspeex/nb_celp.c
trunk/speex/libspeex/sb_celp.c
trunk/speex/libspeex/speex_header.c
Log:
Replaced some warnings by notifications when it's not necessarily caused
by a programming error.
Modified: trunk/speex/libspeex/bits.c
===================================================================
--- trunk/speex/libspeex/bits.c 2007-03-18 10:29:42 UTC (rev 12774)
+++ trunk/speex/libspeex/bits.c 2007-03-18 13:00:10 UTC (rev 12775)
@@ -97,7 +97,7 @@
int nchars = len / BYTES_PER_CHAR;
if (nchars > bits->buf_size)
{
- speex_warning_int("Packet is larger than allocated buffer: ", len);
+ speex_notify("Packet is larger than allocated buffer");
if (bits->owner)
{
char *tmp = (char*)speex_realloc(bits->chars, nchars);
@@ -110,7 +110,7 @@
speex_warning("Could not resize input buffer: truncating input");
}
} else {
- speex_warning("Do not own input buffer: truncating input");
+ speex_warning("Do not own input buffer: truncating oversize input");
nchars=bits->buf_size;
}
}
@@ -159,10 +159,10 @@
bits->chars=tmp;
} else {
nchars=bits->buf_size-(bits->nbBits>>LOG2_BITS_PER_CHAR)-1;
- speex_warning("Could not resize input buffer: truncating input");
+ speex_warning("Could not resize input buffer: truncating oversize input");
}
} else {
- speex_warning("Do not own input buffer: truncating input");
+ speex_warning("Do not own input buffer: truncating oversize input");
nchars=bits->buf_size;
}
}
@@ -223,7 +223,7 @@
if (bits->charPtr+((nbBits+bits->bitPtr)>>LOG2_BITS_PER_CHAR) >= bits->buf_size)
{
- speex_warning("Buffer too small to pack bits");
+ speex_notify("Buffer too small to pack bits");
if (bits->owner)
{
int new_nchars = ((bits->buf_size+5)*3)>>1;
Modified: trunk/speex/libspeex/misc.c
===================================================================
--- trunk/speex/libspeex/misc.c 2007-03-18 10:29:42 UTC (rev 12774)
+++ trunk/speex/libspeex/misc.c 2007-03-18 13:00:10 UTC (rev 12775)
@@ -132,7 +132,7 @@
#ifndef OVERRIDE_SPEEX_ERROR
void speex_error(const char *str)
{
- fprintf (stderr, "Fatal error: %s\n", str);
+ fprintf (stderr, "Fatal (internal) error: %s\n", str);
exit(1);
}
#endif
@@ -140,17 +140,30 @@
#ifndef OVERRIDE_SPEEX_WARNING
void speex_warning(const char *str)
{
+#ifndef DISABLE_WARNINGS
fprintf (stderr, "warning: %s\n", str);
+#endif
}
#endif
#ifndef OVERRIDE_SPEEX_WARNING_INT
void speex_warning_int(const char *str, int val)
{
+#ifndef DISABLE_WARNINGS
fprintf (stderr, "warning: %s %d\n", str, val);
+#endif
}
#endif
+#ifndef OVERRIDE_SPEEX_NOTIFY
+void speex_notify(const char *str)
+{
+#ifndef DISABLE_NOTIFICATIONS
+ fprintf (stderr, "notification: %s\n", str);
+#endif
+}
+#endif
+
#ifdef FIXED_POINT
spx_word16_t speex_rand(spx_word16_t std, spx_int32_t *seed)
{
Modified: trunk/speex/libspeex/misc.h
===================================================================
--- trunk/speex/libspeex/misc.h 2007-03-18 10:29:42 UTC (rev 12774)
+++ trunk/speex/libspeex/misc.h 2007-03-18 13:00:10 UTC (rev 12775)
@@ -98,15 +98,18 @@
/** Speex wrapper for mem_move */
void *speex_move (void *dest, void *src, int n);
-/** Print error message to stderr */
+/** Abort with an error message to stderr (internal Speex error) */
void speex_error(const char *str);
-/** Print warning message to stderr */
+/** Print warning message to stderr (programming error) */
void speex_warning(const char *str);
/** Print warning message with integer argument to stderr */
void speex_warning_int(const char *str, int val);
+/** Print notification message to stderr */
+void speex_notify(const char *str);
+
/** Generate a random number */
spx_word16_t speex_rand(spx_word16_t std, spx_int32_t *seed);
Modified: trunk/speex/libspeex/nb_celp.c
===================================================================
--- trunk/speex/libspeex/nb_celp.c 2007-03-18 10:29:42 UTC (rev 12774)
+++ trunk/speex/libspeex/nb_celp.c 2007-03-18 13:00:10 UTC (rev 12775)
@@ -1257,7 +1257,7 @@
speex_mode_query(&speex_wb_mode, SPEEX_SUBMODE_BITS_PER_FRAME, &advance);
if (advance < 0)
{
- speex_warning ("Invalid wideband mode encountered. Corrupted stream?");
+ speex_notify("Invalid mode encountered. The stream is corrupted.");
return -2;
}
advance -= (SB_SUBMODE_BITS+1);
@@ -1272,7 +1272,7 @@
speex_mode_query(&speex_wb_mode, SPEEX_SUBMODE_BITS_PER_FRAME, &advance);
if (advance < 0)
{
- speex_warning ("Invalid wideband mode encountered: corrupted stream?");
+ speex_notify("Invalid mode encountered. The stream is corrupted.");
return -2;
}
advance -= (SB_SUBMODE_BITS+1);
@@ -1280,7 +1280,7 @@
wideband = speex_bits_unpack_unsigned(bits, 1);
if (wideband)
{
- speex_warning ("More than two wideband layers found: corrupted stream?");
+ speex_notify("More than two wideband layers found. The stream is corrupted.");
return -2;
}
@@ -1305,7 +1305,7 @@
return ret;
} else if (m>8) /* Invalid mode */
{
- speex_warning("Invalid mode encountered: corrupted stream?");
+ speex_notify("Invalid mode encountered. The stream is corrupted.");
return -2;
}
Modified: trunk/speex/libspeex/sb_celp.c
===================================================================
--- trunk/speex/libspeex/sb_celp.c 2007-03-18 10:29:42 UTC (rev 12774)
+++ trunk/speex/libspeex/sb_celp.c 2007-03-18 13:00:10 UTC (rev 12775)
@@ -931,7 +931,7 @@
}
if (st->submodeID != 0 && st->submodes[st->submodeID] == NULL)
{
- speex_warning("Invalid mode encountered: corrupted stream?");
+ speex_notify("Invalid mode encountered. The stream is corrupted.");
return -2;
}
}
Modified: trunk/speex/libspeex/speex_header.c
===================================================================
--- trunk/speex/libspeex/speex_header.c 2007-03-18 10:29:42 UTC (rev 12774)
+++ trunk/speex/libspeex/speex_header.c 2007-03-18 13:00:10 UTC (rev 12775)
@@ -133,14 +133,14 @@
for (i=0;i<8;i++)
if (packet[i]!=h[i])
{
- speex_warning ("This doesn't look like a Speex file");
+ speex_notify("This doesn't look like a Speex file");
return NULL;
}
/*FIXME: Do we allow larger headers?*/
if (size < (int)sizeof(SpeexHeader))
{
- speex_warning("Speex header too small");
+ speex_notify("Speex header too small");
return NULL;
}
More information about the commits
mailing list