Skip to content

Commit

Permalink
xrCore/rt_compressor: fixed stack corruption properly
Browse files Browse the repository at this point in the history
Also removed include guard
Thanks @Im-dex.
  • Loading branch information
Xottab-DUTY committed Jan 7, 2018
1 parent a1d4c52 commit 2ac00fb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
8 changes: 4 additions & 4 deletions src/xrCore/Compression/rt_compressor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@ u32 rtc_csize(u32 in)
return in + in / 64 + 16 + 3;
}

u32 rtc_compress(void* dst, u32 dst_len, const void* src, u32 src_len)
size_t rtc_compress(void* dst, size_t dst_len, const void* src, size_t src_len)
{
u64 out_size = dst_len;
lzo_uint out_size = dst_len;
int r = lzo1x_1_compress((const lzo_byte*)src, (lzo_uint)src_len, (lzo_byte*)dst, (lzo_uintp)&out_size, rtc_wrkmem);
VERIFY(r == LZO_E_OK);
return out_size;
}
u32 rtc_decompress(void* dst, u32 dst_len, const void* src, u32 src_len)
size_t rtc_decompress(void* dst, size_t dst_len, const void* src, size_t src_len)
{
u64 out_size = dst_len;
lzo_uint out_size = dst_len;
int r = lzo1x_decompress((const lzo_byte*)src, (lzo_uint)src_len, (lzo_byte*)dst, (lzo_uintp)&out_size, rtc_wrkmem);
VERIFY(r == LZO_E_OK);
return out_size;
Expand Down
8 changes: 2 additions & 6 deletions src/xrCore/Compression/rt_compressor.h
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
#ifndef rt_compressorH
#define rt_compressorH
#pragma once

extern XRCORE_API void rtc_initialize();
extern XRCORE_API u32 rtc_compress(void* dst, u32 dst_len, const void* src, u32 src_len);
extern XRCORE_API u32 rtc_decompress(void* dst, u32 dst_len, const void* src, u32 src_len);
extern XRCORE_API size_t rtc_compress(void* dst, size_t dst_len, const void* src, size_t src_len);
extern XRCORE_API size_t rtc_decompress(void* dst, size_t dst_len, const void* src, size_t src_len);
extern XRCORE_API u32 rtc_csize(u32 in);

extern XRCORE_API void rtc9_initialize();
extern XRCORE_API void rtc9_uninitialize();
extern XRCORE_API u32 rtc9_compress(void* dst, u32 dst_len, const void* src, u32 src_len);
extern XRCORE_API u32 rtc9_decompress(void* dst, u32 dst_len, const void* src, u32 src_len);
extern XRCORE_API u32 rtc9_csize(u32 in);

#endif

0 comments on commit 2ac00fb

Please sign in to comment.