diff --git a/ChangeLog b/ChangeLog index 13d4125d..ce3f2c79 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2010-11-03 Werner Koch + + * configure.ac (AC_CHECK_HEADERS): Check for sys/types.h and + sys.stat.h. + 2010-11-02 Werner Koch * configure.ac (AC_CHECK_HEADERS): Check for sys.time.h. diff --git a/configure.ac b/configure.ac index 5850aceb..9f36925a 100644 --- a/configure.ac +++ b/configure.ac @@ -774,7 +774,7 @@ AC_CHECK_FUNCS(getgid getegid) # Replacement functions. AC_REPLACE_FUNCS(stpcpy) # Check for unistd.h for setenv replacement function. -AC_CHECK_HEADERS([unistd.h sys/time.h]) +AC_CHECK_HEADERS([unistd.h sys/time.h sys/types.h sys/stat.h]) AC_REPLACE_FUNCS(setenv) # Assuan check for descriptor passing. diff --git a/contrib/ChangeLog b/contrib/ChangeLog index 406d1077..ccee4948 100644 --- a/contrib/ChangeLog +++ b/contrib/ChangeLog @@ -1,3 +1,7 @@ +2010-11-03 Werner Koch + + * conf-w32ce-msc/build.mk (copy-built-source): Create dummy sehmap.h. + 2010-11-01 Werner Koch * conf-w32ce-msc/config.h: New. diff --git a/contrib/conf-w32ce-msc/build.mk b/contrib/conf-w32ce-msc/build.mk index 4a77a99a..70cae832 100755 --- a/contrib/conf-w32ce-msc/build.mk +++ b/contrib/conf-w32ce-msc/build.mk @@ -219,15 +219,21 @@ copy-static-source: cd ../contrib/conf-w32ce-msc ; \ cp -t $(targetsrc)/gpgme/src $(conf_sources) - +# We create a dummy sehmap.h which will be included first due to -I. . +# For some reasons sehmap.h is included by MSC for WindowsCE and +# introduces a macro "leave" which conflicts of our use of "leave" for +# a label (leave and enter are pretty common names for pro- and epilog +# code). copy-built-source: @if [ ! -f ./gpgme.h ]; then \ echo "Please build using ./autogen.sh --build-w32ce first"; \ exit 1; \ fi cp -t $(targetsrc)/gpgme/src $(built_sources) + echo '/* Dummy replacement for useless header. */' \ + > $(targetsrc)/gpgme/src/sehmap.h -copy-source: copy-static-source copy-built-source +copy-source: copy-static-source copy-built-source .c.obj: diff --git a/src/ChangeLog b/src/ChangeLog index 562d2977..207647ec 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,13 @@ +2010-11-03 Werner Koch + + * setenv.c: Include string.h due to our strerror replacement. + + * w32-ce.h (access): New macro. + * w32-ce.c (_gpgme_wince_access): New. + (RegQueryValueExA): Change DATA to a void*. + + Guard include of sys/stat.h and sys/types.h. + 2010-11-02 Werner Koch * data-fd.c (read, write, lseek) [W32CE && ! __MINGW32CE__]: New. diff --git a/src/ath.c b/src/ath.c index a303ffc2..e5acbdaa 100644 --- a/src/ath.c +++ b/src/ath.c @@ -33,7 +33,9 @@ # include # endif #endif -#include +#ifdef HAVE_SYS_TYPES_H +# include +#endif #ifndef HAVE_W32_SYSTEM #include #endif @@ -60,7 +62,6 @@ ath_self (void) } #else # ifdef __linux -#include #include uintptr_t ath_self (void) diff --git a/src/ath.h b/src/ath.h index 8a7a5072..424e3456 100644 --- a/src/ath.h +++ b/src/ath.h @@ -40,7 +40,9 @@ # include # endif # endif -# include +# ifdef HAVE_SYS_TYPES_H +# include +# endif # include #endif /*!HAVE_W32_SYSTEM*/ diff --git a/src/conversion.c b/src/conversion.c index 9d8f403e..e6282faa 100644 --- a/src/conversion.c +++ b/src/conversion.c @@ -25,8 +25,10 @@ #include #include -/* Solaris 8 needs sys/types.h before time.h. */ -#include +#ifdef HAVE_SYS_TYPES_H + /* Solaris 8 needs sys/types.h before time.h. */ +# include +#endif #include #include diff --git a/src/data-compat.c b/src/data-compat.c index 0843ffd4..bf615386 100644 --- a/src/data-compat.c +++ b/src/data-compat.c @@ -26,7 +26,9 @@ #ifdef HAVE_SYS_TIME_H # include #endif -#include +#ifdef HAVE_SYS_STAT_H +# include +#endif #include #include "data.h" diff --git a/src/data-fd.c b/src/data-fd.c index 779202e2..388b45cc 100644 --- a/src/data-fd.c +++ b/src/data-fd.c @@ -25,7 +25,9 @@ #ifdef HAVE_UNISTD_H # include #endif -#include +#ifdef HAVE_SYS_TYPES_H +# include +#endif #include "debug.h" #include "data.h" diff --git a/src/data-stream.c b/src/data-stream.c index 34a18d46..0e840655 100644 --- a/src/data-stream.c +++ b/src/data-stream.c @@ -23,7 +23,9 @@ #endif #include -#include +#ifdef HAVE_SYS_TYPES_H +# include +#endif #include "debug.h" #include "data.h" diff --git a/src/data-user.c b/src/data-user.c index 79e62ba9..65065e7a 100644 --- a/src/data-user.c +++ b/src/data-user.c @@ -22,7 +22,9 @@ #include #endif -#include +#ifdef HAVE_SYS_TYPES_H +# include +#endif #include #include "debug.h" diff --git a/src/data.h b/src/data.h index 370751d5..1257a8d8 100644 --- a/src/data.h +++ b/src/data.h @@ -25,7 +25,9 @@ #include #endif -#include +#ifdef HAVE_SYS_TYPES_H +# include +#endif #include #include "gpgme.h" diff --git a/src/debug.c b/src/debug.c index 754c8e11..1d9a40eb 100644 --- a/src/debug.c +++ b/src/debug.c @@ -33,9 +33,13 @@ #include #include #ifndef HAVE_DOSISH_SYSTEM +# ifdef HAVE_SYS_TYPES_H # include +# endif +# ifdef HAVE_SYS_STAT_H # include -# include +# endif +# include #endif #include diff --git a/src/engine-assuan.c b/src/engine-assuan.c index e521d6d6..dedb8a12 100644 --- a/src/engine-assuan.c +++ b/src/engine-assuan.c @@ -30,7 +30,9 @@ #include #include -#include +#ifdef HAVE_SYS_TYPES_H +# include +#endif #include #ifdef HAVE_UNISTD_H # include diff --git a/src/engine-g13.c b/src/engine-g13.c index f3119b5c..6ba49c42 100644 --- a/src/engine-g13.c +++ b/src/engine-g13.c @@ -25,7 +25,9 @@ #include #include -#include +#ifdef HAVE_SYS_TYPES_H +# include +#endif #include #ifdef HAVE_UNISTD_H # include diff --git a/src/engine-gpgconf.c b/src/engine-gpgconf.c index cf4df568..990b1b94 100644 --- a/src/engine-gpgconf.c +++ b/src/engine-gpgconf.c @@ -24,7 +24,9 @@ #include #include -#include +#ifdef HAVE_SYS_TYPES_H +# include +#endif #include #ifdef HAVE_UNISTD_H # include diff --git a/src/engine-gpgsm.c b/src/engine-gpgsm.c index 8a9cd893..4b7b5a2e 100644 --- a/src/engine-gpgsm.c +++ b/src/engine-gpgsm.c @@ -26,7 +26,9 @@ #include #include -#include +#ifdef HAVE_SYS_TYPES_H +# include +#endif #include #ifdef HAVE_UNISTD_H # include diff --git a/src/engine-uiserver.c b/src/engine-uiserver.c index fec7d7df..92f75363 100644 --- a/src/engine-uiserver.c +++ b/src/engine-uiserver.c @@ -29,7 +29,9 @@ #include #include -#include +#ifdef HAVE_SYS_TYPES_H +# include +#endif #include #ifdef HAVE_UNISTD_H # include diff --git a/src/gpgme-w32spawn.c b/src/gpgme-w32spawn.c index 6f7c609a..ccf88a90 100644 --- a/src/gpgme-w32spawn.c +++ b/src/gpgme-w32spawn.c @@ -28,8 +28,12 @@ #include #include #include -#include -#include +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_SYS_STAT_H +# include +#endif #include #include #include diff --git a/src/keylist.c b/src/keylist.c index f76904b0..8f61a261 100644 --- a/src/keylist.c +++ b/src/keylist.c @@ -25,8 +25,10 @@ #include #include #include -/* Solaris 8 needs sys/types.h before time.h. */ -#include +#ifdef HAVE_SYS_TYPES_H + /* Solaris 8 needs sys/types.h before time.h. */ +# include +#endif #include #include #include diff --git a/src/memrchr.c b/src/memrchr.c index 21662b1b..16ed6acb 100644 --- a/src/memrchr.c +++ b/src/memrchr.c @@ -52,7 +52,9 @@ # define LONG_MAX LONG_MAX_32_BITS #endif -#include +#ifdef HAVE_SYS_TYPES_H +# include +#endif #undef __memrchr #undef memrchr diff --git a/src/posix-io.c b/src/posix-io.c index 762051e7..02782172 100644 --- a/src/posix-io.c +++ b/src/posix-io.c @@ -34,7 +34,9 @@ #ifdef HAVE_SYS_TIME_H # include #endif -#include +#ifdef HAVE_SYS_TYPES_H +# include +#endif #include #ifdef HAVE_SYS_UIO_H # include diff --git a/src/posix-sema.c b/src/posix-sema.c index 7ab08dfd..b1808fd9 100644 --- a/src/posix-sema.c +++ b/src/posix-sema.c @@ -35,7 +35,9 @@ #ifdef HAVE_SYS_TIME_H # include #endif -#include +#ifdef HAVE_SYS_TYPES_H +# include +#endif #include "util.h" #include "sema.h" diff --git a/src/priv-io.h b/src/priv-io.h index 2c9d1e70..9c70d22f 100644 --- a/src/priv-io.h +++ b/src/priv-io.h @@ -32,7 +32,9 @@ #endif /* For pid_t. */ -#include +#ifdef HAVE_SYS_TYPES_H +# include +#endif /* A single file descriptor passed to spawn. For child fds, dup_to diff --git a/src/setenv.c b/src/setenv.c index 5a7e638b..d85bec9c 100644 --- a/src/setenv.c +++ b/src/setenv.c @@ -20,6 +20,7 @@ # include #endif +#include #include #define __set_errno(ev) (gpg_err_set_errno (ev)) diff --git a/src/util.h b/src/util.h index b7dfbbde..6c2cec69 100644 --- a/src/util.h +++ b/src/util.h @@ -31,7 +31,9 @@ #endif /* For pid_t. */ -#include +#ifdef HAVE_SYS_TYPES_H +# include +#endif #include "gpgme.h" diff --git a/src/w32-ce.c b/src/w32-ce.c index e6c512ce..b7dfc38b 100644 --- a/src/w32-ce.c +++ b/src/w32-ce.c @@ -290,7 +290,7 @@ RegQueryValueExA (HKEY hKey, LPCSTR lpValueName, LPDWORD lpReserved, { wchar_t *name; LONG err; - BYTE *data; + void *data; DWORD data_len; DWORD type; @@ -335,8 +335,8 @@ RegQueryValueExA (HKEY hKey, LPCSTR lpValueName, LPDWORD lpReserved, int data_c_len; /* This is valid since we allocated one more above. */ - data[data_len] = '\0'; - data[data_len + 1] = '\0'; + ((char*)data)[data_len] = '\0'; + ((char*)data)[data_len + 1] = '\0'; data_c = wchar_to_utf8 ((wchar_t*) data); if (!data_c) @@ -445,3 +445,31 @@ SHGetSpecialFolderPathA (HWND hwndOwner, LPSTR lpszPath, int nFolder, lpszPath[MAX_PATH - 1] = '\0'; return result; } + +/* Replacement for the access function. Note that we can't use fopen + here because wince might now allow to have a shared read for an + executable; it is better to to read the file attributes. + + Limitation: Only F_OK is supported. +*/ +int +_gpgme_wince_access (const char *fname, int mode) +{ + DWORD attr; + wchar_t *wfname; + + (void)mode; + + wfname = utf8_to_wchar (fname); + if (!wfname) + return -1; + + attr = GetFileAttributes (wfname); + free (wfname); + if (attr == (DWORD)(-1)) + { + gpg_err_set_errno (ENOENT); + return -1; + } + return 0; +} diff --git a/src/w32-ce.h b/src/w32-ce.h index f34eb1b3..2bc34ca7 100644 --- a/src/w32-ce.h +++ b/src/w32-ce.h @@ -67,5 +67,9 @@ DWORD GetTempPathA(DWORD,LPSTR); #define SHGetSpecialFolderPathA _gpgme_wince_SHGetSpecialFolderPathA BOOL SHGetSpecialFolderPathA(HWND,LPSTR,int,BOOL); +int _gpgme_wince_access (const char *fname, int mode); +#define access(a,b) _gpgme_wince_access ((a), (b)) + + #endif /* GPGME_W32_CE_H */ diff --git a/src/w32-glib-io.c b/src/w32-glib-io.c index 6b7cd150..5c72f036 100644 --- a/src/w32-glib-io.c +++ b/src/w32-glib-io.c @@ -34,7 +34,9 @@ #ifdef HAVE_SYS_TIME_H # include #endif -#include +#ifdef HAVE_SYS_TYPES_H +# include +#endif #include #include #include diff --git a/src/w32-io.c b/src/w32-io.c index d7abbf4c..6f732030 100644 --- a/src/w32-io.c +++ b/src/w32-io.c @@ -31,7 +31,9 @@ #ifdef HAVE_SYS_TIME_H # include #endif -#include +#ifdef HAVE_SYS_TYPES_H +# include +#endif #include #include "util.h" diff --git a/src/w32-sema.c b/src/w32-sema.c index 33961041..504e6822 100644 --- a/src/w32-sema.c +++ b/src/w32-sema.c @@ -31,7 +31,9 @@ #ifdef HAVE_SYS_TIME_H # include #endif -#include +#ifdef HAVE_SYS_TYPES_H +# include +#endif #include #include "util.h" diff --git a/src/w32-util.c b/src/w32-util.c index ec2fe50f..532f89e9 100644 --- a/src/w32-util.c +++ b/src/w32-util.c @@ -32,8 +32,12 @@ #ifdef HAVE_SYS_TIME_H # include #endif -#include -#include +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_SYS_STAT_H +# include +#endif #ifdef HAVE_UNISTD_H # include #endif @@ -104,7 +108,6 @@ dlclose (void * hd) } #endif /* HAVE_ALLOW_SET_FOREGROUND_WINDOW */ - void _gpgme_allow_set_foreground_window (pid_t pid) { diff --git a/src/wait.c b/src/wait.c index febd5bd9..a552b54d 100644 --- a/src/wait.c +++ b/src/wait.c @@ -26,7 +26,9 @@ #include #include #include -#include +#ifdef HAVE_SYS_TYPES_H +# include +#endif #include "util.h" #include "context.h"