mirror of
https://github.com/claunia/flac.git
synced 2025-12-16 18:54:26 +00:00
fixes from compiling code and running all the tests on NT
This commit is contained in:
@@ -91,13 +91,13 @@ namespace FLAC {
|
||||
};
|
||||
|
||||
inline bool Prototype::operator==(const Prototype &object) const
|
||||
{ return ::FLAC__metadata_object_is_equal(object_, object.object_); }
|
||||
{ return (bool)::FLAC__metadata_object_is_equal(object_, object.object_); }
|
||||
|
||||
inline bool Prototype::operator==(const ::FLAC__StreamMetadata &object) const
|
||||
{ return ::FLAC__metadata_object_is_equal(object_, &object); }
|
||||
{ return (bool)::FLAC__metadata_object_is_equal(object_, &object); }
|
||||
|
||||
inline bool Prototype::operator==(const ::FLAC__StreamMetadata *object) const
|
||||
{ return ::FLAC__metadata_object_is_equal(object_, object); }
|
||||
{ return (bool)::FLAC__metadata_object_is_equal(object_, object); }
|
||||
|
||||
inline bool Prototype::operator!=(const Prototype &object) const
|
||||
{ return !operator==(object); }
|
||||
|
||||
@@ -1108,7 +1108,6 @@ void metadata_callback(const FLAC__StreamEncoder *encoder, const FLAC__StreamMet
|
||||
if(-1 == fseek(f, 26, SEEK_SET)) goto end_;
|
||||
fwrite(metadata->data.stream_info.md5sum, 1, 16, f);
|
||||
|
||||
samples_:
|
||||
/* if we get this far we know we can seek so no need to check the
|
||||
* return value from fseek()
|
||||
*/
|
||||
|
||||
@@ -18,14 +18,14 @@
|
||||
|
||||
!include <win32.mak>
|
||||
|
||||
SUFFIXES = .cpp
|
||||
SUFFIXES = .cc
|
||||
|
||||
!IFDEF DEBUG
|
||||
.cc.obj:
|
||||
$(cc) /D "_LIB" /GX $(cdebug) $(cflags) /I "..\..\include" -DSTRICT -YX /Od /D "_DEBUG" $<
|
||||
$(cc) /D "_LIB" /GX /GR $(cdebug) $(cflags) /I "..\..\include" -DSTRICT -YX /Od /D "_DEBUG" $<
|
||||
!else
|
||||
.cc.obj:
|
||||
$(cc) /D "_LIB" /O2 $(crelease) $(cflags) /I "..\..\include" -DSTRICT -YX -DNODEBUG $<
|
||||
$(cc) /D "_LIB" /O2 /GR $(crelease) $(cflags) /I "..\..\include" -DSTRICT -YX -DNODEBUG $<
|
||||
!endif
|
||||
|
||||
CC_FILES= \
|
||||
@@ -44,15 +44,15 @@ libFLAC++.lib: $(OBJS)
|
||||
|
||||
# can't figure out how to get it to take .cc so we just hack it for now:
|
||||
file_decoder.obj: file_decoder.cc
|
||||
$(cc) /D "_LIB" /O2 $(crelease) $(cflags) /I "..\..\include" -DSTRICT -YX -DNODEBUG /TP file_decoder.cc
|
||||
$(cc) /D "_LIB" /O2 /GR $(crelease) $(cflags) /I "..\..\include" -DSTRICT -YX -DNODEBUG /TP file_decoder.cc
|
||||
metadata.obj: metadata.cc
|
||||
$(cc) /D "_LIB" /O2 $(crelease) $(cflags) /I "..\..\include" -DSTRICT -YX -DNODEBUG /TP metadata.cc
|
||||
$(cc) /D "_LIB" /O2 /GR $(crelease) $(cflags) /I "..\..\include" -DSTRICT -YX -DNODEBUG /TP metadata.cc
|
||||
seekable_stream_decoder.obj: seekable_stream_decoder.cc
|
||||
$(cc) /D "_LIB" /O2 $(crelease) $(cflags) /I "..\..\include" -DSTRICT -YX -DNODEBUG /TP seekable_stream_decoder.cc
|
||||
$(cc) /D "_LIB" /O2 /GR $(crelease) $(cflags) /I "..\..\include" -DSTRICT -YX -DNODEBUG /TP seekable_stream_decoder.cc
|
||||
stream_decoder.obj: stream_decoder.cc
|
||||
$(cc) /D "_LIB" /O2 $(crelease) $(cflags) /I "..\..\include" -DSTRICT -YX -DNODEBUG /TP stream_decoder.cc
|
||||
$(cc) /D "_LIB" /O2 /GR $(crelease) $(cflags) /I "..\..\include" -DSTRICT -YX -DNODEBUG /TP stream_decoder.cc
|
||||
stream_encoder.obj: stream_encoder.cc
|
||||
$(cc) /D "_LIB" /O2 $(crelease) $(cflags) /I "..\..\include" -DSTRICT -YX -DNODEBUG /TP stream_encoder.cc
|
||||
$(cc) /D "_LIB" /O2 /GR $(crelease) $(cflags) /I "..\..\include" -DSTRICT -YX -DNODEBUG /TP stream_encoder.cc
|
||||
|
||||
clean:
|
||||
-del *.obj *.pch
|
||||
|
||||
@@ -2134,6 +2134,15 @@ FLAC__bool transport_tempfile_(const char *filename, FILE **tempfile, char **tem
|
||||
|
||||
(void)fclose(*tempfile);
|
||||
*tempfile = 0;
|
||||
|
||||
#if defined _MSC_VER || defined __MINGW32__
|
||||
if(unlink(filename) < 0) {
|
||||
cleanup_tempfile_(tempfile, tempfilename);
|
||||
*status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_UNLINK_ERROR;
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*@@@ to fully support the tempfile_path_prefix we need to update this piece to actually copy across filesystems instead of just rename(): */
|
||||
if(0 != rename(*tempfilename, filename)) {
|
||||
cleanup_tempfile_(tempfile, tempfilename);
|
||||
|
||||
@@ -208,23 +208,23 @@ int infoDlg(char *fn, HWND hwnd)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void getfileinfo(char *filename, char *title, int *length_in_ms)
|
||||
void getfileinfo(char *filename, char *title, int *length_in_msec)
|
||||
{
|
||||
id3v1_struct tag;
|
||||
FLAC__StreamMetadata streaminfo;
|
||||
|
||||
if(0 == filename) {
|
||||
filename = lastfn_;
|
||||
if (length_in_ms) {
|
||||
*length_in_ms = getlength();
|
||||
length_in_ms = 0; /* force skip in following code */
|
||||
if (length_in_msec) {
|
||||
*length_in_msec = getlength();
|
||||
length_in_msec = 0; /* force skip in following code */
|
||||
}
|
||||
}
|
||||
|
||||
if(!FLAC__metadata_get_streaminfo(filename, &streaminfo)) {
|
||||
MessageBox(mod_.hMainWindow, filename, "ERROR: invalid/missing FLAC metadata", 0);
|
||||
if(title) {
|
||||
static const char *errtitle = "Invalid FLAC File: ");
|
||||
static const char *errtitle = "Invalid FLAC File: ";
|
||||
sprintf(title, "%s\"%s\"", errtitle, filename);
|
||||
}
|
||||
if(length_in_msec)
|
||||
@@ -237,7 +237,7 @@ void getfileinfo(char *filename, char *title, int *length_in_ms)
|
||||
strcpy(title, tag.description);
|
||||
}
|
||||
if(length_in_msec)
|
||||
*length_in_msec = streaminfo.data.stream_info.total_samples * 10 / (streaminfo.data.stream_info.sample_rate / 100);
|
||||
*length_in_msec = (int)(streaminfo.data.stream_info.total_samples * 10 / (streaminfo.data.stream_info.sample_rate / 100));
|
||||
}
|
||||
|
||||
void eq_set(int on, char data[10], int preamp)
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
!include <win32.mak>
|
||||
|
||||
SUFFIXES = .cpp
|
||||
SUFFIXES = .cc
|
||||
|
||||
!IFDEF DEBUG
|
||||
.c.obj:
|
||||
@@ -29,10 +29,10 @@ SUFFIXES = .cpp
|
||||
|
||||
!IFDEF DEBUG
|
||||
.cc.obj:
|
||||
$(cc) /D "_LIB" /GX $(cdebug) $(cflags) /I "..\..\include" -DSTRICT -YX /Od /D "_DEBUG" $<
|
||||
$(cc) /GR /D "_LIB" /GX $(cdebug) $(cflags) /I "..\..\include" -DSTRICT -YX /Od /D "_DEBUG" $<
|
||||
!else
|
||||
.cc.obj:
|
||||
$(cc) /D "_LIB" /O2 $(crelease) $(cflags) /I "..\..\include" -DSTRICT -YX -DNODEBUG $<
|
||||
$(cc) /GR /D "_LIB" /O2 $(crelease) $(cflags) /I "..\..\include" -DSTRICT -YX -DNODEBUG $<
|
||||
!endif
|
||||
|
||||
C_FILES= \
|
||||
@@ -46,8 +46,10 @@ CC_FILES= \
|
||||
metadata_manip.cc \
|
||||
metadata_object.cc
|
||||
|
||||
OBJS= $(C_FILES:.c=.obj)
|
||||
OBJS= $(CC_FILES:.cc=.obj)
|
||||
C_OBJS= $(C_FILES:.c=.obj)
|
||||
CC_OBJS= $(CC_FILES:.cc=.obj)
|
||||
|
||||
all: test_libFLAC++.exe
|
||||
|
||||
# can't figure out how to get it to take .cc so we just hack it for now:
|
||||
decoders.obj: decoders.cc
|
||||
@@ -63,10 +65,8 @@ metadata_manip.obj: metadata_manip.cc
|
||||
metadata_object.obj: metadata_object.cc
|
||||
$(cc) /D "_LIB" /O2 $(crelease) $(cflags) /I "..\..\include" -DSTRICT -YX -DNODEBUG /TP metadata_object.cc
|
||||
|
||||
all: test_libFLAC++.exe
|
||||
|
||||
test_libFLAC++.exe: $(OBJS)
|
||||
link.exe /libpath:"..\..\obj\lib" -out:../../obj/bin/$*.exe $(OBJS) libFLAC++.lib libFLAC.lib
|
||||
test_libFLAC++.exe: $(C_OBJS) $(CC_OBJS)
|
||||
link.exe /libpath:"..\..\obj\lib" -out:../../obj/bin/$*.exe $(CC_OBJS) $(C_OBJS) libFLAC++.lib libFLAC.lib
|
||||
|
||||
clean:
|
||||
-del *.obj *.pch
|
||||
|
||||
@@ -258,12 +258,12 @@ public:
|
||||
|
||||
void StreamDecoder::metadata_callback(const ::FLAC__StreamMetadata *metadata)
|
||||
{
|
||||
return common_metadata_callback_(metadata);
|
||||
common_metadata_callback_(metadata);
|
||||
}
|
||||
|
||||
void StreamDecoder::error_callback(::FLAC__StreamDecoderErrorStatus status)
|
||||
{
|
||||
return common_error_callback_(status);
|
||||
common_error_callback_(status);
|
||||
}
|
||||
|
||||
bool StreamDecoder::die(const char *msg) const
|
||||
@@ -830,7 +830,7 @@ public:
|
||||
if(error_occurred_)
|
||||
return ::FLAC__SEEKABLE_STREAM_DECODER_SEEK_STATUS_ERROR;
|
||||
|
||||
if(::fseek(file_, absolute_byte_offset, SEEK_SET) < 0) {
|
||||
if(::fseek(file_, (long)absolute_byte_offset, SEEK_SET) < 0) {
|
||||
error_occurred_ = true;
|
||||
return ::FLAC__SEEKABLE_STREAM_DECODER_SEEK_STATUS_ERROR;
|
||||
}
|
||||
@@ -868,7 +868,7 @@ bool SeekableStreamDecoder::eof_callback()
|
||||
if(error_occurred_)
|
||||
return true;
|
||||
|
||||
return feof(file_);
|
||||
return (bool)feof(file_);
|
||||
}
|
||||
|
||||
::FLAC__StreamDecoderWriteStatus SeekableStreamDecoder::write_callback(const ::FLAC__Frame *frame, const FLAC__int32 * const buffer[])
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
#include "metadata.h"
|
||||
#include <stdio.h>
|
||||
|
||||
extern int test_metadata_object();
|
||||
extern int test_metadata_file_manipulation();
|
||||
extern bool test_metadata_object();
|
||||
extern bool test_metadata_file_manipulation();
|
||||
|
||||
bool test_metadata()
|
||||
{
|
||||
|
||||
@@ -639,7 +639,7 @@ static bool test_level_1_()
|
||||
return die_ss_("iterator.insert_block_after(app, true)", iterator);
|
||||
if(!insert_to_our_metadata_(app, ++our_current_position, /*copy=*/true))
|
||||
return false;
|
||||
add_to_padding_length_(our_current_position+1, -((FLAC__STREAM_METADATA_APPLICATION_ID_LEN/8) + app->get_length()));
|
||||
add_to_padding_length_(our_current_position+1, -((int)(FLAC__STREAM_METADATA_APPLICATION_ID_LEN/8) + (int)app->get_length()));
|
||||
|
||||
if(!test_file_(flacfile_, /*ignore_metadata=*/false))
|
||||
return false;
|
||||
@@ -655,7 +655,7 @@ static bool test_level_1_()
|
||||
return die_ss_("iterator.set_block(app, true)", iterator);
|
||||
if(!insert_to_our_metadata_(app, our_current_position, /*copy=*/true))
|
||||
return false;
|
||||
add_to_padding_length_(our_current_position+1, -((FLAC__STREAM_METADATA_APPLICATION_ID_LEN/8) + app->get_length()));
|
||||
add_to_padding_length_(our_current_position+1, -((int)(FLAC__STREAM_METADATA_APPLICATION_ID_LEN/8) + (int)app->get_length()));
|
||||
|
||||
if(!test_file_(flacfile_, /*ignore_metadata=*/false))
|
||||
return false;
|
||||
@@ -690,7 +690,7 @@ static bool test_level_1_()
|
||||
return die_("setting APPLICATION data");
|
||||
if(!replace_in_our_metadata_(app, our_current_position, /*copy=*/true))
|
||||
return die_("copying object");
|
||||
add_to_padding_length_(our_current_position+1, -(sizeof(data) - 12));
|
||||
add_to_padding_length_(our_current_position+1, -((int)sizeof(data) - 12));
|
||||
if(!iterator.set_block(app, true))
|
||||
return die_ss_("iterator.set_block(app, true)", iterator);
|
||||
|
||||
|
||||
@@ -271,7 +271,7 @@ bool test_metadata_object_streaminfo()
|
||||
printf("OK\n");
|
||||
|
||||
printf("testing FLAC::Metadata::clone(const FLAC::Metadata::Prototype *)... ");
|
||||
FLAC::Metadata::Prototype *clone_ = clone(&block);
|
||||
FLAC::Metadata::Prototype *clone_ = FLAC::Metadata::clone(&block);
|
||||
if(0 == clone_)
|
||||
return die_("returned NULL");
|
||||
if(0 == dynamic_cast<FLAC::Metadata::StreamInfo *>(clone_))
|
||||
@@ -381,7 +381,7 @@ bool test_metadata_object_padding()
|
||||
printf("OK\n");
|
||||
|
||||
printf("testing FLAC::Metadata::clone(const FLAC::Metadata::Prototype *)... ");
|
||||
FLAC::Metadata::Prototype *clone_ = clone(&block);
|
||||
FLAC::Metadata::Prototype *clone_ = FLAC::Metadata::clone(&block);
|
||||
if(0 == clone_)
|
||||
return die_("returned NULL");
|
||||
if(0 == dynamic_cast<FLAC::Metadata::Padding *>(clone_))
|
||||
@@ -500,7 +500,7 @@ bool test_metadata_object_application()
|
||||
printf("OK\n");
|
||||
|
||||
printf("testing FLAC::Metadata::clone(const FLAC::Metadata::Prototype *)... ");
|
||||
FLAC::Metadata::Prototype *clone_ = clone(&block);
|
||||
FLAC::Metadata::Prototype *clone_ = FLAC::Metadata::clone(&block);
|
||||
if(0 == clone_)
|
||||
return die_("returned NULL");
|
||||
if(0 == dynamic_cast<FLAC::Metadata::Application *>(clone_))
|
||||
@@ -648,7 +648,7 @@ bool test_metadata_object_seektable()
|
||||
printf("OK\n");
|
||||
|
||||
printf("testing FLAC::Metadata::clone(const FLAC::Metadata::Prototype *)... ");
|
||||
FLAC::Metadata::Prototype *clone_ = clone(&block);
|
||||
FLAC::Metadata::Prototype *clone_ = FLAC::Metadata::clone(&block);
|
||||
if(0 == clone_)
|
||||
return die_("returned NULL");
|
||||
if(0 == dynamic_cast<FLAC::Metadata::SeekTable *>(clone_))
|
||||
@@ -934,7 +934,7 @@ bool test_metadata_object_vorbiscomment()
|
||||
printf("OK\n");
|
||||
|
||||
printf("testing FLAC::Metadata::clone(const FLAC::Metadata::Prototype *)... ");
|
||||
FLAC::Metadata::Prototype *clone_ = clone(&block);
|
||||
FLAC::Metadata::Prototype *clone_ = FLAC::Metadata::clone(&block);
|
||||
if(0 == clone_)
|
||||
return die_("returned NULL");
|
||||
if(0 == dynamic_cast<FLAC::Metadata::VorbisComment *>(clone_))
|
||||
|
||||
@@ -820,7 +820,7 @@ static FLAC__SeekableStreamDecoderSeekStatus seekable_stream_decoder_seek_callba
|
||||
if(dcd->error_occurred)
|
||||
return FLAC__SEEKABLE_STREAM_DECODER_SEEK_STATUS_ERROR;
|
||||
|
||||
if(fseek(dcd->file, absolute_byte_offset, SEEK_SET) < 0) {
|
||||
if(fseek(dcd->file, (long)absolute_byte_offset, SEEK_SET) < 0) {
|
||||
dcd->error_occurred = true;
|
||||
return FLAC__SEEKABLE_STREAM_DECODER_SEEK_STATUS_ERROR;
|
||||
}
|
||||
|
||||
@@ -68,7 +68,22 @@ test_file_piped ()
|
||||
bps=$3
|
||||
encode_options="$4"
|
||||
|
||||
if [ `env | grep -ic '^comspec='` != 0 ] ; then
|
||||
is_win=yes
|
||||
else
|
||||
is_win=no
|
||||
fi
|
||||
|
||||
echo -n "$name: encode via pipes..."
|
||||
if [ $is_win = yes ] ; then
|
||||
cmd="flac -V -s -fr -fb -fs 44100 -fp $bps -fc $channels $encode_options -c $name.raw"
|
||||
echo "### ENCODE $name #######################################################" >> ./streams.log
|
||||
echo "### cmd=$cmd" >> ./streams.log
|
||||
if $cmd 1>$name.flac 2>>./streams.log ; then : ; else
|
||||
echo "ERROR during encode of $name" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
cmd="flac -V -s -fr -fb -fs 44100 -fp $bps -fc $channels $encode_options -c -"
|
||||
echo "### ENCODE $name #######################################################" >> ./streams.log
|
||||
echo "### cmd=$cmd" >> ./streams.log
|
||||
@@ -76,7 +91,17 @@ test_file_piped ()
|
||||
echo "ERROR during encode of $name" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
echo -n "decode via pipes..."
|
||||
if [ $is_win = yes ] ; then
|
||||
cmd="flac -s -fb -d -fr -c $name.flac"
|
||||
echo "### DECODE $name #######################################################" >> ./streams.log
|
||||
echo "### cmd=$cmd" >> ./streams.log
|
||||
if $cmd 1>$name.cmp 2>>./streams.log ; then : ; else
|
||||
echo "ERROR during decode of $name" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
cmd="flac -s -fb -d -fr -c -"
|
||||
echo "### DECODE $name #######################################################" >> ./streams.log
|
||||
echo "### cmd=$cmd" >> ./streams.log
|
||||
@@ -84,6 +109,7 @@ test_file_piped ()
|
||||
echo "ERROR during decode of $name" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
ls -1l $name.raw >> ./streams.log
|
||||
ls -1l $name.flac >> ./streams.log
|
||||
ls -1l $name.cmp >> ./streams.log
|
||||
|
||||
Reference in New Issue
Block a user