Fix for size_t related warnings.

This commit is contained in:
Stefan Sommerfeld 2010-11-07 15:16:33 -02:00 committed by Marcelo Roberto Jimenez
parent 243cd41974
commit fcb5e7c438
6 changed files with 47 additions and 45 deletions

View File

@ -2412,7 +2412,7 @@ EXPORT_SPEC int UpnpReadHttpGet(
/*! [in,out] The buffer to store the read item. */ /*! [in,out] The buffer to store the read item. */
char *buf, char *buf,
/*! [in,out] The size of the buffer to be read. */ /*! [in,out] The size of the buffer to be read. */
unsigned int *size, size_t *size,
/*! [in] The time out value sent with the request during which a response is /*! [in] The time out value sent with the request during which a response is
* expected from the server, failing which, an error is reported back to * expected from the server, failing which, an error is reported back to
* the user. */ * the user. */
@ -2431,9 +2431,9 @@ EXPORT_SPEC int UpnpHttpGetProgress(
/*! [in] The token created by the call to \b UpnpOpenHttpGet. */ /*! [in] The token created by the call to \b UpnpOpenHttpGet. */
void *handle, void *handle,
/*! [out] The number of bytes received. */ /*! [out] The number of bytes received. */
unsigned int *length, size_t *length,
/*! [out] The content length. */ /*! [out] The content length. */
unsigned int *total); size_t *total);
/*! /*!

View File

@ -1440,12 +1440,12 @@ static int GetDescDocumentAndURL(
if (fp == NULL) { if (fp == NULL) {
return UPNP_E_FILE_NOT_FOUND; return UPNP_E_FILE_NOT_FOUND;
} }
membuf = (char *)malloc(fileLen + 1); membuf = (char *)malloc((size_t) fileLen + 1);
if (membuf == NULL) { if (membuf == NULL) {
fclose(fp); fclose(fp);
return UPNP_E_OUTOF_MEMORY; return UPNP_E_OUTOF_MEMORY;
} }
num_read = fread(membuf, 1, fileLen, fp); num_read = fread(membuf, 1, (size_t) fileLen, fp);
if (num_read != fileLen) { if (num_read != fileLen) {
fclose(fp); fclose(fp);
free(membuf); free(membuf);
@ -2877,13 +2877,13 @@ int UpnpCloseHttpGet(void *Handle)
} }
int UpnpReadHttpGet(void *Handle, char *buf, unsigned int *size, int timeout) int UpnpReadHttpGet(void *Handle, char *buf, size_t *size, int timeout)
{ {
return http_ReadHttpGet(Handle, buf, size, timeout); return http_ReadHttpGet(Handle, buf, size, timeout);
} }
int UpnpHttpGetProgress(void *Handle, unsigned int *length, unsigned int *total) int UpnpHttpGetProgress(void *Handle, size_t *length, size_t *total)
{ {
return http_HttpGetProgress(Handle, length, total); return http_HttpGetProgress(Handle, length, total);
} }

View File

@ -102,7 +102,7 @@ static int GeneratePropertySet(
{ {
char *buffer; char *buffer;
int counter = 0; int counter = 0;
int size = 0; size_t size = 0;
int temp_counter = 0; int temp_counter = 0;
/*size += strlen(XML_VERSION);*/ /*size += strlen(XML_VERSION);*/
@ -445,7 +445,7 @@ static char *AllocGenaHeaders(
static const char *HEADER_LINE_4 = static const char *HEADER_LINE_4 =
"NTS: upnp:propchange\r\n"; "NTS: upnp:propchange\r\n";
char *headers = NULL; char *headers = NULL;
int headers_size = 0; size_t headers_size = 0;
int line = 0; int line = 0;
headers_size = headers_size =
@ -1133,7 +1133,7 @@ static int create_url_list(
URL_list *out) URL_list *out)
{ {
int URLcount = 0; int URLcount = 0;
int i; size_t i;
int return_code = 0; int return_code = 0;
uri_type temp; uri_type temp;
token urls; token urls;

View File

@ -928,7 +928,7 @@ int StopMiniServer()
SOCKET sock; SOCKET sock;
struct sockaddr_in ssdpAddr; struct sockaddr_in ssdpAddr;
char buf[256] = "ShutDown"; char buf[256] = "ShutDown";
int bufLen = strlen(buf); size_t bufLen = strlen(buf);
if(gMServState == MSERV_RUNNING) { if(gMServState == MSERV_RUNNING) {
gMServState = MSERV_STOPPING; gMServState = MSERV_STOPPING;
@ -947,8 +947,8 @@ int StopMiniServer()
ssdpAddr.sin_family = AF_INET; ssdpAddr.sin_family = AF_INET;
ssdpAddr.sin_addr.s_addr = inet_addr("127.0.0.1"); ssdpAddr.sin_addr.s_addr = inet_addr("127.0.0.1");
ssdpAddr.sin_port = htons(miniStopSockPort); ssdpAddr.sin_port = htons(miniStopSockPort);
sendto(sock, buf, bufLen, 0, (struct sockaddr *)&ssdpAddr, sendto(sock, buf, (int)bufLen, 0,
socklen); (struct sockaddr *)&ssdpAddr, socklen);
usleep(1000); usleep(1000);
if (gMServState == MSERV_IDLE) { if (gMServState == MSERV_IDLE) {
break; break;

View File

@ -1440,10 +1440,10 @@ ReadResponseLineAndHeaders( IN SOCKINFO * info,
* Function: http_ReadHttpGet * Function: http_ReadHttpGet
* *
* Parameters: * Parameters:
* IN void *Handle; Handle to the HTTP get object * IN void *Handle; Handle to the HTTP get object
* IN OUT char *buf; Buffer to get the read and parsed data * IN OUT char *buf; Buffer to get the read and parsed data
* IN OUT unsigned int *size; Size of the buffer passed * IN OUT size_t *size; Size of the buffer passed
* IN int timeout; time out value * IN int timeout; time out value
* *
* Description: * Description:
* Parses already existing data, then gets new data. * Parses already existing data, then gets new data.
@ -1456,11 +1456,11 @@ ReadResponseLineAndHeaders( IN SOCKINFO * info,
* UPNP_E_BAD_HTTPMSG * UPNP_E_BAD_HTTPMSG
* UPNP_E_CANCELED * UPNP_E_CANCELED
************************************************************************/ ************************************************************************/
int int http_ReadHttpGet(
http_ReadHttpGet( IN void *Handle, IN void *Handle,
IN OUT char *buf, IN OUT char *buf,
IN OUT unsigned int *size, IN OUT size_t *size,
IN int timeout ) IN int timeout)
{ {
http_get_handle_t *handle = Handle; http_get_handle_t *handle = Handle;
@ -1567,9 +1567,9 @@ http_ReadHttpGet( IN void *Handle,
* Function: http_HttpGetProgress * Function: http_HttpGetProgress
* *
* Parameters: * Parameters:
* IN void *Handle; Handle to the HTTP get object * IN void *Handle; Handle to the HTTP get object
* OUT unsigned int *length; Buffer to get the read and parsed data * OUT size_t *length; Buffer to get the read and parsed data
* OUT unsigned int *total; Size of tge buffer passed * OUT size_t *total; Size of tge buffer passed
* *
* Description: * Description:
* Extracts information from the Handle to the HTTP get object. * Extracts information from the Handle to the HTTP get object.
@ -1578,18 +1578,20 @@ http_ReadHttpGet( IN void *Handle,
* UPNP_E_SUCCESS - On Sucess * UPNP_E_SUCCESS - On Sucess
* UPNP_E_INVALID_PARAM - Invalid Parameter * UPNP_E_INVALID_PARAM - Invalid Parameter
************************************************************************/ ************************************************************************/
int http_HttpGetProgress( IN void *Handle, int http_HttpGetProgress(
OUT unsigned int *length, IN void *Handle,
OUT unsigned int *total ) OUT size_t *length,
OUT size_t *total)
{ {
http_get_handle_t *handle = Handle; http_get_handle_t *handle = Handle;
if( ( !handle ) || ( !length ) || ( !total ) ) { if (!handle || !length || !total) {
return UPNP_E_INVALID_PARAM; return UPNP_E_INVALID_PARAM;
} }
*length = handle->response.msg.entity.length; *length = handle->response.msg.entity.length;
*total = handle->response.content_length; *total = handle->response.content_length;
return UPNP_E_SUCCESS;
return UPNP_E_SUCCESS;
} }
/************************************************************************ /************************************************************************

View File

@ -313,10 +313,10 @@ int http_OpenHttpPost(IN const char *url_str,
* Function: http_ReadHttpGet * Function: http_ReadHttpGet
* *
* Parameters: * Parameters:
* IN void *Handle; Handle to the HTTP get object * IN void *Handle; Handle to the HTTP get object
* IN OUT char *buf; Buffer to get the read and parsed data * IN OUT char *buf; Buffer to get the read and parsed data
* IN OUT unsigned int *size; Size of the buffer passed * IN OUT size_t *size; Size of the buffer passed
* IN int timeout; time out value * IN int timeout; time out value
* *
* Description: * Description:
* Parses already existing data, then gets new data. * Parses already existing data, then gets new data.
@ -332,7 +332,7 @@ int http_OpenHttpPost(IN const char *url_str,
int http_ReadHttpGet( int http_ReadHttpGet(
IN void *Handle, IN void *Handle,
IN OUT char *buf, IN OUT char *buf,
IN OUT unsigned int *size, IN OUT size_t *size,
IN int timeout); IN int timeout);
@ -340,9 +340,9 @@ int http_ReadHttpGet(
* Function: http_HttpGetProgress * Function: http_HttpGetProgress
* *
* Parameters: * Parameters:
* IN void *Handle; Handle to the HTTP get object * IN void *Handle; Handle to the HTTP get object
* OUT unsigned int *length; Buffer to get the read and parsed data * OUT size_t *length; Buffer to get the read and parsed data
* OUT unsigned int *total; Size of tge buffer passed * OUT size_t *total; Size of tge buffer passed
* *
* Description: * Description:
* Extracts information from the Handle to the HTTP get object. * Extracts information from the Handle to the HTTP get object.
@ -353,8 +353,8 @@ int http_ReadHttpGet(
************************************************************************/ ************************************************************************/
int http_HttpGetProgress( int http_HttpGetProgress(
IN void *Handle, IN void *Handle,
OUT unsigned int *length, OUT size_t *length,
OUT unsigned int *total ); OUT size_t *total);
/************************************************************************ /************************************************************************