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

warnings fix #308

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

warnings fix #308

wants to merge 2 commits into from

Conversation

Bosiux
Copy link

@Bosiux Bosiux commented Aug 23, 2024

Warning pulled from compiler fixed

FlashDB_compilation

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.

@@ -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);
Copy link
Owner

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?

@Bosiux Bosiux requested a review from armink September 8, 2024 09:15
@@ -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)),
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
(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);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants