Skip to content

Commit 2ac00fb

Browse files
committed
xrCore/rt_compressor: fixed stack corruption properly
Also removed include guard Thanks @Im-dex.
1 parent a1d4c52 commit 2ac00fb

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

src/xrCore/Compression/rt_compressor.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,16 @@ u32 rtc_csize(u32 in)
1414
return in + in / 64 + 16 + 3;
1515
}
1616

17-
u32 rtc_compress(void* dst, u32 dst_len, const void* src, u32 src_len)
17+
size_t rtc_compress(void* dst, size_t dst_len, const void* src, size_t src_len)
1818
{
19-
u64 out_size = dst_len;
19+
lzo_uint out_size = dst_len;
2020
int r = lzo1x_1_compress((const lzo_byte*)src, (lzo_uint)src_len, (lzo_byte*)dst, (lzo_uintp)&out_size, rtc_wrkmem);
2121
VERIFY(r == LZO_E_OK);
2222
return out_size;
2323
}
24-
u32 rtc_decompress(void* dst, u32 dst_len, const void* src, u32 src_len)
24+
size_t rtc_decompress(void* dst, size_t dst_len, const void* src, size_t src_len)
2525
{
26-
u64 out_size = dst_len;
26+
lzo_uint out_size = dst_len;
2727
int r = lzo1x_decompress((const lzo_byte*)src, (lzo_uint)src_len, (lzo_byte*)dst, (lzo_uintp)&out_size, rtc_wrkmem);
2828
VERIFY(r == LZO_E_OK);
2929
return out_size;
Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,12 @@
1-
#ifndef rt_compressorH
2-
#define rt_compressorH
31
#pragma once
42

53
extern XRCORE_API void rtc_initialize();
6-
extern XRCORE_API u32 rtc_compress(void* dst, u32 dst_len, const void* src, u32 src_len);
7-
extern XRCORE_API u32 rtc_decompress(void* dst, u32 dst_len, const void* src, u32 src_len);
4+
extern XRCORE_API size_t rtc_compress(void* dst, size_t dst_len, const void* src, size_t src_len);
5+
extern XRCORE_API size_t rtc_decompress(void* dst, size_t dst_len, const void* src, size_t src_len);
86
extern XRCORE_API u32 rtc_csize(u32 in);
97

108
extern XRCORE_API void rtc9_initialize();
119
extern XRCORE_API void rtc9_uninitialize();
1210
extern XRCORE_API u32 rtc9_compress(void* dst, u32 dst_len, const void* src, u32 src_len);
1311
extern XRCORE_API u32 rtc9_decompress(void* dst, u32 dst_len, const void* src, u32 src_len);
1412
extern XRCORE_API u32 rtc9_csize(u32 in);
15-
16-
#endif

0 commit comments

Comments
 (0)