From 0643b03b0ca30ef7c413a00bcd4eb17026dce568 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Thu, 24 May 2012 03:04:56 +0000 Subject: bin2cpp supports lzma compression. I need to modify the headers so it only includes headers for the things you use. --- default.bld | 2 +- src/tools/bin2cpp.cpp | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/default.bld b/default.bld index 56634fe..6b6bbc3 100644 --- a/default.bld +++ b/default.bld @@ -183,7 +183,7 @@ target "myriadfs" target "bin2cpp" { - LDFLAGS += "-lz -lbz2"; + LDFLAGS += "-lz -lbz2 -llzma"; } // diff --git a/src/tools/bin2cpp.cpp b/src/tools/bin2cpp.cpp index 53da0b5..15ef73d 100644 --- a/src/tools/bin2cpp.cpp +++ b/src/tools/bin2cpp.cpp @@ -3,6 +3,7 @@ #include #include #include +#include #include #include #include @@ -20,7 +21,7 @@ public: addOption( sClass, 'c', "Class name [default=\"Datafiles\"]"); addOption( sOutBase, 'o', "Output base filename [defaults to classname]"); addOption( sOutDir, 'd', "Output directory [defaults to current dir]"); - addOption( slot(this, &Options::addFilter), 'f', "Add filter: deflate, bzip2, base64, hex"); + addOption( slot(this, &Options::addFilter), 'f', "Add filter: deflate, bzip2, lzma, base64, hex"); setNonOption( slot(this, &Options::addInput) ); addHelpOption(); @@ -90,6 +91,7 @@ int main( int argc, char *argv[] ) << "#include " << fSrc.nl << "#include " << fSrc.nl << "#include " << fSrc.nl + << "#include " << fSrc.nl << "#include " << fSrc.nl << "#include " << fSrc.nl << "#include " << fSrc.nl << fSrc.nl @@ -120,6 +122,12 @@ int main( int argc, char *argv[] ) sFltDesc.prepend("b"); hFilters.insert('b', true ); } + else if( *f == "lzma" ) + { + sDat = encodeStr( sDat ); + sFltDesc.prepend("l"); + hFilters.insert('l', true ); + } else if( *f == "base64" ) { sDat = encodeStr( sDat ); @@ -181,6 +189,8 @@ int main( int argc, char *argv[] ) fSrc << "\t\t\tcase 'd': s->pushFilter(); break;" << fSrc.nl; if( hFilters.has('b') ) fSrc << "\t\t\tcase 'b': s->pushFilter(); break;" << fSrc.nl; + if( hFilters.has('l') ) + fSrc << "\t\t\tcase 'l': s->pushFilter(); break;" << fSrc.nl; if( hFilters.has('6') ) fSrc << "\t\t\tcase '6': s->pushFilter(); break;" << fSrc.nl; if( hFilters.has('h') ) -- cgit v1.2.3