projects
/
rocksndiamonds.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
white space changes
[rocksndiamonds.git]
/
src
/
game_bd
/
bd_bdcff.c
diff --git
a/src/game_bd/bd_bdcff.c
b/src/game_bd/bd_bdcff.c
index 8f2ee081e54ffc646a9008e1c3c690820d5d6b37..ff5a60cac3a76d487325c86811acbced04f1f158 100644
(file)
--- 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.
*/
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <glib.h>
-#include <glib/gi18n.h>
-
#include <errno.h>
#include "main_bd.h"
#include <errno.h>
#include "main_bd.h"
@@
-140,7
+137,7
@@
static boolean attrib_is_valid_for_caveset(const char *attrib)
return FALSE;
}
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;
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 */
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;
/* 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;
for (j = 0; j < prop_desc[i].count && params[paramindex] != NULL; j++)
{
boolean success = FALSE;
-
g
double res;
+ double res;
switch (prop_desc[i].type)
{
switch (prop_desc[i].type)
{
@@
-254,6
+251,7
@@
static boolean struct_set_property(gpointer str, const GdStructDescriptor *prop_
break;
case GD_TYPE_PROBABILITY:
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)
{
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:
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)
{
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. */
}
/* 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);
}
{
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. */
}
/* 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;
{
GdCave *cave = (GdCave *)data;
@@
-1060,7
+1059,7
@@
boolean gd_caveset_load_from_bdcff(const char *contents)
strcasecmp(params[0], gd_cave_properties[i].identifier) == 0)
{
/* found identifier */
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;
*((GdElement *) value) = gd_get_element_from_string (params[1]);
break;
@@
-1114,8
+1113,10
@@
boolean gd_caveset_load_from_bdcff(const char *contents)
hashtable_insert(tags, getStringCopy(attrib), getStringCopy(param));
}
else
hashtable_insert(tags, getStringCopy(attrib), getStringCopy(param));
}
else
+ {
/* unknown setting - report. */
Warn("invalid attribute for [game] '%s'", attrib);
/* unknown setting - report. */
Warn("invalid attribute for [game] '%s'", attrib);
+ }
}
else
{
}
else
{