From 68ba1f69427760d004142c420a51e88c0f6b2961 Mon Sep 17 00:00:00 2001 From: neoraider Date: Wed, 31 Oct 2007 23:27:03 +0000 Subject: libzoom: Fixed some warnings with -Wall --- level.c | 122 ++++++++++++++++++++++++++++++++-------------------------------- 1 file changed, 61 insertions(+), 61 deletions(-) (limited to 'level.c') diff --git a/level.c b/level.c index 246f8d5..f59a537 100644 --- a/level.c +++ b/level.c @@ -37,18 +37,18 @@ static void LoadTriangles(xmlNodePtr node, LEVEL *level, WALL* walls, int nWalls for(; node != NULL; node = node->next) { - if(node->type != XML_ELEMENT_NODE || xmlStrcmp(node->name, "triangle")) continue; + if(node->type != XML_ELEMENT_NODE || xmlStrcmp(node->name, (xmlChar*)"triangle")) continue; walls[i].visible = 1; - data = xmlGetProp(node, "visible"); + data = xmlGetProp(node, (xmlChar*)"visible"); if(data) { - if(!xmlStrcmp(data, "false")) walls[i].visible = 0; + if(!xmlStrcmp(data, (xmlChar*)"false")) walls[i].visible = 0; xmlFree(data); } - data = xmlGetProp(node, "texture"); + data = xmlGetProp(node, (xmlChar*)"texture"); if(data) { - tex.name = data; + tex.name = (char*)data; texp = bsearch(&tex, level->textures, level->nTextures, sizeof(TEXTURE), SortTextures); if(texp) walls[i].texture = texp->id; @@ -60,60 +60,60 @@ static void LoadTriangles(xmlNodePtr node, LEVEL *level, WALL* walls, int nWalls for(node2 = node->children; node2 != NULL; node2 = node2->next) { if(node2->type != XML_ELEMENT_NODE) continue; - if(!xmlStrcmp(node2->name, "vertex")) { + if(!xmlStrcmp(node2->name, (xmlChar*)"vertex")) { if(++j > 2) break; - data = xmlGetProp(node2, "x"); + data = xmlGetProp(node2, (xmlChar*)"x"); if(data) { - walls[i].vertices[j].x = atof(data); + walls[i].vertices[j].x = atof((char*)data); xmlFree(data); } - data = xmlGetProp(node2, "y"); + data = xmlGetProp(node2, (xmlChar*)"y"); if(data) { - walls[i].vertices[j].y = atof(data); + walls[i].vertices[j].y = atof((char*)data); xmlFree(data); } - data = xmlGetProp(node2, "z"); + data = xmlGetProp(node2, (xmlChar*)"z"); if(data) { - walls[i].vertices[j].z = atof(data); + walls[i].vertices[j].z = atof((char*)data); xmlFree(data); } } - else if(!xmlStrcmp(node2->name, "normal")) { + else if(!xmlStrcmp(node2->name, (xmlChar*)"normal")) { if(j < 0) continue; - data = xmlGetProp(node2, "x"); + data = xmlGetProp(node2, (xmlChar*)"x"); if(data) { - walls[i].normals[j].x = atof(data); + walls[i].normals[j].x = atof((char*)data); xmlFree(data); } - data = xmlGetProp(node2, "y"); + data = xmlGetProp(node2, (xmlChar*)"y"); if(data) { - walls[i].normals[j].y = atof(data); + walls[i].normals[j].y = atof((char*)data); xmlFree(data); } - data = xmlGetProp(node2, "z"); + data = xmlGetProp(node2, (xmlChar*)"z"); if(data) { - walls[i].normals[j].z = atof(data); + walls[i].normals[j].z = atof((char*)data); xmlFree(data); } } - else if(!xmlStrcmp(node2->name, "texcoords")) { + else if(!xmlStrcmp(node2->name, (xmlChar*)"texcoords")) { if(j < 0) continue; - data = xmlGetProp(node2, "s"); + data = xmlGetProp(node2, (xmlChar*)"s"); if(data) { - walls[i].texcoords[j].s = atof(data); + walls[i].texcoords[j].s = atof((char*)data); xmlFree(data); } - data = xmlGetProp(node2, "t"); + data = xmlGetProp(node2, (xmlChar*)"t"); if(data) { - walls[i].texcoords[j].t = atof(data); + walls[i].texcoords[j].t = atof((char*)data); xmlFree(data); } } @@ -142,10 +142,10 @@ LEVEL *LoadLevel(char *filename) { xmlDocPtr doc; xmlDtdPtr dtd; xmlValidCtxtPtr validCtxt; - xmlNodePtr root, node, node2, node3, rooms = NULL, gates = NULL; + xmlNodePtr root, node, node2, rooms = NULL, gates = NULL; xmlChar *data; char *name; - int i, j; + int i; ROOM room, *roomp; @@ -160,7 +160,7 @@ LEVEL *LoadLevel(char *filename) { if(!doc) return NULL; - dtd = xmlParseDTD("-//libzoom//DTD level 0.1//EN", "levels/level.dtd"); + dtd = xmlParseDTD((xmlChar*)"-//libzoom//DTD level 0.1//EN", (xmlChar*)"levels/level.dtd"); if(!dtd) { xmlFreeDoc(doc); @@ -189,7 +189,7 @@ LEVEL *LoadLevel(char *filename) { xmlFreeDtd(dtd); root = xmlDocGetRootElement(doc); - if(!root || xmlStrcmp(root->name, "level")) { + if(!root || xmlStrcmp(root->name, (xmlChar*)"level")) { xmlFreeDoc(doc); xmlCleanupParser(); return NULL; @@ -202,51 +202,51 @@ LEVEL *LoadLevel(char *filename) { for(node = root->children; node != NULL; node = node->next) { if(node->type != XML_ELEMENT_NODE) continue; - if(!xmlStrcmp(node->name, "info")) { + if(!xmlStrcmp(node->name, (xmlChar*)"info")) { level->info = calloc(1, sizeof(LEVELINFO)); for(node2 = node->children; node2 != NULL; node2 = node2->next) { if(node2->type != XML_ELEMENT_NODE) continue; - if(!xmlStrcmp(node2->name, "name")) { + if(!xmlStrcmp(node2->name, (xmlChar*)"name")) { if(level->info->name != NULL) continue; data = xmlNodeGetContent(node2); - level->info->name = strdup(data); + level->info->name = strdup((char*)data); xmlFree(data); } - else if(!xmlStrcmp(node2->name, "desc")) { + else if(!xmlStrcmp(node2->name, (xmlChar*)"desc")) { if(level->info->desc != NULL) continue; data = xmlNodeGetContent(node2); - level->info->desc = strdup(data); + level->info->desc = strdup((char*)data); xmlFree(data); } - else if(!xmlStrcmp(node2->name, "start")) { - data = xmlGetProp(node2, "x"); - if(data) level->info->start.x = atof(data); + else if(!xmlStrcmp(node2->name, (xmlChar*)"start")) { + data = xmlGetProp(node2, (xmlChar*)"x"); + if(data) level->info->start.x = atof((char*)data); xmlFree(data); - data = xmlGetProp(node2, "y"); - if(data) level->info->start.y = atof(data); + data = xmlGetProp(node2, (xmlChar*)"y"); + if(data) level->info->start.y = atof((char*)data); xmlFree(data); - data = xmlGetProp(node2, "z"); - if(data) level->info->start.z = atof(data); + data = xmlGetProp(node2, (xmlChar*)"z"); + if(data) level->info->start.z = atof((char*)data); xmlFree(data); } } } - else if(!xmlStrcmp(node->name, "rooms")) { + else if(!xmlStrcmp(node->name, (xmlChar*)"rooms")) { if(rooms != NULL) continue; rooms = node; for(node2 = node->children; node2 != NULL; node2 = node2->next) { - if(node2->type == XML_ELEMENT_NODE && !xmlStrcmp(node2->name, "room")) level->nRooms++; + if(node2->type == XML_ELEMENT_NODE && !xmlStrcmp(node2->name, (xmlChar*)"room")) level->nRooms++; } } - else if(!xmlStrcmp(node->name, "gates")) { + else if(!xmlStrcmp(node->name, (xmlChar*)"gates")) { if(gates != NULL) continue; gates = node; @@ -254,32 +254,32 @@ LEVEL *LoadLevel(char *filename) { node2 = node->children; for(node2 = node->children; node2 != NULL; node2 = node2->next) { - if(node2->type == XML_ELEMENT_NODE && !xmlStrcmp(node2->name, "gate")) level->nGates++; + if(node2->type == XML_ELEMENT_NODE && !xmlStrcmp(node2->name, (xmlChar*)"gate")) level->nGates++; } } - else if(!xmlStrcmp(node->name, "textures")) { + else if(!xmlStrcmp(node->name, (xmlChar*)"textures")) { if(level->textures != NULL) continue; for(node2 = node->children; node2 != NULL; node2 = node2->next) { - if(node2->type == XML_ELEMENT_NODE && !xmlStrcmp(node2->name, "texture")) level->nTextures++; + if(node2->type == XML_ELEMENT_NODE && !xmlStrcmp(node2->name, (xmlChar*)"texture")) level->nTextures++; } level->textures = calloc(level->nTextures, sizeof(TEXTURE)); i = 0; for(node2 = node->children; node2 != NULL; node2 = node2->next) { - if(node2->type != XML_ELEMENT_NODE || xmlStrcmp(node2->name, "texture")) continue; + if(node2->type != XML_ELEMENT_NODE || xmlStrcmp(node2->name, (xmlChar*)"texture")) continue; - data = xmlGetProp(node2, "name"); + data = xmlGetProp(node2, (xmlChar*)"name"); if(data) { - level->textures[i].id = LoadTexture(data); + level->textures[i].id = LoadTexture((char*)data); xmlFree(data); } - data = xmlGetProp(node2, "id"); + data = xmlGetProp(node2, (xmlChar*)"id"); if(data) { - level->textures[i].name = strdup(data); + level->textures[i].name = strdup((char*)data); xmlFree(data); } @@ -295,17 +295,17 @@ LEVEL *LoadLevel(char *filename) { i = 0; for(node = rooms->children; node != NULL; node = node->next) { - if(node->type != XML_ELEMENT_NODE || xmlStrcmp(node->name, "room")) continue; + if(node->type != XML_ELEMENT_NODE || xmlStrcmp(node->name, (xmlChar*)"room")) continue; - data = xmlGetProp(node, "id"); + data = xmlGetProp(node, (xmlChar*)"id"); if(data) { - level->rooms[i].id = strdup(data); + level->rooms[i].id = strdup((char*)data); xmlFree(data); } for(node2 = node->children; node2 != NULL; node2 = node2->next) { - if(node2->type == XML_ELEMENT_NODE && !xmlStrcmp(node2->name, "triangle")) level->rooms[i].nWalls++; + if(node2->type == XML_ELEMENT_NODE && !xmlStrcmp(node2->name, (xmlChar*)"triangle")) level->rooms[i].nWalls++; } level->rooms[i].walls = calloc(level->rooms[i].nWalls, sizeof(WALL)); @@ -321,11 +321,11 @@ LEVEL *LoadLevel(char *filename) { i = 0; for(node = gates->children; node != NULL; node = node->next) { - if(node->type != XML_ELEMENT_NODE || xmlStrcmp(node->name, "gate")) continue; + if(node->type != XML_ELEMENT_NODE || xmlStrcmp(node->name, (xmlChar*)"gate")) continue; - data = xmlGetProp(node2, "room1"); + data = xmlGetProp(node, (xmlChar*)"room1"); if(data) { - room.id = data; + room.id = (char*)data; roomp = bsearch(&room, level->rooms, level->nRooms, sizeof(ROOM), SortRooms); if(roomp) level->gates[i].room1 = roomp; @@ -333,9 +333,9 @@ LEVEL *LoadLevel(char *filename) { xmlFree(data); } - data = xmlGetProp(node2, "room2"); + data = xmlGetProp(node, (xmlChar*)"room2"); if(data) { - room.id = data; + room.id = (char*)data; roomp = bsearch(&room, level->rooms, level->nRooms, sizeof(ROOM), SortRooms); if(roomp) level->gates[i].room2 = roomp; @@ -344,7 +344,7 @@ LEVEL *LoadLevel(char *filename) { } for(node2 = node->children; node2 != NULL; node2 = node2->next) { - if(node2->type == XML_ELEMENT_NODE && !xmlStrcmp(node2->name, "triangle")) level->gates[i].nWalls++; + if(node2->type == XML_ELEMENT_NODE && !xmlStrcmp(node2->name, (xmlChar*)"triangle")) level->gates[i].nWalls++; } level->gates[i].walls = calloc(level->gates[i].nWalls, sizeof(WALL)); -- cgit v1.2.3