add new flacdiff util

This commit is contained in:
Josh Coalson 2007-05-11 00:42:35 +00:00
parent a4f93918cd
commit 9506315b44
6 changed files with 584 additions and 0 deletions

View File

@ -45,6 +45,9 @@ Package=<4>
Project_Dep_Name flac_ren Project_Dep_Name flac_ren
End Project Dependency End Project Dependency
Begin Project Dependency Begin Project Dependency
Project_Dep_Name flacdiff
End Project Dependency
Begin Project Dependency
Project_Dep_Name grabbag_static Project_Dep_Name grabbag_static
End Project Dependency End Project Dependency
Begin Project Dependency Begin Project Dependency
@ -123,6 +126,9 @@ Package=<4>
Project_Dep_Name flac_ren Project_Dep_Name flac_ren
End Project Dependency End Project Dependency
Begin Project Dependency Begin Project Dependency
Project_Dep_Name flacdiff
End Project Dependency
Begin Project Dependency
Project_Dep_Name grabbag_static Project_Dep_Name grabbag_static
End Project Dependency End Project Dependency
Begin Project Dependency Begin Project Dependency
@ -513,6 +519,21 @@ Package=<4>
############################################################################### ###############################################################################
Project: "flacdiff"=".\src\utils\flacdiff\flacdiff.dsp" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name libFLAC++_static
End Project Dependency
}}}
###############################################################################
Global: Global:
Package=<5> Package=<5>

View File

@ -15,6 +15,11 @@ Project("{4cefbc7c-c215-11db-8314-0800200c9a66}") = "flac_mac", "src\monkeys_aud
EndProject EndProject
Project("{4cefbc7c-c215-11db-8314-0800200c9a66}") = "flac_ren", "src\monkeys_audio_utilities\flac_ren\flac_ren.vcproj", "{4cefbc7f-c215-11db-8314-0800200c9a66}" Project("{4cefbc7c-c215-11db-8314-0800200c9a66}") = "flac_ren", "src\monkeys_audio_utilities\flac_ren\flac_ren.vcproj", "{4cefbc7f-c215-11db-8314-0800200c9a66}"
EndProject EndProject
Project("{4cefbc7c-c215-11db-8314-0800200c9a66}") = "flacdiff", "src\utils\flacdiff\flacdiff.vcproj", "{4cefbc93-c215-11db-8314-0800200c9a66}"
ProjectSection(ProjectDependencies) = postProject
{4cefbc86-c215-11db-8314-0800200c9a66} = {4cefbc86-c215-11db-8314-0800200c9a66}
EndProjectSection
EndProject
Project("{4cefbc7c-c215-11db-8314-0800200c9a66}") = "getopt_static", "src\share\getopt\getopt_static.vcproj", "{4cefbc80-c215-11db-8314-0800200c9a66}" Project("{4cefbc7c-c215-11db-8314-0800200c9a66}") = "getopt_static", "src\share\getopt\getopt_static.vcproj", "{4cefbc80-c215-11db-8314-0800200c9a66}"
EndProject EndProject
Project("{4cefbc7c-c215-11db-8314-0800200c9a66}") = "grabbag_static", "src\share\grabbag\grabbag_static.vcproj", "{4cefbc81-c215-11db-8314-0800200c9a66}" Project("{4cefbc7c-c215-11db-8314-0800200c9a66}") = "grabbag_static", "src\share\grabbag\grabbag_static.vcproj", "{4cefbc81-c215-11db-8314-0800200c9a66}"
@ -196,6 +201,10 @@ Global
{4cefbc92-c215-11db-8314-0800200c9a66}.Debug|Win32.Build.0 = Debug|Win32 {4cefbc92-c215-11db-8314-0800200c9a66}.Debug|Win32.Build.0 = Debug|Win32
{4cefbc92-c215-11db-8314-0800200c9a66}.Release|Win32.ActiveCfg = Release|Win32 {4cefbc92-c215-11db-8314-0800200c9a66}.Release|Win32.ActiveCfg = Release|Win32
{4cefbc92-c215-11db-8314-0800200c9a66}.Release|Win32.Build.0 = Release|Win32 {4cefbc92-c215-11db-8314-0800200c9a66}.Release|Win32.Build.0 = Release|Win32
{4cefbc93-c215-11db-8314-0800200c9a66}.Debug|Win32.ActiveCfg = Debug|Win32
{4cefbc93-c215-11db-8314-0800200c9a66}.Debug|Win32.Build.0 = Debug|Win32
{4cefbc93-c215-11db-8314-0800200c9a66}.Release|Win32.ActiveCfg = Release|Win32
{4cefbc93-c215-11db-8314-0800200c9a66}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE

