Fix sign error, int/size_t discrepancies, warnings on windows builds.#936
Fix sign error, int/size_t discrepancies, warnings on windows builds.#936kristjanvalur wants to merge 5 commits intoredis:masterfrom
Conversation
| hi_free(curargv); | ||
| *target = cmd; | ||
| return totlen; | ||
| return (int)totlen; |
There was a problem hiding this comment.
These commands really should return a ssize_t result to be consistent with the use of size_t, but I didn't want to modify their signature since they are a public API
There was a problem hiding this comment.
Since then, have updated to reflect the new api which returns long long. Why that was chosen instead of size_t or ssize_t is unclear.
| hi_free(curargv); | ||
| *target = cmd; | ||
| return totlen; | ||
| return (int)totlen; |
There was a problem hiding this comment.
These commands really should return a ssize_t result to be consistent with the use of size_t, but I didn't want to modify their signature since they are a public API
There was a problem hiding this comment.
since this comment was written, the API has been updated to return long long. Why that was chosen instead of the more standard ssize_t remains unclear.
|
|
||
| for (b = bservinfo; b != NULL; b = b->ai_next) { | ||
| if (bind(s,b->ai_addr,b->ai_addrlen) != -1) { | ||
| if (bind(s,b->ai_addr,(socklen_t)b->ai_addrlen) != -1) { |
There was a problem hiding this comment.
Windows has ai_addren as size_t rather than socklen_t. explicitly cast it to silence warning.
|
|
||
| c->flags |= REDIS_CONNECTED; | ||
| return REDIS_OK; | ||
| oom: |
There was a problem hiding this comment.
Fix error about unused label (windows)
| if (v > ((unsigned long long)(-(LLONG_MIN+1))+1)) /* Overflow. */ | ||
| return REDIS_ERR; | ||
| if (value != NULL) *value = -v; | ||
| if (value != NULL) *value = -(long long)v; |
There was a problem hiding this comment.
warning on windows. Negation of an unsigned variable is shaky ground in C, better to be explicit.
read.c
Outdated
| obj = r->fn->createArray(cur,elements); | ||
| else | ||
| obj = (void*)(long)cur->type; | ||
| obj = (void*)(intptr_t)cur->type; |
There was a problem hiding this comment.
Must use an integral type of the same size as pointer to avoid the (sensible) warning here.
d518279 to
f995a71
Compare
|
Any news here? |
|
In the meantime, there have been some slight fixes upstream. Curiosly, the authors have decided to use |
|
Would it be possible to get some sort of review on ths PR please? |
|
This PR fixes a lot of internal type discrepancies within functions, using return (long long) totlen; /* api really should use ssize_t */I'll be happy to remove those, since they reflect my personal opinion :) |
83fb1a1 to
d7341ca
Compare
|
I've squashed and rebased this on top of current and for amd64 |
A lot of discrepancies with int vs size_t were visible when building on windows.
This PR fixes those.