v1.03 prerelease - Full Linux port of crnlib/crunch, in progress - still more testing to do, and some cmd line options (such as -timestamp) don't work under linux yet, but the core stuff (compression/decompression/transcoding) should work fine and performance under Linux is comparable to Windows. The 3 examples haven't been ported yet.

This commit is contained in:
richgel99@gmail.com
2012-04-26 07:14:21 +00:00
parent fffd983ffa
commit f63e26aee6
89 changed files with 3547 additions and 3829 deletions
+3 -29
View File
@@ -2,7 +2,6 @@
// See Copyright Notice and license at the end of inc/crnlib.h
#include "crn_core.h"
#include "crn_data_stream.h"
#include <stdio.h>
namespace crnlib
{
@@ -12,7 +11,7 @@ namespace crnlib
{
}
data_stream::data_stream(const wchar_t* pName, uint attribs) :
data_stream::data_stream(const char* pName, uint attribs) :
m_name(pName),
m_attribs(static_cast<uint16>(attribs)),
m_opened(false), m_error(false), m_got_cr(false)
@@ -85,28 +84,11 @@ namespace crnlib
va_list args;
va_start(args, p);
char buf[4096];
#ifdef _MSC_VER
int l = vsprintf_s(buf, sizeof(buf), p, args);
#else
int l = vsprintf(buf, p, args);
#endif
va_end(args);
if (l < 0)
return false;
return write(buf, l) == static_cast<uint>(l);
}
bool data_stream::printf(const wchar_t* p, ...)
{
va_list args;
va_start(args, p);
dynamic_wstring buf;
dynamic_string buf;
buf.format_args(p, args);
va_end(args);
return write(buf.get_ptr(), buf.get_len() * sizeof(wchar_t)) == buf.get_len() * sizeof(wchar_t);
return write(buf.get_ptr(), buf.get_len() * sizeof(char)) == buf.get_len() * sizeof(char);
}
bool data_stream::write_line(const dynamic_string& str)
@@ -117,14 +99,6 @@ namespace crnlib
return true;
}
bool data_stream::write_line(const dynamic_wstring& str)
{
if (!str.is_empty())
return write(str.get_ptr(), str.get_len() * sizeof(wchar_t)) == str.get_len() * sizeof(wchar_t);
return true;
}
bool data_stream::read_array(vector<uint8>& buf)
{
if (buf.size() < get_remaining())