fixes based on Windows testing
authorJosh Coalson <jcoalson@users.sourceforce.net>
Wed, 21 Aug 2002 05:27:01 +0000 (05:27 +0000)
committerJosh Coalson <jcoalson@users.sourceforce.net>
Wed, 21 Aug 2002 05:27:01 +0000 (05:27 +0000)
16 files changed:
src/flac/Makefile.vc
src/flac/encode.c
src/libFLAC++/file_encoder.cc
src/libFLAC++/seekable_stream_encoder.cc
src/libFLAC++/stream_encoder.cc
src/libFLAC/file_encoder.c
src/libFLAC/seekable_stream_encoder.c
src/libFLAC/stream_encoder.c
src/libOggFLAC++/stream_encoder.cc
src/libOggFLAC/stream_decoder.c
src/libOggFLAC/stream_encoder.c
src/metaflac/main.c
src/share/Makefile.vc
test/test_bins.sh
test/test_metaflac.sh
test/test_streams.sh

index 620c782..f3edecc 100644 (file)
@@ -39,7 +39,7 @@ OBJS= $(C_FILES:.c=.obj)
 all: flac.exe\r
 \r
 flac.exe: $(OBJS)\r
-       link.exe /libpath:"..\..\obj\lib" -out:../../obj/bin/$*.exe $(OBJS) libFLAC.lib ogg_static.lib getopt.lib\r
+       link.exe /libpath:"..\..\obj\lib" -out:../../obj/bin/$*.exe $(OBJS) libOggFLAC.lib libFLAC.lib ogg_static.lib getopt.lib\r
 \r
 clean:\r
        -del *.obj *.pch\r
