Remove some of the implicit cast in upnp part

Remove some of the "implicit integer or enum conversions" as well as
some access to NULL reference in upnp part.
This commit is contained in:
Fabrice Fontaine
2012-03-10 20:20:03 +01:00
parent d45f3c28cf
commit c67187ac94
18 changed files with 190 additions and 160 deletions

View File

@@ -743,8 +743,8 @@ service_info *getServiceList(
service_info *current = NULL;
service_info *previous = NULL;
IXML_NodeList *serviceNodeList = NULL;
long unsigned int NumOfServices = 0;
long unsigned int i = 0;
long unsigned int NumOfServices = 0lu;
long unsigned int i = 0lu;
int fail = 0;
if (getSubElement("UDN", node, &UDN) &&
@@ -753,7 +753,7 @@ service_info *getServiceList(
(IXML_Element *)serviceList, "service");
if (serviceNodeList != NULL) {
NumOfServices = ixmlNodeList_length(serviceNodeList);
for (i = 0; i < NumOfServices; i++) {
for (i = 0lu; i < NumOfServices; i++) {
current_service =
ixmlNodeList_item(serviceNodeList, i);
fail = 0;
@@ -867,8 +867,8 @@ getAllServiceList( IXML_Node * node,
IXML_NodeList *deviceList = NULL;
IXML_Node *currentDevice = NULL;
long unsigned int NumOfDevices = 0;
long unsigned int i = 0;
long unsigned int NumOfDevices = 0lu;
long unsigned int i = 0lu;
(*out_end) = NULL;
@@ -876,7 +876,7 @@ getAllServiceList( IXML_Node * node,
(IXML_Element *)node, "device");
if (deviceList) {
NumOfDevices = ixmlNodeList_length(deviceList);
for (i = 0; i < NumOfDevices; i++) {
for (i = 0lu; i < NumOfDevices; i++) {
currentDevice = ixmlNodeList_item(deviceList, i);
if (head) {
end->next = getServiceList(currentDevice,
@@ -922,8 +922,8 @@ removeServiceTable( IXML_Node * node,
service_info *current_service = NULL;
service_info *start_search = NULL;
service_info *prev_service = NULL;
long unsigned int NumOfDevices = 0;
long unsigned int i = 0;
long unsigned int NumOfDevices = 0lu;
long unsigned int i = 0lu;
if( getSubElement( "root", node, &root ) ) {
current_service = in->serviceList;
@@ -933,7 +933,7 @@ removeServiceTable( IXML_Node * node,
"device" );
if( deviceList != NULL ) {
NumOfDevices = ixmlNodeList_length( deviceList );
for( i = 0; i < NumOfDevices; i++ ) {
for( i = 0lu; i < NumOfDevices; i++ ) {
if( ( start_search )
&& ( ( getSubElement( "UDN", node, &currentUDN ) )
&& ( UDN = getElementValue( currentUDN ) ) ) ) {
@@ -944,7 +944,8 @@ removeServiceTable( IXML_Node * node,
while( ( current_service )
&& ( strcmp( current_service->UDN, UDN ) ) ) {
current_service = current_service->next;
prev_service = current_service->next;
if( current_service != NULL)
prev_service = current_service->next;
}
while( ( current_service )
&& ( !strcmp( current_service->UDN, UDN ) ) ) {