-
Notifications
You must be signed in to change notification settings - Fork 437
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
warnings fix #308
base: master
Are you sure you want to change the base?
warnings fix #308
Conversation
@@ -1076,7 +1076,7 @@ static uint32_t new_kv(fdb_kvdb_t db, kv_sec_info_t sector, size_t kv_size) | |||
already_gc = true; | |||
goto __retry; | |||
} else if (already_gc) { | |||
FDB_INFO("Error: Alloc an KV (size %" PRIuLEAST16 ") failed after GC. KV full.\n", kv_size); | |||
FDB_INFO("Error: Alloc an KV (size %" PRIuPTR ") failed after GC. KV full.\n", (uintptr_t)kv_size); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The size type is not suitable for outputting in pointer format. Is there any other way?
@@ -1505,8 +1505,8 @@ void fdb_kv_print(fdb_kvdb_t db) | |||
kv_iterator(db, &kv, &using_size, db, print_kv_cb); | |||
|
|||
FDB_PRINT("\nmode: next generation\n"); | |||
FDB_PRINT("size: %" PRIu32 "/%" PRIu32 " bytes.\n", (uint32_t)using_size + ((SECTOR_NUM - FDB_GC_EMPTY_SEC_THRESHOLD) * SECTOR_HDR_DATA_SIZE), | |||
db_max_size(db) - db_sec_size(db) * FDB_GC_EMPTY_SEC_THRESHOLD); | |||
FDB_PRINT("size: %lu/%lu bytes.\n", (unsigned long)((uint32_t)using_size + ((SECTOR_NUM - FDB_GC_EMPTY_SEC_THRESHOLD) * SECTOR_HDR_DATA_SIZE)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FDB_PRINT("size: %lu/%lu bytes.\n", (unsigned long)((uint32_t)using_size + ((SECTOR_NUM - FDB_GC_EMPTY_SEC_THRESHOLD) * SECTOR_HDR_DATA_SIZE)), | |
FDB_PRINT("size: %" PRIu32 "/%" PRIu32 " bytes.\n", (uint32_t)(using_size + ((SECTOR_NUM - FDB_GC_EMPTY_SEC_THRESHOLD) * SECTOR_HDR_DATA_SIZE)), |
Is it possible to modify it like this?
FDB_PRINT("size: %" PRIu32 "/%" PRIu32 " bytes.\n", (uint32_t)using_size + ((SECTOR_NUM - FDB_GC_EMPTY_SEC_THRESHOLD) * SECTOR_HDR_DATA_SIZE), | ||
db_max_size(db) - db_sec_size(db) * FDB_GC_EMPTY_SEC_THRESHOLD); | ||
FDB_PRINT("size: %lu/%lu bytes.\n", (unsigned long)((uint32_t)using_size + ((SECTOR_NUM - FDB_GC_EMPTY_SEC_THRESHOLD) * SECTOR_HDR_DATA_SIZE)), | ||
(unsigned long)db_max_size(db) - (unsigned long)db_sec_size(db) * FDB_GC_EMPTY_SEC_THRESHOLD); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(unsigned long)db_max_size(db) - (unsigned long)db_sec_size(db) * FDB_GC_EMPTY_SEC_THRESHOLD); | |
(uint32_t)(db_max_size(db) - db_sec_size(db) * FDB_GC_EMPTY_SEC_THRESHOLD)); |
@@ -1076,7 +1076,7 @@ static uint32_t new_kv(fdb_kvdb_t db, kv_sec_info_t sector, size_t kv_size) | |||
already_gc = true; | |||
goto __retry; | |||
} else if (already_gc) { | |||
FDB_INFO("Error: Alloc an KV (size %" PRIuLEAST16 ") failed after GC. KV full.\n", kv_size); | |||
FDB_INFO("Error: Alloc an KV (size %" PRIuPTR ") failed after GC. KV full.\n", (uintptr_t)kv_size); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FDB_INFO("Error: Alloc an KV (size %" PRIuPTR ") failed after GC. KV full.\n", (uintptr_t)kv_size); | |
FDB_INFO("Error: Alloc an KV (size %" PRIu32 ") failed after GC. KV full.\n", (uint32_t)kv_size); |
Is it possible to modify it like this?
Warning pulled from compiler fixed
OS tested:
RHEL 8
,RHEL 9
This branch contains some changes to original code to cast trought forgot variation of data types moved from a function to another, look up changes to understand my edit.
status
struct has been initialized to {0, 0} to prevent errors, if any errors occurs while using it, the final code result on DB should not be affected.also
FDB_PRINT()
has been modified to match the required data types as args on different calls.