X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Fgame_bd%2Fbd_bdcff.c;h=53fc4c91a15718ad6f0c59bd0d0a16959798323c;hb=bd560c53129c84976b87827f1978ddf8de4ed57a;hp=20aba8f946e499a1f5032ff4b919984ebd0d315c;hpb=cea7a60112df6c411e990bf45a6dab0f31de6cc4;p=rocksndiamonds.git diff --git a/src/game_bd/bd_bdcff.c b/src/game_bd/bd_bdcff.c index 20aba8f9..53fc4c91 100644 --- a/src/game_bd/bd_bdcff.c +++ b/src/game_bd/bd_bdcff.c @@ -14,9 +14,6 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#include -#include - #include #include "main_bd.h" @@ -140,7 +137,7 @@ static boolean attrib_is_valid_for_caveset(const char *attrib) return FALSE; } -static boolean struct_set_property(gpointer str, const GdStructDescriptor *prop_desc, +static boolean struct_set_property(void *str, const GdStructDescriptor *prop_desc, const char *attrib, const char *param, int ratio) { char **params; @@ -163,7 +160,7 @@ static boolean struct_set_property(gpointer str, const GdStructDescriptor *prop_ if (strcasecmp(prop_desc[i].identifier, attrib) == 0) { /* found the identifier */ - gpointer value = G_STRUCT_MEMBER_P(str, prop_desc[i].offset); + void *value = STRUCT_MEMBER_P(str, prop_desc[i].offset); /* these point to the same, but to avoid the awkward cast syntax */ int *ivalue = value; @@ -204,7 +201,7 @@ static boolean struct_set_property(gpointer str, const GdStructDescriptor *prop_ for (j = 0; j < prop_desc[i].count && params[paramindex] != NULL; j++) { boolean success = FALSE; - gdouble res; + double res; switch (prop_desc[i].type) { @@ -254,6 +251,7 @@ static boolean struct_set_property(gpointer str, const GdStructDescriptor *prop_ break; case GD_TYPE_PROBABILITY: + errno = 0; /* must be reset before calling strtod() to detect overflow/underflow */ res = strtod(params[paramindex], NULL); if (errno == 0 && res >= 0 && res <= 1) { @@ -268,6 +266,7 @@ static boolean struct_set_property(gpointer str, const GdStructDescriptor *prop_ break; case GD_TYPE_RATIO: + errno = 0; /* must be reset before calling strtod() to detect overflow/underflow */ res = strtod (params[paramindex], NULL); if (errno == 0 && res >= 0 && res <= 1) { @@ -356,7 +355,7 @@ static boolean replay_store_more_from_bdcff(GdReplay *replay, const char *param) } /* report all remaining tags; called after the above function. */ -static void replay_report_unknown_tags_func(const char *attrib, const char *param, gpointer data) +static void replay_report_unknown_tags_func(const char *attrib, const char *param, void *data) { Warn("unknown replay tag '%s'", attrib); } @@ -487,7 +486,7 @@ static boolean cave_process_tags_func(const char *attrib, const char *param, GdC } /* report all remaining tags; called after the above function. */ -static void cave_report_and_copy_unknown_tags_func(char *attrib, char *param, gpointer data) +static void cave_report_and_copy_unknown_tags_func(char *attrib, char *param, void *data) { GdCave *cave = (GdCave *)data; @@ -884,7 +883,7 @@ boolean gd_caveset_load_from_bdcff(const char *contents) /* strip leading and trailing spaces AFTER checking if we are reading a map. map lines might begin or end with spaces */ - g_strstrip(line); + stripString(line); if (reading_highscore) { @@ -1060,7 +1059,7 @@ boolean gd_caveset_load_from_bdcff(const char *contents) strcasecmp(params[0], gd_cave_properties[i].identifier) == 0) { /* found identifier */ - gpointer value = G_STRUCT_MEMBER_P (cave, gd_cave_properties[i].offset); + void *value = STRUCT_MEMBER_P (cave, gd_cave_properties[i].offset); *((GdElement *) value) = gd_get_element_from_string (params[1]); break; @@ -1194,12 +1193,12 @@ boolean gd_caveset_load_from_bdcff(const char *contents) object.element = cave->initial_border; object.fill_element = cave->initial_border; - cave->objects = list_prepend(cave->objects, getMemCopy(&object, sizeof(object))); + cave->objects = list_prepend(cave->objects, get_memcpy(&object, sizeof(object))); object.x1 = 19; object.y1 = 0; /* 19, as it is also the border */ - cave->objects = list_prepend(cave->objects, getMemCopy(&object, sizeof(object))); /* another */ + cave->objects = list_prepend(cave->objects, get_memcpy(&object, sizeof(object))); /* another */ } } }