Selaa lähdekoodia

Fixed compile warnings - casts from void at memory allocation

Anca Vamanu 13 vuotta sitten
vanhempi
commit
13fb8f05ca
3 muutettua tiedostoa jossa 8 lisäystä ja 8 poistoa
  1. 5 5
      clist.h
  2. 1 1
      str_hash.h
  3. 2 2
      ut.h

+ 5 - 5
clist.h

@@ -41,8 +41,8 @@
 /*! \brief circular list */
 #define clist_init(c, next, prev) \
 	do{ \
-		(c)->next=(void*)(c); \
-		(c)->prev=(void*)(c); \
+		(c)->next=(struct str_hash_entry*)(void*)(c); \
+		(c)->prev=(struct str_hash_entry*)(void*)(c); \
 	} while(0)
 
 
@@ -57,7 +57,7 @@
  */
 #define clist_insert_sublist(head, s, e, next, prev) \
 	do{ \
-		(s)->prev=(void*)(head); \
+		(s)->prev=(struct str_hash_entry*)(void*)(head); \
 		(e)->next=(head)->next; \
 		(e)->next->prev=(e); \
 		(head)->next=s;   \
@@ -91,8 +91,8 @@
  *  instead! */
 #define clist_rm_sublist(s, e, next, prev) \
 	do{\
-		(s)->prev->next=(e)->next;  \
-		(e)->next->prev=(s)->prev ; \
+		(s)->prev->next=(struct str_hash_entry*)(e)->next;  \
+		(e)->next->prev=(struct str_hash_entry*)(s)->prev ; \
 	}while(0)
 
 

+ 1 - 1
str_hash.h

@@ -66,7 +66,7 @@ struct str_hash_table{
 /* returns 0 on success, <0 on failure */
 inline static int str_hash_alloc(struct str_hash_table* ht, int size)
 {
-	ht->table=pkg_malloc(sizeof(struct str_hash_head)*size);
+	ht->table=(struct str_hash_head*)pkg_malloc(sizeof(struct str_hash_head)*size);
 	if (ht->table==0)
 		return -1;
 	ht->size=size;

+ 2 - 2
ut.h

@@ -695,7 +695,7 @@ static inline int str2sint(str* _s, int* _r)
  */
 static inline int shm_str_dup(str* dst, const str* src)
 {
-	dst->s = shm_malloc(src->len);
+	dst->s = (char*)shm_malloc(src->len);
 	if (!dst->s) {
 		SHM_MEM_ERROR;
 		return -1;
@@ -717,7 +717,7 @@ static inline int shm_str_dup(str* dst, const str* src)
  */
 static inline int pkg_str_dup(str* dst, const str* src)
 {
-	dst->s = pkg_malloc(src->len);
+	dst->s = (char*)pkg_malloc(src->len);
 	if (dst->s==NULL)
 	{
 		PKG_MEM_ERROR;