*** CHANGELO 0a1,8 > Tue Jan 25 22:53:40 1994 Jutta Degener (jutta at kugelbus) > > * Release 1.0 Patchlevel 3 > changed rpe.c's STEP macro to work with 16-bit integers, > thanks to Dr Alex Lee (alexlee@solomon.technet.sg) > > * removed non-fatal bugs from add-test.dta, private.h > and toast_audio.c, thanks to P. Emanuelsson. *** ADD-TEST/ADD_TEST.DTA 14,15c14,15 < ; - and + by itself mean MIN_WORD and MAX_WORD, respecitvely; < ; -- and ++ mean MIN_LONGWORLD and MAX_LONGWORD. --- > ; - and + by itself mean MIN_WORD and MAX_WORD, respectively; > ; -- and ++ mean MIN_LONGWORD and MAX_LONGWORD. *** INC/CONFIG.H 7c7 < /*$Header: /home/kbs/jutta/src/gsm/gsm-1.0/inc/RCS/config.h,v 1.1 1992/10/28 00:11:08 jutta Exp $*/ --- > /*$Header: /home/kbs/jutta/src/gsm/gsm-1.0/inc/RCS/config.h,v 1.2 1994/01/25 22:20:51 jutta Exp $*/ 12c12 < /*efine SIGHANDLER_T 1 /* signal handlers are void */ --- > /*efine SIGHANDLER_T int /* signal handlers are void */ *** INC/GSM.H 7c7 < /*$Header: /home/kbs/jutta/src/gsm/gsm-1.0/inc/RCS/gsm.h,v 1.4 1993/01/29 20:07:38 jutta Exp $*/ --- > /*$Header: /home/kbs/jutta/src/gsm/gsm-1.0/inc/RCS/gsm.h,v 1.5 1994/01/25 22:20:48 jutta Exp $*/ 47c47 < #define GSM_PATCHLEVEL 2 --- > #define GSM_PATCHLEVEL 3 *** SRC/RPE.C 7c7 < /* $Header: /home/kbs/jutta/src/gsm/gsm-1.0/src/RCS/rpe.c,v 1.1 1992/10/28 14:17:32 jutta Exp $ */ --- > /* $Header: /home/kbs/jutta/src/gsm/gsm-1.0/src/RCS/rpe.c,v 1.2 1994/01/25 22:21:15 jutta Exp $ */ 63c63 < #define STEP( i, H ) (e[ k + i ] * H) --- > #define STEP( i, H ) (e[ k + i ] * (long)H) *** SRC/TOAST_AU.C 7c7 < /* $Header: /home/kbs/jutta/src/gsm/gsm-1.0/src/RCS/toast_audio.c,v 1.1 1992/10/28 00:15:50 jutta Exp $ */ --- > /* $Header: /home/kbs/jutta/src/gsm/gsm-1.0/src/RCS/toast_audio.c,v 1.2 1994/01/25 22:21:20 jutta Exp $ */ 49,50c49,50 < if ( (i = getc(f)) == EOF < || ((u = (unsigned char)i), (i = getc(f)) == EOF) --- > if ( (i = getc(f)) == EOF > || ((u = (unsigned char)i), (i = getc(f)) == EOF) 53,54c53 < < *up = u | (unsigned char)i; --- > *up = (u<<8)|(unsigned char)i; *** CHANGELO *** 0a1,9 > Tue May 10 19:41:34 1994 Jutta Degener (jutta at kugelbus) > > * Release 1.0 Patchlevel 4 > inc/private.h: GSM_ADD should cast to ulongword, not to unsigned. > src/long_term.c: missing cast to longword. > add-test/add_test.c: Test macros too, not only functions, > thanks to Simao Ferraz de Campos Neto, simao@dragon.cpqd.ansp.br > General cleanup: remove unused variables, add function prototypes. > *** MAKEFILE *** 35c35 < CC = gcc --- > CC = gcc -ansi -pedantic 118c118 < DEBUG = -DNDEBUG --- > # DEBUG = -DNDEBUG *** ADD-TEST/ADD_TEST.C *** 7c7 < /* $Header: /home/kbs/jutta/src/gsm/gsm-1.0/add-test/RCS/add_test.c,v 1.1 1992/10/28 00:09:10 jutta Exp $ */ --- > /* $Header: /home/kbs/jutta/src/gsm/gsm-1.0/add-test/RCS/add_test.c,v 1.2 1994/05/10 20:18:17 jutta Exp $ */ 13d12 < #define GSM_IMPLEMENTATION 24a24,31 > word M_gsm_add P((word op1, word op2)); > word M_gsm_sub P((word op1, word op2)); > word M_gsm_mult P((word op1, word op2)); > word M_gsm_mult_r P((word op1, word op2)); > word M_gsm_abs P((word op1)); > longword M_gsm_L_mult P((word op1, word op2)); > longword M_gsm_L_add P((longword op1, longword op2)); > 172c179 < int main() --- > int main(ac, av) char ** av; 175a183,200 > FILE * in; > > if (ac > 2) { > fprintf(stderr, "Usage: %s [filename]\n", av[0]); > fail: > #ifdef EXIT_FAILURE > exit(EXIT_FAILURE); > #else > exit(1); > #endif > } > if (ac < 2) in = stdin; > else if (!(in = fopen(av[1], "r"))) { > perror(av[1]); > fprintf(stderr, "%s: cannot open file \"%s\" for reading\n", > av[0], av[1]); > goto fail; > } 177c202 < interactive = isatty(fileno(stdin)); --- > interactive = isatty(fileno(in)); 182c207 < if (!fgets(buf, sizeof(buf), stdin)) exit(0); --- > if (!fgets(buf, sizeof(buf), in)) exit(0); 201a227,230 > if (!strcmp(c, "M_add")) { > do_word( M_gsm_add( op1, op2 )); > continue; > } 205a235,238 > if (!strcmp(c, "M_sub")) { > do_word( M_gsm_sub( op1, op2 )); > continue; > } 209a243,246 > if (!strcmp(c, "M_mult")) { > do_word( M_gsm_mult( op1, op2 )); > continue; > } 213a251,254 > if (!strcmp(c, "M_mult_r")) { > do_word( M_gsm_mult_r(op1, op2)); > continue; > } 217a259,262 > if (!strcmp(c, "M_abs" )) { > do_word( M_gsm_abs(op1) ); > continue; > } 237a283,286 > if (!strcmp(c, "M_L_mult")) { > do_longword( M_gsm_L_mult( op1, op2 )); > continue; > } 241a291,294 > if (!strcmp(c, "M_L_add" )) { > do_longword( M_gsm_L_add( L_op1, L_op2 )); > continue; > } 255a309,352 > } > > #include "private.h" > > /* > * Function stubs for macro implementations of commonly used > * math functions > */ > word M_gsm_add P2((op1, op2),word op1, word op2) > { > longword ltmp; > return GSM_ADD(op1, op2); > } > > word M_gsm_sub P2((op1, op2), word op1, word op2) > { > longword ltmp; > return GSM_SUB(op1, op2); > } > > word M_gsm_mult P2((op1, op2), word op1, word op2) > { > return GSM_MULT(op1, op2); > } > > word M_gsm_mult_r P2((op1, op2), word op1, word op2) > { > return GSM_MULT_R(op1, op2); > } > > word M_gsm_abs P1((op1), word op1) > { > return GSM_ABS(op1); > } > > longword M_gsm_L_mult P2((op1, op2), word op1, word op2) > { > return GSM_L_MULT(op1, op2); > } > > longword M_gsm_L_add P2((op1, op2), longword op1, longword op2) > { > ulongword utmp; > return GSM_L_ADD(op1, op2); *** ADD-TEST/ADD_TEST.DTA *** 435a436,683 > > 'macros > ' > 'add ================ > ' basic > > M_add 0 0 = 0 > M_add 7 4 = 11 > M_add 4 6 = 10 > M_add 1 1 = 2 > > ' negative operands > > M_add -7 4 = -3 > M_add 4 -6 = -2 > M_add -1 -3 = -4 > M_add 7 -4 = 3 > M_add -4 6 = 2 > > ' positive overflow > ; (max-word = 32767) > M_add + 1 = + > M_add + + = + > M_add -1 + = 32766 > M_add 32766 2 = + > M_add 1 32766 = + > > ' underflow > ; (min-word = 32768) > > M_add - -1 = - > M_add - - = - > M_add 1 - = -32767 > M_add -32767 -2 = - > M_add -1 -32766 = -32767 > M_add -32767 -1 = - > M_add - + = -1 > M_add + - = -1 > M_add 0 - = - > M_add 0 + = + > ' > > 'L_add ================ > ' basic > > M_L_add 0 0 = 0 > M_L_add 7 4 = 11 > M_L_add 4 6 = 10 > M_L_add 1 1 = 2 > > ' negative operands > > M_L_add -7 4 = -3 > M_L_add 4 -6 = -2 > M_L_add -1 -3 = -4 > M_L_add 7 -4 = 3 > M_L_add -4 6 = 2 > M_L_add 0 -1 = -1 > > ' positive overflow > ; (max-longword = 2147483647) > M_L_add ++ 1 = ++ > M_L_add ++ ++ = ++ > M_L_add -1 ++ = 2147483646 > M_L_add 2147483646 2 = ++ > M_L_add 1 2147483645 = 2147483646 > > ' underflow > ; (min-longword = -2147483648) > > M_L_add -- -1 = -- > M_L_add -- -- = -- > M_L_add 1 -- = -2147483647 > M_L_add -2147483647 -2 = -- > M_L_add -1 -2147483646 = -2147483647 > M_L_add -2147483647 -1 = -- > M_L_add -- ++ = -1 > M_L_add ++ -- = -1 > M_L_add 0 -- = -- > M_L_add 0 ++ = ++ > ' > > 'sub ================ > ' basic > > M_sub 0 0 = 0 > M_sub 7 4 = 3 > M_sub 4 6 = -2 > M_sub 1 0 = 1 > > ' negative operands > > M_sub -7 4 = -11 > M_sub 4 -6 = 10 > M_sub -1 -3 = 2 > M_sub 7 -4 = 11 > M_sub -4 6 = -10 > > ' positive overflow > ; (max-word = 32767) > M_sub 1 - = + > M_sub + + = 0 > M_sub + 0 = + > M_sub + -1 = + > M_sub + 1 = 32766 > M_sub 1 + = -32766 > M_sub 0 + = -32767 > > ' underflow > ; (min-word = 32768) > > M_sub - -1 = -32767 > M_sub - 1 = - > M_sub - - = 0 > M_sub - + = - > M_sub + - = + > M_sub 1 - = + > M_sub -1 - = + > M_sub -32767 2 = - > M_sub 0 - = + > ' > ' > 'abs ================ > ' basic > > M_abs 0 = 0 > M_abs 2 = 2 > M_abs -459 = 459 > > ' overflow > > M_abs + = + > M_abs - = + > M_abs -32767 = + > M_abs 32766 = 32766 > M_abs -32766 = 32766 > > ' > 'mult ================ > ; actually, a * b >> 15 > > ' basic > M_mult 0 0 = 0 > M_mult 0x100 0x100 = 2 > M_mult 4711 0x4000 = 2355 > > ' negative operands > M_mult -1 0 = 0 > > M_mult -0x100 0x100 = -2 > M_mult 0x100 -0x100 = -2 > M_mult -0x100 -0x100 = 2 > > M_mult -4711 0x4000 = -2356 > M_mult 4711 -0x4000 = -2356 > M_mult -4711 -0x4000 = 2355 > > ' overflow > M_mult + + = 32766 > M_mult + 0x4000 = 0x3fff > M_mult 0x4000 + = 0x3fff > M_mult + 1 = 0 > M_mult + 2 = 1 > M_mult + 3 = 2 > > ' underflow > ; M_mult - - = + assert !(a == b && b == MIN_WORD) > M_mult - -32767 = + > M_mult -32767 - = + > M_mult - + = -32767 > M_mult + - = -32767 > M_mult - 1 = -1 > M_mult - 2 = -2 > M_mult - 3 = -3 > > ' > 'mult_r ================ > ; actually, (a * b + 16384) >> 15 > > ' basic > M_mult_r 0 0 = 0 > M_mult_r 0x100 0x100 = 2 > M_mult_r 4711 0x4000 = 2356 > > ' negative operands > M_mult_r -1 0 = 0 > > M_mult_r -0x100 0x100 = -2 > M_mult_r 0x100 -0x100 = -2 > M_mult_r -0x100 -0x100 = 2 > > M_mult_r -4711 0x4000 = -2355 > M_mult_r 4711 -0x4000 = -2355 > M_mult_r -4711 -0x4000 = 2356 > > ' overflow > M_mult_r + + = 32766 > M_mult_r + 32766 = 32765 > M_mult_r 32766 + = 32765 > M_mult_r + 0x4000 = 0x4000 > M_mult_r 0x4000 + = 0x4000 > M_mult_r + 0x4001 = 0x4000 > M_mult_r 0x4001 + = 0x4000 > M_mult_r + 2 = 2 > M_mult_r + 1 = 1 > M_mult_r 1 + = 1 > M_mult_r + 0 = 0 > M_mult_r 0 + = 0 > > ' underflow > ; M_mult_r - - = + assert !(a == b && b == MIN_WORD) > M_mult_r - -32767 = + > M_mult_r -32767 - = + > M_mult_r - + = -32767 > M_mult_r + - = -32767 > M_mult_r - 1 = -1 > M_mult_r - 2 = -2 > M_mult_r - 3 = -3 > > ' > 'L_mult ================ > ; actually, (a * b) << 1 > ; assert (a != MIN_WORD && b != MIN_WORD) > > ' basic > M_L_mult 0 0 = 0 > M_L_mult 2 3 = 12 > M_L_mult 4711 5 = 47110 > > ' negative operands > > M_L_mult -2 3 = -12 > M_L_mult 2 -3 = -12 > M_L_mult -2 -3 = 12 > M_L_mult -4711 5 = -47110 > M_L_mult 4711 -5 = -47110 > M_L_mult -4711 -5 = 47110 > > ' overflow > M_L_mult + + = 2147352578 > M_L_mult + -32767 = -2147352578 > M_L_mult -32767 + = -2147352578 > M_L_mult + 2 = 131068 > M_L_mult + 1 = 65534 > M_L_mult 1 + = 65534 > M_L_mult + 0 = 0 > M_L_mult 0 + = 0 > *** INC/CONFIG.H *** 7c7 < /*$Header: /home/kbs/jutta/src/gsm/gsm-1.0/inc/RCS/config.h,v 1.2 1994/01/25 22:20:51 jutta Exp $*/ --- > /*$Header: /home/kbs/jutta/src/gsm/gsm-1.0/inc/RCS/config.h,v 1.3 1994/05/10 20:18:22 jutta Exp $*/ 26a27 > #define HAS_UNISTD_H 1 /* /usr/include/unistd.h */ 29c30 < /*efine HAS_UTIME_H 1 /* UTIME header file */ --- > #define HAS_UTIME_H 1 /* UTIME header file */ *** INC/GSM.H *** 7c7 < /*$Header: /home/kbs/jutta/src/gsm/gsm-1.0/inc/RCS/gsm.h,v 1.5 1994/01/25 22:20:48 jutta Exp $*/ --- > /*$Header: /home/kbs/jutta/src/gsm/gsm-1.0/inc/RCS/gsm.h,v 1.6 1994/05/10 20:18:20 jutta Exp $*/ 47c47 < #define GSM_PATCHLEVEL 3 --- > #define GSM_PATCHLEVEL 4 *** INC/PRIVATE.H *** 7c7 < /*$Header: /home/kbs/jutta/src/gsm/gsm-1.0/inc/RCS/private.h,v 1.2 1993/01/29 18:25:27 jutta Exp $*/ --- > /*$Header: /home/kbs/jutta/src/gsm/gsm-1.0/inc/RCS/private.h,v 1.3 1994/05/10 20:18:23 jutta Exp $*/ 40c40 < #define MIN_WORD (-32768) --- > #define MIN_WORD ((-32767)-1) 112c112 < ((unsigned)((ltmp = (longword)(a) + (longword)(b)) - MIN_WORD) > \ --- > ((ulongword)((ltmp = (longword)(a) + (longword)(b)) - MIN_WORD) > \ 128a129 > # define GSM_SUB(a, b) gsm_sub(a, b) 200a202,215 > > void Gsm_RPE_Decoding P(( > struct gsm_state *S, > word xmaxcr, > word Mcr, > word * xMcr, /* [0..12], 3 bits IN */ > word * erp)); /* [0..39] OUT */ > > void Gsm_RPE_Encoding P(( > struct gsm_state * S, > word * e, /* -5..-1][0..39][40..44 IN/OUT */ > word * xmaxc, /* OUT */ > word * Mc, /* OUT */ > word * xMc)); /* [0..12] OUT */ *** INC/TOAST.H *** 7c7 < /* $Header: /home/kbs/jutta/src/gsm/gsm-1.0/inc/RCS/toast.h,v 1.1 1992/10/28 00:11:08 jutta Exp $ */ --- > /* $Header: /home/kbs/jutta/src/gsm/gsm-1.0/inc/RCS/toast.h,v 1.2 1994/05/10 20:18:25 jutta Exp $ */ 88d87 < #ifdef USE_PATHCONF 92d90 < #endif 100a99,103 > > extern int audio_init_input P((void)), audio_init_output P((void)); > extern int ulaw_input P((gsm_signal*)), ulaw_output P((gsm_signal *)); > extern int alaw_input P((gsm_signal*)), alaw_output P((gsm_signal *)); > extern int linear_input P((gsm_signal*)), linear_output P((gsm_signal *)); *** SRC/ADD.C *** 7c7 < /* $Header: /home/kbs/jutta/src/gsm/gsm-1.0/src/RCS/add.c,v 1.2 1993/01/29 18:23:15 jutta Exp $ */ --- > /* $Header: /home/kbs/jutta/src/gsm/gsm-1.0/src/RCS/add.c,v 1.3 1994/05/10 20:18:30 jutta Exp $ */ 94c94 < return A >= MAX_LONGWORD ? MIN_LONGWORD : -A - 1; --- > return A >= MAX_LONGWORD ? MIN_LONGWORD : -(longword)A - 1; *** SRC/CODE.C *** 7c7 < /* $Header: /home/kbs/jutta/src/gsm/gsm-1.0/src/RCS/code.c,v 1.1 1992/10/28 00:15:50 jutta Exp $ */ --- > /* $Header: /home/kbs/jutta/src/gsm/gsm-1.0/src/RCS/code.c,v 1.2 1994/05/10 20:18:31 jutta Exp $ */ 62d61 < word ep[40]; *** SRC/GSM_CREA.C *** 7c7 < static char ident[] = "$Header: /home/kbs/jutta/src/gsm/gsm-1.0/src/RCS/gsm_create.c,v 1.1 1992/10/28 00:15:50 jutta Exp $"; --- > static char ident[] = "$Header: /home/kbs/jutta/src/gsm/gsm-1.0/src/RCS/gsm_create.c,v 1.2 1994/05/10 20:18:39 jutta Exp $"; 11,12c11,12 < #ifdef HAS_STDLIB_H < #include --- > #ifdef HAS_STRING_H > #include 16a17,27 > > #ifdef HAS_STDLIB_H > # include > #else > # ifdef HAS_MALLOC_H > # include > # else > extern char * malloc(); > # endif > #endif > *** SRC/GSM_DEST.C *** 7c7 < /* $Header: /home/kbs/jutta/src/gsm/gsm-1.0/src/RCS/gsm_destroy.c,v 1.1 1992/10/28 00:15:50 jutta Exp $ */ --- > /* $Header: /home/kbs/jutta/src/gsm/gsm-1.0/src/RCS/gsm_destroy.c,v 1.2 1994/05/10 20:18:34 jutta Exp $ */ 10a11,20 > > #ifdef HAS_STDLIB_H > # include > #else > # ifdef HAS_MALLOC_H > # include > # else > extern void free(); > # endif > #endif *** SRC/LONG_TER.C *** 7c7 < /* $Header: /home/kbs/jutta/src/gsm/gsm-1.0/src/RCS/long_term.c,v 1.1 1992/10/28 00:15:50 jutta Exp $ */ --- > /* $Header: /home/kbs/jutta/src/gsm/gsm-1.0/src/RCS/long_term.c,v 1.2 1994/05/10 20:18:42 jutta Exp $ */ 80,81d79 < register ulongword utmp; /* for L_ADD */ < 104c102 < temp = gsm_norm( dmax << 16 ); --- > temp = gsm_norm( (longword)dmax << 16 ); 221,222d218 < register ulongword utmp; /* for L_ADD */ < 247c243 < temp = gsm_norm( dmax << 16 ); --- > temp = gsm_norm( (longword)dmax << 16 ); 388,389d383 < register ulongword utmp; /* for L_ADD */ < 520d513 < register word bp; *** SRC/LPC.C *** 7c7 < /* $Header: /home/kbs/jutta/src/gsm/gsm-1.0/src/RCS/lpc.c,v 1.1 1992/10/28 00:15:50 jutta Exp $ */ --- > /* $Header: /home/kbs/jutta/src/gsm/gsm-1.0/src/RCS/lpc.c,v 1.2 1994/05/10 20:18:43 jutta Exp $ */ 37d36 < longword L_temp; 41,43d39 < longword L_temp2; < #else < longword L_temp2; 294d289 < ulongword utmp; *** SRC/PREPROCE.C *** 7c7 < /* $Header: /home/kbs/jutta/src/gsm/gsm-1.0/src/RCS/preprocess.c,v 1.1 1992/10/28 00:15:50 jutta Exp $ */ --- > /* $Header: /home/kbs/jutta/src/gsm/gsm-1.0/src/RCS/preprocess.c,v 1.2 1994/05/10 20:18:45 jutta Exp $ */ 49c49 < word msp, lsp, temp; --- > word msp, lsp; *** SRC/RPE.C *** 7c7 < /* $Header: /home/kbs/jutta/src/gsm/gsm-1.0/src/RCS/rpe.c,v 1.2 1994/01/25 22:21:15 jutta Exp $ */ --- > /* $Header: /home/kbs/jutta/src/gsm/gsm-1.0/src/RCS/rpe.c,v 1.3 1994/05/10 20:18:46 jutta Exp $ */ 36c36 < register int k, i; --- > register int k /* , i */ ; 63c63 < #define STEP( i, H ) (e[ k + i ] * (long)H) --- > #define STEP( i, H ) (e[ k + i ] * (longword)H) 127,128c127 < register int m, i; < register ulongword utmp; --- > register int /* m, */ i; 268d266 < register longword ltmp; /* for GSM_ADD */ 364d361 < ulongword utmp; *** SRC/SHORT_TE.C *** 7c7 < /* $Header: /home/kbs/jutta/src/gsm/gsm-1.0/src/RCS/short_term.c,v 1.1 1992/10/28 00:15:50 jutta Exp $ */ --- > /* $Header: /home/kbs/jutta/src/gsm/gsm-1.0/src/RCS/short_term.c,v 1.2 1994/05/10 20:18:47 jutta Exp $ */ 27c27 < register word temp1, temp2; --- > register word temp1 /* , temp2 */; *** SRC/TOAST.C *** 7c7 < /* $Header: /home/kbs/jutta/src/gsm/gsm-1.0/src/RCS/toast.c,v 1.3 1993/01/29 18:19:25 jutta Exp $ */ --- > /* $Header: /home/kbs/jutta/src/gsm/gsm-1.0/src/RCS/toast.c,v 1.4 1994/05/10 20:18:49 jutta Exp $ */ 46,47c46,47 < int (*init_input) P(()), < (*init_output) P(()); --- > int (*init_input) P((void)), > (*init_output) P((void)); 51,55d50 < extern int audio_init_input(), audio_init_output(); < extern int ulaw_input P((gsm_signal*)), ulaw_output P((gsm_signal *)); < extern int alaw_input P((gsm_signal*)), alaw_output P((gsm_signal *)); < extern int linear_input P((gsm_signal*)), linear_output P((gsm_signal *)); < 60,61c55,56 < int (* init_input ) P(()), < (* init_output) P(()); --- > int (* init_input ) P((void)), > (* init_output) P((void)); 111c106 < char * endname P1((name), char * name) --- > static char * endname P1((name), char * name) 127d121 < char * c; 147c141 < int length_okay P1((name), char * name) --- > static int length_okay P1((name), char * name) 150c144 < char * end, * s, tmp; --- > char * end; 167,174c161,170 < < /* s = dirname(name) < */ < if ((s = end) > name) { < if (s > name + 1) s--; < tmp = s; < *s = 0; < } --- > #ifdef USE_PATHCONF > { char * s, tmp; > > /* s = dirname(name) > */ > if ((s = end) > name) { > if (s > name + 1) s--; > tmp = s; > *s = 0; > } 176,180c172,177 < errno = 0; < max_filename_length = pathconf(s > name ? name : ".", _PC_NAME_MAX); < if (max_filename_length == -1 && errno) { < perror( s > name ? name : "." ); < fprintf(stderr, --- > errno = 0; > max_filename_length = pathconf(s > name ? name : ".", > _PC_NAME_MAX); > if (max_filename_length == -1 && errno) { > perror( s > name ? name : "." ); > fprintf(stderr, 182,183c179,182 < progname, s > name ? name : "."); < return 0; --- > progname, s > name ? name : "."); > return 0; > } > if (s > name) *s = tmp; 185,186c184 < if (s > name) *s = tmp; < --- > #endif /* USE_PATHCONF */ 206,207c204,205 < int nlen = strlen(name); < int slen = strlen(suf); --- > size_t nlen = strlen(name); > size_t slen = strlen(suf); 215c213 < void catch_signals P1((fun), SIGHANDLER_T (*fun)()) --- > static void catch_signals P1((fun), SIGHANDLER_T (*fun) ()) 251c249 < static char * emalloc P1((len), int len) --- > static char * emalloc P1((len), size_t len) 265c263 < int maxlen; --- > size_t maxlen; 283c281 < char * plainname P1((name), char *name) --- > static char * plainname P1((name), char *name) 291c289 < char * codename P1((name), char *name) --- > static char * codename P1((name), char *name) 319c317 < void update_mode P0() --- > static void update_mode P0() 338c336 < void update_own P0() --- > static void update_own P0() 348c346 < void update_times P0() --- > static void update_times P0() 519c517 < int process_encode P0() --- > static int process_encode P0() 522d519 < int n = 0; 556c553 < int process_decode P0() --- > static int process_decode P0() 562c559 < int cc, cw; --- > int cc; 608c605 < int process P1((name), char * name) --- > static int process P1((name), char * name) 610,612d606 < int outfd = -1; < char * tmp; < 684c678 < "$Id: toast.c,v 1.3 1993/01/29 18:19:25 jutta Exp $" ); --- > "$Id: toast.c,v 1.4 1994/05/10 20:18:49 jutta Exp $" ); 711c705 < void set_format P1((f), struct fmtdesc * f) --- > static void set_format P1((f), struct fmtdesc * f) 727d720 < extern char * optarg; *** SRC/TOAST_AU.C *** 7c7 < /* $Header: /home/kbs/jutta/src/gsm/gsm-1.0/src/RCS/toast_audio.c,v 1.2 1994/01/25 22:21:20 jutta Exp $ */ --- > /* $Header: /home/kbs/jutta/src/gsm/gsm-1.0/src/RCS/toast_audio.c,v 1.3 1994/05/10 20:18:52 jutta Exp $ */ 68c68 < || fseek(in, len-4*4, 1) < 0) return 0; --- > || fseek(in, (long)(len - 4*4), 1) < 0) return 0; 88c88 < || put_u32(out, ~0) --- > || put_u32(out, ~(unsigned long)0) *** COPYRIGH *** 1c1 < Copyright 1992 by Jutta Degener and Carsten Bormann, --- > Copyright 1992, 1993, 1994 by Jutta Degener and Carsten Bormann, 14c14 < Berlin, 15.09.1992 --- > Berlin, 28.11.1994 *** CHANGELO *** 0a1,11 > Mon Nov 28 20:49:57 1994 Jutta Degener (jutta@cs.tu-berlin.de) > > * Release 1.0 Patchlevel 5 > src/toast_audio.c: initialization should return -1 on error > src/gsm_destroy.c: #include configuration header file > src/add.c: gsm_sub should cast its parameters to longword > man/*: bug reports to {jutta,cabo}@cs.tu-berlin.de, not to toast@tub > inc/private.h: longword long by default, not int > inc/toast.h: read/write fopen modes "rb" and "wb", not just "r" > src/toast.c: better (or different, anyway) error handling in process() > *** INSTALL *** 3,5c3,5 < * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische < * Universitaet Berlin. See the accompanying file "COPYRIGHT" for < * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE. --- > * Copyright 1992, 1993, 1994, by Jutta Degener and Carsten Bormann, > * Technische Universitaet Berlin. See the accompanying file "COPYRIGHT" > * for details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE. 85c85,86 < Please direct bug reports to toast@tub.cs.tu-berlin.de. --- > Please direct bug reports to jutta@cs.tu-berlin.de and > cabo@cs.tu-berlin.de . *** INC/GSM.H *** 7c7 < /*$Header: /home/kbs/jutta/src/gsm/gsm-1.0/inc/RCS/gsm.h,v 1.6 1994/05/10 20:18:20 jutta Exp $*/ --- > /*$Header: /home/kbs/jutta/src/gsm/gsm-1.0/inc/RCS/gsm.h,v 1.7 1994/11/28 20:39:48 jutta Exp $*/ 47c47 < #define GSM_PATCHLEVEL 4 --- > #define GSM_PATCHLEVEL 5 *** INC/PRIVATE.H *** 7c7 < /*$Header: /home/kbs/jutta/src/gsm/gsm-1.0/inc/RCS/private.h,v 1.3 1994/05/10 20:18:23 jutta Exp $*/ --- > /*$Header: /home/kbs/jutta/src/gsm/gsm-1.0/inc/RCS/private.h,v 1.4 1994/11/28 20:25:03 jutta Exp $*/ 13c13 < typedef int longword; /* 32 bit signed int */ --- > typedef long longword; /* 32 bit signed int */ 16c16 < typedef unsigned int ulongword; /* unsigned longword */ --- > typedef unsigned long ulongword; /* unsigned longword */ *** INC/TOAST.H *** 7c7 < /* $Header: /home/kbs/jutta/src/gsm/gsm-1.0/inc/RCS/toast.h,v 1.2 1994/05/10 20:18:25 jutta Exp $ */ --- > /* $Header: /home/kbs/jutta/src/gsm/gsm-1.0/inc/RCS/toast.h,v 1.3 1994/11/28 20:25:03 jutta Exp $ */ 47,48c47,48 < # define READ "r" < # define WRITE "w" --- > # define READ "rb" > # define WRITE "wb" *** MAN/BITTER.1 *** 70c70 < Please direct bug reports to toast@tub.cs.tu-berlin.de. --- > Please direct bug reports to jutta@cs.tu-berlin.de and cabo@cs.tu-berlin.de. *** MAN/GSM.3 *** 22c22 < gsm_frame dst; --- > gsm_frame dst; 69c69 < .SH EXAMPLES --- > .SH EXAMPLE 75a76 > int cc, soundfd; 77,81c78,85 < play() { < if (!(handle = gsm_create())) exit(1); < while (read(1, (char *)buf, sizeof(buf)) == sizeof(buf)) { < if (gsm_decode(handle, buf, sample) < 0) exit(2); < write(soundfd, sample, sizeof(sample)); --- > play() { /* read compressed data from standard input, write to soundfd */ > > if (!(handle = gsm_create())) error... > while (cc = read(0, (char *)buf, sizeof buf)) { > if (cc != sizeof buf) error... > if (gsm_decode(handle, buf, sample) < 0) error... > if (write(soundfd, sample, sizeof sample) != sizeof sample) > error... 86,88c90,94 < record() { < if (!(handle = gsm_create())) exit(1); < while (read(1, sample, sizeof(sample)) == sizeof(sample)) { --- > record() { /* read from soundfd, write compressed to standard output */ > > if (!(handle = gsm_create())) error... > while (cc = read(soundfd, sample, sizeof sample)) { > if (cc != sizeof sample) error... 90c96,97 < write(s, (char *)buf, sizeof(buf)); --- > if (write(1, (char *)buf, sizeof buf) != sizeof sample) > error... 96c103 < Please direct bug reports to toast@tub.cs.tu-berlin.de. --- > Please direct bug reports to jutta@cs.tu-berlin.de and cabo@cs.tu-berlin.de. *** MAN/GSM_EXPL.3 *** 45c45 < Please direct bug reports to toast@tub.cs.tu-berlin.de. --- > Please direct bug reports to jutta@cs.tu-berlin.de and cabo@cs.tu-berlin.de. *** MAN/GSM_OPTI.3 *** 77c77 < Please direct bug reports to toast@tub.cs.tu-berlin.de. --- > Please direct bug reports to jutta@cs.tu-berlin.de and cabo@cs.tu-berlin.de. *** MAN/GSM_PRIN.3 *** 50c50 < Please direct bug reports to toast@tub.cs.tu-berlin.de. --- > Please direct bug reports to jutta@cs.tu-berlin.de and cabo@cs.tu-berlin.de. *** MAN/TOAST.1 *** 138c138 < Please direct bug reports to toast@tub.cs.tu-berlin.de. --- > Please direct bug reports to jutta@cs.tu-berlin.de and cabo@cs.tu-berlin.de. *** SRC/ADD.C *** 7c7 < /* $Header: /home/kbs/jutta/src/gsm/gsm-1.0/src/RCS/add.c,v 1.3 1994/05/10 20:18:30 jutta Exp $ */ --- > /* $Header: /home/kbs/jutta/src/gsm/gsm-1.0/src/RCS/add.c,v 1.4 1994/11/28 19:52:16 jutta Exp $ */ 25c25 < longword sum = a + b; --- > longword sum = (longword)a + (longword)b; 31c31 < longword diff = a - b; --- > longword diff = (longword)a - (longword)b; *** SRC/GSM_DEST.C *** 7c7 < /* $Header: /home/kbs/jutta/src/gsm/gsm-1.0/src/RCS/gsm_destroy.c,v 1.2 1994/05/10 20:18:34 jutta Exp $ */ --- > /* $Header: /home/kbs/jutta/src/gsm/gsm-1.0/src/RCS/gsm_destroy.c,v 1.3 1994/11/28 19:52:25 jutta Exp $ */ 9a10 > #include "config.h" *** SRC/LPC.C *** 7c7 < /* $Header: /home/kbs/jutta/src/gsm/gsm-1.0/src/RCS/lpc.c,v 1.2 1994/05/10 20:18:43 jutta Exp $ */ --- > /* $Header: /home/kbs/jutta/src/gsm/gsm-1.0/src/RCS/lpc.c,v 1.3 1994/11/28 19:52:31 jutta Exp $ */ 189c189 < if (L_ACF[0] == 0) { /* everything is the same. */ --- > if (L_ACF[0] == 0) { *** SRC/TOAST.C *** 7c7 < /* $Header: /home/kbs/jutta/src/gsm/gsm-1.0/src/RCS/toast.c,v 1.4 1994/05/10 20:18:49 jutta Exp $ */ --- > /* $Header: /home/kbs/jutta/src/gsm/gsm-1.0/src/RCS/toast.c,v 1.5 1994/11/29 00:55:54 jutta Exp $ */ 418,424d417 < < if (!f_decode && !f_cat && name && suffix( name, SUFFIX_TOASTED )) { < fprintf(stderr, < "%s: %s already has \"%s\" suffix -- unchanged.\n", < progname, name, SUFFIX_TOASTED ); < return 0; < } 469,471c462,471 < if (!f_decode) inname = strcpy(emalloc(strlen(name)+1), name); < else inname = codename(name); < --- > if (f_decode) inname = codename(name); > else { > if (!f_cat && suffix(name, SUFFIX_TOASTED)) { > fprintf(stderr, > "%s: %s already has \"%s\" suffix -- unchanged.\n", > progname, name, SUFFIX_TOASTED ); > return 0; > } > inname = strcpy(emalloc(strlen(name)+1), name); > } 525c525,528 < if (!(r = gsm_create())) return -1; --- > if (!(r = gsm_create())) { > perror(progname); > return -1; > } 542c545 < perror(inname ? inname : ""); --- > perror(inname ? inname : "stdin"); 544c547 < progname, inname ? inname : ""); --- > progname, inname ? inname : "stdin"); 561c564,567 < if (!(r = gsm_create())) return -1; --- > if (!(r = gsm_create())) { /* malloc failed */ > perror(progname); > return -1; > } 572c578 < inname ? inname : "" ); --- > inname ? inname : "stdin" ); 573a580 > errno = 0; 576d582 < 579c585 < progname, outname ? outname : "stdout"); --- > progname, inname ? inname : "stdin"); 580a587 > errno = 0; 594c601 < perror(inname ? inname : "" ); --- > perror(inname ? inname : "stdin" ); 596c603 < inname ? inname : ""); --- > inname ? inname : "stdin"); 606a614,615 > int step = 0; > 613,642c622,623 < if ( !open_input( name, &instat ) < || !open_output( name ) < || (*(f_decode ? init_output : init_input))() < || (*(f_decode ? process_decode : process_encode))() < || fflush(out) < 0 < || ferror(out)) { < < err: if (out) { < perror(outname ? outname : "stdout"); < fprintf(stderr, "%s: error writing \"%s\"\n", < progname, outname ? outname : "stdout"); < < if (out != stdout) { < (void)fclose(out); < if ( unlink(outname) < 0 < && errno != ENOENT < && errno != EINTR) { < < perror(outname); < fprintf(stderr, < "%s: could not unlink \"%s\"\n", < progname, outname); < } < } < } < < if (in && in != stdin) fclose(in); < < if (inname && inname != name) free(inname); < if (outname && outname != name) free(outname); --- > if (!open_input(name, &instat) || !open_output(name)) > goto err; 644c625,641 < return -1; --- > if ((*(f_decode ? init_output : init_input))()) { > fprintf(stderr, "%s: error %s %s\n", > progname, > f_decode ? "writing header to" : "reading header from", > f_decode ? (outname ? outname : "stdout") > : (inname ? inname : "stdin")); > goto err; > } > > if ((*(f_decode ? process_decode : process_encode))()) > goto err; > > if (fflush(out) < 0 || ferror(out)) { > perror(outname ? outname : "stdout"); > fprintf(stderr, "%s: error writing \"%s\"\n", progname, > outname ? outname:"stdout"); > goto err; 653,654c650,656 < if (fclose(out) < 0) goto err; < free(outname); --- > if (fclose(out) < 0) { > perror(outname); > fprintf(stderr, "%s: error writing \"%s\"\n", > progname, outname); > goto err; > } > if (outname != name) free(outname); 657c659 < --- > out = (FILE *)0; 659c661 < fclose(in); --- > (void)fclose(in), in = (FILE *)0; 666a669 > goto err; 668c671 < free(inname); --- > if (inname != name) free(inname); 671a675,695 > > /* > * Error handling and cleanup: > * - error out: close out, unlink it, close in, free the names. > * - > */ > err: > if (out && out != stdout) { > (void)fclose(out), out = (FILE *)0; > if (unlink(outname) < 0 && errno != ENOENT && errno != EINTR) { > perror(outname); > fprintf(stderr, "%s: could not unlink \"%s\"\n", > progname, outname); > } > } > if (in && in != stdin) (void)fclose(in), in = (FILE *)0; > > if (inname && inname != name) free(inname); > if (outname && outname != name) free(outname); > > return -1; 678c702 < "$Id: toast.c,v 1.4 1994/05/10 20:18:49 jutta Exp $" ); --- > "$Id: toast.c,v 1.5 1994/11/29 00:55:54 jutta Exp $" ); *** SRC/TOAST_AU.C *** 7c7 < /* $Header: /home/kbs/jutta/src/gsm/gsm-1.0/src/RCS/toast_audio.c,v 1.3 1994/05/10 20:18:52 jutta Exp $ */ --- > /* $Header: /home/kbs/jutta/src/gsm/gsm-1.0/src/RCS/toast_audio.c,v 1.5 1994/11/29 00:55:54 jutta Exp $ */ 68c68,74 < || fseek(in, (long)(len - 4*4), 1) < 0) return 0; --- > || fseek(in, (long)(len - 4*4), 1) < 0) { > fprintf(stderr, > "%s: bad (missing?) header in Sun audio file \"%s\";\n\ > Try one of -u, -a, -l instead (%s -h for help).\n", > progname, inname ? inname : "stdin", progname); > return -1; > } 76c82 < "%s: warning: file format #%lu for %s not implemented.\n", --- > "%s: warning: file format #%lu for %s not implemented, defaulting to u-law.\n",