Remove more implicit casts in upnp part

Remove more "implicit integer or enum conversions" errors as well as
dead code.
This commit is contained in:
Fabrice Fontaine
2012-03-11 00:25:16 +01:00
parent 8e39b2af85
commit c40d2bc0c9
8 changed files with 159 additions and 131 deletions

View File

@@ -77,7 +77,7 @@ struct SUpnpString
UpnpString *UpnpString_new()
{
/* All bytes are zero, and so is the length of the string. */
struct SUpnpString *p = calloc(1, sizeof (struct SUpnpString));
struct SUpnpString *p = calloc((size_t)1, sizeof (struct SUpnpString));
if (p == NULL) {
goto error_handler1;
}
@@ -86,7 +86,7 @@ UpnpString *UpnpString_new()
#endif
/* This byte is zero, calloc does initialize it. */
p->m_string = calloc(1, 1);
p->m_string = calloc((size_t)1, (size_t)1);
if (p->m_string == NULL) {
goto error_handler2;
}
@@ -106,7 +106,7 @@ void UpnpString_delete(UpnpString *p)
if (!q) return;
q->m_length = 0;
q->m_length = (size_t)0;
free(q->m_string);
q->m_string = NULL;
@@ -116,7 +116,7 @@ void UpnpString_delete(UpnpString *p)
UpnpString *UpnpString_dup(const UpnpString *p)
{
struct SUpnpString *q = calloc(1, sizeof (struct SUpnpString));
struct SUpnpString *q = calloc((size_t)1, sizeof (struct SUpnpString));
if (q == NULL) {
goto error_handler1;
}
@@ -187,7 +187,7 @@ error_handler1:
void UpnpString_clear(UpnpString *p)
{
((struct SUpnpString *)p)->m_length = 0;
((struct SUpnpString *)p)->m_length = (size_t)0;
/* No need to realloc now, will do later when needed. */
((struct SUpnpString *)p)->m_string[0] = 0;
}