Skip to content

Commit 8b128d7

Browse files
keith-packardmbolivar-nordic
authored andcommitted
samples/soc_flash_nrf: Fix printf usage with off_t values
off_t is often unsigned long, which means printf needs to use %lx. Insert a cast in case the value is unsigned int. Signed-off-by: Keith Packard <[email protected]>
1 parent f70bc95 commit 8b128d7

File tree

1 file changed

+4
-4
lines changed
  • samples/drivers/soc_flash_nrf/src

1 file changed

+4
-4
lines changed

samples/drivers/soc_flash_nrf/src/main.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,8 @@ void main(void)
155155

156156
if (!rc) {
157157
printf(" Offset 0x%08x:\n", FLASH_TEST_OFFSET2);
158-
printf(" belongs to the page %u of start offset 0x%08x\n",
159-
info.index, info.start_offset);
158+
printf(" belongs to the page %u of start offset 0x%08lx\n",
159+
info.index, (unsigned long) info.start_offset);
160160
printf(" and the size of 0x%08x B.\n", info.size);
161161
} else {
162162
printf(" Error: flash_get_page_info_by_offs returns %d\n",
@@ -166,9 +166,9 @@ void main(void)
166166
rc = flash_get_page_info_by_idx(flash_dev, FLASH_TEST_PAGE_IDX, &info);
167167

168168
if (!rc) {
169-
printf(" Page of number %u has start offset 0x%08x\n",
169+
printf(" Page of number %u has start offset 0x%08lx\n",
170170
FLASH_TEST_PAGE_IDX,
171-
info.start_offset);
171+
(unsigned long) info.start_offset);
172172
printf(" and size of 0x%08x B.\n", info.size);
173173
if (info.index == FLASH_TEST_PAGE_IDX) {
174174
printf(" Page index resolved properly\n");

0 commit comments

Comments
 (0)