Skip to content

bpo-32707: Fix warnings in hamt.c #5430

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 29, 2018
Merged
Changes from all commits
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
8 changes: 5 additions & 3 deletions Python/hamt.c
Original file line number Diff line number Diff line change
Expand Up @@ -620,7 +620,8 @@ hamt_node_bitmap_clone_without(PyHamtNode_Bitmap *o, uint32_t bit)
new->b_array[i] = o->b_array[i];
}

for (i = val_idx + 1; i < Py_SIZE(o); i++) {
assert(Py_SIZE(o) >= 0 && Py_SIZE(o) <= 32);
for (i = val_idx + 1; i < (uint32_t)Py_SIZE(o); i++) {
Py_XINCREF(o->b_array[i]);
new->b_array[i - 2] = o->b_array[i];
}
Expand Down Expand Up @@ -920,7 +921,7 @@ hamt_node_bitmap_assoc(PyHamtNode_Bitmap *self,

uint32_t key_idx = 2 * idx;
uint32_t val_idx = key_idx + 1;
Py_ssize_t i;
uint32_t i;

*added_leaf = 1;

Expand All @@ -947,7 +948,8 @@ hamt_node_bitmap_assoc(PyHamtNode_Bitmap *self,

/* Copy all keys/values that will be after the new key/value
we are adding. */
for (i = key_idx; i < Py_SIZE(self); i++) {
assert(Py_SIZE(self) >= 0 && Py_SIZE(self) <= 32);
for (i = key_idx; i < (uint32_t)Py_SIZE(self); i++) {
Py_XINCREF(self->b_array[i]);
new_node->b_array[i + 2] = self->b_array[i];
}
Expand Down