diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e69740c5..975b2774 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,7 +27,7 @@ jobs: - name: Install deno uses: denolib/setup-deno@master with: - deno-version: 0.42.0 + deno-version: 1.0.0 - name: Check formatting run: deno fmt --check diff --git a/deps.ts b/deps.ts index 156da2bb..1d519287 100644 --- a/deps.ts +++ b/deps.ts @@ -1,13 +1,13 @@ export { BufReader, BufWriter, -} from "https://deno.land/std@v0.42.0/io/bufio.ts"; +} from "https://deno.land/std@0.51.0/io/bufio.ts"; -export { copyBytes } from "https://deno.land/std@v0.42.0/io/util.ts"; +export { copyBytes } from "https://deno.land/std@0.51.0/io/util.ts"; export { Deferred, deferred, -} from "https://deno.land/std@v0.42.0/util/async.ts"; +} from "https://deno.land/std@0.51.0/async/deferred.ts"; export { Hash } from "https://deno.land/x/checksum@1.2.0/mod.ts"; diff --git a/packet_writer.ts b/packet_writer.ts index 7513c156..4a3d9f2b 100644 --- a/packet_writer.ts +++ b/packet_writer.ts @@ -49,7 +49,7 @@ export class PacketWriter { // https://stackoverflow.com/questions/2269063/buffer-growth-strategy const newSize = oldBuffer.length + (oldBuffer.length >> 1) + size; this.buffer = new Uint8Array(newSize); - copyBytes(this.buffer, oldBuffer); + copyBytes(oldBuffer, this.buffer); } } @@ -76,7 +76,7 @@ export class PacketWriter { } else { const encodedStr = this.encoder.encode(string); this._ensure(encodedStr.byteLength + 1); // +1 for null terminator - copyBytes(this.buffer, encodedStr, this.offset); + copyBytes(encodedStr, this.buffer, this.offset); this.offset += encodedStr.byteLength; } @@ -90,7 +90,7 @@ export class PacketWriter { } this._ensure(1); - copyBytes(this.buffer, this.encoder.encode(c), this.offset); + copyBytes(this.encoder.encode(c), this.buffer, this.offset); this.offset++; return this; } @@ -99,14 +99,14 @@ export class PacketWriter { string = string || ""; const encodedStr = this.encoder.encode(string); this._ensure(encodedStr.byteLength); - copyBytes(this.buffer, encodedStr, this.offset); + copyBytes(encodedStr, this.buffer, this.offset); this.offset += encodedStr.byteLength; return this; } add(otherBuffer: Uint8Array) { this._ensure(otherBuffer.length); - copyBytes(this.buffer, otherBuffer, this.offset); + copyBytes(otherBuffer, this.buffer, this.offset); this.offset += otherBuffer.length; return this; } diff --git a/test_deps.ts b/test_deps.ts index b49533ee..1179c739 100644 --- a/test_deps.ts +++ b/test_deps.ts @@ -5,4 +5,4 @@ export { assertStrContains, assertThrows, assertThrowsAsync, -} from "https://deno.land/std@v0.42.0/testing/asserts.ts"; +} from "https://deno.land/std@0.51.0/testing/asserts.ts"; diff --git a/utils.ts b/utils.ts index 845917bf..baa26c3b 100644 --- a/utils.ts +++ b/utils.ts @@ -16,9 +16,9 @@ export function readInt32BE(buffer: Uint8Array, offset: number): number { return ( (buffer[offset] << 24) | - (buffer[offset + 1] << 16) | - (buffer[offset + 2] << 8) | - buffer[offset + 3] + (buffer[offset + 1] << 16) | + (buffer[offset + 2] << 8) | + buffer[offset + 3] ); }