Skip to content

Commit 554675b

Browse files
committed
chore: cast to size_t
1 parent 30f6bdc commit 554675b

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

pandas/_libs/src/parser/tokenizer.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1893,7 +1893,10 @@ static int copy_string_without_char(char output[PROCESSED_WORD_CAPACITY],
18931893
right = memchr(left, char_to_remove, remaining_bytes_to_read);
18941894

18951895
// If it doesn't find the char to remove, just copy until EOS.
1896-
size_t chunk_size = right ? right - left : end_ptr - left;
1896+
// We are also casting directly to size_t because
1897+
// `left` never goes beyond `right` or `end_ptr`.
1898+
size_t chunk_size =
1899+
right ? (size_t)(right - left) : (size_t)(end_ptr - left);
18971900

18981901
// check if we have enough space, including the null terminator.
18991902
if (chunk_size + bytes_written >= PROCESSED_WORD_CAPACITY) {

0 commit comments

Comments
 (0)