From c6e150ae2add2ccfeb3aa583dc2b9a19d6ff27b2 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Tue, 21 Feb 2017 20:07:13 +0100 Subject: [PATCH] Fix CXX_BUILD --- deps/miniupnpc/minisoap.c | 2 +- deps/miniupnpc/minissdpc.c | 4 ++-- deps/miniupnpc/miniupnpc.c | 12 ++++++------ deps/miniupnpc/miniwget.c | 16 ++++++++-------- deps/miniupnpc/portlistingparse.c | 2 +- deps/miniupnpc/upnpcommands.c | 26 +++++++++++++------------- deps/miniupnpc/upnpreplyparse.c | 4 ++-- 7 files changed, 33 insertions(+), 33 deletions(-) diff --git a/deps/miniupnpc/minisoap.c b/deps/miniupnpc/minisoap.c index 5c9a11438f..ce7cc3953c 100644 --- a/deps/miniupnpc/minisoap.c +++ b/deps/miniupnpc/minisoap.c @@ -44,7 +44,7 @@ httpWrite(int fd, const char * body, int bodysize, * soap request that are sent into only one packet */ char * p; /* TODO: AVOID MALLOC, we could use writev() for that */ - p = malloc(headerssize+bodysize); + p = (char*)malloc(headerssize+bodysize); if(!p) return -1; memcpy(p, headers, headerssize); diff --git a/deps/miniupnpc/minissdpc.c b/deps/miniupnpc/minissdpc.c index 5c790e4ca1..59016c8549 100644 --- a/deps/miniupnpc/minissdpc.c +++ b/deps/miniupnpc/minissdpc.c @@ -295,7 +295,7 @@ receiveDevicesFromMiniSSDPD(int s, int * error) #ifdef DEBUG printf(" urlsize=%u", urlsize); #endif /* DEBUG */ - url = malloc(urlsize); + url = (unsigned char*)malloc(urlsize); if(url == NULL) { if (error) *error = MINISSDPC_MEMORY_ERROR; @@ -316,7 +316,7 @@ receiveDevicesFromMiniSSDPD(int s, int * error) #ifdef DEBUG printf(" stsize=%u", stsize); #endif /* DEBUG */ - st = malloc(stsize); + st = (unsigned char*)malloc(stsize); if (st == NULL) { if (error) *error = MINISSDPC_MEMORY_ERROR; diff --git a/deps/miniupnpc/miniupnpc.c b/deps/miniupnpc/miniupnpc.c index 5eb9500e30..d2d4e57bbe 100644 --- a/deps/miniupnpc/miniupnpc.c +++ b/deps/miniupnpc/miniupnpc.c @@ -230,7 +230,7 @@ char * simpleUPnPcommand2(int s, const char * url, const char * service, return NULL; } - buf = getHTTPResponse(s, bufsize, &status_code); + buf = (char*)getHTTPResponse(s, bufsize, &status_code); #ifdef DEBUG if(*bufsize > 0 && buf) { @@ -432,7 +432,7 @@ build_absolute_url(const char * baseurl, const char * descURL, base = (baseurl[0] == '\0') ? descURL : baseurl; n = strlen(base); if(n > 7) { - p = strchr(base + 7, '/'); + p = (char*)strchr(base + 7, '/'); if(p) 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); #endif /* defined(IF_NAMESIZE) && !defined(_WIN32) */ } - s = malloc(l); + s = (char*)malloc(l); if(s == NULL) return NULL; memcpy(s, base, n); if(scope_id != 0) { @@ -585,7 +585,7 @@ UPNP_GetValidIGD(struct UPNPDev * devlist, ndev++; if(ndev > 0) { - desc = calloc(ndev, sizeof(struct xml_desc)); + desc = (struct xml_desc*)calloc(ndev, sizeof(struct xml_desc)); if(!desc) return -1; /* memory allocation error */ } @@ -594,7 +594,7 @@ UPNP_GetValidIGD(struct UPNPDev * devlist, { /* we should choose an internet gateway device. * 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), dev->scope_id, &status_code); #ifdef DEBUG @@ -705,7 +705,7 @@ UPNP_GetIGDFromUrl(const char * rootdescurl, char * descXML; int descXMLsize = 0; - descXML = miniwget_getaddr(rootdescurl, &descXMLsize, + descXML = (char*)miniwget_getaddr(rootdescurl, &descXMLsize, lanaddr, lanaddrlen, 0, NULL); if(descXML) { memset(data, 0, sizeof(struct IGDdatas)); diff --git a/deps/miniupnpc/miniwget.c b/deps/miniupnpc/miniwget.c index 84b392b372..4c5446fe82 100644 --- a/deps/miniupnpc/miniwget.c +++ b/deps/miniupnpc/miniwget.c @@ -89,7 +89,7 @@ getHTTPResponse(int s, int * size, int * status_code) #endif if(status_code) *status_code = -1; - header_buf = malloc(header_buf_len); + header_buf = (char*)malloc(header_buf_len); if(header_buf == NULL) { #ifdef DEBUG @@ -98,7 +98,7 @@ getHTTPResponse(int s, int * size, int * status_code) *size = -1; return NULL; } - content_buf = malloc(content_buf_len); + content_buf = (char*)malloc(content_buf_len); if(content_buf == NULL) { free(header_buf); @@ -120,7 +120,7 @@ getHTTPResponse(int s, int * size, int * status_code) int colon=0; int valuestart=0; 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) { /* memory allocation error */ free(header_buf); @@ -293,7 +293,7 @@ getHTTPResponse(int s, int * size, int * status_code) } else { 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) { /* memory allocation error */ free(content_buf); @@ -325,7 +325,7 @@ getHTTPResponse(int s, int * size, int * status_code) } else { 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) { /* memory allocation error */ free(content_buf); @@ -481,11 +481,11 @@ miniwget2(const char * host, char * respbuffer; #if 1 - respbuffer = miniwget3(host, port, path, size, + respbuffer = (char*)miniwget3(host, port, path, size, addr_str, addr_str_len, "1.1", scope_id, status_code); #else - respbuffer = miniwget3(host, port, path, size, + respbuffer = (char*)miniwget3(host, port, path, size, addr_str, addr_str_len, "1.0", scope_id, status_code); if (*size == 0) @@ -523,7 +523,7 @@ parseURL(const char * url, char * p1, *p2, *p3; if(!url) return 0; - p1 = strstr(url, "://"); + p1 = (char*)strstr(url, "://"); if(!p1) return 0; p1 += 3; diff --git a/deps/miniupnpc/portlistingparse.c b/deps/miniupnpc/portlistingparse.c index 722fed2bc7..e864c0eb70 100644 --- a/deps/miniupnpc/portlistingparse.c +++ b/deps/miniupnpc/portlistingparse.c @@ -64,7 +64,7 @@ startelt(void * d, const char * name, int l) if(pdata->curelt == PortMappingEntry) { struct PortMapping * pm; - pm = calloc(1, sizeof(struct PortMapping)); + pm = (struct PortMapping*)calloc(1, sizeof(struct PortMapping)); if(pm == NULL) { /* malloc error */ diff --git a/deps/miniupnpc/upnpcommands.c b/deps/miniupnpc/upnpcommands.c index 9f704496fb..50f3eecba6 100644 --- a/deps/miniupnpc/upnpcommands.c +++ b/deps/miniupnpc/upnpcommands.c @@ -354,7 +354,7 @@ UPNP_AddPortMapping(const char * controlURL, const char * servicetype, if(!inPort || !inClient || !proto || !extPort) return UPNPCOMMAND_INVALID_ARGS; - AddPortMappingArgs = calloc(9, sizeof(struct UPNParg)); + AddPortMappingArgs = (struct UPNParg*)calloc(9, sizeof(struct UPNParg)); if(AddPortMappingArgs == NULL) return UPNPCOMMAND_MEM_ALLOC_ERROR; AddPortMappingArgs[0].elt = "NewRemoteHost"; @@ -418,7 +418,7 @@ UPNP_AddAnyPortMapping(const char * controlURL, const char * servicetype, if(!inPort || !inClient || !proto || !extPort) return UPNPCOMMAND_INVALID_ARGS; - AddPortMappingArgs = calloc(9, sizeof(struct UPNParg)); + AddPortMappingArgs = (struct UPNParg*)calloc(9, sizeof(struct UPNParg)); if(AddPortMappingArgs == NULL) return UPNPCOMMAND_MEM_ALLOC_ERROR; AddPortMappingArgs[0].elt = "NewRemoteHost"; @@ -482,7 +482,7 @@ UPNP_DeletePortMapping(const char * controlURL, const char * servicetype, if(!extPort || !proto) return UPNPCOMMAND_INVALID_ARGS; - DeletePortMappingArgs = calloc(4, sizeof(struct UPNParg)); + DeletePortMappingArgs = (struct UPNParg*)calloc(4, sizeof(struct UPNParg)); if(DeletePortMappingArgs == NULL) return UPNPCOMMAND_MEM_ALLOC_ERROR; DeletePortMappingArgs[0].elt = "NewRemoteHost"; @@ -528,7 +528,7 @@ UPNP_DeletePortMappingRange(const char * controlURL, const char * servicetype, if(!extPortStart || !extPortEnd || !proto || !manage) return UPNPCOMMAND_INVALID_ARGS; - DeletePortMappingArgs = calloc(5, sizeof(struct UPNParg)); + DeletePortMappingArgs = (struct UPNParg*)calloc(5, sizeof(struct UPNParg)); if(DeletePortMappingArgs == NULL) return UPNPCOMMAND_MEM_ALLOC_ERROR; DeletePortMappingArgs[0].elt = "NewStartPort"; @@ -583,7 +583,7 @@ UPNP_GetGenericPortMappingEntry(const char * controlURL, return UPNPCOMMAND_INVALID_ARGS; intClient[0] = '\0'; intPort[0] = '\0'; - GetPortMappingArgs = calloc(2, sizeof(struct UPNParg)); + GetPortMappingArgs = (struct UPNParg*)calloc(2, sizeof(struct UPNParg)); if(GetPortMappingArgs == NULL) return UPNPCOMMAND_MEM_ALLOC_ERROR; GetPortMappingArgs[0].elt = "NewPortMappingIndex"; @@ -720,7 +720,7 @@ UPNP_GetSpecificPortMappingEntry(const char * controlURL, if(!intPort || !intClient || !extPort || !proto) return UPNPCOMMAND_INVALID_ARGS; - GetPortMappingArgs = calloc(4, sizeof(struct UPNParg)); + GetPortMappingArgs = (struct UPNParg*)calloc(4, sizeof(struct UPNParg)); if(GetPortMappingArgs == NULL) return UPNPCOMMAND_MEM_ALLOC_ERROR; GetPortMappingArgs[0].elt = "NewRemoteHost"; @@ -811,7 +811,7 @@ UPNP_GetListOfPortMappings(const char * controlURL, if(!startPort || !endPort || !protocol) return UPNPCOMMAND_INVALID_ARGS; - GetListOfPortMappingsArgs = calloc(6, sizeof(struct UPNParg)); + GetListOfPortMappingsArgs = (struct UPNParg*)calloc(6, sizeof(struct UPNParg)); if(GetListOfPortMappingsArgs == NULL) return UPNPCOMMAND_MEM_ALLOC_ERROR; GetListOfPortMappingsArgs[0].elt = "NewStartPort"; @@ -940,7 +940,7 @@ UPNP_GetOutboundPinholeTimeout(const char * controlURL, const char * servicetype if(!intPort || !intClient || !proto || !remotePort || !remoteHost) return UPNPCOMMAND_INVALID_ARGS; - GetOutboundPinholeTimeoutArgs = calloc(6, sizeof(struct UPNParg)); + GetOutboundPinholeTimeoutArgs = (struct UPNParg*)calloc(6, sizeof(struct UPNParg)); if(GetOutboundPinholeTimeoutArgs == NULL) return UPNPCOMMAND_MEM_ALLOC_ERROR; GetOutboundPinholeTimeoutArgs[0].elt = "RemoteHost"; @@ -998,7 +998,7 @@ UPNP_AddPinhole(const char * controlURL, const char * servicetype, if(!intPort || !intClient || !proto || !remoteHost || !remotePort || !leaseTime) return UPNPCOMMAND_INVALID_ARGS; - AddPinholeArgs = calloc(7, sizeof(struct UPNParg)); + AddPinholeArgs = (struct UPNParg*)calloc(7, sizeof(struct UPNParg)); if(AddPinholeArgs == NULL) return UPNPCOMMAND_MEM_ALLOC_ERROR; /* RemoteHost can be wilcarded */ @@ -1073,7 +1073,7 @@ UPNP_UpdatePinhole(const char * controlURL, const char * servicetype, if(!uniqueID || !leaseTime) return UPNPCOMMAND_INVALID_ARGS; - UpdatePinholeArgs = calloc(3, sizeof(struct UPNParg)); + UpdatePinholeArgs = (struct UPNParg*)calloc(3, sizeof(struct UPNParg)); if(UpdatePinholeArgs == NULL) return UPNPCOMMAND_MEM_ALLOC_ERROR; UpdatePinholeArgs[0].elt = "UniqueID"; @@ -1116,7 +1116,7 @@ UPNP_DeletePinhole(const char * controlURL, const char * servicetype, const char if(!uniqueID) return UPNPCOMMAND_INVALID_ARGS; - DeletePinholeArgs = calloc(2, sizeof(struct UPNParg)); + DeletePinholeArgs = (struct UPNParg*)calloc(2, sizeof(struct UPNParg)); if(DeletePinholeArgs == NULL) return UPNPCOMMAND_MEM_ALLOC_ERROR; DeletePinholeArgs[0].elt = "UniqueID"; @@ -1157,7 +1157,7 @@ UPNP_CheckPinholeWorking(const char * controlURL, const char * servicetype, if(!uniqueID) return UPNPCOMMAND_INVALID_ARGS; - CheckPinholeWorkingArgs = calloc(4, sizeof(struct UPNParg)); + CheckPinholeWorkingArgs = (struct UPNParg*)calloc(4, sizeof(struct UPNParg)); if(CheckPinholeWorkingArgs == NULL) return UPNPCOMMAND_MEM_ALLOC_ERROR; CheckPinholeWorkingArgs[0].elt = "UniqueID"; @@ -1206,7 +1206,7 @@ UPNP_GetPinholePackets(const char * controlURL, const char * servicetype, if(!uniqueID) return UPNPCOMMAND_INVALID_ARGS; - GetPinholePacketsArgs = calloc(4, sizeof(struct UPNParg)); + GetPinholePacketsArgs = (struct UPNParg*)calloc(4, sizeof(struct UPNParg)); if(GetPinholePacketsArgs == NULL) return UPNPCOMMAND_MEM_ALLOC_ERROR; GetPinholePacketsArgs[0].elt = "UniqueID"; diff --git a/deps/miniupnpc/upnpreplyparse.c b/deps/miniupnpc/upnpreplyparse.c index 5de5796a39..30d2daba74 100644 --- a/deps/miniupnpc/upnpreplyparse.c +++ b/deps/miniupnpc/upnpreplyparse.c @@ -39,7 +39,7 @@ NameValueParserEndElt(void * d, const char * name, int l) int l; /* standard case. Limited to n chars strings */ l = data->cdatalen; - nv = malloc(sizeof(struct NameValue)); + nv = (struct NameValue*)malloc(sizeof(struct NameValue)); if(nv == NULL) { /* malloc error */ @@ -77,7 +77,7 @@ NameValueParserGetData(void * d, const char * datas, int l) if(strcmp(data->curelt, "NewPortListing") == 0) { /* specific case for NewPortListing which is a XML Document */ - data->portListing = malloc(l + 1); + data->portListing = (char*)malloc(l + 1); if(!data->portListing) { /* malloc error */