Fix problems detected as dead assignment warning by clang scan-build.
Wrong assignment by shutdown result hides the real error code
of NewRequestHandler() in ssdp_device.c.
Fix return code description of NewRequestHandler().
Handle return code from ithread_create in sample applications.
Remove unused assignments.
(forward ported from commit 39dfad2cba
)
This commit is contained in:
parent
76e8812acc
commit
c27a089d6f
10
ChangeLog
10
ChangeLog
@ -332,6 +332,16 @@ Version 1.8.0
|
|||||||
Version 1.6.18
|
Version 1.6.18
|
||||||
*******************************************************************************
|
*******************************************************************************
|
||||||
|
|
||||||
|
2012-04-21 Yoichi NAKAYAMA <yoichi.nakayama(at)gmail.com>
|
||||||
|
|
||||||
|
Fix problems detected as dead assignment warning by clang scan-build.
|
||||||
|
|
||||||
|
Wrong assignment by shutdown result hides the real error code
|
||||||
|
of NewRequestHandler() in ssdp_device.c.
|
||||||
|
Fix return code description of NewRequestHandler().
|
||||||
|
Handle return code from ithread_create in sample applications.
|
||||||
|
Remove unused assignments.
|
||||||
|
|
||||||
2012-04-20 Yoichi NAKAYAMA <yoichi.nakayama(at)gmail.com>
|
2012-04-20 Yoichi NAKAYAMA <yoichi.nakayama(at)gmail.com>
|
||||||
|
|
||||||
Avoid dereference of null pointer in ixmlNode_setNodeProperties.
|
Avoid dereference of null pointer in ixmlNode_setNodeProperties.
|
||||||
|
@ -55,6 +55,9 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
/* start a command loop thread */
|
/* start a command loop thread */
|
||||||
code = ithread_create(&cmdloop_thread, NULL, TvCtrlPointCommandLoop, NULL);
|
code = ithread_create(&cmdloop_thread, NULL, TvCtrlPointCommandLoop, NULL);
|
||||||
|
if (code != 0) {
|
||||||
|
return UPNP_E_INTERNAL_ERROR;
|
||||||
|
}
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
ithread_join(cmdloop_thread, NULL);
|
ithread_join(cmdloop_thread, NULL);
|
||||||
#else
|
#else
|
||||||
|
@ -54,6 +54,9 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
/* start a command loop thread */
|
/* start a command loop thread */
|
||||||
code = ithread_create(&cmdloop_thread, NULL, TvCtrlPointCommandLoop, NULL);
|
code = ithread_create(&cmdloop_thread, NULL, TvCtrlPointCommandLoop, NULL);
|
||||||
|
if (code != 0) {
|
||||||
|
return UPNP_E_INTERNAL_ERROR;
|
||||||
|
}
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
ithread_join(cmdloop_thread, NULL);
|
ithread_join(cmdloop_thread, NULL);
|
||||||
#else
|
#else
|
||||||
|
@ -53,6 +53,9 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
/* start a command loop thread */
|
/* start a command loop thread */
|
||||||
code = ithread_create(&cmdloop_thread, NULL, TvDeviceCommandLoop, NULL);
|
code = ithread_create(&cmdloop_thread, NULL, TvDeviceCommandLoop, NULL);
|
||||||
|
if (code != 0) {
|
||||||
|
return UPNP_E_INTERNAL_ERROR;
|
||||||
|
}
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
ithread_join(cmdloop_thread, NULL);
|
ithread_join(cmdloop_thread, NULL);
|
||||||
#else
|
#else
|
||||||
|
@ -102,12 +102,11 @@ static int GeneratePropertySet(
|
|||||||
char *buffer;
|
char *buffer;
|
||||||
int counter = 0;
|
int counter = 0;
|
||||||
size_t size = 0;
|
size_t size = 0;
|
||||||
int temp_counter = 0;
|
|
||||||
|
|
||||||
/*size += strlen(XML_VERSION);*/
|
/*size += strlen(XML_VERSION);*/
|
||||||
size += strlen(XML_PROPERTYSET_HEADER);
|
size += strlen(XML_PROPERTYSET_HEADER);
|
||||||
size += strlen("</e:propertyset>\n\n");
|
size += strlen("</e:propertyset>\n\n");
|
||||||
for (temp_counter = 0, counter = 0; counter < count; counter++) {
|
for (counter = 0; counter < count; counter++) {
|
||||||
size += strlen( "<e:property>\n</e:property>\n" );
|
size += strlen( "<e:property>\n</e:property>\n" );
|
||||||
size += 2 * strlen(names[counter]) +
|
size += 2 * strlen(names[counter]) +
|
||||||
strlen(values[counter]) +
|
strlen(values[counter]) +
|
||||||
|
@ -1000,7 +1000,6 @@ static int ReadResponseLineAndHeaders(
|
|||||||
return num_read;
|
return num_read;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
done = 0;
|
|
||||||
status = parser_parse_headers(parser);
|
status = parser_parse_headers(parser);
|
||||||
if ((status == (parse_status_t)PARSE_OK) &&
|
if ((status == (parse_status_t)PARSE_OK) &&
|
||||||
(parser->position == (parser_pos_t)POS_ENTITY))
|
(parser->position == (parser_pos_t)POS_ENTITY))
|
||||||
|
@ -926,7 +926,6 @@ removeServiceTable( IXML_Node * node,
|
|||||||
long unsigned int i = 0lu;
|
long unsigned int i = 0lu;
|
||||||
|
|
||||||
if( getSubElement( "root", node, &root ) ) {
|
if( getSubElement( "root", node, &root ) ) {
|
||||||
current_service = in->serviceList;
|
|
||||||
start_search = in->serviceList;
|
start_search = in->serviceList;
|
||||||
deviceList =
|
deviceList =
|
||||||
ixmlElement_getElementsByTagName( ( IXML_Element * ) root,
|
ixmlElement_getElementsByTagName( ( IXML_Element * ) root,
|
||||||
|
@ -242,7 +242,6 @@ void ssdp_handle_ctrlpt_msg(http_message_t *hmsg, struct sockaddr_storage *dest_
|
|||||||
/*hdr_value.buf[ hdr_value.length ] = '\0'; */
|
/*hdr_value.buf[ hdr_value.length ] = '\0'; */
|
||||||
while (node != NULL) {
|
while (node != NULL) {
|
||||||
searchArg = node->item;
|
searchArg = node->item;
|
||||||
matched = 0;
|
|
||||||
/* check for match of ST header and search target */
|
/* check for match of ST header and search target */
|
||||||
switch (searchArg->requestType) {
|
switch (searchArg->requestType) {
|
||||||
case SSDP_ALL:
|
case SSDP_ALL:
|
||||||
|
@ -169,7 +169,7 @@ void ssdp_handle_device_request(http_message_t *hmsg, struct sockaddr_storage *d
|
|||||||
* \brief Works as a request handler which passes the HTTP request string
|
* \brief Works as a request handler which passes the HTTP request string
|
||||||
* to multicast channel.
|
* to multicast channel.
|
||||||
*
|
*
|
||||||
* \return 1 if successful else appropriate error.
|
* \return UPNP_E_SUCCESS if successful else appropriate error.
|
||||||
*/
|
*/
|
||||||
static int NewRequestHandler(
|
static int NewRequestHandler(
|
||||||
/*! [in] Ip address, to send the reply. */
|
/*! [in] Ip address, to send the reply. */
|
||||||
@ -246,8 +246,7 @@ static int NewRequestHandler(
|
|||||||
}
|
}
|
||||||
|
|
||||||
end_NewRequestHandler:
|
end_NewRequestHandler:
|
||||||
ret = shutdown(ReplySock, SD_BOTH);
|
if (shutdown(ReplySock, SD_BOTH) == -1) {
|
||||||
if (ret == -1) {
|
|
||||||
strerror_r(errno, errorBuffer, ERROR_BUFFER_LEN);
|
strerror_r(errno, errorBuffer, ERROR_BUFFER_LEN);
|
||||||
UpnpPrintf(UPNP_INFO, SSDP, __FILE__, __LINE__,
|
UpnpPrintf(UPNP_INFO, SSDP, __FILE__, __LINE__,
|
||||||
"Error in shutdown: %s\n", errorBuffer);
|
"Error in shutdown: %s\n", errorBuffer);
|
||||||
|
@ -864,8 +864,8 @@ static int create_ssdp_sock_v4(
|
|||||||
/* This is probably not a critical error, so let's continue. */
|
/* This is probably not a critical error, so let's continue. */
|
||||||
}
|
}
|
||||||
/* result is not checked becuase it will fail in WinMe and Win9x. */
|
/* result is not checked becuase it will fail in WinMe and Win9x. */
|
||||||
ret = setsockopt(*ssdpSock, IPPROTO_IP,
|
setsockopt(*ssdpSock, IPPROTO_IP,
|
||||||
IP_MULTICAST_TTL, &ttl, sizeof(ttl));
|
IP_MULTICAST_TTL, &ttl, sizeof(ttl));
|
||||||
onOff = 1;
|
onOff = 1;
|
||||||
ret = setsockopt(*ssdpSock, SOL_SOCKET, SO_BROADCAST,
|
ret = setsockopt(*ssdpSock, SOL_SOCKET, SO_BROADCAST,
|
||||||
(char *)&onOff, sizeof(onOff));
|
(char *)&onOff, sizeof(onOff));
|
||||||
|
Loading…
Reference in New Issue
Block a user