-
Notifications
You must be signed in to change notification settings - Fork 329
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
Resolve some warnings when MSVC warning level is 4 #240
Open
Demonese
wants to merge
1
commit into
phoboslab:master
Choose a base branch
from
Demonese:less-warning
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 all commits
Commits
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 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 |
---|---|---|
|
@@ -339,10 +339,10 @@ typedef union { | |
static const unsigned char qoi_padding[8] = {0,0,0,0,0,0,0,1}; | ||
|
||
static void qoi_write_32(unsigned char *bytes, int *p, unsigned int v) { | ||
bytes[(*p)++] = (0xff000000 & v) >> 24; | ||
bytes[(*p)++] = (0x00ff0000 & v) >> 16; | ||
bytes[(*p)++] = (0x0000ff00 & v) >> 8; | ||
bytes[(*p)++] = (0x000000ff & v); | ||
bytes[(*p)++] = (v >> 24) & 0xff; | ||
bytes[(*p)++] = (v >> 16) & 0xff; | ||
bytes[(*p)++] = (v >> 8) & 0xff; | ||
bytes[(*p)++] = (v >> 0) & 0xff; | ||
} | ||
|
||
static unsigned int qoi_read_32(const unsigned char *bytes, int *p) { | ||
|
@@ -415,22 +415,22 @@ void *qoi_encode(const void *data, const qoi_desc *desc, int *out_len) { | |
if (px.v == px_prev.v) { | ||
run++; | ||
if (run == 62 || px_pos == px_end) { | ||
bytes[p++] = QOI_OP_RUN | (run - 1); | ||
bytes[p++] = QOI_OP_RUN | (unsigned char)(run - 1); | ||
run = 0; | ||
} | ||
} | ||
else { | ||
int index_pos; | ||
|
||
if (run > 0) { | ||
bytes[p++] = QOI_OP_RUN | (run - 1); | ||
bytes[p++] = QOI_OP_RUN | (unsigned char)(run - 1); | ||
run = 0; | ||
} | ||
|
||
index_pos = QOI_COLOR_HASH(px) % 64; | ||
|
||
if (index[index_pos].v == px.v) { | ||
bytes[p++] = QOI_OP_INDEX | index_pos; | ||
bytes[p++] = QOI_OP_INDEX | (unsigned char)index_pos; | ||
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. same as |
||
} | ||
else { | ||
index[index_pos] = px; | ||
|
@@ -566,9 +566,9 @@ void *qoi_decode(const void *data, int size, qoi_desc *desc, int channels) { | |
else if ((b1 & QOI_MASK_2) == QOI_OP_LUMA) { | ||
int b2 = bytes[p++]; | ||
int vg = (b1 & 0x3f) - 32; | ||
px.rgba.r += vg - 8 + ((b2 >> 4) & 0x0f); | ||
px.rgba.g += vg; | ||
px.rgba.b += vg - 8 + (b2 & 0x0f); | ||
px.rgba.r += (signed char)(vg - 8 + ((b2 >> 4) & 0x0f)); | ||
px.rgba.g += (signed char)(vg); | ||
px.rgba.b += (signed char)(vg - 8 + (b2 & 0x0f)); | ||
} | ||
else if ((b1 & QOI_MASK_2) == QOI_OP_RUN) { | ||
run = (b1 & 0x3f); | ||
|
@@ -637,7 +637,7 @@ void *qoi_read(const char *filename, qoi_desc *desc, int channels) { | |
return NULL; | ||
} | ||
|
||
bytes_read = fread(data, 1, size, f); | ||
bytes_read = (int)fread(data, 1, size, f); | ||
fclose(f); | ||
|
||
pixels = qoi_decode(data, bytes_read, desc, channels); | ||
|
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.
why not declaring
run
as anunsigned char
?