Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions std/zip.d
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ final class ZipArchive
*/
void[] build() @safe pure
{
import std.array : array;
import std.array : array, uninitializedArray;
import std.algorithm.sorting : sort;
import std.string : representation;

Expand Down Expand Up @@ -449,7 +449,7 @@ final class ZipArchive
if (isZip64)
dataSize += eocd64LocLength + eocd64Length;

_data = new ubyte[dataSize];
_data = uninitializedArray!(ubyte[])(dataSize);

// Populate the data[]

Expand Down
9 changes: 6 additions & 3 deletions std/zlib.d
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,9 @@ in
do
{
import core.memory : GC;
import std.array : uninitializedArray;
auto destlen = srcbuf.length + ((srcbuf.length + 1023) / 1024) + 12;
auto destbuf = new ubyte[destlen];
auto destbuf = uninitializedArray!(ubyte[])(destlen);
auto err = etc.c.zlib.compress2(destbuf.ptr, &destlen, cast(ubyte *) srcbuf.ptr, srcbuf.length, level);
if (err)
{
Expand Down Expand Up @@ -411,6 +412,7 @@ class Compress
const(void)[] compress(const(void)[] buf)
{
import core.memory : GC;
import std.array : uninitializedArray;
int err;
ubyte[] destbuf;

Expand All @@ -425,7 +427,7 @@ class Compress
inited = 1;
}

destbuf = new ubyte[zs.avail_in + buf.length];
destbuf = uninitializedArray!(ubyte[])(zs.avail_in + buf.length);
zs.next_out = destbuf.ptr;
zs.avail_out = to!uint(destbuf.length);

Expand Down Expand Up @@ -586,6 +588,7 @@ class UnCompress
return null;

import core.memory : GC;
import std.array : uninitializedArray;
int err;

if (!inited)
Expand All @@ -604,7 +607,7 @@ class UnCompress

if (!destbufsize)
destbufsize = to!uint(buf.length) * 2;
auto destbuf = new ubyte[destbufsize];
auto destbuf = uninitializedArray!(ubyte[])(destbufsize);
size_t destFill;

zs.next_in = cast(ubyte*) buf.ptr;
Expand Down