From c3187174bfe39f05c8aa8c6b411952e4b502477d Mon Sep 17 00:00:00 2001 From: Ulf Lamping Date: Sun, 6 Nov 2005 22:43:25 +0000 Subject: replace *a lot* of file related calls by their GLib counterparts. This is necessary for the switch to GTK 2.6 (at least on WIN32). to do this, I've added file_util.h to wiretap (would file_compat.h be a better name?), and provide compat_macros like eth_open() instead of open(). While at it, move other file related things there, like #include , definition of O_BINARY and alike, so it's all in one place. deleted related things from config.h.win32 As of these massive changes, I'm almost certain that this will break the Unix build. I'll keep an eye on the buildbot so hopefully everything is working again soon. svn path=/trunk/; revision=16403 --- gtk/proto_draw.c | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) (limited to 'gtk/proto_draw.c') diff --git a/gtk/proto_draw.c b/gtk/proto_draw.c index 8cb6bf513d..0d0c8a47f9 100644 --- a/gtk/proto_draw.c +++ b/gtk/proto_draw.c @@ -31,10 +31,6 @@ #include -#ifdef HAVE_IO_H -#include /* open/close on win32 */ -#endif - #ifdef HAVE_FCNTL_H #include #endif @@ -73,11 +69,7 @@ #include "font_utils.h" #include "../ui_util.h" - -/* Win32 needs the O_BINARY flag for open() */ -#ifndef O_BINARY -#define O_BINARY 0 -#endif +#include "file_util.h" #define BYTE_VIEW_WIDTH 16 #define BYTE_VIEW_SEP 8 @@ -886,17 +878,17 @@ savehex_save_clicked_cb(GtkWidget * w _U_, gpointer data _U_) return; } - fd = open(file, O_WRONLY|O_CREAT|O_TRUNC|O_BINARY, 0666); + fd = eth_open(file, O_WRONLY|O_CREAT|O_TRUNC|O_BINARY, 0666); if (fd == -1) { open_failure_alert_box(file, errno, TRUE); return; } - if (write(fd, data_p + start, end - start) < 0) { + if (eth_write(fd, data_p + start, end - start) < 0) { write_failure_alert_box(file, errno); - close(fd); + eth_close(fd); return; } - if (close(fd) < 0) { + if (eth_close(fd) < 0) { write_failure_alert_box(file, errno); return; } -- cgit v1.2.3