Move git root from Client/ to src/ to track all source code: - Client: Game client source (moved to Client/Client/) - Server: Game server source - GameTools: Development tools - CryptoSource: Encryption utilities - database: Database scripts - Script: Game scripts - rylCoder_16.02.2008_src: Legacy coder tools - GMFont, Game: Additional resources 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
31 lines
930 B
C++
31 lines
930 B
C++
#include "stdafx.h"
|
|
#include "minilzo.h"
|
|
#include "miniLZOWrapper.h"
|
|
|
|
#if _MSC_VER >= 1300
|
|
#define THREAD_LOCAL_STORAGE __declspec(thread) static
|
|
#else
|
|
#define THREAD_LOCAL_STORAGE
|
|
#endif
|
|
|
|
bool CMiniLZO::CheckLZOUsable()
|
|
{
|
|
return LZO_E_OK == lzo_init();
|
|
}
|
|
|
|
bool CMiniLZO::Compress(const char* in, unsigned long in_len,
|
|
char* out, unsigned long* lp_out_len)
|
|
{
|
|
THREAD_LOCAL_STORAGE lzo_voidp wrkmem[LZO1X_1_MEM_COMPRESS];
|
|
return (LZO_E_OK == lzo1x_1_compress(reinterpret_cast<const lzo_byte*>(in), in_len,
|
|
reinterpret_cast<lzo_byte*>(out), reinterpret_cast<lzo_uintp>(lp_out_len), wrkmem));
|
|
}
|
|
|
|
bool CMiniLZO::Decompress(const char* in, unsigned long in_len,
|
|
char* out, unsigned long* buffersize_in_out_len)
|
|
{
|
|
return (LZO_E_OK == lzo1x_decompress_safe(reinterpret_cast<const lzo_byte*>(in), in_len,
|
|
reinterpret_cast<lzo_byte*>(out), reinterpret_cast<lzo_uintp>(buffersize_in_out_len), 0));
|
|
}
|
|
|