From eef49ef4171011dec88156481cc70ee350cbbc92 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Mon, 15 Nov 2010 08:40:30 +0000 Subject: [PATCH] Fixes for the MSC build --- contrib/ChangeLog | 6 ++++++ contrib/conf-w32ce-msc/build.mk | 16 +++++++++++++++- src/ChangeLog | 14 ++++++++++++++ src/ath.c | 8 ++++++++ src/ath.h | 3 +++ src/data-compat.c | 8 ++++++++ src/w32-ce.h | 14 +++++++++----- 7 files changed, 63 insertions(+), 6 deletions(-) diff --git a/contrib/ChangeLog b/contrib/ChangeLog index 40e528a..1ed8d52 100644 --- a/contrib/ChangeLog +++ b/contrib/ChangeLog @@ -1,3 +1,9 @@ +2010-11-15 Werner Koch + + * conf-w32ce-msc/build.mk (copy-static-source): Create stdint.h. + (all): Add ws2.lib + (clean): New. + 2010-11-04 Werner Koch * conf-w32ce-msc/build.mk (copy-built-source): Revert last diff --git a/contrib/conf-w32ce-msc/build.mk b/contrib/conf-w32ce-msc/build.mk index 74e7ff7..72b683a 100755 --- a/contrib/conf-w32ce-msc/build.mk +++ b/contrib/conf-w32ce-msc/build.mk @@ -209,6 +209,7 @@ built_sources = \ gpgme.h \ status-table.h +my_stdint = $(targetsrc)/libassuan/src/stdint.h copy-static-source: @if [ ! -f ./gpgme.c ]; then \ @@ -218,6 +219,14 @@ copy-static-source: cp -t $(targetsrc)/gpgme/src $(sources); cd ../contrib/conf-w32ce-msc ; \ cp -t $(targetsrc)/gpgme/src $(conf_sources) + @echo typedef unsigned long long uint64_t; >$(my_stdint) + @echo typedef long long int64_t; >>$(my_stdint) + @echo typedef unsigned int uint32_t; >>$(my_stdint) + @echo typedef int int32_t; >>$(my_stdint) + @echo typedef unsigned short uint16_t; >>$(my_stdint) + @echo typedef short int16_t; >>$(my_stdint) + @echo typedef unsigned int uintptr_t; >>$(my_stdint) + @echo typedef int intptr_t; >>$(my_stdint) copy-built-source: @if [ ! -f ./gpgme.h ]; then \ @@ -242,7 +251,7 @@ all: $(sources) $(conf_sources) $(built_sources) $(objs) $(libdir)/libgpg-error-0-msc.lib \ $(libdir)/libassuan-0-msc.lib \ coredll.lib corelibc.lib ole32.lib oleaut32.lib uuid.lib \ - commctrl.lib /subsystem:windowsce,5.02 + commctrl.lib ws2.lib /subsystem:windowsce,5.02 # Note that we don't need to create the install directories because # libgpg-error must have been build and installed prior to this @@ -251,3 +260,8 @@ install: all copy /y gpgme.h $(incdir:/=\) copy /y libgpgme-11-msc.dll $(bindir:/=\) copy /y libgpgme-11-msc.lib $(libdir:/=\) + + +clean: + del *.obj libgpgme-11-msc.lib libgpgme-11-msc.dll libgpgme-11-msc.exp + diff --git a/src/ChangeLog b/src/ChangeLog index f4e0e7d..8736644 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,17 @@ +2010-11-15 Werner Koch + + * data-compat.c (gpgme_data_new_from_filepart) + (gpgme_data_new_from_file) [W32CE && _MSC_VER]: Return not + GPG_ERR_NOT_IMPLEMENTED. + + * w32-ce.h (HKEY_PERFORMANCE_DATA, HKEY_CURRENT_CONFIG, _IOLBF) + (abort) [_MSC_VER]: Provide these macros. + + * ath.h [W32CE && _MSC_VER]: Include winsock2.h. + + * ath.c (ath_read, ath_write) [W32CE && _MSC_VER]: Do not call + non-available functions. + 2010-11-04 Werner Koch * w32-ce.h [_MSC_VER && W32CE]: Undef leave. diff --git a/src/ath.c b/src/ath.c index e5acbda..e5b9964 100644 --- a/src/ath.c +++ b/src/ath.c @@ -128,14 +128,22 @@ ath_mutex_unlock (ath_mutex_t *lock) ssize_t ath_read (int fd, void *buf, size_t nbytes) { +#if defined(HAVE_W32CE_SYSTEM) && defined(_MSC_VER) + return -1; /* Not supported. */ +#else return read (fd, buf, nbytes); +#endif } ssize_t ath_write (int fd, const void *buf, size_t nbytes) { +#if defined(HAVE_W32CE_SYSTEM) && defined(_MSC_VER) + return -1; /* Not supported. */ +#else return write (fd, buf, nbytes); +#endif } diff --git a/src/ath.h b/src/ath.h index 424e345..9ada550 100644 --- a/src/ath.h +++ b/src/ath.h @@ -28,6 +28,9 @@ /* fixme: Check how we did it in libgcrypt. */ struct msghdr { int dummy; }; typedef int socklen_t; +# if defined(HAVE_W32CE_SYSTEM) && defined(_MSC_VER) +# include +# endif # include # include diff --git a/src/data-compat.c b/src/data-compat.c index bf61538..39c743e 100644 --- a/src/data-compat.c +++ b/src/data-compat.c @@ -43,6 +43,9 @@ gpgme_error_t gpgme_data_new_from_filepart (gpgme_data_t *r_dh, const char *fname, FILE *stream, off_t offset, size_t length) { +#if defined (HAVE_W32CE_SYSTEM) && defined (_MSC_VER) + return gpgme_error (GPG_ERR_NOT_IMPLEMENTED); +#else gpgme_error_t err; char *buf = NULL; int res; @@ -111,6 +114,7 @@ gpgme_data_new_from_filepart (gpgme_data_t *r_dh, const char *fname, (*r_dh)->data.mem.length = length; return TRACE_SUC1 ("r_dh=%p", *r_dh); +#endif } @@ -119,6 +123,9 @@ gpgme_data_new_from_filepart (gpgme_data_t *r_dh, const char *fname, gpgme_error_t gpgme_data_new_from_file (gpgme_data_t *r_dh, const char *fname, int copy) { +#if defined (HAVE_W32CE_SYSTEM) && defined (_MSC_VER) + return gpgme_error (GPG_ERR_NOT_IMPLEMENTED); +#else gpgme_error_t err; struct stat statbuf; TRACE_BEG3 (DEBUG_DATA, "gpgme_data_new_from_filepart", r_dh, @@ -132,6 +139,7 @@ gpgme_data_new_from_file (gpgme_data_t *r_dh, const char *fname, int copy) err = gpgme_data_new_from_filepart (r_dh, fname, NULL, 0, statbuf.st_size); return TRACE_ERR (err); +#endif } diff --git a/src/w32-ce.h b/src/w32-ce.h index fafaa06..a74c6e1 100644 --- a/src/w32-ce.h +++ b/src/w32-ce.h @@ -32,7 +32,6 @@ typedef int pid_t; #include /* For getaddrinfo. */ #include - #define getenv _gpgme_wince_getenv char *getenv (const char *name); @@ -75,11 +74,16 @@ void *_gpgme_wince_bsearch (const void *key, const void *base, int (*compar) (const void *, const void *)); #define bsearch(a,b,c,d,e) _gpgme_wince_bsearch ((a),(b),(c),(d),(e)) -/* Remove the redefined __leave keyword. It is defined by MSC for W32 - in excpt.h and not in sehmap.h as for the plain windows - version. */ -#if defined(_MSC_VER) && defined(HAVE_W32CE_SYSTEM) +#if defined(_MSC_VER) + /* Remove the redefined __leave keyword. It is defined by MSC for + W32 in excpt.h and not in sehmap.h as for the plain windows + version. */ # undef leave +# define HKEY_PERFORMANCE_DATA ((HKEY)0x80000004) +# define HKEY_CURRENT_CONFIG ((HKEY)0x80000005) + /* Replace the Mingw32CE provided abort function. */ +# define abort() do { TerminateProcess (GetCurrentProcess(), 8); } while (0) +# define _IOLBF 0x40 #endif #endif /* GPGME_W32_CE_H */ -- 2.26.2