[dia] build: fix wrong runtime usage of wmf plug-in
- From: Hans Breuer <hans src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dia] build: fix wrong runtime usage of wmf plug-in
- Date: Thu, 9 Jun 2011 19:31:01 +0000 (UTC)
commit ff03e2c1cec015532cc9be0a1c26a72a8cd46408
Author: Hans Breuer <hans breuer org>
Date: Thu Jun 9 21:30:24 2011 +0200
build: fix wrong runtime usage of wmf plug-in
The recent cleanup of plug-ins/makefile.msc did break the wmf plug-in
by linking the static CRT. The result was bad-file-descriptor on final
fwrite(), so that's now detected as well. Finally there is some
preprocessor define to get a compile time error instead of producing
a less obvious runtime error.
plug-ins/makefile.msc | 2 ++
plug-ins/wmf/wmf.cpp | 8 +++++++-
2 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/plug-ins/makefile.msc b/plug-ins/makefile.msc
index d4122fb..89eaa50 100644
--- a/plug-ins/makefile.msc
+++ b/plug-ins/makefile.msc
@@ -195,6 +195,8 @@ $(PACKAGE).dll : $(OBJECTS) $(PKG_DEF)
$(PKG_LINK) $(EXTRALIBS) user32.lib advapi32.lib wsock32.lib $(LDFLAGS) /def:$(PKG_DEF)
$(PRJ_TOP)\config.h: $(PRJ_TOP)\config.h.win32
copy $(PRJ_TOP)\config.h.win32 $(PRJ_TOP)\config.h
+.cpp.obj :
+ $(CC) $(CFLAGS) -c $(PKG_CFLAGS) $<
!ENDIF
diff --git a/plug-ins/wmf/wmf.cpp b/plug-ins/wmf/wmf.cpp
index 1697e44..c59883d 100644
--- a/plug-ins/wmf/wmf.cpp
+++ b/plug-ins/wmf/wmf.cpp
@@ -39,6 +39,11 @@
#include "paginate_gdiprint.h"
#if defined HAVE_WINDOWS_H || defined G_OS_WIN32
+#ifdef _MSC_VER
+#ifndef _DLL
+#error "fwrite will fail with wrong crt"
+#endif
+#endif
namespace W32 {
// at least Rectangle conflicts ...
# define WIN32_LEAN_AND_MEAN
@@ -300,7 +305,8 @@ end_render(DiaRenderer *self)
}
/* write file */
- fwrite(pData,1,nSize,f);
+ if (fwrite(pData,1,nSize,f) != nSize)
+ message_error (_("Couldn't write file %s\n%s"), renderer->sFileName, strerror(errno));
fclose(f);
g_free(pData);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]