View File

@ -0,0 +1,42 @@
# flacdiff - Displays where two FLAC streams differ
# Copyright (C) 2007 Josh Coalson
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
# GNU makefile
#
topdir = ../../..
libdir = $(topdir)/obj/$(BUILD)/lib
PROGRAM_NAME = flacdiff
INCLUDES = -I$(topdir)/include
ifeq ($(DARWIN_BUILD),yes)
EXPLICIT_LIBS = $(libdir)/libFLAC++.a $(libdir)/libFLAC.a $(OGG_LIB_DIR)/libogg.a -lm
else
LIBS = -lFLAC++ -lFLAC -L$(OGG_LIB_DIR) -logg -lm
endif
SRCS_CPP = \
main.cpp
include $(topdir)/build/exe.mk
LINK = $(CCC) $(LINKAGE)
# DO NOT DELETE THIS LINE -- make depend depends on it.

View File

@ -0,0 +1,100 @@
# Microsoft Developer Studio Project File - Name="flacdiff" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=flacdiff - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "flacdiff.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "flacdiff.mak" CFG="flacdiff - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "flacdiff - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "flacdiff - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "flacdiff - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "..\..\..\obj\release\bin"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /c
# ADD CPP /nologo /MD /W3 /GR /GX /O2 /I "..\..\..\include" /D "NDEBUG" /D "FLAC__NO_DLL" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /FD /c
# SUBTRACT CPP /YX /Yc /Yu
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 ..\..\..\obj\release\lib\libFLAC++_static.lib ..\..\..\obj\release\lib\libFLAC_static.lib ..\..\..\obj\release\lib\ogg_static.lib /nologo /subsystem:console /machine:I386
!ELSEIF "$(CFG)" == "flacdiff - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "..\..\..\obj\debug\bin"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c
# ADD CPP /nologo /MDd /W3 /Gm /GR /GX /ZI /Od /I "..\..\..\include" /D "_DEBUG" /D "DEBUG" /D "FLAC__NO_DLL" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /FD /GZ /c
# SUBTRACT CPP /YX /Yc /Yu
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 ..\..\..\obj\debug\lib\libFLAC++_static.lib ..\..\..\obj\debug\lib\libFLAC_static.lib ..\..\..\obj\release\lib\ogg_static.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
!ENDIF
# Begin Target
# Name "flacdiff - Win32 Release"
# Name "flacdiff - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=.\main.cpp
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# End Group
# End Target
# End Project

View File

@ -0,0 +1,196 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="flacdiff"
ProjectGUID="{4cefbc93-c215-11db-8314-0800200c9a66}"
RootNamespace="flacdiff"
Keyword="Win32Proj"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="..\..\..\obj\debug\bin"
IntermediateDirectory="Debug"
ConfigurationType="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=".;..\..\..\include"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;FLAC__NO_DLL;DEBUG"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="4"
DisableSpecificWarnings="4267;4996"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="..\..\..\obj\release\lib\ogg_static.lib"
LinkIncremental="2"
IgnoreDefaultLibraryNames="uuid.lib"
GenerateDebugInformation="true"
SubSystem="1"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="..\..\..\obj\release\bin"
IntermediateDirectory="Release"
ConfigurationType="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=".;..\..\..\include"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;FLAC__NO_DLL"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
DisableSpecificWarnings="4267;4996"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="..\..\..\obj\release\lib\ogg_static.lib"
LinkIncremental="2"
IgnoreDefaultLibraryNames="uuid.lib"
GenerateDebugInformation="true"
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
</Filter>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath=".\main.cpp"
>
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

216
src/utils/flacdiff/main.cpp Normal file
View File

@ -0,0 +1,216 @@
/* flacdiff - Displays where two FLAC streams differ
* Copyright (C) 2007 Josh Coalson
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#if HAVE_CONFIG_H
# include <config.h>
#endif
#include <stdio.h>
#include <string.h>
#include "FLAC++/decoder.h"
class AutoFILE {
protected:
::FILE *f_;
public:
inline AutoFILE(const char *path, const char *mode): f_(::fopen(path, mode)) { }
inline virtual ~AutoFILE() { if (f_) (void)::fclose(f_); }
inline operator bool() const { return 0 != f_; }
inline operator const ::FILE *() const { return f_; }
inline operator ::FILE *() { return f_; }
private:
AutoFILE();
AutoFILE(const AutoFILE &);
void operator=(const AutoFILE &);
};
class Decoder: public FLAC::Decoder::Stream {
public:
Decoder(AutoFILE &f, off_t tgt): tgtpos_((FLAC__uint64)tgt), curpos_(0), go_(true), err_(false), frame_(), f_(f) { memset(&frame_, 0, sizeof(::FLAC__Frame)); }
FLAC__uint64 tgtpos_, curpos_;
bool go_, err_;
::FLAC__Frame frame_;
protected:
AutoFILE &f_;
// from FLAC::Decoder::Stream
virtual ::FLAC__StreamDecoderReadStatus read_callback(FLAC__byte buffer[], size_t *bytes)
{
*bytes = fread(buffer, 1, *bytes, f_);
if(ferror(f_))
return ::FLAC__STREAM_DECODER_READ_STATUS_ABORT;
else if(*bytes == 0 && feof(f_))
return ::FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM;
else
return ::FLAC__STREAM_DECODER_READ_STATUS_CONTINUE;
}
virtual ::FLAC__StreamDecoderTellStatus tell_callback(FLAC__uint64 *absolute_byte_offset)
{
off_t off = ftello(f_);
if(off < 0)
return ::FLAC__STREAM_DECODER_TELL_STATUS_ERROR;
*absolute_byte_offset = off;
return ::FLAC__STREAM_DECODER_TELL_STATUS_OK;
}
virtual bool eof_callback()
{
return feof(f_);
}
virtual ::FLAC__StreamDecoderWriteStatus write_callback(const ::FLAC__Frame *frame, const FLAC__int32 * const /*buffer*/[])
{
FLAC__uint64 pos;
if(!get_decode_position(&pos)) {
go_ = false;
err_ = true;
return ::FLAC__STREAM_DECODER_WRITE_STATUS_ABORT;
}
if(pos > tgtpos_) {
go_ = false;
frame_ = *frame;
}
else
curpos_ = pos;
return ::FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE;
}
virtual void error_callback(::FLAC__StreamDecoderErrorStatus status)
{
fprintf(stderr, "get error %d:%s\n", status, ::FLAC__StreamDecoderErrorStatusString[status]);
go_ = false;
err_ = true;
}
};
static bool show_diff(AutoFILE &f1, AutoFILE &f2, off_t off)
{
Decoder d1(f1, off), d2(f2, off);
if(!d1) {
fprintf(stderr, "ERROR: setting up decoder1, state=%s\n", d1.get_state().resolved_as_cstring(d1));
return false;
}
if(!d2) {
fprintf(stderr, "ERROR: setting up decoder2, state=%s\n", d2.get_state().resolved_as_cstring(d2));
return false;
}
::FLAC__StreamDecoderInitStatus is;
if((is = d1.init()) != FLAC__STREAM_DECODER_INIT_STATUS_OK) {
fprintf(stderr, "ERROR: initializing decoder1, status=%s state=%s\n", FLAC__StreamDecoderInitStatusString[is], d1.get_state().resolved_as_cstring(d1));
return false;
}
if((is = d2.init()) != FLAC__STREAM_DECODER_INIT_STATUS_OK) {
fprintf(stderr, "ERROR: initializing decoder2, status=%s state=%s\n", FLAC__StreamDecoderInitStatusString[is], d2.get_state().resolved_as_cstring(d2));
return false;
}
if(!d1.process_until_end_of_metadata()) {
fprintf(stderr, "ERROR: skipping metadata in decoder1, state=%s\n", d1.get_state().resolved_as_cstring(d1));
return false;
}
if(!d2.process_until_end_of_metadata()) {
fprintf(stderr, "ERROR: skipping metadata in decoder2, state=%s\n", d2.get_state().resolved_as_cstring(d2));
return false;
}
while(d1.go_ && d2.go_) {
if(!d1.process_single()) {
fprintf(stderr, "ERROR: decoding frame in decoder1, state=%s\n", d1.get_state().resolved_as_cstring(d1));
return false;
}
if(!d2.process_single()) {
fprintf(stderr, "ERROR: decoding frame in decoder2, state=%s\n", d2.get_state().resolved_as_cstring(d2));
return false;
}
}
if(d1.err_) {
fprintf(stderr, "ERROR: got err_ in decoder1, state=%s\n", d1.get_state().resolved_as_cstring(d1));
return false;
}
if(d2.err_) {
fprintf(stderr, "ERROR: got err_ in decoder2, state=%s\n", d2.get_state().resolved_as_cstring(d2));
return false;
}
if(d1.go_ != d2.go_) {
fprintf(stderr, "ERROR: d1.go_(%s) != d2.go_(%s)\n", d1.go_?"true":"false", d2.go_?"true":"false");
return false;
}
fprintf(stdout, "pos1 = %llu blocksize=%u sample#%llu frame#%llu\n", d1.curpos_, d1.frame_.header.blocksize, d1.frame_.header.number.sample_number, d1.frame_.header.number.sample_number / d1.frame_.header.blocksize);
fprintf(stdout, "pos2 = %llu blocksize=%u sample#%llu frame#%llu\n", d2.curpos_, d2.frame_.header.blocksize, d2.frame_.header.number.sample_number, d2.frame_.header.number.sample_number / d2.frame_.header.blocksize);
return true;
}
static off_t get_diff_offset(AutoFILE &f1, AutoFILE &f2)
{
off_t off = 0;
while(1) {
if(feof((FILE*)f1) && feof((FILE*)f1)) {
fprintf(stderr, "ERROR: files are identical\n");
return -1;
}
if(feof((FILE*)f1)) {
fprintf(stderr, "ERROR: file1 EOF\n");
return -1;
}
if(feof((FILE*)f2)) {
fprintf(stderr, "ERROR: file2 EOF\n");
return -1;
}
if(fgetc(f1) != fgetc(f2))
return off;
off++;
}
}
static bool run(const char *fn1, const char *fn2)
{
off_t off;
AutoFILE f1(fn1, "rb"), f2(fn2, "rb");
if(!f1) {
fprintf(stderr, "ERROR: opening %s for reading\n", fn1);
return false;
}
if(!f2) {
fprintf(stderr, "ERROR: opening %s for reading\n", fn2);
return false;
}
if((off = get_diff_offset(f1, f2)) < 0)
return false;
fprintf(stdout, "got diff offset = %u\n", (unsigned)off); //@@@ 4G limit (what is % modifier for off_t?)
return show_diff(f1, f2, off);
}
int main(int argc, char *argv[])
{
const char *usage = "usage: flacdiff flacfile1 flacfile2\n";
if(argc > 1 && 0 == strcmp(argv[1], "-h")) {
printf(usage);
return 0;
}
else if(argc != 3) {
fprintf(stderr, usage);
return 255;
}
return run(argv[1], argv[2])? 0 : 1;
}