From 8f3dd0487895772b67753af68ece41dd6bd6fca3 Mon Sep 17 00:00:00 2001 From: ketmar Date: Wed, 3 Nov 2021 05:44:03 +0000 Subject: [PATCH] dlzma: example cosmetix FossilOrigin-Name: 31506d566c2e43f103c1f03b279301c31a3c78aa41c73465ec58797ab88283e1 --- dlzma/test/dlzmatest.d | 8 ++++---- dlzma/test/dlzmatest_onecall.d | 16 ++++++++-------- dlzma/test/dlzmatest_vanilla.d | 8 ++++---- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/dlzma/test/dlzmatest.d b/dlzma/test/dlzmatest.d index 65f2c80..0434fb1 100644 --- a/dlzma/test/dlzmatest.d +++ b/dlzma/test/dlzmatest.d @@ -157,11 +157,11 @@ void decompressFile (ref VFile fi, ref VFile fo) { enum InBufSize = 1024*1024; enum OutBufSize = 1024*1024; - ubyte *inbuf = cast(ubyte*)lzmaDefAllocator.Alloc(&lzmaDefAllocator, InBufSize); - ubyte *outbuf = cast(ubyte*)lzmaDefAllocator.Alloc(&lzmaDefAllocator, OutBufSize); + ubyte *inbuf = cast(ubyte*)ISzAlloc_Alloc(&lzmaDefAllocator, InBufSize); + ubyte *outbuf = cast(ubyte*)ISzAlloc_Alloc(&lzmaDefAllocator, OutBufSize); scope(exit) { - lzmaDefAllocator.Free(&lzmaDefAllocator, inbuf); - lzmaDefAllocator.Free(&lzmaDefAllocator, outbuf); + ISzAlloc_Free(&lzmaDefAllocator, inbuf); + ISzAlloc_Free(&lzmaDefAllocator, outbuf); } CLzmaDec dec; diff --git a/dlzma/test/dlzmatest_onecall.d b/dlzma/test/dlzmatest_onecall.d index bc7cf32..e9fd10c 100644 --- a/dlzma/test/dlzmatest_onecall.d +++ b/dlzma/test/dlzmatest_onecall.d @@ -26,11 +26,11 @@ void main (string[] args) { if (args[1] == "c") { auto fi = VFile(args[2]); usize insize = cast(usize)fi.size; - ubyte *inbuf = cast(ubyte*)lzmaDefAllocator.Alloc(&lzmaDefAllocator, insize); + ubyte *inbuf = cast(ubyte*)ISzAlloc_Alloc(&lzmaDefAllocator, insize); fi.rawReadExact(inbuf[0..insize]); fi.close(); - ubyte *outbuf = cast(ubyte*)lzmaDefAllocator.Alloc(&lzmaDefAllocator, insize); + ubyte *outbuf = cast(ubyte*)ISzAlloc_Alloc(&lzmaDefAllocator, insize); CLzmaEncProps props; LzmaEncProps_Init(&props); @@ -47,7 +47,7 @@ void main (string[] args) { writeln("compressing..."); usize destLen = insize; SRes res = LzmaEncode(outbuf, &destLen, inbuf, insize, &props, header.ptr, &headerSize, 0/*writeEndMark*/, null, &lzmaDefAllocator, &lzmaDefAllocator); - lzmaDefAllocator.Free(&lzmaDefAllocator, inbuf); + ISzAlloc_Free(&lzmaDefAllocator, inbuf); switch (res) { case SZ_OK: break; @@ -68,7 +68,7 @@ void main (string[] args) { fo.rawWriteExact(outbuf[0..destLen]); fo.close(); - lzmaDefAllocator.Free(&lzmaDefAllocator, outbuf); + ISzAlloc_Free(&lzmaDefAllocator, outbuf); } else if (args[1] == "x") { usize unsize = 0; usize pksize = 0; @@ -82,17 +82,17 @@ void main (string[] args) { unsize = fi.readNum!usize; pksize = fi.readNum!usize; fi.rawReadExact(header[0..headerSize]); - ubyte *inbuf = cast(ubyte*)lzmaDefAllocator.Alloc(&lzmaDefAllocator, pksize); + ubyte *inbuf = cast(ubyte*)ISzAlloc_Alloc(&lzmaDefAllocator, pksize); fi.rawReadExact(inbuf[0..pksize]); fi.close(); - ubyte *outbuf = cast(ubyte*)lzmaDefAllocator.Alloc(&lzmaDefAllocator, unsize); + ubyte *outbuf = cast(ubyte*)ISzAlloc_Alloc(&lzmaDefAllocator, unsize); usize srcLen = pksize; usize destLen = unsize; ELzmaStatus status = 0; writeln("decompressing..."); int res = LzmaDecode(outbuf, &destLen, inbuf, &srcLen, header.ptr, headerSize, /*LZMA_FINISH_END*/LZMA_FINISH_ANY, &status, &lzmaDefAllocator); - lzmaDefAllocator.Free(&lzmaDefAllocator, inbuf); + ISzAlloc_Free(&lzmaDefAllocator, inbuf); switch (res) { case SZ_OK: @@ -114,6 +114,6 @@ void main (string[] args) { fo.rawWriteExact(outbuf[0..destLen]); fo.close(); - lzmaDefAllocator.Free(&lzmaDefAllocator, outbuf); + ISzAlloc_Free(&lzmaDefAllocator, outbuf); } } diff --git a/dlzma/test/dlzmatest_vanilla.d b/dlzma/test/dlzmatest_vanilla.d index bd13a26..e7b57d2 100644 --- a/dlzma/test/dlzmatest_vanilla.d +++ b/dlzma/test/dlzmatest_vanilla.d @@ -213,11 +213,11 @@ void decompressFile (ref File fi, ref File fo) { enum InBufSize = 1024*1024; enum OutBufSize = 1024*1024; - ubyte *inbuf = cast(ubyte*)lzmaDefAllocator.Alloc(&lzmaDefAllocator, InBufSize); - ubyte *outbuf = cast(ubyte*)lzmaDefAllocator.Alloc(&lzmaDefAllocator, OutBufSize); + ubyte *inbuf = cast(ubyte*)ISzAlloc_Alloc(&lzmaDefAllocator, InBufSize); + ubyte *outbuf = cast(ubyte*)ISzAlloc_Alloc(&lzmaDefAllocator, OutBufSize); scope(exit) { - lzmaDefAllocator.Free(&lzmaDefAllocator, inbuf); - lzmaDefAllocator.Free(&lzmaDefAllocator, outbuf); + ISzAlloc_Free(&lzmaDefAllocator, inbuf); + ISzAlloc_Free(&lzmaDefAllocator, outbuf); } CLzmaDec dec; -- 2.11.4.GIT