diff options
-rw-r--r-- | Makefile | 18 | ||||
-rw-r--r-- | ptformat.cc (renamed from ptfformat.cc) | 28 | ||||
-rw-r--r-- | ptformat/ptformat.h (renamed from ptformat/ptfformat.h) | 10 | ||||
-rw-r--r-- | ptftool.cc | 2 | ||||
-rw-r--r-- | ptgenmissing.cc | 2 | ||||
-rw-r--r-- | ptunxor.cc | 2 |
6 files changed, 23 insertions, 39 deletions
@@ -4,19 +4,19 @@ STRICT=-Wall -Wcast-align -Wextra -Wwrite-strings -Wunsafe-loop-optimizations -W CLANGSTRICT=-Woverloaded-virtual -Wno-mismatched-tags -ansi -Wnon-virtual-dtor -Woverloaded-virtual -fstrict-overflow -Wall -Wcast-align -Wextra -Wwrite-strings -Wno-unused-function -std=c++98 all: - $(CXX) -o ptftool -g ${INCL} ${STRICT} ptftool.cc ptfformat.cc - $(CXX) -o ptunxor -g ${INCL} ${STRICT} ptunxor.cc ptfformat.cc - $(CXX) -o ptgenmissing -g ${INCL} ${STRICT} ptgenmissing.cc ptfformat.cc + $(CXX) -o ptftool -g ${INCL} ${STRICT} ptftool.cc ptformat.cc + $(CXX) -o ptunxor -g ${INCL} ${STRICT} ptunxor.cc ptformat.cc + $(CXX) -o ptgenmissing -g ${INCL} ${STRICT} ptgenmissing.cc ptformat.cc all32: - $(CXX) -m32 -o ptftool -g ${INCL32} ${STRICT} ptftool.cc ptfformat.cc - $(CXX) -m32 -o ptunxor -g ${INCL32} ${STRICT} ptunxor.cc ptfformat.cc - $(CXX) -m32 -o ptgenmissing -g ${INCL32} ${STRICT} ptgenmissing.cc ptfformat.cc + $(CXX) -m32 -o ptftool -g ${INCL32} ${STRICT} ptftool.cc ptformat.cc + $(CXX) -m32 -o ptunxor -g ${INCL32} ${STRICT} ptunxor.cc ptformat.cc + $(CXX) -m32 -o ptgenmissing -g ${INCL32} ${STRICT} ptgenmissing.cc ptformat.cc clangall: - clang++ -o ptftool -g ${INCL} ${CLANGSTRICT} ptftool.cc ptfformat.cc - clang++ -o ptunxor -g ${INCL} ${CLANGSTRICT} ptunxor.cc ptfformat.cc - clang++ -o ptgenmissing -g ${INCL} ${CLANGSTRICT} ptgenmissing.cc ptfformat.cc + clang++ -o ptftool -g ${INCL} ${CLANGSTRICT} ptftool.cc ptformat.cc + clang++ -o ptunxor -g ${INCL} ${CLANGSTRICT} ptunxor.cc ptformat.cc + clang++ -o ptgenmissing -g ${INCL} ${CLANGSTRICT} ptgenmissing.cc ptformat.cc clean: rm ptftool ptunxor ptgenmissing diff --git a/ptfformat.cc b/ptformat.cc index 6ab2d5a..fd0792a 100644 --- a/ptfformat.cc +++ b/ptformat.cc @@ -28,7 +28,13 @@ #include <glib/gstdio.h> -#include "ptformat/ptfformat.h" +#include "ptformat/ptformat.h" + +#define BITCODE "0010111100101011" +#define ZMARK '\x5a' +#define ZERO_TICKS 0xe8d4a51000ULL +#define MAX_CONTENT_TYPE 0x3000 +#define MAX_CHANNELS_PER_TRACK 8 #if 0 #define DEBUG @@ -42,22 +48,6 @@ using namespace std; -static bool wavidx_compare(PTFFormat::wav_t& w1, PTFFormat::wav_t& w2) { - return w1.index < w2.index; -} - -static bool wavname_compare(PTFFormat::wav_t& w1, PTFFormat::wav_t& w2) { - return (strcasecmp(w1.filename.c_str(), w2.filename.c_str()) < 0); -} - -static bool regidx_compare(PTFFormat::region_t& r1, PTFFormat::region_t& r2) { - return r1.index < r2.index; -} - -static bool regname_compare(PTFFormat::region_t& r1, PTFFormat::region_t& r2) { - return (strcasecmp(r1.name.c_str(), r2.name.c_str()) < 0); -} - static void hexdump(uint8_t *data, int length, int level) { @@ -97,7 +87,7 @@ PTFFormat::~PTFFormat() { cleanup(); } -std::string +const std::string PTFFormat::get_content_description(uint16_t ctype) { switch(ctype) { case 0x0030: @@ -351,7 +341,7 @@ PTFFormat::jumpback(uint32_t *currpos, unsigned char *buf, const uint32_t maxoff } bool -PTFFormat::foundin(std::string haystack, std::string needle) { +PTFFormat::foundin(std::string const& haystack, std::string const& needle) { size_t found = haystack.find(needle); if (found != std::string::npos) { return true; diff --git a/ptformat/ptfformat.h b/ptformat/ptformat.h index 5a08596..22a4007 100644 --- a/ptformat/ptfformat.h +++ b/ptformat/ptformat.h @@ -28,12 +28,6 @@ #include <stdint.h> #include "ptformat/visibility.h" -#define BITCODE "0010111100101011" -#define ZMARK '\x5a' -#define ZERO_TICKS 0xe8d4a51000ULL -#define MAX_CONTENT_TYPE 0x3000 -#define MAX_CHANNELS_PER_TRACK 8 - class LIBPTFORMAT_API PTFFormat { public: PTFFormat(); @@ -251,7 +245,7 @@ private: bool jumpback(uint32_t *currpos, unsigned char *buf, const uint32_t maxoffset, const unsigned char *needle, const uint32_t needlelen); bool jumpto(uint32_t *currpos, unsigned char *buf, const uint32_t maxoffset, const unsigned char *needle, const uint32_t needlelen); - bool foundin(std::string haystack, std::string needle); + bool foundin(std::string const& haystack, std::string const& needle); int64_t foundat(unsigned char *haystack, uint64_t n, const char *needle); uint16_t u_endian_read2(unsigned char *buf, bool); uint32_t u_endian_read3(unsigned char *buf, bool); @@ -260,7 +254,7 @@ private: uint64_t u_endian_read8(unsigned char *buf, bool); char *parsestring(uint32_t pos); - std::string get_content_description(uint16_t ctype); + const std::string get_content_description(uint16_t ctype); int parse(void); void parseblocks(void); bool parseheader(void); @@ -19,7 +19,7 @@ * */ -#include "ptformat/ptfformat.h" +#include "ptformat/ptformat.h" #include <inttypes.h> // PRIxyy #include <cstdio> #include <stdlib.h> diff --git a/ptgenmissing.cc b/ptgenmissing.cc index 0e8389b..068496c 100644 --- a/ptgenmissing.cc +++ b/ptgenmissing.cc @@ -19,7 +19,7 @@ * */ -#include "ptformat/ptfformat.h" +#include "ptformat/ptformat.h" #include <inttypes.h> // PRIx #include <cstdio> #include <stdlib.h> @@ -21,7 +21,7 @@ #include <stdlib.h> #include <cstdio> #include <inttypes.h> -#include "ptformat/ptfformat.h" +#include "ptformat/ptformat.h" int main(int argc, char** argv) { |