Commit 5f39e9f1 authored by Josh Coalson's avatar Josh Coalson
Browse files

fixes based on Windows testing

parent 402da70f
......@@ -39,7 +39,7 @@ OBJS= $(C_FILES:.c=.obj)
all: flac.exe
flac.exe: $(OBJS)
link.exe /libpath:"..\..\obj\lib" -out:../../obj/bin/$*.exe $(OBJS) libFLAC.lib ogg_static.lib getopt.lib
link.exe /libpath:"..\..\obj\lib" -out:../../obj/bin/$*.exe $(OBJS) libOggFLAC.lib libFLAC.lib ogg_static.lib getopt.lib
clean:
-del *.obj *.pch
......
......@@ -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;
}
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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;
......
......@@ -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)
......
......@@ -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;
......
......@@ -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
......
......@@ -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);
}
......@@ -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)
......
......@@ -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)
......
......@@ -2,19 +2,24 @@
!IFDEF DEBUG
.c.obj:
$(cc) /D "_LIB" /GX $(cdebug) $(cflags) /I "..\..\include" -DSTRICT -YX /Od /D "_DEBUG" $<
$(cc) /D "_LIB" /GX $(cdebug) $(cflags) /I "..\..\include" /I "..\..\include\share" -DSTRICT -YX /Od /D "_DEBUG" $<
!else
.c.obj:
$(cc) /D "_LIB" /O2 $(crelease) $(cflags) /I "..\..\include" -DSTRICT -YX -DNODEBUG $<
$(cc) /D "_LIB" /O2 $(crelease) $(cflags) /I "..\..\include" /I "..\..\include\share" -DSTRICT -YX -DNODEBUG $<
!endif
C_FILES= \
getopt.c \
getopt1.c
UTF8_C_FILES= \
charset.c \
iconvert.c \
utf8.c
OBJS= $(C_FILES:.c=.obj)
UTF8_OBJS=charset.o iconvert.o utf8.o
UTF8_OBJS= $(UTF8_C_FILES:.c=.obj)
all: getopt.lib utf8.lib
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment