Skip to content

Commit

Permalink
make it just a constant and comment.
Browse files Browse the repository at this point in the history
  • Loading branch information
treeform committed Nov 16, 2024
1 parent 327765f commit 0a0a5fa
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/pixie/fileformats/jpeg.nim
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ const
0.uint32, 1, 3, 7, 15, 31, 63, 127, 255, 511,
1023, 2047, 4095, 8191, 16383, 32767, 65535
]
jpegEndOfImage = 0xD9

type
Huffman = object
Expand Down Expand Up @@ -878,7 +877,8 @@ proc checkRestart(state: var DecoderState) =
if state.todoBeforeRestart <= 0:
if state.pos + 1 > state.len:
failInvalid()
if state.buffer[state.pos] == 0xFF and state.buffer[state.pos+1] == jpegEndOfImage:
# Handle getting a restart marker right at the end.
if state.buffer[state.pos] == 0xFF and state.buffer[state.pos+1] == 0xD9:
return
if state.buffer[state.pos] != 0xFF or
state.buffer[state.pos + 1] notin {0xD0 .. 0xD7}:
Expand Down

0 comments on commit 0a0a5fa

Please sign in to comment.