diff options
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | catalog.c | 6 | ||||
-rw-r--r-- | libxml.h | 9 | ||||
-rw-r--r-- | nanoftp.c | 2 | ||||
-rw-r--r-- | nanohttp.c | 3 | ||||
-rw-r--r-- | trio.c | 26 | ||||
-rw-r--r-- | triostr.c | 10 | ||||
-rw-r--r-- | triostr.h | 4 | ||||
-rw-r--r-- | win32/wince/wincecompat.c | 8 | ||||
-rw-r--r-- | win32/wince/wincecompat.h | 4 | ||||
-rw-r--r-- | xmlIO.c | 6 |
11 files changed, 71 insertions, 13 deletions
@@ -1,3 +1,9 @@ +Tue Apr 17 14:47:42 CEST 2007 Daniel Veillard <daniel@veillard.com> + + * catalog.c libxml.h win32/wince/wincecompat.h win32/wince/wincecompat.c + xmlIO.c nanohttp.c nanoftp.c trio.c triostr.c triostr.h: applied + patch from Andreas Stricke to ease the compilation on Windows CE + Tue Apr 17 14:34:45 CEST 2007 Daniel Veillard <daniel@veillard.com> * xmllint.c catalog.c: "xmllint unusable on win32" so applied @@ -77,9 +77,15 @@ #if defined(_WIN32) && defined(_MSC_VER) #undef XML_XML_DEFAULT_CATALOG static char XML_XML_DEFAULT_CATALOG[256] = "file:///etc/xml/catalog"; +#if defined(_WIN32_WCE) +/* Windows CE don't have a A variant */ +#define GetModuleHandleA GetModuleHandle +#define GetModuleFileNameA GetModuleFileName +#else void* __stdcall GetModuleHandleA(const char*); unsigned long __stdcall GetModuleFileNameA(void*, char*, unsigned long); #endif +#endif static xmlChar *xmlCatalogNormalizePublic(const xmlChar *pubID); static int xmlExpandCatalog(xmlCatalogPtr catal, const char *filename); @@ -32,6 +32,15 @@ int snprintf(char *, size_t, const char *, ...); int vfprintf(FILE *, const char *, va_list); #endif +/* + * Windows CE compatibility definitions and functions + * This is needed to compile libxml2 for Windows CE. + * At least I tested it with WinCE 4.2 for Emulator and SH4 target + */ +#if defined(_WIN32_WCE) +#include <wincecompat.h> +#endif + #ifndef WITH_TRIO #include <stdio.h> #else @@ -77,7 +77,7 @@ #endif -#ifdef __MINGW32__ +#if defined(__MINGW32__) || defined(_WIN32_WCE) #define _WINSOCKAPI_ #include <wsockcompat.h> #include <winsock2.h> @@ -74,8 +74,7 @@ #define SOCKET int #endif - -#ifdef __MINGW32__ +#if defined(__MINGW32__) || defined(_WIN32_WCE) #define _WINSOCKAPI_ #include <wsockcompat.h> #include <winsock2.h> @@ -62,7 +62,9 @@ #include <limits.h> #include <float.h> -#if defined(__STDC_ISO_10646__) || defined(MB_LEN_MAX) || defined(USE_MULTIBYTE) || TRIO_WIDECHAR +#if (defined(__STDC_ISO_10646__) || defined(MB_LEN_MAX) \ + || defined(USE_MULTIBYTE) || TRIO_WIDECHAR) \ + && !defined(_WIN32_WCE) # define TRIO_COMPILER_SUPPORTS_MULTIBYTE # if !defined(MB_LEN_MAX) # define MB_LEN_MAX 6 @@ -73,6 +75,10 @@ # define TRIO_COMPILER_SUPPORTS_MSVC_INT #endif +#if defined(_WIN32_WCE) +#include <wincecompat.h> +#endif + /************************************************************************* * Generic definitions */ @@ -92,7 +98,10 @@ # include <stdarg.h> #endif #include <stddef.h> + +#ifdef HAVE_ERRNO_H #include <errno.h> +#endif #ifndef NULL # define NULL 0 @@ -133,9 +142,13 @@ typedef unsigned long trio_flags_t; # include <unistd.h> #endif #if defined(TRIO_PLATFORM_WIN32) -# include <io.h> -# define read _read -# define write _write +# if defined(_WIN32_WCE) +# include <wincecompat.h> +# else +# include <io.h> +# define read _read +# define write _write +# endif #endif /* TRIO_PLATFORM_WIN32 */ #if TRIO_WIDECHAR @@ -243,8 +256,9 @@ typedef trio_longlong_t trio_int64_t; # endif #endif -#if !(defined(TRIO_COMPILER_SUPPORTS_C99) \ - || defined(TRIO_COMPILER_SUPPORTS_UNIX01)) +#if (!(defined(TRIO_COMPILER_SUPPORTS_C99) \ + || defined(TRIO_COMPILER_SUPPORTS_UNIX01))) \ + && !defined(_WIN32_WCE) # define floorl(x) floor((double)(x)) # define fmodl(x,y) fmod((double)(x),(double)(y)) # define powl(x,y) pow((double)(x),(double)(y)) @@ -73,7 +73,11 @@ # endif #elif defined(TRIO_PLATFORM_WIN32) # define USE_STRCASECMP -# define strcasecmp(x,y) strcmpi(x,y) +# if defined(_WIN32_WCE) +# define strcasecmp(x,y) _stricmp(x,y) +# else +# define strcasecmp(x,y) strcmpi(x,y) +# endif #endif #if !(defined(TRIO_PLATFORM_SUNOS)) @@ -574,7 +578,7 @@ TRIO_ARGS1((error_number), } -#if !defined(TRIO_MINIMAL) +#if !defined(TRIO_MINIMAL) && !defined(_WIN32_WCE) /** Format the date/time according to @p format. @@ -1887,7 +1891,7 @@ TRIO_ARGS3((self, max, other), #endif /* !defined(TRIO_MINIMAL) */ -#if !defined(TRIO_MINIMAL) +#if !defined(TRIO_MINIMAL) && !defined(_WIN32_WCE) /* * trio_string_format_data_max */ @@ -65,7 +65,9 @@ TRIO_STRING_PUBLIC int trio_contains TRIO_PROTO((const char *string, const char TRIO_STRING_PUBLIC int trio_copy TRIO_PROTO((char *target, const char *source)); TRIO_STRING_PUBLIC char *trio_duplicate_max TRIO_PROTO((const char *source, size_t max)); TRIO_STRING_PUBLIC int trio_equal_case_max TRIO_PROTO((const char *first, size_t max, const char *second)); +#if !defined(_WIN32_WCE) TRIO_STRING_PUBLIC size_t trio_format_date_max TRIO_PROTO((char *target, size_t max, const char *format, const struct tm *datetime)); +#endif TRIO_STRING_PUBLIC unsigned long trio_hash TRIO_PROTO((const char *string, int type)); TRIO_STRING_PUBLIC char *trio_index TRIO_PROTO((const char *string, int character)); TRIO_STRING_PUBLIC char *trio_index_last TRIO_PROTO((const char *string, int character)); @@ -114,7 +116,9 @@ TRIO_STRING_PUBLIC int trio_string_equal TRIO_PROTO((trio_string_t *self, trio_s TRIO_STRING_PUBLIC int trio_string_equal_max TRIO_PROTO((trio_string_t *self, size_t max, trio_string_t *second)); TRIO_STRING_PUBLIC int trio_string_equal_case TRIO_PROTO((trio_string_t *self, trio_string_t *other)); TRIO_STRING_PUBLIC int trio_string_equal_case_max TRIO_PROTO((trio_string_t *self, size_t max, trio_string_t *other)); +#if !defined(_WIN32_WCE) TRIO_STRING_PUBLIC size_t trio_string_format_date_max TRIO_PROTO((trio_string_t *self, size_t max, const char *format, const struct tm *datetime)); +#endif TRIO_STRING_PUBLIC char *trio_string_index TRIO_PROTO((trio_string_t *self, int character)); TRIO_STRING_PUBLIC char *trio_string_index_last TRIO_PROTO((trio_string_t *self, int character)); TRIO_STRING_PUBLIC int trio_string_length TRIO_PROTO((trio_string_t *self)); diff --git a/win32/wince/wincecompat.c b/win32/wince/wincecompat.c index bf70fcc4..1d8df877 100644 --- a/win32/wince/wincecompat.c +++ b/win32/wince/wincecompat.c @@ -47,6 +47,14 @@ int close(int handle) } +char *getcwd( char *buffer, unsigned int size) +{ + /* Windows CE don't have the concept of a current directory + * so we just return NULL to indicate an error + */ + return NULL; +} + char *getenv( const char *varname ) { return NULL; diff --git a/win32/wince/wincecompat.h b/win32/wince/wincecompat.h index 49468a3d..aa0f3dce 100644 --- a/win32/wince/wincecompat.h +++ b/win32/wince/wincecompat.h @@ -12,6 +12,7 @@ #define __WINCECOMPAT_H__ #include <stdio.h> +#include <winbase.h> #define MAX_STRERROR 31 @@ -24,6 +25,8 @@ #define O_TRUNC 0x0200 /* open and truncate */ #define O_EXCL 0x0400 /* open only if file doesn't already exist */ +#define BUFSIZ 4096 + extern int errno; /* Prototypes @@ -33,6 +36,7 @@ int write(int handle, const char *buffer, unsigned int len); int open(const char *filename,int oflag, ...); int close(int handle); char *getenv( const char *varname ); +char *getcwd( char *buffer, unsigned int size); char *strerror(int errnum); /* @@ -36,10 +36,14 @@ #include <zlib.h> #endif -#ifdef WIN32 +#if defined(WIN32) || defined(_WIN32) #include <windows.h> #endif +#if defined(_WIN32_WCE) +#include <winnls.h> /* for CP_UTF8 */ +#endif + /* Figure a portable way to know if a file is a directory. */ #ifndef HAVE_STAT # ifdef HAVE__STAT |