OSDN Git Service

* update nkf32.dll.
authorNARUSE, Yui <naruse@users.sourceforge.jp>
Thu, 23 Oct 2008 03:27:57 +0000 (03:27 +0000)
committerNARUSE, Yui <naruse@users.sourceforge.jp>
Thu, 23 Oct 2008 03:27:57 +0000 (03:27 +0000)
nkf.c
nkf.h
nkf32.h
nkf32dll.c

diff --git a/nkf.c b/nkf.c
index 3dc1f57..fb5d399 100644 (file)
--- a/nkf.c
+++ b/nkf.c
@@ -31,9 +31,9 @@
  * \e$B8=:_!"\e(Bnkf \e$B$O\e(B SorceForge \e$B$K$F%a%s%F%J%s%9$,B3$1$i$l$F$$$^$9!#\e(B
  * http://sourceforge.jp/projects/nkf/
  ***********************************************************************/
-#define NKF_IDENT "$Id: nkf.c,v 1.183 2008/10/19 09:33:43 naruse Exp $"
+#define NKF_IDENT "$Id: nkf.c,v 1.184 2008/10/22 18:27:57 naruse Exp $"
 #define NKF_VERSION "2.0.8"
-#define NKF_RELEASE_DATE "2008-10-19"
+#define NKF_RELEASE_DATE "2008-10-23"
 #define COPY_RIGHT \
     "Copyright (C) 1987, FUJITSU LTD. (I.Ichikawa),2000 S. Kono, COW\n" \
     "Copyright (C) 2002-2008 Kono, Furukawa, Naruse, mastodon"
