Last active
November 19, 2015 21:38
-
-
Save k-takata/2b9e7c8d901d7d1da9be to your computer and use it in GitHub Desktop.
libXpm patches
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 0d28151eb1de2b3f8196c611d488be8496ad02c0 Mon Sep 17 00:00:00 2001 | |
From: MURAOKA Taro <[email protected]> | |
Date: Thu, 2 Feb 2012 01:14:15 +0900 | |
Subject: [PATCH 1/7] make compilable for 32bit Windows | |
--- | |
src/.gitignore | 8 +++++ | |
src/Attrib.c | 2 +- | |
src/Make_msvc.mak | 104 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
src/RdFToI.c | 1 + | |
src/WrFFrI.c | 10 +++++- | |
src/create.c | 4 +-- | |
src/hashtab.c | 2 +- | |
src/simx.c | 2 +- | |
src/simx.h | 5 +-- | |
9 files changed, 130 insertions(+), 8 deletions(-) | |
create mode 100644 src/.gitignore | |
create mode 100644 src/Make_msvc.mak | |
diff --git a/src/.gitignore b/src/.gitignore | |
new file mode 100644 | |
index 0000000..6039405 | |
--- /dev/null | |
+++ b/src/.gitignore | |
@@ -0,0 +1,8 @@ | |
+*.obj | |
+libXpm.def | |
+libXpm.dll | |
+libXpm.dll.manifest | |
+libXpm.exp | |
+libXpm.lib | |
+libXpm.map | |
+tags | |
diff --git a/src/Attrib.c b/src/Attrib.c | |
index 1b38047..9259b97 100644 | |
--- a/src/Attrib.c | |
+++ b/src/Attrib.c | |
@@ -128,7 +128,7 @@ XpmFreeExtensions( | |
char **sptr; | |
if (extensions && nextensions > 0) { | |
- for (i = 0, ext = extensions; i < nextensions; i++, ext++) { | |
+ for (i = 0, ext = extensions; i < (unsigned int)nextensions; i++, ext++) { | |
if (ext->name) | |
XpmFree(ext->name); | |
nlines = ext->nlines; | |
diff --git a/src/Make_msvc.mak b/src/Make_msvc.mak | |
new file mode 100644 | |
index 0000000..f6d19ba | |
--- /dev/null | |
+++ b/src/Make_msvc.mak | |
@@ -0,0 +1,104 @@ | |
+# USAGE: | |
+# Build debug version: nmake | |
+# Build release version: nmake nodebug=1 | |
+ | |
+############################################################################ | |
+# PROJECT SETTINGS. | |
+ | |
+SRCS = \ | |
+ Attrib.c \ | |
+ CrBufFrI.c \ | |
+ CrDatFrI.c \ | |
+ CrIFrBuf.c \ | |
+ CrIFrDat.c \ | |
+ Image.c \ | |
+ Info.c \ | |
+ RdFToBuf.c \ | |
+ RdFToDat.c \ | |
+ RdFToI.c \ | |
+ WrFFrBuf.c \ | |
+ WrFFrDat.c \ | |
+ WrFFrI.c \ | |
+ create.c \ | |
+ data.c \ | |
+ hashtab.c \ | |
+ misc.c \ | |
+ parse.c \ | |
+ rgb.c \ | |
+ scan.c \ | |
+ simx.c | |
+ | |
+DLLDEF = libXpm.def | |
+ | |
+RESSRCS = | |
+LIBS = gdi32.lib | |
+ | |
+OUTPUT_NAME = libXpm | |
+OUTPUT = $(OUTPUT_NAME).dll | |
+ | |
+DEFINES = /D_CRT_SECURE_NO_WARNINGS=1 \ | |
+ /D_BIND_TO_CURRENT_VCLIBS_VERSION=1 \ | |
+ /DFOR_MSW=1 | |
+ | |
+INCLUDES = /I ..\include\X11 | |
+ | |
+CCFLAGS = $(DEFINES) $(INCLUDES) /wd 4996 | |
+CPPFLAGS = $(DEFINES) $(INCLUDES) | |
+ | |
+LINKFLAGS = /MAP:libXpm.map | |
+ | |
+############################################################################ | |
+# WINDOWS BUILD SETTINGS. | |
+ | |
+APPVER = 5.0 | |
+TARGET = WINNT | |
+TARGETLANG = LANG_JAPANESE | |
+_WIN32_IE = 0x0600 | |
+!INCLUDE <Win32.Mak> | |
+ | |
+############################################################################ | |
+# DON'T CHANGE BELOW. | |
+ | |
+OBJS1 = $(SRCS:.cpp=.obj) | |
+OBJS = $(OBJS1:.c=.obj) | |
+RESOBJS = $(RESSRCS:.rc=.res) | |
+ | |
+# TARGETS | |
+ | |
+build : $(OUTPUT) | |
+ | |
+clean : | |
+ del /F *.obj | |
+ del /F *.res | |
+ del /F *.exe | |
+ del /F *.exe.manifest | |
+ del /F *.dll | |
+ del /F *.dll.manifest | |
+ del /F *.pdb | |
+ del /F tags | |
+ | |
+tags: *.c *.h | |
+ ctags -R . ..\include | |
+ | |
+rebuild : clean tags build | |
+ | |
+.PHONY: build clean rebuild | |
+ | |
+.c.obj :: | |
+ $(CC) $(cdebug) $(cflags) $(cvarsdll) $(CCFLAGS) /c $< | |
+ | |
+.cpp.obj :: | |
+ $(CC) $(cdebug) $(cflags) $(cvarsdll) $(CPPFLAGS) /c $< | |
+ | |
+$(OUTPUT_NAME).exe : $(OBJS) $(RESOBJS) | |
+ $(link) $(ldebug) $(guilflags) $(guilibsdll) \ | |
+ /OUT:$@ $(LINKFLAGS) $(OBJS) $(RESOBJS) $(LIBS) | |
+ IF EXIST [email protected] \ | |
+ mt -nologo -manifest [email protected] -outputresource:$@;1 | |
+ | |
+$(OUTPUT_NAME).dll : $(OBJS) $(RESOBJS) $(DLLDEF) | |
+ $(link) /NOLOGO $(ldebug) $(dlllflags) $(conlibsdll) \ | |
+ /OUT:$@ /DEF:$(DLLDEF) $(LINKFLAGS) $(OBJS) $(RESOBJS) $(LIBS) | |
+ IF EXIST [email protected] \ | |
+ mt -nologo -manifest [email protected] -outputresource:$@;2 | |
+ | |
diff --git a/src/RdFToI.c b/src/RdFToI.c | |
index bd09611..00c6c96 100644 | |
--- a/src/RdFToI.c | |
+++ b/src/RdFToI.c | |
@@ -45,6 +45,7 @@ | |
#include <sys/wait.h> | |
#else | |
#ifdef FOR_MSW | |
+#include <io.h> | |
#include <fcntl.h> | |
#endif | |
#endif | |
diff --git a/src/WrFFrI.c b/src/WrFFrI.c | |
index 067c96b..eb2cec0 100644 | |
--- a/src/WrFFrI.c | |
+++ b/src/WrFFrI.c | |
@@ -49,6 +49,14 @@ | |
#include "errno.h" | |
#endif | |
+#ifdef FOR_MSW | |
+# include <io.h> | |
+# include <fcntl.h> | |
+# define O_WRONLY _O_WRONLY | |
+# define O_CREAT _O_CREAT | |
+# define O_TRUNC _O_TRUNC | |
+#endif | |
+ | |
#include "fcntl.h" | |
/* MS Windows define a function called WriteFile @#%#&!!! */ | |
@@ -330,7 +338,7 @@ OpenWriteFile( | |
#ifndef NO_ZPIPE | |
size_t len; | |
#endif | |
- int fd = open(filename, O_WRONLY|O_CREAT|O_TRUNC, 0644); | |
+ int fd = _open(filename, O_WRONLY|O_CREAT|O_TRUNC, 0644); | |
if ( fd < 0 ) | |
return(XpmOpenFailed); | |
#ifndef NO_ZPIPE | |
diff --git a/src/create.c b/src/create.c | |
index 98678d8..1e75e55 100644 | |
--- a/src/create.c | |
+++ b/src/create.c | |
@@ -1733,7 +1733,7 @@ MSWPutImagePixels( | |
{ | |
unsigned int *data = pixelindex; | |
unsigned int x, y; | |
- HBITMAP obm; | |
+ HGDIOBJ obm; | |
obm = SelectObject(*dc, image->bitmap); | |
for (y = 0; y < height; y++) { | |
@@ -2334,7 +2334,7 @@ ParseAndPutPixels( | |
unsigned short colidx[256]; | |
#ifdef FOR_MSW | |
HDC shapedc; | |
- HBITMAP obm, sobm; | |
+ HGDIOBJ obm, sobm; | |
if ( shapeimage ) { | |
shapedc = CreateCompatibleDC(*dc); | |
diff --git a/src/hashtab.c b/src/hashtab.c | |
index 1bd4109..f3b2e0c 100644 | |
--- a/src/hashtab.c | |
+++ b/src/hashtab.c | |
@@ -139,7 +139,7 @@ HashTableGrows(xpmHashTable *table) | |
xpmHashAtom *atomTable = table->atomTable; | |
unsigned int size = table->size; | |
xpmHashAtom *t, *p; | |
- int i; | |
+ unsigned int i; | |
unsigned int oldSize = size; | |
t = atomTable; | |
diff --git a/src/simx.c b/src/simx.c | |
index c76934b..9d5c0aa 100644 | |
--- a/src/simx.c | |
+++ b/src/simx.c | |
@@ -141,7 +141,7 @@ XDefaultColormap(Display *display, Screen *screen) | |
/* convert hex color names, | |
wrong digits (not a-f,A-F,0-9) are treated as zero */ | |
static int | |
-hexCharToInt(c) | |
+hexCharToInt(char c) | |
{ | |
int r; | |
diff --git a/src/simx.h b/src/simx.h | |
index 7c4c4b9..528b833 100644 | |
--- a/src/simx.h | |
+++ b/src/simx.h | |
@@ -103,9 +103,9 @@ extern "C" { | |
FUNC(XDefaultDepth, int, (Display *d, Screen *s)); | |
/* color related */ | |
- FUNC(XParseColor, int, (Display *, Colormap *, char *, XColor *)); | |
+ FUNC(XParseColor, int, (Display *, Colormap, char *, XColor *)); | |
FUNC(XAllocColor, int, (Display *, Colormap, XColor *)); | |
- FUNC(XQueryColors, void, (Display *display, Colormap *colormap, | |
+ FUNC(XQueryColors, void, (Display *display, Colormap colormap, | |
XColor *xcolors, int ncolors)); | |
FUNC(XFreeColors, int, (Display *d, Colormap cmap, | |
unsigned long pixels[], | |
@@ -147,6 +147,7 @@ typedef BOOL Bool; /* take MSW bool */ | |
#define O_RDONLY _O_RDONLY | |
#define rindex strrchr | |
#define strdup _strdup | |
+#define snprintf _snprintf | |
#endif /* def FOR_MSW */ | |
-- | |
2.4.5 | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From b95ac907891576c9a0564de9128b97b4ea4704ef Mon Sep 17 00:00:00 2001 | |
From: mattn <[email protected]> | |
Date: Thu, 2 Feb 2012 11:11:37 +0900 | |
Subject: [PATCH 2/7] add Makefile for mingw32. | |
--- | |
src/Make_ming.mak | 39 +++++++++++++++++++++++++++++++++++++++ | |
1 file changed, 39 insertions(+) | |
create mode 100644 src/Make_ming.mak | |
diff --git a/src/Make_ming.mak b/src/Make_ming.mak | |
new file mode 100644 | |
index 0000000..9ffd1fc | |
--- /dev/null | |
+++ b/src/Make_ming.mak | |
@@ -0,0 +1,39 @@ | |
+SRCS = \ | |
+ Attrib.c \ | |
+ CrBufFrI.c \ | |
+ CrDatFrI.c \ | |
+ CrIFrBuf.c \ | |
+ CrIFrDat.c \ | |
+ Image.c \ | |
+ Info.c \ | |
+ RdFToBuf.c \ | |
+ RdFToDat.c \ | |
+ RdFToI.c \ | |
+ WrFFrBuf.c \ | |
+ WrFFrDat.c \ | |
+ WrFFrI.c \ | |
+ create.c \ | |
+ data.c \ | |
+ hashtab.c \ | |
+ misc.c \ | |
+ parse.c \ | |
+ rgb.c \ | |
+ scan.c \ | |
+ simx.c | |
+ | |
+CFLAGS = -I../include/X11 -I. \ | |
+ -D_CRT_SECURE_NO_WARNINGS=1 \ | |
+ -D_BIND_TO_CURRENT_VCLIBS_VERSION=1 \ | |
+ -DFOR_MSW=1 | |
+OBJS = $(subst .c,.o,$(SRCS)) | |
+ | |
+all : libXpm.dll | |
+.c.o :: | |
+ gcc $(CFLAGS) -c $< | |
+ | |
+libXpm.dll : $(OBJS) | |
+ gcc -shared -o $@ $(OBJS) -lgdi32 | |
+ | |
+clean : | |
+ rm -f *.o *.dll | |
+ | |
-- | |
2.4.5 | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From cc19711d6fb8b472b4d4909f48fd9d87ed611b2f Mon Sep 17 00:00:00 2001 | |
From: MURAOKA Taro <[email protected]> | |
Date: Sat, 4 Aug 2012 08:48:39 +0900 | |
Subject: [PATCH 3/7] add libXpm.def (had be ignored) | |
--- | |
src/libXpm.def | 28 ++++++++++++++++++++++++++++ | |
1 file changed, 28 insertions(+) | |
create mode 100644 src/libXpm.def | |
diff --git a/src/libXpm.def b/src/libXpm.def | |
new file mode 100644 | |
index 0000000..765b69a | |
--- /dev/null | |
+++ b/src/libXpm.def | |
@@ -0,0 +1,28 @@ | |
+LIBRARY "libXpm" | |
+EXPORTS | |
+ XImageFree | |
+ XpmAttributesSize | |
+ XpmCreateBufferFromXpmImage | |
+ XpmCreateDataFromImage | |
+ XpmCreateDataFromXpmImage | |
+ XpmCreateImageFromBuffer | |
+ XpmCreateImageFromData | |
+ XpmCreateImageFromXpmImage | |
+ XpmCreateXpmImageFromBuffer | |
+ XpmCreateXpmImageFromData | |
+ XpmCreateXpmImageFromImage | |
+ XpmFree | |
+ XpmFreeAttributes | |
+ XpmFreeExtensions | |
+ XpmFreeXpmImage | |
+ XpmFreeXpmInfo | |
+ XpmGetErrorString | |
+ XpmLibraryVersion | |
+ XpmReadFileToBuffer | |
+ XpmReadFileToData | |
+ XpmReadFileToImage | |
+ XpmReadFileToXpmImage | |
+ XpmWriteFileFromBuffer | |
+ XpmWriteFileFromData | |
+ XpmWriteFileFromImage | |
+ XpmWriteFileFromXpmImage | |
-- | |
2.4.5 | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 9fa5f165beed234701b660c15eb3078a1b86a1ce Mon Sep 17 00:00:00 2001 | |
From: MURAOKA Taro <[email protected]> | |
Date: Sat, 4 Aug 2012 13:18:16 +0900 | |
Subject: [PATCH 4/7] add makefile to build static library | |
--- | |
src/Make_msvc.mak | 104 -------------------------------------------------- | |
src/Make_msvc_dll.mak | 104 ++++++++++++++++++++++++++++++++++++++++++++++++++ | |
src/Make_msvc_lib.mak | 26 +++++++++++++ | |
src/WrFFrI.c | 14 +++---- | |
4 files changed, 135 insertions(+), 113 deletions(-) | |
delete mode 100644 src/Make_msvc.mak | |
create mode 100644 src/Make_msvc_dll.mak | |
create mode 100644 src/Make_msvc_lib.mak | |
diff --git a/src/Make_msvc.mak b/src/Make_msvc.mak | |
deleted file mode 100644 | |
index f6d19ba..0000000 | |
--- a/src/Make_msvc.mak | |
+++ /dev/null | |
@@ -1,104 +0,0 @@ | |
-# USAGE: | |
-# Build debug version: nmake | |
-# Build release version: nmake nodebug=1 | |
- | |
-############################################################################ | |
-# PROJECT SETTINGS. | |
- | |
-SRCS = \ | |
- Attrib.c \ | |
- CrBufFrI.c \ | |
- CrDatFrI.c \ | |
- CrIFrBuf.c \ | |
- CrIFrDat.c \ | |
- Image.c \ | |
- Info.c \ | |
- RdFToBuf.c \ | |
- RdFToDat.c \ | |
- RdFToI.c \ | |
- WrFFrBuf.c \ | |
- WrFFrDat.c \ | |
- WrFFrI.c \ | |
- create.c \ | |
- data.c \ | |
- hashtab.c \ | |
- misc.c \ | |
- parse.c \ | |
- rgb.c \ | |
- scan.c \ | |
- simx.c | |
- | |
-DLLDEF = libXpm.def | |
- | |
-RESSRCS = | |
-LIBS = gdi32.lib | |
- | |
-OUTPUT_NAME = libXpm | |
-OUTPUT = $(OUTPUT_NAME).dll | |
- | |
-DEFINES = /D_CRT_SECURE_NO_WARNINGS=1 \ | |
- /D_BIND_TO_CURRENT_VCLIBS_VERSION=1 \ | |
- /DFOR_MSW=1 | |
- | |
-INCLUDES = /I ..\include\X11 | |
- | |
-CCFLAGS = $(DEFINES) $(INCLUDES) /wd 4996 | |
-CPPFLAGS = $(DEFINES) $(INCLUDES) | |
- | |
-LINKFLAGS = /MAP:libXpm.map | |
- | |
-############################################################################ | |
-# WINDOWS BUILD SETTINGS. | |
- | |
-APPVER = 5.0 | |
-TARGET = WINNT | |
-TARGETLANG = LANG_JAPANESE | |
-_WIN32_IE = 0x0600 | |
-!INCLUDE <Win32.Mak> | |
- | |
-############################################################################ | |
-# DON'T CHANGE BELOW. | |
- | |
-OBJS1 = $(SRCS:.cpp=.obj) | |
-OBJS = $(OBJS1:.c=.obj) | |
-RESOBJS = $(RESSRCS:.rc=.res) | |
- | |
-# TARGETS | |
- | |
-build : $(OUTPUT) | |
- | |
-clean : | |
- del /F *.obj | |
- del /F *.res | |
- del /F *.exe | |
- del /F *.exe.manifest | |
- del /F *.dll | |
- del /F *.dll.manifest | |
- del /F *.pdb | |
- del /F tags | |
- | |
-tags: *.c *.h | |
- ctags -R . ..\include | |
- | |
-rebuild : clean tags build | |
- | |
-.PHONY: build clean rebuild | |
- | |
-.c.obj :: | |
- $(CC) $(cdebug) $(cflags) $(cvarsdll) $(CCFLAGS) /c $< | |
- | |
-.cpp.obj :: | |
- $(CC) $(cdebug) $(cflags) $(cvarsdll) $(CPPFLAGS) /c $< | |
- | |
-$(OUTPUT_NAME).exe : $(OBJS) $(RESOBJS) | |
- $(link) $(ldebug) $(guilflags) $(guilibsdll) \ | |
- /OUT:$@ $(LINKFLAGS) $(OBJS) $(RESOBJS) $(LIBS) | |
- IF EXIST [email protected] \ | |
- mt -nologo -manifest [email protected] -outputresource:$@;1 | |
- | |
-$(OUTPUT_NAME).dll : $(OBJS) $(RESOBJS) $(DLLDEF) | |
- $(link) /NOLOGO $(ldebug) $(dlllflags) $(conlibsdll) \ | |
- /OUT:$@ /DEF:$(DLLDEF) $(LINKFLAGS) $(OBJS) $(RESOBJS) $(LIBS) | |
- IF EXIST [email protected] \ | |
- mt -nologo -manifest [email protected] -outputresource:$@;2 | |
- | |
diff --git a/src/Make_msvc_dll.mak b/src/Make_msvc_dll.mak | |
new file mode 100644 | |
index 0000000..f6d19ba | |
--- /dev/null | |
+++ b/src/Make_msvc_dll.mak | |
@@ -0,0 +1,104 @@ | |
+# USAGE: | |
+# Build debug version: nmake | |
+# Build release version: nmake nodebug=1 | |
+ | |
+############################################################################ | |
+# PROJECT SETTINGS. | |
+ | |
+SRCS = \ | |
+ Attrib.c \ | |
+ CrBufFrI.c \ | |
+ CrDatFrI.c \ | |
+ CrIFrBuf.c \ | |
+ CrIFrDat.c \ | |
+ Image.c \ | |
+ Info.c \ | |
+ RdFToBuf.c \ | |
+ RdFToDat.c \ | |
+ RdFToI.c \ | |
+ WrFFrBuf.c \ | |
+ WrFFrDat.c \ | |
+ WrFFrI.c \ | |
+ create.c \ | |
+ data.c \ | |
+ hashtab.c \ | |
+ misc.c \ | |
+ parse.c \ | |
+ rgb.c \ | |
+ scan.c \ | |
+ simx.c | |
+ | |
+DLLDEF = libXpm.def | |
+ | |
+RESSRCS = | |
+LIBS = gdi32.lib | |
+ | |
+OUTPUT_NAME = libXpm | |
+OUTPUT = $(OUTPUT_NAME).dll | |
+ | |
+DEFINES = /D_CRT_SECURE_NO_WARNINGS=1 \ | |
+ /D_BIND_TO_CURRENT_VCLIBS_VERSION=1 \ | |
+ /DFOR_MSW=1 | |
+ | |
+INCLUDES = /I ..\include\X11 | |
+ | |
+CCFLAGS = $(DEFINES) $(INCLUDES) /wd 4996 | |
+CPPFLAGS = $(DEFINES) $(INCLUDES) | |
+ | |
+LINKFLAGS = /MAP:libXpm.map | |
+ | |
+############################################################################ | |
+# WINDOWS BUILD SETTINGS. | |
+ | |
+APPVER = 5.0 | |
+TARGET = WINNT | |
+TARGETLANG = LANG_JAPANESE | |
+_WIN32_IE = 0x0600 | |
+!INCLUDE <Win32.Mak> | |
+ | |
+############################################################################ | |
+# DON'T CHANGE BELOW. | |
+ | |
+OBJS1 = $(SRCS:.cpp=.obj) | |
+OBJS = $(OBJS1:.c=.obj) | |
+RESOBJS = $(RESSRCS:.rc=.res) | |
+ | |
+# TARGETS | |
+ | |
+build : $(OUTPUT) | |
+ | |
+clean : | |
+ del /F *.obj | |
+ del /F *.res | |
+ del /F *.exe | |
+ del /F *.exe.manifest | |
+ del /F *.dll | |
+ del /F *.dll.manifest | |
+ del /F *.pdb | |
+ del /F tags | |
+ | |
+tags: *.c *.h | |
+ ctags -R . ..\include | |
+ | |
+rebuild : clean tags build | |
+ | |
+.PHONY: build clean rebuild | |
+ | |
+.c.obj :: | |
+ $(CC) $(cdebug) $(cflags) $(cvarsdll) $(CCFLAGS) /c $< | |
+ | |
+.cpp.obj :: | |
+ $(CC) $(cdebug) $(cflags) $(cvarsdll) $(CPPFLAGS) /c $< | |
+ | |
+$(OUTPUT_NAME).exe : $(OBJS) $(RESOBJS) | |
+ $(link) $(ldebug) $(guilflags) $(guilibsdll) \ | |
+ /OUT:$@ $(LINKFLAGS) $(OBJS) $(RESOBJS) $(LIBS) | |
+ IF EXIST [email protected] \ | |
+ mt -nologo -manifest [email protected] -outputresource:$@;1 | |
+ | |
+$(OUTPUT_NAME).dll : $(OBJS) $(RESOBJS) $(DLLDEF) | |
+ $(link) /NOLOGO $(ldebug) $(dlllflags) $(conlibsdll) \ | |
+ /OUT:$@ /DEF:$(DLLDEF) $(LINKFLAGS) $(OBJS) $(RESOBJS) $(LIBS) | |
+ IF EXIST [email protected] \ | |
+ mt -nologo -manifest [email protected] -outputresource:$@;2 | |
+ | |
diff --git a/src/Make_msvc_lib.mak b/src/Make_msvc_lib.mak | |
new file mode 100644 | |
index 0000000..4ea038f | |
--- /dev/null | |
+++ b/src/Make_msvc_lib.mak | |
@@ -0,0 +1,26 @@ | |
+SRC = Attrib.c CrBufFrI.c CrDatFrI.c CrIFrBuf.c CrIFrDat.c Image.c Info.c \ | |
+ RdFToBuf.c RdFToDat.c RdFToI.c WrFFrBuf.c WrFFrDat.c WrFFrI.c \ | |
+ create.c data.c hashtab.c misc.c parse.c rgb.c scan.c simx.c | |
+ | |
+OBJ = $(SRC:.c=.obj) | |
+ | |
+CFLAGS = /nologo /I../include/X11 /DFOR_MSW=1 /Ox /MD | |
+LFLAGS = /NOLOGO | |
+ | |
+!IFDEF OPT | |
+CFLAGS = $(CFLAGS) /GL | |
+LFLAGS = $(LFLAGS) /LTCG | |
+!ENDIF | |
+ | |
+############################################################################ | |
+ | |
+default: libXpm.lib | |
+ | |
+clean: | |
+ -DEL /F $(OBJ) | |
+ -DEL /F libXpm.lib | |
+ -DEL /F libXpm.exp | |
+ -DEL /F libXpm.map | |
+ | |
+libXpm.lib: $(OBJ) | |
+ LIB $(LFLAGS) $(OBJ) /OUT:libXpm.lib | |
diff --git a/src/WrFFrI.c b/src/WrFFrI.c | |
index eb2cec0..56d1ae2 100644 | |
--- a/src/WrFFrI.c | |
+++ b/src/WrFFrI.c | |
@@ -42,6 +42,10 @@ | |
#endif | |
#include "XpmI.h" | |
+#ifdef FOR_MSW | |
+# include <io.h> | |
+#endif | |
+ | |
#ifndef NO_ZPIPE | |
#include "sys/wait.h" | |
#include "sys/types.h" | |
@@ -49,14 +53,6 @@ | |
#include "errno.h" | |
#endif | |
-#ifdef FOR_MSW | |
-# include <io.h> | |
-# include <fcntl.h> | |
-# define O_WRONLY _O_WRONLY | |
-# define O_CREAT _O_CREAT | |
-# define O_TRUNC _O_TRUNC | |
-#endif | |
- | |
#include "fcntl.h" | |
/* MS Windows define a function called WriteFile @#%#&!!! */ | |
@@ -338,7 +334,7 @@ OpenWriteFile( | |
#ifndef NO_ZPIPE | |
size_t len; | |
#endif | |
- int fd = _open(filename, O_WRONLY|O_CREAT|O_TRUNC, 0644); | |
+ int fd = open(filename, O_WRONLY|O_CREAT|O_TRUNC, 0644); | |
if ( fd < 0 ) | |
return(XpmOpenFailed); | |
#ifndef NO_ZPIPE | |
-- | |
2.4.5 | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From b8517e0dde1feb53a5dd63069716da4867f551b8 Mon Sep 17 00:00:00 2001 | |
From: "K.Takata" <[email protected]> | |
Date: Wed, 22 Jul 2015 23:12:57 +0900 | |
Subject: [PATCH 5/7] Support VS2015 | |
VS2015 has snprintf. | |
--- | |
src/simx.h | 2 ++ | |
1 file changed, 2 insertions(+) | |
diff --git a/src/simx.h b/src/simx.h | |
index 528b833..22c1bb1 100644 | |
--- a/src/simx.h | |
+++ b/src/simx.h | |
@@ -147,7 +147,9 @@ typedef BOOL Bool; /* take MSW bool */ | |
#define O_RDONLY _O_RDONLY | |
#define rindex strrchr | |
#define strdup _strdup | |
+#if defined(_MSC_VER) && _MSC_VER < 1900 | |
#define snprintf _snprintf | |
+#endif | |
#endif /* def FOR_MSW */ | |
-- | |
2.4.5 | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From e652745115ea098c5b1f28e7592fe14a6b209cae Mon Sep 17 00:00:00 2001 | |
From: "K.Takata" <[email protected]> | |
Date: Fri, 24 Jul 2015 09:09:19 +0900 | |
Subject: [PATCH 6/7] Support dynamic/static link to CRT | |
If USE_STATIC_CRT is defined, static CRT is linked. | |
Otherwise msvcrXX.dll is linked. | |
--- | |
src/Make_msvc_dll.mak | 16 +++++++++++----- | |
src/Make_msvc_lib.mak | 11 ++++++++++- | |
2 files changed, 21 insertions(+), 6 deletions(-) | |
diff --git a/src/Make_msvc_dll.mak b/src/Make_msvc_dll.mak | |
index f6d19ba..d458546 100644 | |
--- a/src/Make_msvc_dll.mak | |
+++ b/src/Make_msvc_dll.mak | |
@@ -37,7 +37,6 @@ OUTPUT_NAME = libXpm | |
OUTPUT = $(OUTPUT_NAME).dll | |
DEFINES = /D_CRT_SECURE_NO_WARNINGS=1 \ | |
- /D_BIND_TO_CURRENT_VCLIBS_VERSION=1 \ | |
/DFOR_MSW=1 | |
INCLUDES = /I ..\include\X11 | |
@@ -47,6 +46,13 @@ CPPFLAGS = $(DEFINES) $(INCLUDES) | |
LINKFLAGS = /MAP:libXpm.map | |
+!ifdef USE_STATIC_CRT | |
+CVARS = $(cvarsmt) | |
+!else | |
+CVARS = $(cvarsdll) | |
+DEFINES = $(DEFINES) /D_BIND_TO_CURRENT_VCLIBS_VERSION=1 | |
+!endif | |
+ | |
############################################################################ | |
# WINDOWS BUILD SETTINGS. | |
@@ -85,19 +91,19 @@ rebuild : clean tags build | |
.PHONY: build clean rebuild | |
.c.obj :: | |
- $(CC) $(cdebug) $(cflags) $(cvarsdll) $(CCFLAGS) /c $< | |
+ $(CC) $(cdebug) $(cflags) $(CVARS) $(CCFLAGS) /c $< | |
.cpp.obj :: | |
- $(CC) $(cdebug) $(cflags) $(cvarsdll) $(CPPFLAGS) /c $< | |
+ $(CC) $(cdebug) $(cflags) $(CVARS) $(CPPFLAGS) /c $< | |
$(OUTPUT_NAME).exe : $(OBJS) $(RESOBJS) | |
- $(link) $(ldebug) $(guilflags) $(guilibsdll) \ | |
+ $(link) $(ldebug) $(guilflags) $(guilibs) \ | |
/OUT:$@ $(LINKFLAGS) $(OBJS) $(RESOBJS) $(LIBS) | |
IF EXIST [email protected] \ | |
mt -nologo -manifest [email protected] -outputresource:$@;1 | |
$(OUTPUT_NAME).dll : $(OBJS) $(RESOBJS) $(DLLDEF) | |
- $(link) /NOLOGO $(ldebug) $(dlllflags) $(conlibsdll) \ | |
+ $(link) /NOLOGO $(ldebug) $(dlllflags) $(conlibs) \ | |
/OUT:$@ /DEF:$(DLLDEF) $(LINKFLAGS) $(OBJS) $(RESOBJS) $(LIBS) | |
IF EXIST [email protected] \ | |
mt -nologo -manifest [email protected] -outputresource:$@;2 | |
diff --git a/src/Make_msvc_lib.mak b/src/Make_msvc_lib.mak | |
index 4ea038f..6731b97 100644 | |
--- a/src/Make_msvc_lib.mak | |
+++ b/src/Make_msvc_lib.mak | |
@@ -4,7 +4,16 @@ SRC = Attrib.c CrBufFrI.c CrDatFrI.c CrIFrBuf.c CrIFrDat.c Image.c Info.c \ | |
OBJ = $(SRC:.c=.obj) | |
-CFLAGS = /nologo /I../include/X11 /DFOR_MSW=1 /Ox /MD | |
+CFLAGS = /nologo /I../include/X11 /Ox /W3 \ | |
+ /DFOR_MSW=1 \ | |
+ /D_CRT_SECURE_NO_WARNINGS=1 | |
+ | |
+!ifdef USE_STATIC_CRT | |
+CFLAGS = $(CFLAGS) /MT | |
+!else | |
+CFLAGS = $(CFLAGS) /MD | |
+!endif | |
+ | |
LFLAGS = /NOLOGO | |
!IFDEF OPT | |
-- | |
2.4.5 | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 7749afcdbb1e3fbd24ca8527bd46f35a1cbc9500 Mon Sep 17 00:00:00 2001 | |
From: MURAOKA Taro <[email protected]> | |
Date: Sat, 25 Jul 2015 23:55:58 +0900 | |
Subject: [PATCH 7/7] arrange codes, add tiny doc | |
--- | |
src/Make_msvc_dll.mak | 32 ++++++++++++++++++++------------ | |
src/Make_msvc_lib.mak | 18 ++++++++++++------ | |
2 files changed, 32 insertions(+), 18 deletions(-) | |
diff --git a/src/Make_msvc_dll.mak b/src/Make_msvc_dll.mak | |
index d458546..abf3b18 100644 | |
--- a/src/Make_msvc_dll.mak | |
+++ b/src/Make_msvc_dll.mak | |
@@ -1,6 +1,11 @@ | |
# USAGE: | |
+# | |
# Build debug version: nmake | |
# Build release version: nmake nodebug=1 | |
+# | |
+# Build without MSVCRT: nmake nomsvcrt=1 | |
+# Build release version without MSVCRT: | |
+# nmake nodebug=1 nomsvcrt=1 | |
############################################################################ | |
# PROJECT SETTINGS. | |
@@ -46,13 +51,6 @@ CPPFLAGS = $(DEFINES) $(INCLUDES) | |
LINKFLAGS = /MAP:libXpm.map | |
-!ifdef USE_STATIC_CRT | |
-CVARS = $(cvarsmt) | |
-!else | |
-CVARS = $(cvarsdll) | |
-DEFINES = $(DEFINES) /D_BIND_TO_CURRENT_VCLIBS_VERSION=1 | |
-!endif | |
- | |
############################################################################ | |
# WINDOWS BUILD SETTINGS. | |
@@ -65,6 +63,17 @@ _WIN32_IE = 0x0600 | |
############################################################################ | |
# DON'T CHANGE BELOW. | |
+!IFDEF NOMSVCRT | |
+_CVARS = $(cvarsmt) | |
+_LIBS_EXE = $(guilibsmt) | |
+_LIBS_DLL = $(conlibsmt) | |
+!ELSE | |
+DEFINES = $(DEFINES) /D_BIND_TO_CURRENT_VCLIBS_VERSION=1 | |
+_CVARS = $(cvarsdll) | |
+_LIBS_EXE = $(guilibsdll) | |
+_LIBS_DLL = $(conlibsdll) | |
+!ENDIF | |
+ | |
OBJS1 = $(SRCS:.cpp=.obj) | |
OBJS = $(OBJS1:.c=.obj) | |
RESOBJS = $(RESSRCS:.rc=.res) | |
@@ -91,20 +100,19 @@ rebuild : clean tags build | |
.PHONY: build clean rebuild | |
.c.obj :: | |
- $(CC) $(cdebug) $(cflags) $(CVARS) $(CCFLAGS) /c $< | |
+ $(CC) $(cdebug) $(cflags) $(_CVARS) $(CCFLAGS) /c $< | |
.cpp.obj :: | |
- $(CC) $(cdebug) $(cflags) $(CVARS) $(CPPFLAGS) /c $< | |
+ $(CC) $(cdebug) $(cflags) $(_CVARS) $(CPPFLAGS) /c $< | |
$(OUTPUT_NAME).exe : $(OBJS) $(RESOBJS) | |
- $(link) $(ldebug) $(guilflags) $(guilibs) \ | |
+ $(link) $(ldebug) $(guilflags) $(_LIBS_EXE) \ | |
/OUT:$@ $(LINKFLAGS) $(OBJS) $(RESOBJS) $(LIBS) | |
IF EXIST [email protected] \ | |
mt -nologo -manifest [email protected] -outputresource:$@;1 | |
$(OUTPUT_NAME).dll : $(OBJS) $(RESOBJS) $(DLLDEF) | |
- $(link) /NOLOGO $(ldebug) $(dlllflags) $(conlibs) \ | |
+ $(link) /NOLOGO $(ldebug) $(dlllflags) $(_LIBS_DLL) \ | |
/OUT:$@ /DEF:$(DLLDEF) $(LINKFLAGS) $(OBJS) $(RESOBJS) $(LIBS) | |
IF EXIST [email protected] \ | |
mt -nologo -manifest [email protected] -outputresource:$@;2 | |
- | |
diff --git a/src/Make_msvc_lib.mak b/src/Make_msvc_lib.mak | |
index 6731b97..586fd89 100644 | |
--- a/src/Make_msvc_lib.mak | |
+++ b/src/Make_msvc_lib.mak | |
@@ -1,3 +1,8 @@ | |
+# USAGE: | |
+# | |
+# Build with MSVCRT: nmake | |
+# Build without MSVCRT: nmake nomsvcrt=1 | |
+ | |
SRC = Attrib.c CrBufFrI.c CrDatFrI.c CrIFrBuf.c CrIFrDat.c Image.c Info.c \ | |
RdFToBuf.c RdFToDat.c RdFToI.c WrFFrBuf.c WrFFrDat.c WrFFrI.c \ | |
create.c data.c hashtab.c misc.c parse.c rgb.c scan.c simx.c | |
@@ -5,15 +10,10 @@ SRC = Attrib.c CrBufFrI.c CrDatFrI.c CrIFrBuf.c CrIFrDat.c Image.c Info.c \ | |
OBJ = $(SRC:.c=.obj) | |
CFLAGS = /nologo /I../include/X11 /Ox /W3 \ | |
+ /wd 4996 \ | |
/DFOR_MSW=1 \ | |
/D_CRT_SECURE_NO_WARNINGS=1 | |
-!ifdef USE_STATIC_CRT | |
-CFLAGS = $(CFLAGS) /MT | |
-!else | |
-CFLAGS = $(CFLAGS) /MD | |
-!endif | |
- | |
LFLAGS = /NOLOGO | |
!IFDEF OPT | |
@@ -23,6 +23,12 @@ LFLAGS = $(LFLAGS) /LTCG | |
############################################################################ | |
+!IFDEF NOMSVCRT | |
+CFLAGS = $(CFLAGS) /MT | |
+!ELSE | |
+CFLAGS = $(CFLAGS) /MD | |
+!ENDIF | |
+ | |
default: libXpm.lib | |
clean: | |
-- | |
2.4.5 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
perfect work! I found it too late.