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

urldata: make 'actions[]' use unsigned char instead of int #6648

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 8 additions & 8 deletions lib/multi.c
Expand Up @@ -2526,7 +2526,7 @@ static CURLMcode singlesocket(struct Curl_multi *multi,
curl_socket_t s;
int num;
unsigned int curraction;
int actions[MAX_SOCKSPEREASYHANDLE];
unsigned char actions[MAX_SOCKSPEREASYHANDLE];

for(i = 0; i< MAX_SOCKSPEREASYHANDLE; i++)
socks[i] = CURL_SOCKET_BAD;
Expand All @@ -2543,9 +2543,9 @@ static CURLMcode singlesocket(struct Curl_multi *multi,
for(i = 0; (i< MAX_SOCKSPEREASYHANDLE) &&
(curraction & (GETSOCK_READSOCK(i) | GETSOCK_WRITESOCK(i)));
i++) {
unsigned int action = CURL_POLL_NONE;
unsigned int prevaction = 0;
unsigned int comboaction;
unsigned char action = CURL_POLL_NONE;
unsigned char prevaction = 0;
int comboaction;
bool sincebefore = FALSE;

s = socks[i];
Expand Down Expand Up @@ -2603,10 +2603,10 @@ static CURLMcode singlesocket(struct Curl_multi *multi,
}

comboaction = (entry->writers? CURL_POLL_OUT : 0) |
(entry->readers ? CURL_POLL_IN : 0);
(entry->readers ? CURL_POLL_IN : 0);

/* socket existed before and has the same action set as before */
if(sincebefore && (entry->action == comboaction))
if(sincebefore && ((int)entry->action == comboaction))
/* same, continue */
continue;

Expand Down Expand Up @@ -2639,7 +2639,7 @@ static CURLMcode singlesocket(struct Curl_multi *multi,
/* if this is NULL here, the socket has been closed and notified so
already by Curl_multi_closed() */
if(entry) {
int oldactions = data->actions[i];
unsigned char oldactions = data->actions[i];
/* this socket has been removed. Decrease user count */
entry->users--;
if(oldactions & CURL_POLL_OUT)
Expand All @@ -2664,7 +2664,7 @@ static CURLMcode singlesocket(struct Curl_multi *multi,
} /* for loop over numsocks */

memcpy(data->sockets, socks, num*sizeof(curl_socket_t));
memcpy(data->actions, actions, num*sizeof(int));
memcpy(data->actions, actions, num*sizeof(char));
data->numsocks = num;
return CURLM_OK;
}
Expand Down
4 changes: 2 additions & 2 deletions lib/urldata.h
Expand Up @@ -1918,8 +1918,8 @@ struct Curl_easy {
the state etc are also kept. This array is mostly used to detect when a
socket is to be removed from the hash. See singlesocket(). */
curl_socket_t sockets[MAX_SOCKSPEREASYHANDLE];
int actions[MAX_SOCKSPEREASYHANDLE]; /* action for each socket in
sockets[] */
unsigned char actions[MAX_SOCKSPEREASYHANDLE]; /* action for each socket in
sockets[] */
int numsocks;

struct Names dns;
Expand Down