diff -ruN speex-1.1.11.1/include/speex/speex_header.h speex-1.1.11.1.new/include/speex/speex_header.h --- speex-1.1.11.1/include/speex/speex_header.h 2005-11-16 11:08:21.000000000 +0000 +++ speex-1.1.11.1.new/include/speex/speex_header.h 2006-04-30 01:32:05.000000000 +0100 @@ -38,6 +38,7 @@ #define SPEEX_HEADER_H #include "speex/speex_types.h" +#include #ifdef __cplusplus extern "C" { @@ -73,7 +74,7 @@ void speex_init_header(SpeexHeader *header, int rate, int nb_channels, const struct SpeexMode *m); /** Creates the header packet from the header itself (mostly involves endianness conversion) */ -char *speex_header_to_packet(SpeexHeader *header, int *size); +char *speex_header_to_packet(SpeexHeader *header, size_t *size); /** Creates a SpeexHeader from a packet */ SpeexHeader *speex_packet_to_header(char *packet, int size); diff -ruN speex-1.1.11.1/libspeex/speex_header.c speex-1.1.11.1.new/libspeex/speex_header.c --- speex-1.1.11.1/libspeex/speex_header.c 2005-11-16 11:08:27.000000000 +0000 +++ speex-1.1.11.1.new/libspeex/speex_header.c 2006-04-30 01:32:02.000000000 +0100 @@ -38,6 +38,7 @@ #include "misc.h" #include #include +#include #ifndef NULL #define NULL 0 @@ -101,7 +102,7 @@ header->reserved2 = 0; } -char *speex_header_to_packet(SpeexHeader *header, int *size) +char *speex_header_to_packet(SpeexHeader *header, size_t *size) { SpeexHeader *le_header; le_header = (SpeexHeader*)speex_alloc(sizeof(SpeexHeader)); diff -ruN speex-1.1.11.1/src/speexenc.c speex-1.1.11.1.new/src/speexenc.c --- speex-1.1.11.1/src/speexenc.c 2005-11-16 11:08:22.000000000 +0000 +++ speex-1.1.11.1.new/src/speexenc.c 2006-04-30 01:31:54.000000000 +0100 @@ -44,6 +44,7 @@ #include #include #include +#include #include #include @@ -628,8 +629,13 @@ /*Write header*/ { - - op.packet = (unsigned char *)speex_header_to_packet(&header, (int*)&(op.bytes)); +#if SIZE_MAX > LONG_MAX +#error speex is not supported on this platform due to size_t truncation when casting to long +#endif + size_t bytes; + op.packet = (unsigned char *)speex_header_to_packet(&header, &bytes); + op.bytes = bytes; + op.b_o_s = 1; op.e_o_s = 0; op.granulepos = 0; @@ -659,7 +665,7 @@ } } - free(comments); + //free(comments); speex_bits_init(&bits);