Skip to content
This repository has been archived by the owner on Aug 7, 2019. It is now read-only.

Change header check constant to hex #9

Merged
merged 4 commits into from
Jan 15, 2019
Merged
Changes from 1 commit
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 src/webUSBDevice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ export default class WebUSBDevice extends Device {
protected async read (): Promise<ByteBuffer> {
let first = await this.readChunk()

// FIXME: assert that buffer starts with: [ 0x3f, 0x23, 0x23 ]
const valid = first.getUint32(0) === 1059267328
// Check that buffer starts with: [ 0x3f, 0x23, 0x23, 0x00 ]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// Check that buffer starts with: [ 0x3f, 0x23, 0x23, 0x00 ]
// Check that buffer starts with: [ 0x3f, 0x23, 0x23 ]

const valid = first.getUint32(0) === 0x3f232300
majorhayes marked this conversation as resolved.
Show resolved Hide resolved
const msgLength = first.getUint32(5)
if (valid && msgLength > 0 && msgLength < 4194304) { // 4 MB sanity check
// FIXME: why doesn't ByteBuffer.concat() work?
Expand Down