* 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"
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;
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;
for (j = 0; j < prop_desc[i].count && params[paramindex] != NULL; j++)
{
boolean success = FALSE;
- gdouble res;
+ double res;
switch (prop_desc[i].type)
{
break;
case GD_TYPE_PROBABILITY:
- res = g_ascii_strtod(params[paramindex], NULL);
+ errno = 0; /* must be reset before calling strtod() to detect overflow/underflow */
+ res = strtod(params[paramindex], NULL);
if (errno == 0 && res >= 0 && res <= 1)
{
/* fill all remaining items in array - may be only one */
break;
case GD_TYPE_RATIO:
- res = g_ascii_strtod (params[paramindex], NULL);
+ errno = 0; /* must be reset before calling strtod() to detect overflow/underflow */
+ res = strtod (params[paramindex], NULL);
if (errno == 0 && res >= 0 && res <= 1)
{
for (k = j; k < prop_desc[i].count; k++)
}
/* 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);
}
}
/* 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;
/* 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)
{
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;
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 */
}
}
}