diff --git a/nkf.h b/nkf.h
index 6aafbfd..f6005a1 100755 (executable)
--- a/nkf.h
+++ b/nkf.h
-/*\r
- * \r
- * nkf.h - Header file for nkf\r
- * \r
- * $Id: nkf.h,v 1.3 2008/02/01 09:07:56 naruse Exp $\r
- */\r
-\r
-#ifndef NKF_H\r
-\r
-/* Wrapper of configurations */\r
-\r
-#ifndef MIME_DECODE_DEFAULT\r
-#define MIME_DECODE_DEFAULT STRICT_MIME\r
-#endif\r
-#ifndef X0201_DEFAULT\r
-#define X0201_DEFAULT TRUE\r
-#endif\r
-\r
-#if DEFAULT_NEWLINE == 0x0D0A\r
-#define PUT_NEWLINE(func) do {\\r
-    func(0x0D);\\r
-    func(0x0A);\\r
-} while (0)\r
-#define OCONV_NEWLINE(func) do {\\r
-    func(0, 0x0D);\\r
-    func(0, 0x0A);\\r
-} while (0)\r
-#elif DEFAULT_NEWLINE == 0x0D\r
-#define PUT_NEWLINE(func) func(0x0D)\r
-#define OCONV_NEWLINE(func) func(0, 0x0D)\r
-#else\r
-#define DEFAULT_NEWLINE 0x0A\r
-#define PUT_NEWLINE(func) func(0x0A)\r
-#define OCONV_NEWLINE(func) func(0, 0x0A)\r
-#endif\r
-#ifdef HELP_OUTPUT_STDERR\r
-#define HELP_OUTPUT stderr\r
-#else\r
-#define HELP_OUTPUT stdout\r
-#endif\r
-\r
-\r
-/* Compatibility definitions */\r
-\r
-#ifdef nkf_char\r
-#elif defined(INT_IS_SHORT)\r
-typedef long nkf_char;\r
-#define NKF_INT32_C(n)   (n##L)\r
-#else\r
-typedef int nkf_char;\r
-#define NKF_INT32_C(n)   (n)\r
-#endif\r
-\r
-#if (defined(__TURBOC__) || defined(_MSC_VER) || defined(LSI_C) || defined(__MINGW32__) || defined(__EMX__) || defined(__MSDOS__) || defined(__WINDOWS__) || defined(__DOS__) || defined(__OS2__)) && !defined(MSDOS)\r
-#define MSDOS\r
-#if (defined(__Win32__) || defined(_WIN32)) && !defined(__WIN32__)\r
-#define __WIN32__\r
-#endif\r
-#endif\r
-\r
-#ifdef PERL_XS\r
-#undef OVERWRITE\r
-#endif\r
-\r
-#ifndef PERL_XS\r
-#include <stdio.h>\r
-#endif\r
-\r
-#include <stdlib.h>\r
-#include <string.h>\r
-\r
-#if defined(MSDOS) || defined(__OS2__)\r
-#include <fcntl.h>\r
-#include <io.h>\r
-#if defined(_MSC_VER) || defined(__WATCOMC__)\r
-#define mktemp _mktemp\r
-#endif\r
-#endif\r
-\r
-#ifdef MSDOS\r
-#ifdef LSI_C\r
-#define setbinmode(fp) fsetbin(fp)\r
-#elif defined(__DJGPP__)\r
-#include <libc/dosio.h>\r
-void  setbinmode(FILE *fp)\r
-{\r
-    /* we do not use libc's setmode(), which changes COOKED/RAW mode in device. */\r
-    int fd, m;\r
-    fd = fileno(fp);\r
-    m = (__file_handle_modes[fd] & (~O_TEXT)) | O_BINARY;\r
-    __file_handle_set(fd, m);\r
-}\r
-#else /* Microsoft C, Turbo C */\r
-#define setbinmode(fp) setmode(fileno(fp), O_BINARY)\r
-#endif\r
-#else /* UNIX */\r
-#define setbinmode(fp)\r
-#endif\r
-\r
-#ifdef _IOFBF /* SysV and MSDOS, Windows */\r
-#define       setvbuffer(fp, buf, size)       setvbuf(fp, buf, _IOFBF, size)\r
-#else /* BSD */\r
-#define       setvbuffer(fp, buf, size)       setbuffer(fp, buf, size)\r
-#endif\r
-\r
-/*Borland C++ 4.5 EasyWin*/\r
-#if defined(__TURBOC__) && defined(_Windows) && !defined(__WIN32__) /*Easy Win */\r
-#define         EASYWIN\r
-#ifndef __WIN16__\r
-#define __WIN16__\r
-#endif\r
-#include <windows.h>\r
-#endif\r
-\r
-#ifdef OVERWRITE\r
-/* added by satoru@isoternet.org */\r
-#if defined(__EMX__)\r
-#include <sys/types.h>\r
-#endif\r
-#include <sys/stat.h>\r
-#if !defined(MSDOS) || defined(__DJGPP__) /* UNIX, djgpp */\r
-#include <unistd.h>\r
-#if defined(__WATCOMC__)\r
-#include <sys/utime.h>\r
-#else\r
-#include <utime.h>\r
-#endif\r
-#else /* defined(MSDOS) */\r
-#ifdef __WIN32__\r
-#ifdef __BORLANDC__ /* BCC32 */\r
-#include <utime.h>\r
-#else /* !defined(__BORLANDC__) */\r
-#include <sys/utime.h>\r
-#endif /* (__BORLANDC__) */\r
-#else /* !defined(__WIN32__) */\r
-#if defined(_MSC_VER) || defined(__MINGW32__) || defined(__WATCOMC__) || defined(__OS2__) || defined(__EMX__) || defined(__IBMC__) || defined(__IBMCPP__)  /* VC++, MinGW, Watcom, emx+gcc, IBM VAC++ */\r
-#include <sys/utime.h>\r
-#elif defined(__TURBOC__) /* BCC */\r
-#include <utime.h>\r
-#elif defined(LSI_C) /* LSI C */\r
-#endif /* (__WIN32__) */\r
-#endif\r
-#endif\r
-#endif\r
-\r
-#ifdef DEFAULT_CODE_LOCALE\r
-\r
-#ifndef __WIN32__ /* not win32 is posix */\r
-#ifndef HAVE_LANGINFO_H\r
-#define HAVE_LANGINFO_H\r
-#endif\r
-#ifndef HAVE_LOCALE_H\r
-#define HAVE_LOCALE_H\r
-#endif\r
-#endif\r
-\r
-#ifdef HAVE_LANGINFO_H\r
-#include <langinfo.h>\r
-#endif\r
-#ifdef HAVE_LOCALE_H\r
-#include <locale.h>\r
-#endif\r
-\r
-#endif /* DEFAULT_CODE_LOCALE */\r
-\r
-#define         FALSE   0\r
-#define         TRUE    1\r
-\r
-#ifdef WIN32DLL\r
-#include "nkf32.h"\r
-#endif\r
-\r
-#endif /* NKF_H */\r
+/*
+ * 
+ * nkf.h - Header file for nkf
+ * 
+ * $Id: nkf.h,v 1.4 2008/10/22 18:27:57 naruse Exp $
+ */
+
+#ifndef NKF_H
+
+/* Wrapper of configurations */
+
+#ifndef MIME_DECODE_DEFAULT
+#define MIME_DECODE_DEFAULT STRICT_MIME
+#endif
+#ifndef X0201_DEFAULT
+#define X0201_DEFAULT TRUE
+#endif
+
+#if DEFAULT_NEWLINE == 0x0D0A
+#define PUT_NEWLINE(func) do {\
+    func(0x0D);\
+    func(0x0A);\
+} while (0)
+#define OCONV_NEWLINE(func) do {\
+    func(0, 0x0D);\
+    func(0, 0x0A);\
+} while (0)
+#elif DEFAULT_NEWLINE == 0x0D
+#define PUT_NEWLINE(func) func(0x0D)
+#define OCONV_NEWLINE(func) func(0, 0x0D)
+#else
+#define DEFAULT_NEWLINE 0x0A
+#define PUT_NEWLINE(func) func(0x0A)
+#define OCONV_NEWLINE(func) func(0, 0x0A)
+#endif
+#ifdef HELP_OUTPUT_STDERR
+#define HELP_OUTPUT stderr
+#else
+#define HELP_OUTPUT stdout
+#endif
+
+
+/* Compatibility definitions */
+
+#ifdef nkf_char
+#elif defined(INT_IS_SHORT)
+typedef long nkf_char;
+#define NKF_INT32_C(n)   (n##L)
+#else
+typedef int nkf_char;
+#define NKF_INT32_C(n)   (n)
+#endif
+
+#if (defined(__TURBOC__) || defined(_MSC_VER) || defined(LSI_C) || defined(__MINGW32__) || defined(__EMX__) || defined(__MSDOS__) || defined(__WINDOWS__) || defined(__DOS__) || defined(__OS2__)) && !defined(MSDOS)
+#define MSDOS
+#if (defined(__Win32__) || defined(_WIN32)) && !defined(__WIN32__)
+#define __WIN32__
+#endif
+#endif
+
+#ifdef PERL_XS
+#undef OVERWRITE
+#endif
+
+#ifndef PERL_XS
+#include <stdio.h>
+#endif
+
+#include <stdlib.h>
+#include <string.h>
+
+#if defined(MSDOS) || defined(__OS2__)
+#include <fcntl.h>
+#include <io.h>
+#if defined(_MSC_VER) || defined(__WATCOMC__)
+#define mktemp _mktemp
+#endif
+#endif
+
+#ifdef MSDOS
+#ifdef LSI_C
+#define setbinmode(fp) fsetbin(fp)
+#elif defined(__DJGPP__)
+#include <libc/dosio.h>
+void  setbinmode(FILE *fp)
+{
+    /* we do not use libc's setmode(), which changes COOKED/RAW mode in device. */
+    int fd, m;
+    fd = fileno(fp);
+    m = (__file_handle_modes[fd] & (~O_TEXT)) | O_BINARY;
+    __file_handle_set(fd, m);
+}
+#else /* Microsoft C, Turbo C */
+#define setbinmode(fp) setmode(fileno(fp), O_BINARY)
+#endif
+#else /* UNIX */
+#define setbinmode(fp)
+#endif
+
+#ifdef _IOFBF /* SysV and MSDOS, Windows */
+#define       setvbuffer(fp, buf, size)       setvbuf(fp, buf, _IOFBF, size)
+#else /* BSD */
+#define       setvbuffer(fp, buf, size)       setbuffer(fp, buf, size)
+#endif
+
+/*Borland C++ 4.5 EasyWin*/
+#if defined(__TURBOC__) && defined(_Windows) && !defined(__WIN32__) /*Easy Win */
+#define         EASYWIN
+#ifndef __WIN16__
+#define __WIN16__
+#endif
+#include <windows.h>
+#endif
+
+#ifdef OVERWRITE
+/* added by satoru@isoternet.org */
+#if defined(__EMX__)
+#include <sys/types.h>
+#endif
+#include <sys/stat.h>
+#if !defined(MSDOS) || defined(__DJGPP__) /* UNIX, djgpp */
+#include <unistd.h>
+#if defined(__WATCOMC__)
+#include <sys/utime.h>
+#else
+#include <utime.h>
+#endif
+#else /* defined(MSDOS) */
+#ifdef __WIN32__
+#ifdef __BORLANDC__ /* BCC32 */
+#include <utime.h>
+#else /* !defined(__BORLANDC__) */
+#include <sys/utime.h>
+#endif /* (__BORLANDC__) */
+#else /* !defined(__WIN32__) */
+#if defined(_MSC_VER) || defined(__MINGW32__) || defined(__WATCOMC__) || defined(__OS2__) || defined(__EMX__) || defined(__IBMC__) || defined(__IBMCPP__)  /* VC++, MinGW, Watcom, emx+gcc, IBM VAC++ */
+#include <sys/utime.h>
+#elif defined(__TURBOC__) /* BCC */
+#include <utime.h>
+#elif defined(LSI_C) /* LSI C */
+#endif /* (__WIN32__) */
+#endif
+#endif
+#endif
+
+#ifdef DEFAULT_CODE_LOCALE
+
+#ifndef __WIN32__ /* not win32 should be posix */
+#ifndef HAVE_LANGINFO_H
+#define HAVE_LANGINFO_H
+#endif
+#ifndef HAVE_LOCALE_H
+#define HAVE_LOCALE_H
+#endif
+#endif
+
+#ifdef HAVE_LANGINFO_H
+#include <langinfo.h>
+#endif
+#ifdef HAVE_LOCALE_H
+#include <locale.h>
+#endif
+
+#endif /* DEFAULT_CODE_LOCALE */
+
+#define         FALSE   0
+#define         TRUE    1
+
+#ifdef WIN32DLL
+#include "nkf32.h"
+#endif
+
+#endif /* NKF_H */
diff --git a/nkf32.h b/nkf32.h
index e10d86f..c21fb5d 100755 (executable)
--- a/nkf32.h
+++ b/nkf32.h
@@ -1,78 +1,85 @@
-#ifndef NKF32_H\r
-#ifndef CLASS_DECLSPEC\r
-/* dll __declspec(dllexport) */\r
-/* app __declspec(dllimport) */\r
-#define CLASS_DECLSPEC\r
-#endif\r
-\r
-#ifdef __cplusplus\r
-extern "C" {\r
-#endif /* __cplusplus */\r
-#ifdef __BORLANDC__\r
-#pragma argsused\r
-#endif /*__BORLANDC__*/\r
-/* uminchu nkf32103a.lzh 1.00 */\r
-void CALLBACK CLASS_DECLSPEC GetNkfVersion(LPSTR verStr);\r
-int CALLBACK CLASS_DECLSPEC SetNkfOption(LPCSTR optStr);\r
-void CALLBACK CLASS_DECLSPEC NkfConvert(LPSTR outStr, LPCSTR inStr);\r
-/* uminchu nkf32103a.lzh 1.02 */\r
-void CALLBACK CLASS_DECLSPEC ToHankaku(LPSTR inStr);\r
-void CALLBACK CLASS_DECLSPEC ToZenkakuKana(LPSTR outStr ,LPCSTR inStr);\r
-/* uminchu nkf32103a.lzh 1.03 */\r
-void CALLBACK CLASS_DECLSPEC EncodeSubject(LPSTR outStr ,LPCSTR inStr);\r
-/* tkaneto nkf32204.zip 2.0.4.0 */\r
-#ifdef TOMIME\r
-void CALLBACK CLASS_DECLSPEC ToMime(LPSTR outStr ,LPCSTR inStr);\r
-#endif /*TOMIME*/\r
-#ifdef GETKANJICODE\r
-int CALLBACK CLASS_DECLSPEC NkfGetKanjiCode(VOID);\r
-#endif /*GETKANJICODE*/\r
-#ifdef FILECONVERT1\r
-void CALLBACK CLASS_DECLSPEC NkfFileConvert1(LPCSTR fName);\r
-#endif /*FILECONVERT1*/\r
-#ifdef FILECONVERT2\r
-void CALLBACK CLASS_DECLSPEC NkfFileConvert2(LPCSTR fInName,LPCSTR fOutName);\r
-#endif /*FILECONVERT2*/\r
-#ifndef NKF32103A\r
-/* safe */\r
-BOOL WINAPI CLASS_DECLSPEC GetNkfVersionSafeA(LPSTR verStr,DWORD nBufferLength /*in TCHARs*/,LPDWORD lpTCHARsReturned /*in TCHARs*/);\r
-BOOL WINAPI CLASS_DECLSPEC NkfConvertSafe(LPSTR outStr,DWORD nOutBufferLength /*in Bytes*/,LPDWORD lpBytesReturned /*in Bytes*/, LPCSTR inStr,DWORD nInBufferLength /*in Bytes*/);\r
-BOOL WINAPI CLASS_DECLSPEC ToZenkakuKanaSafe(LPSTR outStr,DWORD nOutBufferLength /*in Bytes*/,LPDWORD lpBytesReturned /*in Bytes*/,LPCSTR inStr,DWORD nInBufferLength /*in Bytes*/);\r
-BOOL WINAPI CLASS_DECLSPEC ToHankakuSafe(LPSTR outStr,DWORD nOutBufferLength /*in Bytes*/,LPDWORD lpBytesReturned /*in Bytes*/,LPCSTR inStr,DWORD nInBufferLength /*in Bytes*/);\r
-BOOL WINAPI CLASS_DECLSPEC EncodeSubjectSafe(LPSTR outStr,DWORD nOutBufferLength /*in Bytes*/,LPDWORD lpBytesReturned /*in Bytes*/,LPCSTR inStr,DWORD nInBufferLength /*in Bytes*/);\r
-BOOL WINAPI CLASS_DECLSPEC NkfFileConvert1SafeA(LPCSTR fName,DWORD nBufferLength /*in TCHARs*/);\r
-BOOL WINAPI CLASS_DECLSPEC NkfFileConvert2SafeA(LPCSTR fInName,DWORD fInBufferLength /*in TCHARs*/,LPCSTR fOutName,DWORD fOutBufferLength /*in TCHARs*/);\r
-BOOL WINAPI CLASS_DECLSPEC GetNkfGuessA(LPSTR outStr,DWORD nBufferLength /*in TCHARs*/,LPDWORD lpTCHARsReturned /*in TCHARs*/);\r
-\r
-BOOL WINAPI CLASS_DECLSPEC GetNkfVersionSafeW(LPWSTR verStr,DWORD nBufferLength /*in TCHARs*/,LPDWORD lpTCHARsReturned /*in TCHARs*/);\r
-BOOL WINAPI CLASS_DECLSPEC NkfFileConvert1SafeW(LPCWSTR fName,DWORD nBufferLength /*in TCHARs*/);\r
-BOOL WINAPI CLASS_DECLSPEC NkfFileConvert2SafeW(LPCWSTR fInName,DWORD fInBufferLength /*in TCHARs*/,LPCWSTR fOutName,DWORD fOutBufferLength /*in TCHARs*/);\r
-BOOL WINAPI CLASS_DECLSPEC GetNkfGuessW(LPWSTR outStr,DWORD nBufferLength /*in TCHARs*/,LPDWORD lpTCHARsReturned /*in TCHARs*/);\r
-BOOL WINAPI CLASS_DECLSPEC GetNkfSupportFunctions(void *outStr,DWORD nBufferLength /*in Bytes*/,LPDWORD lpBytesReturned /*in Bytes*/);\r
-BOOL WINAPI CLASS_DECLSPEC NkfUsage(LPSTR outStr,DWORD nBufferLength /*in Bytes*/,LPDWORD lpBytesReturned /*in Bytes*/);\r
-\r
-#ifdef UNICODE\r
-#define GetNkfVersionSafe   GetNkfVersionSafeW\r
-#define GetNkfGuess         GetNkfGuessW\r
-#define NkfFileConvert1Safe NkfFileConvert1SafeW\r
-#define NkfFileConvert2Safe NkfFileConvert2SafeW\r
-#else /*UNICODE*/\r
-#define GetNkfVersionSafe   GetNkfVersionSafeA\r
-#define GetNkfGuess         GetNkfGuessA\r
-#define NkfFileConvert1Safe NkfFileConvert1SafeA\r
-#define NkfFileConvert2Safe NkfFileConvert2SafeA\r
-#endif /*UNICODE*/\r
-\r
-struct NKFSUPPORTFUNCTIONS {\r
-DWORD size;\r
-LPCSTR copyrightA;\r
-LPCSTR versionA;\r
-LPCSTR dateA;\r
-DWORD functions;\r
-};\r
-#endif /*!defined(NKF32103A)*/\r
-\r
-#ifdef __cplusplus\r
-}       // Balance extern "C" above\r
-#endif /*__cplusplus*/\r
-#endif\r
+#ifndef NKF32_H
+#ifndef CLASS_DECLSPEC
+/* dll __declspec(dllexport) */
+/* app __declspec(dllimport) */
+#define CLASS_DECLSPEC
+#endif
+
+#ifndef LPSTR
+#include <windows.h>
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+#ifdef __BORLANDC__
+#pragma argsused
+#endif /*__BORLANDC__*/
+/* uminchu nkf32103a.lzh 1.00 */
+void CALLBACK CLASS_DECLSPEC GetNkfVersion(LPSTR verStr);
+int CALLBACK CLASS_DECLSPEC SetNkfOption(LPSTR optStr);
+void CALLBACK CLASS_DECLSPEC NkfConvert(LPSTR outStr, LPCSTR inStr);
+/* uminchu nkf32103a.lzh 1.02 */
+void CALLBACK CLASS_DECLSPEC ToHankaku(LPSTR inStr);
+void CALLBACK CLASS_DECLSPEC ToZenkakuKana(LPSTR outStr ,LPCSTR inStr);
+/* uminchu nkf32103a.lzh 1.03 */
+void CALLBACK CLASS_DECLSPEC EncodeSubject(LPSTR outStr ,LPCSTR inStr);
+/* tkaneto nkf32204.zip 2.0.4.0 */
+#ifdef TOMIME
+void CALLBACK CLASS_DECLSPEC ToMime(LPSTR outStr ,LPCSTR inStr);
+#endif /*TOMIME*/
+#ifdef GETKANJICODE
+int CALLBACK CLASS_DECLSPEC NkfGetKanjiCode(VOID);
+#endif /*GETKANJICODE*/
+#ifdef FILECONVERT1
+void CALLBACK CLASS_DECLSPEC NkfFileConvert1(LPCSTR fName);
+#endif /*FILECONVERT1*/
+#ifdef FILECONVERT2
+void CALLBACK CLASS_DECLSPEC NkfFileConvert2(LPCSTR fInName,LPCSTR fOutName);
+#endif /*FILECONVERT2*/
+#ifndef NKF32103A
+/* safe */
+BOOL WINAPI CLASS_DECLSPEC GetNkfVersionSafeA(LPSTR verStr,DWORD nBufferLength /*in TCHARs*/,LPDWORD lpTCHARsReturned /*in TCHARs*/);
+BOOL WINAPI CLASS_DECLSPEC NkfConvertSafe(LPSTR outStr,DWORD nOutBufferLength /*in Bytes*/,LPDWORD lpBytesReturned /*in Bytes*/, LPCSTR inStr,DWORD nInBufferLength /*in Bytes*/);
+BOOL WINAPI CLASS_DECLSPEC ToZenkakuKanaSafe(LPSTR outStr,DWORD nOutBufferLength /*in Bytes*/,LPDWORD lpBytesReturned /*in Bytes*/,LPCSTR inStr,DWORD nInBufferLength /*in Bytes*/);
+BOOL WINAPI CLASS_DECLSPEC ToHankakuSafe(LPSTR outStr,DWORD nOutBufferLength /*in Bytes*/,LPDWORD lpBytesReturned /*in Bytes*/,LPCSTR inStr,DWORD nInBufferLength /*in Bytes*/);
+BOOL WINAPI CLASS_DECLSPEC EncodeSubjectSafe(LPSTR outStr,DWORD nOutBufferLength /*in Bytes*/,LPDWORD lpBytesReturned /*in Bytes*/,LPCSTR inStr,DWORD nInBufferLength /*in Bytes*/);
+BOOL WINAPI CLASS_DECLSPEC NkfFileConvert1SafeA(LPCSTR fName,DWORD nBufferLength /*in TCHARs*/);
+BOOL WINAPI CLASS_DECLSPEC NkfFileConvert2SafeA(LPCSTR fInName,DWORD fInBufferLength /*in TCHARs*/,LPCSTR fOutName,DWORD fOutBufferLength /*in TCHARs*/);
+BOOL WINAPI CLASS_DECLSPEC GetNkfGuessA(LPSTR outStr,DWORD nBufferLength /*in TCHARs*/,LPDWORD lpTCHARsReturned /*in TCHARs*/);
+
+BOOL WINAPI CLASS_DECLSPEC GetNkfVersionSafeW(LPWSTR verStr,DWORD nBufferLength /*in TCHARs*/,LPDWORD lpTCHARsReturned /*in TCHARs*/);
+BOOL WINAPI CLASS_DECLSPEC NkfFileConvert1SafeW(LPCWSTR fName,DWORD nBufferLength /*in TCHARs*/);
+BOOL WINAPI CLASS_DECLSPEC NkfFileConvert2SafeW(LPCWSTR fInName,DWORD fInBufferLength /*in TCHARs*/,LPCWSTR fOutName,DWORD fOutBufferLength /*in TCHARs*/);
+BOOL WINAPI CLASS_DECLSPEC GetNkfGuessW(LPWSTR outStr,DWORD nBufferLength /*in TCHARs*/,LPDWORD lpTCHARsReturned /*in TCHARs*/);
+BOOL WINAPI CLASS_DECLSPEC GetNkfSupportFunctions(void *outStr,DWORD nBufferLength /*in Bytes*/,LPDWORD lpBytesReturned /*in Bytes*/);
+BOOL WINAPI CLASS_DECLSPEC NkfUsage(LPSTR outStr,DWORD nBufferLength /*in Bytes*/,LPDWORD lpBytesReturned /*in Bytes*/);
+
+#ifdef UNICODE
+#define GetNkfVersionSafe   GetNkfVersionSafeW
+#define GetNkfGuess         GetNkfGuessW
+#define NkfFileConvert1Safe NkfFileConvert1SafeW
+#define NkfFileConvert2Safe NkfFileConvert2SafeW
+#else /*UNICODE*/
+#define GetNkfVersionSafe   GetNkfVersionSafeA
+#define GetNkfGuess         GetNkfGuessA
+#define NkfFileConvert1Safe NkfFileConvert1SafeA
+#define NkfFileConvert2Safe NkfFileConvert2SafeA
+#endif /*UNICODE*/
+
+struct NKFSUPPORTFUNCTIONS {
+DWORD size;
+LPCSTR copyrightA;
+LPCSTR versionA;
+LPCSTR dateA;
+DWORD functions;
+};
+
+
+void reinitdll(void);
+#endif /*!defined(NKF32103A)*/
+
+#ifdef __cplusplus
+}       // Balance extern "C" above
+#endif /*__cplusplus*/
+#endif
index f78b658..a3e8b89 100644 (file)
@@ -53,7 +53,7 @@ wchar_t *guessbuffW = NULL;
 UINT guessCodePage = CP_OEMCP;
 DWORD guessdwFlags = MB_PRECOMPOSED;
 
