-
Notifications
You must be signed in to change notification settings - Fork 640
Add printf formatting macros for nk data types #773
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
Open
PROP65
wants to merge
13
commits into
Immediate-Mode-UI:master
Choose a base branch
from
PROP65:type_fmt
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 11 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
80dd024
Update nuklear.h
PROP65 479c89b
rebuild nuklear.h
PROP65 79548f4
fix MSVC warning
PROP65 943b652
Make macros more clear
PROP65 290d0c8
Rebuild nuklear.h
PROP65 f862c81
Update macros
PROP65 09438a4
remove hh (not allowed in C89, whoops), change pointers to hex
PROP65 9510cba
Rebuild nuklear.h again
PROP65 8c729d7
Change 32bit formatting on MSVC
PROP65 34d7f1a
Rebuild nuklear.h
PROP65 859c86c
Update changelog for 4.12.5
RobLoach 447fa19
MinGW patch
PROP65 2ea9cb7
Rebuild nuklear.h
PROP65 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -444,7 +444,7 @@ overview(struct nk_context *ctx) | |
} | ||
/* progressbar combobox */ | ||
sum = prog_a + prog_b + prog_c + prog_d; | ||
sprintf(buffer, "%lu", sum); | ||
sprintf(buffer, "%" NK_FMT_SIZE, sum); | ||
if (nk_combo_begin_label(ctx, buffer, nk_vec2(200,200))) { | ||
nk_layout_row_dynamic(ctx, 30, 1); | ||
nk_progress(ctx, &prog_a, 100, NK_MODIFIABLE); | ||
|
@@ -456,7 +456,7 @@ overview(struct nk_context *ctx) | |
|
||
/* checkbox combobox */ | ||
sum = (size_t)(check_values[0] + check_values[1] + check_values[2] + check_values[3] + check_values[4]); | ||
sprintf(buffer, "%lu", sum); | ||
sprintf(buffer, "%" NK_FMT_SIZE, sum); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Warning message:
|
||
if (nk_combo_begin_label(ctx, buffer, nk_vec2(200,200))) { | ||
nk_layout_row_dynamic(ctx, 30, 1); | ||
nk_checkbox_label(ctx, weapons[0], &check_values[0]); | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
On Windows 64 bit, msys2/mingw64 this line gives the following warning message if demo is built in
-std=c89
mode.Compiler settings:
Warning message:
NK_INCLUDE_FIXED_TYPES
is active in the above context.Disabling the macro in the 64 bit build environment fails via assertions like:
The potential reason is this:
On Windows 64 bit, msys2/mingw64 unsigned long is 4 bytes.
Architecture of built software:
The 32 bit build environment, using msys2/mingw32, builds without errors and warnings.
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.
I added checks for MinGW; the static asserts should be fixed. Since there isn't any type in c89 that is guaranteed to be at least 64 bits, it may not be possible on 64 bit windows targets to format
nk_size
in a way that is c89 compliant.Uh oh!
There was an error while loading. Please reload this page.
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.
I checked both
NK_INCLUDE_FIXED_TYPES
active and inactive in 32/64 bit and c89/c99/c11/c17/c23 combinations.The rest are warnings and as noted by PRP65, most are C ISO standards related.
long long
warnings in 64 bit mode which is perfectly fine.