Skip to content
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

Fix useless-cast warning #1090

Closed
wants to merge 9 commits into from
Closed
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion include/aws/common/array_list.inl
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ AWS_STATIC_IMPL
void aws_array_list_clean_up_secure(struct aws_array_list *AWS_RESTRICT list) {
AWS_PRECONDITION(AWS_IS_ZEROED(*list) || aws_array_list_is_valid(list));
if (list->alloc && list->data) {
aws_secure_zero((void *)list->data, list->current_size);
aws_secure_zero(list->data, list->current_size);
aws_mem_release(list->alloc, list->data);
}

Expand Down
20 changes: 10 additions & 10 deletions include/aws/common/math.inl
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@ AWS_STATIC_IMPL int aws_sub_u32_checked(uint32_t a, uint32_t b, uint32_t *r) {
*/
AWS_STATIC_IMPL size_t aws_mul_size_saturating(size_t a, size_t b) {
#if SIZE_BITS == 32
return (size_t)aws_mul_u32_saturating(a, b);
return aws_mul_u32_saturating(a, b);
#elif SIZE_BITS == 64
return (size_t)aws_mul_u64_saturating(a, b);
return aws_mul_u64_saturating(a, b);
#else
# error "Target not supported"
#endif
Expand All @@ -111,9 +111,9 @@ AWS_STATIC_IMPL int aws_mul_size_checked(size_t a, size_t b, size_t *r) {
*/
AWS_STATIC_IMPL size_t aws_add_size_saturating(size_t a, size_t b) {
#if SIZE_BITS == 32
return (size_t)aws_add_u32_saturating(a, b);
return aws_add_u32_saturating(a, b);
#elif SIZE_BITS == 64
return (size_t)aws_add_u64_saturating(a, b);
return aws_add_u64_saturating(a, b);
#else
# error "Target not supported"
#endif
Expand All @@ -125,29 +125,29 @@ AWS_STATIC_IMPL size_t aws_add_size_saturating(size_t a, size_t b) {
*/
AWS_STATIC_IMPL int aws_add_size_checked(size_t a, size_t b, size_t *r) {
#if SIZE_BITS == 32
return aws_add_u32_checked(a, b, (uint32_t *)r);
return aws_add_u32_checked(a, b, r);
#elif SIZE_BITS == 64
return aws_add_u64_checked(a, b, (uint64_t *)r);
return aws_add_u64_checked(a, b, r);
#else
# error "Target not supported"
#endif
}

AWS_STATIC_IMPL size_t aws_sub_size_saturating(size_t a, size_t b) {
#if SIZE_BITS == 32
return (size_t)aws_sub_u32_saturating(a, b);
return aws_sub_u32_saturating(a, b);
#elif SIZE_BITS == 64
return (size_t)aws_sub_u64_saturating(a, b);
return aws_sub_u64_saturating(a, b);
#else
# error "Target not supported"
#endif
}

AWS_STATIC_IMPL int aws_sub_size_checked(size_t a, size_t b, size_t *r) {
#if SIZE_BITS == 32
return aws_sub_u32_checked(a, b, (uint32_t *)r);
return aws_sub_u32_checked(a, b, r);
#elif SIZE_BITS == 64
return aws_sub_u64_checked(a, b, (uint64_t *)r);
return aws_sub_u64_checked(a, b, r);
#else
# error "Target not supported"
#endif
Expand Down
Loading