Fix CXX_BUILD

This commit is contained in:
twinaphex 2017-02-21 20:07:13 +01:00
parent f8576ca88c
commit c6e150ae2a
7 changed files with 33 additions and 33 deletions

View File

@ -44,7 +44,7 @@ httpWrite(int fd, const char * body, int bodysize,
* soap request that are sent into only one packet */ * soap request that are sent into only one packet */
char * p; char * p;
/* TODO: AVOID MALLOC, we could use writev() for that */ /* TODO: AVOID MALLOC, we could use writev() for that */
p = malloc(headerssize+bodysize); p = (char*)malloc(headerssize+bodysize);
if(!p) if(!p)
return -1; return -1;
memcpy(p, headers, headerssize); memcpy(p, headers, headerssize);

View File

@ -295,7 +295,7 @@ receiveDevicesFromMiniSSDPD(int s, int * error)
#ifdef DEBUG #ifdef DEBUG
printf(" urlsize=%u", urlsize); printf(" urlsize=%u", urlsize);
#endif /* DEBUG */ #endif /* DEBUG */
url = malloc(urlsize); url = (unsigned char*)malloc(urlsize);
if(url == NULL) { if(url == NULL) {
if (error) if (error)
*error = MINISSDPC_MEMORY_ERROR; *error = MINISSDPC_MEMORY_ERROR;
@ -316,7 +316,7 @@ receiveDevicesFromMiniSSDPD(int s, int * error)
#ifdef DEBUG #ifdef DEBUG
printf(" stsize=%u", stsize); printf(" stsize=%u", stsize);
#endif /* DEBUG */ #endif /* DEBUG */
st = malloc(stsize); st = (unsigned char*)malloc(stsize);
if (st == NULL) { if (st == NULL) {
if (error) if (error)
*error = MINISSDPC_MEMORY_ERROR; *error = MINISSDPC_MEMORY_ERROR;

View File

@ -230,7 +230,7 @@ char * simpleUPnPcommand2(int s, const char * url, const char * service,
return NULL; return NULL;
} }
buf = getHTTPResponse(s, bufsize, &status_code); buf = (char*)getHTTPResponse(s, bufsize, &status_code);
#ifdef DEBUG #ifdef DEBUG
if(*bufsize > 0 && buf) if(*bufsize > 0 && buf)
{ {
@ -432,7 +432,7 @@ build_absolute_url(const char * baseurl, const char * descURL,
base = (baseurl[0] == '\0') ? descURL : baseurl; base = (baseurl[0] == '\0') ? descURL : baseurl;
n = strlen(base); n = strlen(base);
if(n > 7) { if(n > 7) {
p = strchr(base + 7, '/'); p = (char*)strchr(base + 7, '/');
if(p) if(p)
n = p - base; n = p - base;
} }
@ -449,7 +449,7 @@ build_absolute_url(const char * baseurl, const char * descURL,
l += 3 + snprintf(scope_str, sizeof(scope_str), "%u", scope_id); l += 3 + snprintf(scope_str, sizeof(scope_str), "%u", scope_id);
#endif /* defined(IF_NAMESIZE) && !defined(_WIN32) */ #endif /* defined(IF_NAMESIZE) && !defined(_WIN32) */
} }
s = malloc(l); s = (char*)malloc(l);
if(s == NULL) return NULL; if(s == NULL) return NULL;
memcpy(s, base, n); memcpy(s, base, n);
if(scope_id != 0) { if(scope_id != 0) {
@ -585,7 +585,7 @@ UPNP_GetValidIGD(struct UPNPDev * devlist,
ndev++; ndev++;
if(ndev > 0) if(ndev > 0)
{ {
desc = calloc(ndev, sizeof(struct xml_desc)); desc = (struct xml_desc*)calloc(ndev, sizeof(struct xml_desc));
if(!desc) if(!desc)
return -1; /* memory allocation error */ return -1; /* memory allocation error */
} }
@ -594,7 +594,7 @@ UPNP_GetValidIGD(struct UPNPDev * devlist,
{ {
/* we should choose an internet gateway device. /* we should choose an internet gateway device.
* with st == urn:schemas-upnp-org:device:InternetGatewayDevice:1 */ * with st == urn:schemas-upnp-org:device:InternetGatewayDevice:1 */
desc[i].xml = miniwget_getaddr(dev->descURL, &(desc[i].size), desc[i].xml = (char*)miniwget_getaddr(dev->descURL, &(desc[i].size),
myLanAddr, sizeof(myLanAddr), myLanAddr, sizeof(myLanAddr),
dev->scope_id, &status_code); dev->scope_id, &status_code);
#ifdef DEBUG #ifdef DEBUG
@ -705,7 +705,7 @@ UPNP_GetIGDFromUrl(const char * rootdescurl,
char * descXML; char * descXML;
int descXMLsize = 0; int descXMLsize = 0;
descXML = miniwget_getaddr(rootdescurl, &descXMLsize, descXML = (char*)miniwget_getaddr(rootdescurl, &descXMLsize,
lanaddr, lanaddrlen, 0, NULL); lanaddr, lanaddrlen, 0, NULL);
if(descXML) { if(descXML) {
memset(data, 0, sizeof(struct IGDdatas)); memset(data, 0, sizeof(struct IGDdatas));

View File

@ -89,7 +89,7 @@ getHTTPResponse(int s, int * size, int * status_code)
#endif #endif
if(status_code) *status_code = -1; if(status_code) *status_code = -1;
header_buf = malloc(header_buf_len); header_buf = (char*)malloc(header_buf_len);
if(header_buf == NULL) if(header_buf == NULL)
{ {
#ifdef DEBUG #ifdef DEBUG
@ -98,7 +98,7 @@ getHTTPResponse(int s, int * size, int * status_code)
*size = -1; *size = -1;
return NULL; return NULL;
} }
content_buf = malloc(content_buf_len); content_buf = (char*)malloc(content_buf_len);
if(content_buf == NULL) if(content_buf == NULL)
{ {
free(header_buf); free(header_buf);
@ -120,7 +120,7 @@ getHTTPResponse(int s, int * size, int * status_code)
int colon=0; int colon=0;
int valuestart=0; int valuestart=0;
if(header_buf_used + n > header_buf_len) { if(header_buf_used + n > header_buf_len) {
char * tmp = realloc(header_buf, header_buf_used + n); char * tmp = (char*)realloc(header_buf, header_buf_used + n);
if(tmp == NULL) { if(tmp == NULL) {
/* memory allocation error */ /* memory allocation error */
free(header_buf); free(header_buf);
@ -293,7 +293,7 @@ getHTTPResponse(int s, int * size, int * status_code)
} else { } else {
content_buf_len = content_buf_used + bytestocopy; content_buf_len = content_buf_used + bytestocopy;
} }
tmp = realloc(content_buf, content_buf_len); tmp = (char*)realloc(content_buf, content_buf_len);
if(tmp == NULL) { if(tmp == NULL) {
/* memory allocation error */ /* memory allocation error */
free(content_buf); free(content_buf);
@ -325,7 +325,7 @@ getHTTPResponse(int s, int * size, int * status_code)
} else { } else {
content_buf_len = content_buf_used + n; content_buf_len = content_buf_used + n;
} }
tmp = realloc(content_buf, content_buf_len); tmp = (char*)realloc(content_buf, content_buf_len);
if(tmp == NULL) { if(tmp == NULL) {
/* memory allocation error */ /* memory allocation error */
free(content_buf); free(content_buf);
@ -481,11 +481,11 @@ miniwget2(const char * host,
char * respbuffer; char * respbuffer;
#if 1 #if 1
respbuffer = miniwget3(host, port, path, size, respbuffer = (char*)miniwget3(host, port, path, size,
addr_str, addr_str_len, "1.1", addr_str, addr_str_len, "1.1",
scope_id, status_code); scope_id, status_code);
#else #else
respbuffer = miniwget3(host, port, path, size, respbuffer = (char*)miniwget3(host, port, path, size,
addr_str, addr_str_len, "1.0", addr_str, addr_str_len, "1.0",
scope_id, status_code); scope_id, status_code);
if (*size == 0) if (*size == 0)
@ -523,7 +523,7 @@ parseURL(const char * url,
char * p1, *p2, *p3; char * p1, *p2, *p3;
if(!url) if(!url)
return 0; return 0;
p1 = strstr(url, "://"); p1 = (char*)strstr(url, "://");
if(!p1) if(!p1)
return 0; return 0;
p1 += 3; p1 += 3;

View File

@ -64,7 +64,7 @@ startelt(void * d, const char * name, int l)
if(pdata->curelt == PortMappingEntry) if(pdata->curelt == PortMappingEntry)
{ {
struct PortMapping * pm; struct PortMapping * pm;
pm = calloc(1, sizeof(struct PortMapping)); pm = (struct PortMapping*)calloc(1, sizeof(struct PortMapping));
if(pm == NULL) if(pm == NULL)
{ {
/* malloc error */ /* malloc error */

View File

@ -354,7 +354,7 @@ UPNP_AddPortMapping(const char * controlURL, const char * servicetype,
if(!inPort || !inClient || !proto || !extPort) if(!inPort || !inClient || !proto || !extPort)
return UPNPCOMMAND_INVALID_ARGS; return UPNPCOMMAND_INVALID_ARGS;
AddPortMappingArgs = calloc(9, sizeof(struct UPNParg)); AddPortMappingArgs = (struct UPNParg*)calloc(9, sizeof(struct UPNParg));
if(AddPortMappingArgs == NULL) if(AddPortMappingArgs == NULL)
return UPNPCOMMAND_MEM_ALLOC_ERROR; return UPNPCOMMAND_MEM_ALLOC_ERROR;
AddPortMappingArgs[0].elt = "NewRemoteHost"; AddPortMappingArgs[0].elt = "NewRemoteHost";
@ -418,7 +418,7 @@ UPNP_AddAnyPortMapping(const char * controlURL, const char * servicetype,
if(!inPort || !inClient || !proto || !extPort) if(!inPort || !inClient || !proto || !extPort)
return UPNPCOMMAND_INVALID_ARGS; return UPNPCOMMAND_INVALID_ARGS;
AddPortMappingArgs = calloc(9, sizeof(struct UPNParg)); AddPortMappingArgs = (struct UPNParg*)calloc(9, sizeof(struct UPNParg));
if(AddPortMappingArgs == NULL) if(AddPortMappingArgs == NULL)
return UPNPCOMMAND_MEM_ALLOC_ERROR; return UPNPCOMMAND_MEM_ALLOC_ERROR;
AddPortMappingArgs[0].elt = "NewRemoteHost"; AddPortMappingArgs[0].elt = "NewRemoteHost";
@ -482,7 +482,7 @@ UPNP_DeletePortMapping(const char * controlURL, const char * servicetype,
if(!extPort || !proto) if(!extPort || !proto)
return UPNPCOMMAND_INVALID_ARGS; return UPNPCOMMAND_INVALID_ARGS;
DeletePortMappingArgs = calloc(4, sizeof(struct UPNParg)); DeletePortMappingArgs = (struct UPNParg*)calloc(4, sizeof(struct UPNParg));
if(DeletePortMappingArgs == NULL) if(DeletePortMappingArgs == NULL)
return UPNPCOMMAND_MEM_ALLOC_ERROR; return UPNPCOMMAND_MEM_ALLOC_ERROR;
DeletePortMappingArgs[0].elt = "NewRemoteHost"; DeletePortMappingArgs[0].elt = "NewRemoteHost";
@ -528,7 +528,7 @@ UPNP_DeletePortMappingRange(const char * controlURL, const char * servicetype,
if(!extPortStart || !extPortEnd || !proto || !manage) if(!extPortStart || !extPortEnd || !proto || !manage)
return UPNPCOMMAND_INVALID_ARGS; return UPNPCOMMAND_INVALID_ARGS;
DeletePortMappingArgs = calloc(5, sizeof(struct UPNParg)); DeletePortMappingArgs = (struct UPNParg*)calloc(5, sizeof(struct UPNParg));
if(DeletePortMappingArgs == NULL) if(DeletePortMappingArgs == NULL)
return UPNPCOMMAND_MEM_ALLOC_ERROR; return UPNPCOMMAND_MEM_ALLOC_ERROR;
DeletePortMappingArgs[0].elt = "NewStartPort"; DeletePortMappingArgs[0].elt = "NewStartPort";
@ -583,7 +583,7 @@ UPNP_GetGenericPortMappingEntry(const char * controlURL,
return UPNPCOMMAND_INVALID_ARGS; return UPNPCOMMAND_INVALID_ARGS;
intClient[0] = '\0'; intClient[0] = '\0';
intPort[0] = '\0'; intPort[0] = '\0';
GetPortMappingArgs = calloc(2, sizeof(struct UPNParg)); GetPortMappingArgs = (struct UPNParg*)calloc(2, sizeof(struct UPNParg));
if(GetPortMappingArgs == NULL) if(GetPortMappingArgs == NULL)
return UPNPCOMMAND_MEM_ALLOC_ERROR; return UPNPCOMMAND_MEM_ALLOC_ERROR;
GetPortMappingArgs[0].elt = "NewPortMappingIndex"; GetPortMappingArgs[0].elt = "NewPortMappingIndex";
@ -720,7 +720,7 @@ UPNP_GetSpecificPortMappingEntry(const char * controlURL,
if(!intPort || !intClient || !extPort || !proto) if(!intPort || !intClient || !extPort || !proto)
return UPNPCOMMAND_INVALID_ARGS; return UPNPCOMMAND_INVALID_ARGS;
GetPortMappingArgs = calloc(4, sizeof(struct UPNParg)); GetPortMappingArgs = (struct UPNParg*)calloc(4, sizeof(struct UPNParg));
if(GetPortMappingArgs == NULL) if(GetPortMappingArgs == NULL)
return UPNPCOMMAND_MEM_ALLOC_ERROR; return UPNPCOMMAND_MEM_ALLOC_ERROR;
GetPortMappingArgs[0].elt = "NewRemoteHost"; GetPortMappingArgs[0].elt = "NewRemoteHost";
@ -811,7 +811,7 @@ UPNP_GetListOfPortMappings(const char * controlURL,
if(!startPort || !endPort || !protocol) if(!startPort || !endPort || !protocol)
return UPNPCOMMAND_INVALID_ARGS; return UPNPCOMMAND_INVALID_ARGS;
GetListOfPortMappingsArgs = calloc(6, sizeof(struct UPNParg)); GetListOfPortMappingsArgs = (struct UPNParg*)calloc(6, sizeof(struct UPNParg));
if(GetListOfPortMappingsArgs == NULL) if(GetListOfPortMappingsArgs == NULL)
return UPNPCOMMAND_MEM_ALLOC_ERROR; return UPNPCOMMAND_MEM_ALLOC_ERROR;
GetListOfPortMappingsArgs[0].elt = "NewStartPort"; GetListOfPortMappingsArgs[0].elt = "NewStartPort";
@ -940,7 +940,7 @@ UPNP_GetOutboundPinholeTimeout(const char * controlURL, const char * servicetype
if(!intPort || !intClient || !proto || !remotePort || !remoteHost) if(!intPort || !intClient || !proto || !remotePort || !remoteHost)
return UPNPCOMMAND_INVALID_ARGS; return UPNPCOMMAND_INVALID_ARGS;
GetOutboundPinholeTimeoutArgs = calloc(6, sizeof(struct UPNParg)); GetOutboundPinholeTimeoutArgs = (struct UPNParg*)calloc(6, sizeof(struct UPNParg));
if(GetOutboundPinholeTimeoutArgs == NULL) if(GetOutboundPinholeTimeoutArgs == NULL)
return UPNPCOMMAND_MEM_ALLOC_ERROR; return UPNPCOMMAND_MEM_ALLOC_ERROR;
GetOutboundPinholeTimeoutArgs[0].elt = "RemoteHost"; GetOutboundPinholeTimeoutArgs[0].elt = "RemoteHost";
@ -998,7 +998,7 @@ UPNP_AddPinhole(const char * controlURL, const char * servicetype,
if(!intPort || !intClient || !proto || !remoteHost || !remotePort || !leaseTime) if(!intPort || !intClient || !proto || !remoteHost || !remotePort || !leaseTime)
return UPNPCOMMAND_INVALID_ARGS; return UPNPCOMMAND_INVALID_ARGS;
AddPinholeArgs = calloc(7, sizeof(struct UPNParg)); AddPinholeArgs = (struct UPNParg*)calloc(7, sizeof(struct UPNParg));
if(AddPinholeArgs == NULL) if(AddPinholeArgs == NULL)
return UPNPCOMMAND_MEM_ALLOC_ERROR; return UPNPCOMMAND_MEM_ALLOC_ERROR;
/* RemoteHost can be wilcarded */ /* RemoteHost can be wilcarded */
@ -1073,7 +1073,7 @@ UPNP_UpdatePinhole(const char * controlURL, const char * servicetype,
if(!uniqueID || !leaseTime) if(!uniqueID || !leaseTime)
return UPNPCOMMAND_INVALID_ARGS; return UPNPCOMMAND_INVALID_ARGS;
UpdatePinholeArgs = calloc(3, sizeof(struct UPNParg)); UpdatePinholeArgs = (struct UPNParg*)calloc(3, sizeof(struct UPNParg));
if(UpdatePinholeArgs == NULL) if(UpdatePinholeArgs == NULL)
return UPNPCOMMAND_MEM_ALLOC_ERROR; return UPNPCOMMAND_MEM_ALLOC_ERROR;
UpdatePinholeArgs[0].elt = "UniqueID"; UpdatePinholeArgs[0].elt = "UniqueID";
@ -1116,7 +1116,7 @@ UPNP_DeletePinhole(const char * controlURL, const char * servicetype, const char
if(!uniqueID) if(!uniqueID)
return UPNPCOMMAND_INVALID_ARGS; return UPNPCOMMAND_INVALID_ARGS;
DeletePinholeArgs = calloc(2, sizeof(struct UPNParg)); DeletePinholeArgs = (struct UPNParg*)calloc(2, sizeof(struct UPNParg));
if(DeletePinholeArgs == NULL) if(DeletePinholeArgs == NULL)
return UPNPCOMMAND_MEM_ALLOC_ERROR; return UPNPCOMMAND_MEM_ALLOC_ERROR;
DeletePinholeArgs[0].elt = "UniqueID"; DeletePinholeArgs[0].elt = "UniqueID";
@ -1157,7 +1157,7 @@ UPNP_CheckPinholeWorking(const char * controlURL, const char * servicetype,
if(!uniqueID) if(!uniqueID)
return UPNPCOMMAND_INVALID_ARGS; return UPNPCOMMAND_INVALID_ARGS;
CheckPinholeWorkingArgs = calloc(4, sizeof(struct UPNParg)); CheckPinholeWorkingArgs = (struct UPNParg*)calloc(4, sizeof(struct UPNParg));
if(CheckPinholeWorkingArgs == NULL) if(CheckPinholeWorkingArgs == NULL)
return UPNPCOMMAND_MEM_ALLOC_ERROR; return UPNPCOMMAND_MEM_ALLOC_ERROR;
CheckPinholeWorkingArgs[0].elt = "UniqueID"; CheckPinholeWorkingArgs[0].elt = "UniqueID";
@ -1206,7 +1206,7 @@ UPNP_GetPinholePackets(const char * controlURL, const char * servicetype,
if(!uniqueID) if(!uniqueID)
return UPNPCOMMAND_INVALID_ARGS; return UPNPCOMMAND_INVALID_ARGS;
GetPinholePacketsArgs = calloc(4, sizeof(struct UPNParg)); GetPinholePacketsArgs = (struct UPNParg*)calloc(4, sizeof(struct UPNParg));
if(GetPinholePacketsArgs == NULL) if(GetPinholePacketsArgs == NULL)
return UPNPCOMMAND_MEM_ALLOC_ERROR; return UPNPCOMMAND_MEM_ALLOC_ERROR;
GetPinholePacketsArgs[0].elt = "UniqueID"; GetPinholePacketsArgs[0].elt = "UniqueID";

View File

@ -39,7 +39,7 @@ NameValueParserEndElt(void * d, const char * name, int l)
int l; int l;
/* standard case. Limited to n chars strings */ /* standard case. Limited to n chars strings */
l = data->cdatalen; l = data->cdatalen;
nv = malloc(sizeof(struct NameValue)); nv = (struct NameValue*)malloc(sizeof(struct NameValue));
if(nv == NULL) if(nv == NULL)
{ {
/* malloc error */ /* malloc error */
@ -77,7 +77,7 @@ NameValueParserGetData(void * d, const char * datas, int l)
if(strcmp(data->curelt, "NewPortListing") == 0) if(strcmp(data->curelt, "NewPortListing") == 0)
{ {
/* specific case for NewPortListing which is a XML Document */ /* specific case for NewPortListing which is a XML Document */
data->portListing = malloc(l + 1); data->portListing = (char*)malloc(l + 1);
if(!data->portListing) if(!data->portListing)
{ {
/* malloc error */ /* malloc error */