projects
/
rocksndiamonds.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
replaced glib function calls to g_print()
[rocksndiamonds.git]
/
src
/
game_bd
/
bd_caveset.c
diff --git
a/src/game_bd/bd_caveset.c
b/src/game_bd/bd_caveset.c
index 36b82a5e0bb664a8c541f01ca87e59cd332f29b2..50598fb7a0ec4dbe69a68e0bc69f7bc582a4de78 100644
(file)
--- a/
src/game_bd/bd_caveset.c
+++ b/
src/game_bd/bd_caveset.c
@@
-504,12
+504,11
@@
static void caveset_name_set_from_filename(char *filename)
*/
boolean gd_caveset_load_from_file(char *filename)
{
*/
boolean gd_caveset_load_from_file(char *filename)
{
- GError *error = NULL;
gsize length;
char *buf;
gsize length;
char *buf;
- boolean read;
List *new_caveset;
struct stat st;
List *new_caveset;
struct stat st;
+ File *file;
if (stat(filename, &st) != 0)
{
if (stat(filename, &st) != 0)
{
@@
-525,12
+524,22
@@
boolean gd_caveset_load_from_file(char *filename)
return FALSE;
}
return FALSE;
}
- read = g_file_get_contents (filename, &buf, &length, &error);
- if (!read)
+ if (!(file = openFile(filename, MODE_READ)))
{
{
- Warn("
%s", error->messag
e);
+ Warn("
cannot open file '%s'", filenam
e);
- g_error_free(error);
+ return FALSE;
+ }
+
+ buf = checked_malloc(st.st_size + 1);
+ length = readFile(file, buf, 1, st.st_size);
+ buf[length] = '\0';
+
+ closeFile(file);
+
+ if (length < st.st_size)
+ {
+ Warn("cannot read file '%s'", filename);
return FALSE;
}
return FALSE;
}