-wchar_t *tounicode(char *p)
+wchar_t *tounicode(const char *p)
 {
 static wchar_t buff[GUESS];
     int sts;
@@ -182,14 +182,7 @@ void
 print_guessed_code (filename)
     char *filename;
 {
-    char *codename = "BINARY";
-    if (!is_inputcode_mixed) {
-        if (strcmp(input_codename, "") == 0) {
-            codename = "ASCII";
-        } else {
-            codename = input_codename;
-        }
-    }
+    const char *codename = get_guessed_code();
     if (filename != NULL) {
         guessbuffA = realloc(guessbuffA,(strlen(filename) + GUESS + 1) * sizeof (char) );
         sprintf(guessbuffA,"%s:%s", filename,codename);
@@ -204,20 +197,16 @@ void
 print_guessed_codeW (filename)
     wchar_t *filename;
 {
-    char *codename = "BINARY";
-    if (!is_inputcode_mixed) {
-        if (strcmp(input_codename, "") == 0) {
-            codename = "ASCII";
-        } else {
-            codename = input_codename;
-        }
-    }
+    const char *codename = get_guessed_code();
+    size_t size;
     if (filename != NULL) {
-        guessbuffW = realloc(guessbuffW,(wcslen(filename) + GUESS + 1) * sizeof (wchar_t) );
-        swprintf(guessbuffW,L"%s:%s",filename,tounicode(codename));
+       size = (wcslen(filename) + GUESS + 1) * sizeof (wchar_t);
+       guessbuffW = realloc(guessbuffW, size);
+       _snwprintf(guessbuffW, size, L"%s:%s", filename, tounicode(codename));
     } else {
-        guessbuffW = realloc(guessbuffW,(GUESS + 1) * sizeof (wchar_t));
-        swprintf(guessbuffW,L"%s",tounicode(codename));
+       size = (GUESS + 1) * sizeof (wchar_t);
+       guessbuffW = realloc(guessbuffW, size);
+       _snwprintf(guessbuffW, size, L"%s", tounicode(codename));
     }
 }
 #endif /*UNICODESUPPORT*/
@@ -236,8 +225,8 @@ print_guessed_codeW (filename)
  **
  **/
 
-void 
-reinitdll()
+void
+reinitdll(void)
 {
     cin = NULL;
     nin = -1;