Skip to content

Commit

Permalink
lint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
FZambia committed May 6, 2024
1 parent 15466d9 commit 08162cc
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions src/fossil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,10 @@ function checksum(arr: ByteArray): number {
}
sum3 = (((((sum3 + (sum2 << 8)) | 0) + (sum1 << 16)) | 0) + (sum0 << 24)) | 0;
switch (N) {
//@ts-ignore
//@ts-ignore fallthrough is needed.
case 3:
sum3 = (sum3 + (arr[z + 2] << 8)) | 0; /* falls through */
//@ts-ignore
//@ts-ignore fallthrough is needed.
case 2:
sum3 = (sum3 + (arr[z + 1] << 16)) | 0; /* falls through */
case 1:
Expand All @@ -138,18 +138,17 @@ export function applyDelta<T extends ByteArray>(
source: T,
delta: T
): T {
let limit: number,
total = 0;
let total = 0;
const zDelta = new Reader(delta);
const lenSrc = source.length;
const lenDelta = delta.length;

limit = zDelta.getInt();
const limit = zDelta.getInt();
if (zDelta.getChar() !== "\n")
throw new Error("size integer not terminated by '\\n'");
const zOut = new Writer();
while (zDelta.haveBytes()) {
let cnt = zDelta.getInt();
const cnt = zDelta.getInt();
let ofst: number;

switch (zDelta.getChar()) {
Expand Down Expand Up @@ -177,13 +176,14 @@ export function applyDelta<T extends ByteArray>(
break;

case ";":
const out = zOut.toByteArray(source);
if (cnt !== checksum(out))
throw new Error("bad checksum");
if (total !== limit)
throw new Error("generated size does not match predicted size");
return out;

{
const out = zOut.toByteArray(source);
if (cnt !== checksum(out))
throw new Error("bad checksum");
if (total !== limit)
throw new Error("generated size does not match predicted size");
return out;
}
default:
throw new Error("unknown delta operator");
}
Expand Down

0 comments on commit 08162cc

Please sign in to comment.