| 1355 | #endif |
| 1356 | |
| 1357 | LZ4_stream_t* LZ4_initStream (void* buffer, size_t size) |
| 1358 | { |
| 1359 | DEBUGLOG(5, "LZ4_initStream"); |
| 1360 | if (buffer == NULL) { return NULL; } |
| 1361 | if (size < sizeof(LZ4_stream_t)) { return NULL; } |
| 1362 | #ifndef _MSC_VER /* for some reason, Visual fails the aligment test on 32-bit x86 : |
| 1363 | it reports an aligment of 8-bytes, |
| 1364 | while actually aligning LZ4_stream_t on 4 bytes. */ |
| 1365 | if (((size_t)buffer) & (LZ4_stream_t_alignment() - 1)) { return NULL; } /* alignment check */ |
| 1366 | #endif |
| 1367 | MEM_INIT(buffer, 0, sizeof(LZ4_stream_t)); |
| 1368 | return (LZ4_stream_t*)buffer; |
| 1369 | } |
| 1370 | |
| 1371 | /* resetStream is now deprecated, |
| 1372 | * prefer initStream() which is more general */ |
no test coverage detected