return fe->filesel_name;
}
+struct savefile_write_ctx {
+ FILE *fp;
+ int error;
+};
+
static void savefile_write(void *wctx, void *buf, int len)
{
- FILE *fp = (FILE *)wctx;
- fwrite(buf, 1, len, fp);
+ struct savefile_write_ctx *ctx = (struct savefile_write_ctx *)wctx;
+ if (fwrite(buf, 1, len, ctx->fp) < len)
+ ctx->error = 1;
}
static int savefile_read(void *wctx, void *buf, int len)
return;
}
- midend_serialise(fe->me, savefile_write, fp);
+ {
+ struct savefile_write_ctx ctx;
+ ctx.fp = fp;
+ ctx.error = 0;
+ midend_serialise(fe->me, savefile_write, &ctx);
+ fclose(fp);
+ if (ctx.error) {
+ error_box(fe->window, "Error writing save file");
+ return;
+ }
+ }
- fclose(fp);
}
}
} else
fe->preset_custom_bullet = NULL;
- changed_preset(fe);
} else {
fe->npresets = 0;
fe->preset_bullets = NULL;
GTK_SIGNAL_FUNC(menu_about_event), fe);
gtk_widget_show(menuitem);
+ changed_preset(fe);
+
{
int i, ncolours;
float *colours;
gdk_colormap_alloc_colors(fe->colmap, fe->colours, ncolours,
FALSE, FALSE, success);
for (i = 0; i < ncolours; i++) {
- if (!success[i])
+ if (!success[i]) {
g_error("couldn't allocate colour %d (#%02x%02x%02x)\n",
i, fe->colours[i].red >> 8,
fe->colours[i].green >> 8,
fe->colours[i].blue >> 8);
+ }
}
}