index 7045e97..c7485ed 100644 (file)
@@ -273,7 +273,7 @@ flac__encode_aif(FILE *infile, long infilesize, const char *infilename, const ch
                                /* is guaranteed to be less than LONG_MAX */
                                for(; remaining>0U; remaining-= remaining>(1U<<30) ? remaining : (1U<<30))
                                {
-                                       unsigned long skip= remaining % (1U<<30);
+                                       unsigned long skip= (unsigned long)(remaining % (1U<<30));
 
                                        FLAC__ASSERT(skip<=LONG_MAX);
                                        while(skip>0 && fseek(infile, skip, SEEK_CUR)<0) {
@@ -1683,7 +1683,7 @@ read_sane_extended(FILE *f, FLAC__uint32 *val, FLAC__bool eof_ok, const char *fn
 
        for(i= 0U; i<8U; ++i)
                p|= (FLAC__uint64)(buf[i+2])<<(56U-i*8);
-       *val= (FLAC__uint32)(p>>shift)+(p>>(shift-1) & 0x1);
+       *val= (FLAC__uint32)((p>>shift)+(p>>(shift-1) & 0x1));
 
        return true;
 }
index eaa299c..b95186b 100644 (file)
@@ -181,7 +181,7 @@ namespace FLAC {
                void File::get_verify_decoder_error_stats(FLAC__uint64 *absolute_sample, unsigned *frame_number, unsigned *channel, unsigned *sample, FLAC__int32 *expected, FLAC__int32 *got)
                {
                        FLAC__ASSERT(is_valid());
-                       return ::FLAC__file_encoder_get_verify_decoder_error_stats(encoder_, absolute_sample, frame_number, channel, sample, expected, got);
+                       ::FLAC__file_encoder_get_verify_decoder_error_stats(encoder_, absolute_sample, frame_number, channel, sample, expected, got);
                }
 
                bool File::get_verify() const
index ed5c8ae..2ee432f 100644 (file)
@@ -169,7 +169,7 @@ namespace FLAC {
                void SeekableStream::get_verify_decoder_error_stats(FLAC__uint64 *absolute_sample, unsigned *frame_number, unsigned *channel, unsigned *sample, FLAC__int32 *expected, FLAC__int32 *got)
                {
                        FLAC__ASSERT(is_valid());
-                       return ::FLAC__seekable_stream_encoder_get_verify_decoder_error_stats(encoder_, absolute_sample, frame_number, channel, sample, expected, got);
+                       ::FLAC__seekable_stream_encoder_get_verify_decoder_error_stats(encoder_, absolute_sample, frame_number, channel, sample, expected, got);
                }
 
                bool SeekableStream::get_verify() const
index 6d275f1..e8a6a68 100644 (file)
@@ -163,7 +163,7 @@ namespace FLAC {
                void Stream::get_verify_decoder_error_stats(FLAC__uint64 *absolute_sample, unsigned *frame_number, unsigned *channel, unsigned *sample, FLAC__int32 *expected, FLAC__int32 *got)
                {
                        FLAC__ASSERT(is_valid());
-                       return ::FLAC__stream_encoder_get_verify_decoder_error_stats(encoder_, absolute_sample, frame_number, channel, sample, expected, got);
+                       ::FLAC__stream_encoder_get_verify_decoder_error_stats(encoder_, absolute_sample, frame_number, channel, sample, expected, got);
                }
 
                bool Stream::get_verify() const
index abf1c78..7f75032 100644 (file)
@@ -170,7 +170,7 @@ FLAC__FileEncoderState FLAC__file_encoder_init(FLAC__FileEncoder *encoder)
                unsigned blocksize = FLAC__file_encoder_get_blocksize(encoder);
 
                FLAC__ASSERT(blocksize != 0);
-               encoder->private_->total_frames_estimate = (FLAC__file_encoder_get_total_samples_estimate(encoder) + blocksize - 1) / blocksize;
+               encoder->private_->total_frames_estimate = (unsigned)((FLAC__file_encoder_get_total_samples_estimate(encoder) + blocksize - 1) / blocksize);
        }
 
        return encoder->protected_->state = FLAC__FILE_ENCODER_OK;
@@ -476,7 +476,7 @@ void FLAC__file_encoder_get_verify_decoder_error_stats(const FLAC__FileEncoder *
 {
        FLAC__ASSERT(0 != encoder);
        FLAC__ASSERT(0 != encoder->private_);
-       return FLAC__seekable_stream_encoder_get_verify_decoder_error_stats(encoder->private_->seekable_stream_encoder, absolute_sample, frame_number, channel, sample, expected, got);
+       FLAC__seekable_stream_encoder_get_verify_decoder_error_stats(encoder->private_->seekable_stream_encoder, absolute_sample, frame_number, channel, sample, expected, got);
 }
 
 FLAC__bool FLAC__file_encoder_get_verify(const FLAC__FileEncoder *encoder)
@@ -649,7 +649,7 @@ FLAC__SeekableStreamEncoderSeekStatus seek_callback_(const FLAC__SeekableStreamE
 
        FLAC__ASSERT(0 != file_encoder);
 
-       if(fseek(file_encoder->private_->file, absolute_byte_offset, SEEK_SET) < 0)
+       if(fseek(file_encoder->private_->file, (long)absolute_byte_offset, SEEK_SET) < 0)
                return FLAC__SEEKABLE_STREAM_ENCODER_SEEK_STATUS_ERROR;
        else
                return FLAC__SEEKABLE_STREAM_ENCODER_SEEK_STATUS_OK;
index ae862f1..d36b6a3 100644 (file)
@@ -474,7 +474,7 @@ void FLAC__seekable_stream_encoder_get_verify_decoder_error_stats(const FLAC__Se
 {
        FLAC__ASSERT(0 != encoder);
        FLAC__ASSERT(0 != encoder->private_);
-       return FLAC__stream_encoder_get_verify_decoder_error_stats(encoder->private_->stream_encoder, absolute_sample, frame_number, channel, sample, expected, got);
+       FLAC__stream_encoder_get_verify_decoder_error_stats(encoder->private_->stream_encoder, absolute_sample, frame_number, channel, sample, expected, got);
 }
 
 FLAC__bool FLAC__seekable_stream_encoder_get_verify(const FLAC__SeekableStreamEncoder *encoder)
index 485c43d..d8ab93e 100644 (file)
@@ -2958,7 +2958,7 @@ FLAC__StreamDecoderWriteStatus verify_write_callback_(const FLAC__StreamDecoder
                        FLAC__ASSERT(i < blocksize);
                        FLAC__ASSERT(frame->header.number_type == FLAC__FRAME_NUMBER_TYPE_SAMPLE_NUMBER);
                        encoder->private_->verify.error_stats.absolute_sample = frame->header.number.sample_number + sample;
-                       encoder->private_->verify.error_stats.frame_number = frame->header.number.sample_number / blocksize;
+                       encoder->private_->verify.error_stats.frame_number = (unsigned)(frame->header.number.sample_number / blocksize);
                        encoder->private_->verify.error_stats.channel = channel;
                        encoder->private_->verify.error_stats.sample = sample;
                        encoder->private_->verify.error_stats.expected = expect;
index 399d599..33367d3 100644 (file)
@@ -169,7 +169,7 @@ namespace OggFLAC {
                void Stream::get_verify_decoder_error_stats(FLAC__uint64 *absolute_sample, unsigned *frame_number, unsigned *channel, unsigned *sample, FLAC__int32 *expected, FLAC__int32 *got)
                {
                        FLAC__ASSERT(is_valid());
-                       return ::OggFLAC__stream_encoder_get_verify_decoder_error_stats(encoder_, absolute_sample, frame_number, channel, sample, expected, got);
+                       ::OggFLAC__stream_encoder_get_verify_decoder_error_stats(encoder_, absolute_sample, frame_number, channel, sample, expected, got);
                }
 
                bool Stream::get_verify() const
index aedaa03..958f9f4 100644 (file)
@@ -485,21 +485,21 @@ FLAC__StreamDecoderReadStatus read_callback_(const FLAC__StreamDecoder *unused,
 
 FLAC__StreamDecoderWriteStatus write_callback_(const FLAC__StreamDecoder *unused, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data)
 {
-    OggFLAC__StreamDecoder *decoder = (OggFLAC__StreamDecoder*)client_data;
+       OggFLAC__StreamDecoder *decoder = (OggFLAC__StreamDecoder*)client_data;
        (void)unused;
        return decoder->private_->write_callback(decoder, frame, buffer, decoder->private_->client_data);
 }
 
 void metadata_callback_(const FLAC__StreamDecoder *unused, const FLAC__StreamMetadata *metadata, void *client_data)
 {
-    OggFLAC__StreamDecoder *decoder = (OggFLAC__StreamDecoder*)client_data;
+       OggFLAC__StreamDecoder *decoder = (OggFLAC__StreamDecoder*)client_data;
        (void)unused;
-       return decoder->private_->metadata_callback(decoder, metadata, decoder->private_->client_data);
+       decoder->private_->metadata_callback(decoder, metadata, decoder->private_->client_data);
 }
 
 void error_callback_(const FLAC__StreamDecoder *unused, FLAC__StreamDecoderErrorStatus status, void *client_data)
 {
-    OggFLAC__StreamDecoder *decoder = (OggFLAC__StreamDecoder*)client_data;
+       OggFLAC__StreamDecoder *decoder = (OggFLAC__StreamDecoder*)client_data;
        (void)unused;
-       return decoder->private_->error_callback(decoder, status, decoder->private_->client_data);
+       decoder->private_->error_callback(decoder, status, decoder->private_->client_data);
 }
index 6d38404..d1ca547 100644 (file)
@@ -436,7 +436,7 @@ void OggFLAC__stream_encoder_get_verify_decoder_error_stats(const OggFLAC__Strea
 {
        FLAC__ASSERT(0 != encoder);
        FLAC__ASSERT(0 != encoder->private_);
-       return FLAC__stream_encoder_get_verify_decoder_error_stats(encoder->private_->FLAC_stream_encoder, absolute_sample, frame_number, channel, sample, expected, got);
+       FLAC__stream_encoder_get_verify_decoder_error_stats(encoder->private_->FLAC_stream_encoder, absolute_sample, frame_number, channel, sample, expected, got);
 }
 
 FLAC__bool OggFLAC__stream_encoder_get_verify(const OggFLAC__StreamEncoder *encoder)
index b379b1d..302b0ff 100644 (file)
@@ -1757,7 +1757,13 @@ FLAC__bool set_vc_field(const char *filename, FLAC__StreamMetadata *block, const
 FLAC__bool field_name_matches_entry(const char *field_name, unsigned field_name_length, const FLAC__StreamMetadata_VorbisComment_Entry *entry)
 {
        FLAC__byte *eq = memchr(entry->entry, '=', entry->length);
-       return (0 != eq && (unsigned)(eq-entry->entry) == field_name_length && 0 == strncasecmp(field_name, entry->entry, field_name_length));
+#if defined _MSC_VER || defined __MINGW32__
+#define FLAC__STRNCASECMP strnicmp
+#else
+#define FLAC__STRNCASECMP strncasecmp
+#endif
+       return (0 != eq && (unsigned)(eq-entry->entry) == field_name_length && 0 == FLAC__STRNCASECMP(field_name, entry->entry, field_name_length));
+#undef FLAC__STRNCASECMP
 }
 
 void hexdump(const char *filename, const FLAC__byte *buf, unsigned bytes, const char *indent)
index 0dcd227..2acda94 100644 (file)
@@ -2,19 +2,24 @@
 \r
 !IFDEF DEBUG\r
 .c.obj:\r
-       $(cc) /D "_LIB" /GX $(cdebug) $(cflags) /I "..\..\include" -DSTRICT -YX /Od /D "_DEBUG" $<\r
+       $(cc) /D "_LIB" /GX $(cdebug) $(cflags) /I "..\..\include" /I "..\..\include\share" -DSTRICT -YX /Od /D "_DEBUG" $<\r
 !else\r
 .c.obj:\r
-       $(cc) /D "_LIB" /O2 $(crelease) $(cflags) /I "..\..\include" -DSTRICT -YX -DNODEBUG $<\r
+       $(cc) /D "_LIB" /O2 $(crelease) $(cflags) /I "..\..\include" /I "..\..\include\share" -DSTRICT -YX -DNODEBUG $<\r
 !endif\r
 \r
 C_FILES= \\r
        getopt.c \\r
        getopt1.c\r
 \r
+UTF8_C_FILES= \\r
+       charset.c \\r
+       iconvert.c \\r
+       utf8.c\r
+\r
 OBJS= $(C_FILES:.c=.obj)\r
 \r
-UTF8_OBJS=charset.o iconvert.o utf8.o\r
+UTF8_OBJS= $(UTF8_C_FILES:.c=.obj)\r
 \r
 all: getopt.lib utf8.lib\r
 \r
index 07d3d7e..52c5f1f 100755 (executable)
@@ -40,7 +40,7 @@ test_file ()
                exit 1
        fi
        echo -n "decode..."
-       cmd="flac --silent --endian=big --decode --force-raw-format $name.flac";
+       cmd="flac --silent --endian=big --sign=signed --decode --force-raw-format $name.flac";
        echo "### DECODE $name #######################################################" >> ./streams.log
        echo "###    cmd=$cmd" >> ./streams.log
        if $cmd 2>>./streams.log ; then : ; else
index 08db080..cb89107 100755 (executable)
@@ -30,7 +30,12 @@ metaflac --help 1>/dev/null 2>/dev/null || (echo "ERROR can't find metaflac exec
 if [ $? != 0 ] ; then exit 1 ; fi
 
 echo "Generating stream..."
-if flac --verify -0 --output-name=$flacfile --force-raw-format --endian=big --sign=signed --channels=1 --bps=8 --sample-rate=44100 /bin/sh ; then
+if [ -f /bin/sh.exe ] ; then
+       inputfile=/bin/sh.exe
+else
+       inputfile=/bin/sh
+fi
+if flac --verify -0 --output-name=$flacfile --force-raw-format --endian=big --sign=signed --channels=1 --bps=8 --sample-rate=44100 $inputfile ; then
        chmod +w $flacfile
 else
        echo "ERROR during generation" 1>&2
index 4283765..d715d31 100755 (executable)
@@ -143,7 +143,7 @@ test_file ()
                exit 1
        fi
        echo -n "decode..."
-       cmd="flac --silent --endian=big --decode --force-raw-format --output-name=$name.cmp $name.flac"
+       cmd="flac --silent --endian=big --sign=signed --decode --force-raw-format --output-name=$name.cmp $name.flac"
        echo "### DECODE $name #######################################################" >> ./streams.log
        echo "###    cmd=$cmd" >> ./streams.log
        if $cmd 2>>./streams.log ; then : ; else
@@ -194,7 +194,7 @@ test_file_piped ()
        fi
        echo -n "decode via pipes..."
        if [ $is_win = yes ] ; then
-               cmd="flac --silent --endian=big --decode --force-raw-format --stdout $name.flac"
+               cmd="flac --silent --endian=big --sign=signed --decode --force-raw-format --stdout $name.flac"
                echo "### DECODE $name #######################################################" >> ./streams.log
                echo "###    cmd=$cmd" >> ./streams.log
                if $cmd 1>$name.cmp 2>>./streams.log ; then : ; else
@@ -202,7 +202,7 @@ test_file_piped ()
                        exit 1
                fi
        else
-               cmd="flac --silent --endian=big --decode --force-raw-format --stdout -"
+               cmd="flac --silent --endian=big --sign=signed --decode --force-raw-format --stdout -"
                echo "### DECODE $name #######################################################" >> ./streams.log
                echo "###    cmd=$cmd" >> ./streams.log
                if cat $name.flac | $cmd 1>$name.cmp 2>>./streams.log ; then : ; else