diff options
| author | Stephen Torri <storri@users.sourceforge.net> | 2003-02-28 02:51:47 +0000 |
|---|---|---|
| committer | Stephen Torri <storri@users.sourceforge.net> | 2003-02-28 02:51:47 +0000 |
| commit | 49327f43ca2196122a60314e67eeee929efea873 (patch) | |
| tree | 1b9ce1d2b141d0e411e422df265f6d57183906e1 /src/libxineadec/gsm610/lpc.c | |
| parent | 7eb769e2d3c1abb16e53d87af5f8633967e7f6ce (diff) | |
| download | xine-lib-49327f43ca2196122a60314e67eeee929efea873.tar.gz xine-lib-49327f43ca2196122a60314e67eeee929efea873.tar.bz2 | |
Xine assert() replacement:
All assert() function calls, with exceptions of libdvdread and libdvdnav, have been
replaced with XINE_ASSERT. Functionally XINE_ASSERT behaves just likes its predecesor but its
adding the ability to print out a stack trace at the point where the assertion fails.
So here are a few examples.
assert (0);
This use of assert was found in a couple locations most favorably being the default case of a switch
statement. This was the only thing there. So if the switch statement was unable to find a match
it would have defaulted to this and the user and the developers would be stuck wonder who died and where.
So it has been replaced with
XINE_ASSERT(0, "We have reach this point and don't have a default case");
It may seem a bit none descriptive but there is more going on behind the scene.
In addition to checking a condition is true/false, in this case '0', the XINE_ASSERT
prints out:
<filename>:<function name>:<line number> - assertion '<assertion expression>' failed. <description>
An example of this might be:
input_dvd.c:open_plugin:1178 - assertion '0' failed. xine_malloc failed!!! You have run out of memory
XINE_ASSERT and its helper function, print_trace, are found in src/xine-utils/xineutils.h
CVS patchset: 4301
CVS date: 2003/02/28 02:51:47
Diffstat (limited to 'src/libxineadec/gsm610/lpc.c')
| -rw-r--r-- | src/libxineadec/gsm610/lpc.c | 41 |
1 files changed, 25 insertions, 16 deletions
diff --git a/src/libxineadec/gsm610/lpc.c b/src/libxineadec/gsm610/lpc.c index 7795ca542..461f0b70f 100644 --- a/src/libxineadec/gsm610/lpc.c +++ b/src/libxineadec/gsm610/lpc.c @@ -4,10 +4,10 @@ * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE. */ -/* $Header: /nfshome/cvs/xine-lib/src/libxineadec/gsm610/lpc.c,v 1.1 2002/10/12 19:12:49 tmmm Exp $ */ +/* $Header: /nfshome/cvs/xine-lib/src/libxineadec/gsm610/lpc.c,v 1.2 2003/02/28 02:51:50 storri Exp $ */ #include <stdio.h> -#include <assert.h> +#include "xineutils.h" #include "private.h" @@ -54,7 +54,7 @@ static void Autocorrelation P2((s, L_ACF), */ if (smax == 0) scalauto = 0; else { - assert(smax > 0); + XINE_ASSERT(smax > 0, "Scale maximum (smax) is not greater than 0: %d", smax); scalauto = 4 - gsm_norm( (longword)smax << 16 );/* sub(4,..) */ } @@ -139,7 +139,7 @@ static void Autocorrelation P2((s, L_ACF), /* Rescaling of the array s[0..159] */ if (scalauto > 0) { - assert(scalauto <= 4); + XINE_ASSERT(scalauto <= 4, "scalauto is not <= 4: %d", scalauto); for (k = 160; k--; *s++ <<= scalauto) ; } } @@ -194,10 +194,10 @@ static void Reflection_coefficients P2( (L_ACF, r), return; } - assert( L_ACF[0] != 0 ); + XINE_ASSERT( L_ACF[0] != 0 , "L_ACF[0] is NULL"); temp = gsm_norm( L_ACF[0] ); - assert(temp >= 0 && temp < 32); + XINE_ASSERT(temp >= 0 && temp < 32, "temp is not within range 0 to 32: %d", temp); /* ? overflow ? */ for (i = 0; i <= 8; i++) ACF[i] = SASR( L_ACF[i] << temp, 16 ); @@ -221,9 +221,12 @@ static void Reflection_coefficients P2( (L_ACF, r), *r = gsm_div( temp, P[0] ); - assert(*r >= 0); + XINE_ASSERT(*r >= 0, "value 'r' is not >= 0: %d", *r); + if (P[1] > 0) *r = -*r; /* r[n] = sub(0, r[n]) */ - assert (*r != MIN_WORD); + + XINE_ASSERT (*r != MIN_WORD, "value 'r' is equal to MIN_WORD: %d", *r); + if (n == 8) return; /* Schur recursion @@ -264,21 +267,27 @@ static void Transformation_to_Log_Area_Ratios P1((r), temp = *r; temp = GSM_ABS(temp); - assert(temp >= 0); + + XINE_ASSERT(temp >= 0, "value 'temp' is not >= 0: %d", temp); if (temp < 22118) { temp >>= 1; } else if (temp < 31130) { - assert( temp >= 11059 ); + XINE_ASSERT(temp >= 11059, "value 'temp' is not >= 11059: %d", temp); temp -= 11059; } else { - assert( temp >= 26112 ); - temp -= 26112; - temp <<= 2; + XINE_ASSERT(temp >= 26112, "value 'temp' is not >= 26112: %d", temp); + temp -= 26112; + temp <<= 2; } - - *r = *r < 0 ? -temp : temp; - assert( *r != MIN_WORD ); + + if (*r < 0) { + *r = -temp; + } + else { + *r = temp; + } + XINE_ASSERT (*r != MIN_WORD, "value 'r' is equal to MIN_WORD: %d", *r); } } |
