Skip to content

Commit

Permalink
Code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
JrMasterModelBuilder committed Sep 24, 2023
1 parent ab46130 commit bca9152
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/icon/icns.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,8 @@ export class IconIcns extends Icon {
const {toc} = this;
const headName = new Uint8Array([105, 99, 110, 115]);
const headSize = new Uint8Array(4);
let size = 8;
let tocSizeValue = 8;
let sized = 8;
let tocSized = 8;
const tocs = toc
? [new Uint8Array([84, 79, 67, 32]), new Uint8Array(4)]
: null;
Expand All @@ -147,34 +147,34 @@ export class IconIcns extends Icon {
imgName[i] = type.charCodeAt(i) || 0;
}
const imgSize = new Uint8Array(4);
const imgSizeValue = data.length + 8;
const imgSized = data.length + 8;
new DataView(
imgSize.buffer,
imgSize.byteOffset,
imgSize.byteLength
).setUint32(0, imgSizeValue, false);
).setUint32(0, imgSized, false);
if (tocs) {
tocs.push(imgName, imgSize);
tocSizeValue += 8;
size += 8;
tocSized += 8;
sized += 8;
}
imgs.push(imgName, imgSize, data);
size += imgSizeValue;
sized += imgSized;
}
if (tocs) {
const [, tocSize] = tocs;
new DataView(
tocSize.buffer,
tocSize.byteOffset,
tocSize.byteLength
).setUint32(0, tocSizeValue, false);
size += 8;
).setUint32(0, tocSized, false);
sized += 8;
}
new DataView(
headSize.buffer,
headSize.byteOffset,
headSize.byteLength
).setUint32(0, size, false);
).setUint32(0, sized, false);
return concatUint8Arrays([
headName,
headSize,
Expand Down

0 comments on commit bca9152

Please sign in to comment.