Skip to content

Commit

Permalink
fix offset parsing (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
fabi321 committed Dec 31, 2023
1 parent 15f0f73 commit 0d3c30b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,10 @@ mod test {
"PX 0 0 ffffff\nPX 42 42 000000\n"
)] // The get pixel result is also offseted
#[case("OFFSET 0 0\nPX 0 42 abcdef\nPX 0 42\n", "PX 0 42 abcdef\n")]
#[case(
"OFFSET 10 10\nPX 0 0 ffffff\nOFFSET 0 0\nPX 0 0\nPX 10 10\n",
"PX 0 0 000000\nPX 10 10 ffffff\n"
)]
#[tokio::test]
async fn test_setting_pixel(
#[case] input: &str,
Expand Down
2 changes: 1 addition & 1 deletion src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ pub async fn parse_pixelflut_commands(
continue;
}
}
} else if current_command & 0x0000_ffff_ffff_ffff == string_to_number(b"OFFSET \0\0") {
} else if current_command & 0x00ff_ffff_ffff_ffff == string_to_number(b"OFFSET \0\0") {
i += 7;

let (x, y, present) = parse_pixel_coordinates(buffer.as_ptr(), &mut i);
Expand Down

0 comments on commit 0d3c30b

Please sign in to comment.