diff --git a/ChangeLog b/ChangeLog index afd5c9f..00d9bb1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,16 @@ Version 1.6.18 ******************************************************************************* +2012-04-21 Yoichi NAKAYAMA + + 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 Avoid dereference of null pointer in ixmlNode_setNodeProperties. diff --git a/upnp/sample/linux/tv_combo_main.c b/upnp/sample/linux/tv_combo_main.c index 92788e4..cb9909e 100644 --- a/upnp/sample/linux/tv_combo_main.c +++ b/upnp/sample/linux/tv_combo_main.c @@ -55,6 +55,9 @@ int main(int argc, char *argv[]) } /* start a command loop thread */ code = ithread_create(&cmdloop_thread, NULL, TvCtrlPointCommandLoop, NULL); + if (code != 0) { + return UPNP_E_INTERNAL_ERROR; + } #ifdef WIN32 ithread_join(cmdloop_thread, NULL); #else diff --git a/upnp/sample/linux/tv_ctrlpt_main.c b/upnp/sample/linux/tv_ctrlpt_main.c index 2d40b81..79641fc 100644 --- a/upnp/sample/linux/tv_ctrlpt_main.c +++ b/upnp/sample/linux/tv_ctrlpt_main.c @@ -54,6 +54,9 @@ int main(int argc, char **argv) } /* start a command loop thread */ code = ithread_create(&cmdloop_thread, NULL, TvCtrlPointCommandLoop, NULL); + if (code != 0) { + return UPNP_E_INTERNAL_ERROR; + } #ifdef WIN32 ithread_join(cmdloop_thread, NULL); #else diff --git a/upnp/sample/linux/tv_device_main.c b/upnp/sample/linux/tv_device_main.c index 57e7035..9d59d5e 100644 --- a/upnp/sample/linux/tv_device_main.c +++ b/upnp/sample/linux/tv_device_main.c @@ -53,6 +53,9 @@ int main(int argc, char *argv[]) /* start a command loop thread */ code = ithread_create(&cmdloop_thread, NULL, TvDeviceCommandLoop, NULL); + if (code != 0) { + return UPNP_E_INTERNAL_ERROR; + } #ifdef WIN32 ithread_join(cmdloop_thread, NULL); #else diff --git a/upnp/src/gena/gena_device.c b/upnp/src/gena/gena_device.c index 877d887..5afadf9 100644 --- a/upnp/src/gena/gena_device.c +++ b/upnp/src/gena/gena_device.c @@ -102,12 +102,11 @@ static int GeneratePropertySet( char *buffer; int counter = 0; size_t size = 0; - int temp_counter = 0; /*size += strlen(XML_VERSION);*/ size += strlen(XML_PROPERTYSET_HEADER); size += strlen("\n\n"); - for (temp_counter = 0, counter = 0; counter < count; counter++) { + for (counter = 0; counter < count; counter++) { size += strlen( "\n\n" ); size += 2 * strlen(names[counter]) + strlen(values[counter]) + diff --git a/upnp/src/genlib/net/http/httpreadwrite.c b/upnp/src/genlib/net/http/httpreadwrite.c index b1955a7..0e97ecc 100644 --- a/upnp/src/genlib/net/http/httpreadwrite.c +++ b/upnp/src/genlib/net/http/httpreadwrite.c @@ -1206,7 +1206,6 @@ static int ReadResponseLineAndHeaders( return num_read; } } - done = 0; status = parser_parse_headers(parser); if ((status == (parse_status_t)PARSE_OK) && (parser->position == (parser_pos_t)POS_ENTITY)) diff --git a/upnp/src/genlib/service_table/service_table.c b/upnp/src/genlib/service_table/service_table.c index 3f09976..5b173f3 100644 --- a/upnp/src/genlib/service_table/service_table.c +++ b/upnp/src/genlib/service_table/service_table.c @@ -926,7 +926,6 @@ removeServiceTable( IXML_Node * node, long unsigned int i = 0lu; if( getSubElement( "root", node, &root ) ) { - current_service = in->serviceList; start_search = in->serviceList; deviceList = ixmlElement_getElementsByTagName( ( IXML_Element * ) root, diff --git a/upnp/src/soap/soap_device.c b/upnp/src/soap/soap_device.c index 7d41454..3e8eaaa 100644 --- a/upnp/src/soap/soap_device.c +++ b/upnp/src/soap/soap_device.c @@ -723,8 +723,6 @@ static UPNP_INLINE void handle_query_variable( "Return from callback for var request\n"); /* validate, and handle result */ if (variable.CurrentVal == NULL) { - err_code = SOAP_ACTION_FAILED; - err_str = Soap_Action_Failed; send_error_response(info, SOAP_INVALID_VAR, Soap_Invalid_Var, request); return; diff --git a/upnp/src/ssdp/ssdp_ctrlpt.c b/upnp/src/ssdp/ssdp_ctrlpt.c index 2fb3b68..136a3ca 100644 --- a/upnp/src/ssdp/ssdp_ctrlpt.c +++ b/upnp/src/ssdp/ssdp_ctrlpt.c @@ -239,7 +239,6 @@ void ssdp_handle_ctrlpt_msg(http_message_t *hmsg, struct sockaddr_storage *dest_ /*hdr_value.buf[ hdr_value.length ] = '\0'; */ while (node != NULL) { searchArg = node->item; - matched = 0; /* check for match of ST header and search target */ switch (searchArg->requestType) { case SSDP_ALL: diff --git a/upnp/src/ssdp/ssdp_device.c b/upnp/src/ssdp/ssdp_device.c index a439005..d00efb5 100644 --- a/upnp/src/ssdp/ssdp_device.c +++ b/upnp/src/ssdp/ssdp_device.c @@ -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 * to multicast channel. * - * \return 1 if successful else appropriate error. + * \return UPNP_E_SUCCESS if successful else appropriate error. */ static int NewRequestHandler( /*! [in] Ip address, to send the reply. */ @@ -246,8 +246,7 @@ static int NewRequestHandler( } end_NewRequestHandler: - ret = shutdown(ReplySock, SD_BOTH); - if (ret == -1) { + if (shutdown(ReplySock, SD_BOTH) == -1) { strerror_r(errno, errorBuffer, ERROR_BUFFER_LEN); UpnpPrintf(UPNP_INFO, SSDP, __FILE__, __LINE__, "Error in shutdown: %s\n", errorBuffer); diff --git a/upnp/src/ssdp/ssdp_server.c b/upnp/src/ssdp/ssdp_server.c index 01c873f..231c2c5 100644 --- a/upnp/src/ssdp/ssdp_server.c +++ b/upnp/src/ssdp/ssdp_server.c @@ -864,8 +864,8 @@ static int create_ssdp_sock_v4( /* This is probably not a critical error, so let's continue. */ } /* result is not checked becuase it will fail in WinMe and Win9x. */ - ret = setsockopt(*ssdpSock, IPPROTO_IP, - IP_MULTICAST_TTL, &ttl, sizeof(ttl)); + setsockopt(*ssdpSock, IPPROTO_IP, + IP_MULTICAST_TTL, &ttl, sizeof(ttl)); onOff = 1; ret = setsockopt(*ssdpSock, SOL_SOCKET, SO_BROADCAST, (char *)&onOff, sizeof(onOff));