Improoving debug code.

git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@377 119443c7-1b9e-41f8-b6fc-b9c35fce742c
This commit is contained in:
Marcelo Roberto Jimenez 2008-05-07 21:56:49 +00:00
parent efb6812b3e
commit e90e549cbb

View File

@ -464,9 +464,11 @@ int UpnpRegisterRootDevice(
retVal = UpnpDownloadXmlDoc(HInfo->DescURL, &(HInfo->DescDocument));
if (retVal != UPNP_E_SUCCESS) {
UpnpPrintf(UPNP_ALL, API, __FILE__, __LINE__,
"UpnpRegisterRootDevice: error downloading Document: %d\n",
retVal);
CLIENTONLY( ListDestroy(&HInfo->SsdpSearchList, 0); )
FreeHandle(*Hnd);
retVal = retVal;
goto exit_function;
}
UpnpPrintf(UPNP_ALL, API, __FILE__, __LINE__,
@ -3144,9 +3146,7 @@ UpnpDownloadUrlItem( const char *url,
* Return Values: int
* UPNP_E_SUCCESS if successful else sends appropriate error.
***************************************************************************/
int
UpnpDownloadXmlDoc( const char *url,
IXML_Document ** xmlDoc )
int UpnpDownloadXmlDoc(const char *url, IXML_Document **xmlDoc)
{
int ret_code;
char *xml_buf;
@ -3159,7 +3159,7 @@ UpnpDownloadXmlDoc( const char *url,
ret_code = UpnpDownloadUrlItem(url, &xml_buf, content_type);
if (ret_code != UPNP_E_SUCCESS) {
UpnpPrintf(UPNP_CRITICAL, API, __FILE__, __LINE__,
"retCode: %d\n", ret_code );
"Error downloading document, retCode: %d\n", ret_code);
return ret_code;
}
@ -3178,13 +3178,16 @@ UpnpDownloadXmlDoc( const char *url,
ret_code = ixmlParseBufferEx(xml_buf, xmlDoc);
free(xml_buf);
if (ret_code != IXML_SUCCESS) {
UpnpPrintf( UPNP_CRITICAL, API, __FILE__, __LINE__,
"Invalid desc\n" );
if (ret_code == IXML_INSUFFICIENT_MEMORY) {
UpnpPrintf(UPNP_CRITICAL, API, __FILE__, __LINE__,
"Out of memory, ixml error code: %d\n",
ret_code);
return UPNP_E_OUTOF_MEMORY;
} else {
UpnpPrintf(UPNP_CRITICAL, API, __FILE__, __LINE__,
"Invalid Description, ixml error code: %d\n",
ret_code);
return UPNP_E_INVALID_DESC;
}
} else {
@ -3198,6 +3201,7 @@ UpnpDownloadXmlDoc( const char *url,
#endif
UpnpPrintf( UPNP_ALL, API, __FILE__, __LINE__,
"Exiting UpnpDownloadXmlDoc\n");
return UPNP_E_SUCCESS;
}
}
@ -4121,15 +4125,15 @@ int FreeHandle(int Upnp_Handle)
int ret = UPNP_E_INVALID_HANDLE;
UpnpPrintf(UPNP_INFO, API, __FILE__, __LINE__,
"FreeHandleInfo: entering, Handle is %d\n", Upnp_Handle);
"FreeHandle: entering, Handle is %d\n", Upnp_Handle);
if (Upnp_Handle < 1 || Upnp_Handle >= NUM_HANDLE) {
UpnpPrintf(UPNP_CRITICAL, API, __FILE__, __LINE__,
"FreeHandleInfo: Handle %d is out of range\n",
"FreeHandle: Handle %d is out of range\n",
Upnp_Handle);
} else if (HandleTable[Upnp_Handle] == NULL) {
UpnpPrintf(UPNP_CRITICAL, API, __FILE__, __LINE__,
"FreeHandleInfo: HandleTable[%d] is NULL\n",
"FreeHandle: HandleTable[%d] is NULL\n",
Upnp_Handle);
} else {
free( HandleTable[Upnp_Handle] );
@ -4137,7 +4141,8 @@ int FreeHandle(int Upnp_Handle)
ret = UPNP_E_SUCCESS;
}
UpnpPrintf(UPNP_ALL, API, __FILE__, __LINE__, "FreeHandleInfo: exiting\n");
UpnpPrintf(UPNP_ALL, API, __FILE__, __LINE__,
"FreeHandle: exiting, ret = %d.\n", ret);
return ret;
}