More include guards.
authorWerner Koch <wk@gnupg.org>
Wed, 3 Nov 2010 09:56:27 +0000 (09:56 +0000)
committerWerner Koch <wk@gnupg.org>
Wed, 3 Nov 2010 09:56:27 +0000 (09:56 +0000)
Provide access for Wince.
Install dummy sehmap.h

34 files changed:
ChangeLog
configure.ac
contrib/ChangeLog
contrib/conf-w32ce-msc/build.mk
src/ChangeLog
src/ath.c
src/ath.h
src/conversion.c
src/data-compat.c
src/data-fd.c
src/data-stream.c
src/data-user.c
src/data.h
src/debug.c
src/engine-assuan.c
src/engine-g13.c
src/engine-gpgconf.c
src/engine-gpgsm.c
src/engine-uiserver.c
src/gpgme-w32spawn.c
src/keylist.c
src/memrchr.c
src/posix-io.c
src/posix-sema.c
src/priv-io.h
src/setenv.c
src/util.h
src/w32-ce.c
src/w32-ce.h
src/w32-glib-io.c
src/w32-io.c
src/w32-sema.c
src/w32-util.c
src/wait.c

index 13d4125d7357356e73a4e426878f22a79aef9d22..ce3f2c79b280013257205594c6bea4ea3e617982 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2010-11-03  Werner Koch  <wk@g10code.com>
+
+       * configure.ac (AC_CHECK_HEADERS): Check for sys/types.h and
+       sys.stat.h.
+
 2010-11-02  Werner Koch  <wk@g10code.com>
 
        * configure.ac (AC_CHECK_HEADERS): Check for sys.time.h.
index 5850acebd87e0a311b306452e252a95076d91fed..9f36925af58b955eec1293f8d6dcff8d8a1f0989 100644 (file)
@@ -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.
index 406d10777f269e193140089539f1aba0050cf55e..ccee4948496ea87e3cbd44ec968fc7fa509ed5bb 100644 (file)
@@ -1,3 +1,7 @@
+2010-11-03  Werner Koch  <wk@g10code.com>
+
+       * conf-w32ce-msc/build.mk (copy-built-source): Create dummy sehmap.h.
+
 2010-11-01  Werner Koch  <wk@g10code.com>
 
        * conf-w32ce-msc/config.h: New.
index 4a77a99aa586c552ab9235fda96f864cfbba313f..70cae8329bae3d3960e0400088f813e6869f7f8c 100755 (executable)
@@ -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:
index 562d2977e40236caf7ef3ccedb047f5690d76243..207647ece832e1797d71856290a7b4702753ad52 100644 (file)
@@ -1,3 +1,13 @@
+2010-11-03  Werner Koch  <wk@g10code.com>
+
+       * 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  <wk@g10code.com>
 
        * data-fd.c (read, write, lseek) [W32CE && ! __MINGW32CE__]: New.
index a303ffc239d9b7a0c7601656b884189850f51550..e5acbdaa6fcd0111007b499f9c993b30ede9bfe4 100644 (file)
--- a/src/ath.c
+++ b/src/ath.c
@@ -33,7 +33,9 @@
 #  include <sys/time.h>
 # endif
 #endif
-#include <sys/types.h>
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
 #ifndef HAVE_W32_SYSTEM
 #include <sys/wait.h>
 #endif
@@ -60,7 +62,6 @@ ath_self (void)
 }
 #else
 # ifdef __linux
-#include <sys/types.h>
 #include <sys/syscall.h>
 uintptr_t
 ath_self (void)
index 8a7a507267a760ca74c367bd4e23323921289f4c..424e3456bac22794dd38e1013b289ab784462b72 100644 (file)
--- a/src/ath.h
+++ b/src/ath.h
@@ -40,7 +40,9 @@
 #   include <sys/time.h>
 #  endif
 # endif
-# include <sys/types.h>
+# ifdef HAVE_SYS_TYPES_H
+#  include <sys/types.h>
+# endif
 # include <sys/socket.h>
 
 #endif  /*!HAVE_W32_SYSTEM*/
index 9d8f403e2734e2a55fd7d792dfc4adfac6b17e88..e6282faa6108271c0499c13bf949dfabfad3c8a7 100644 (file)
 
 #include <stdlib.h>
 #include <string.h>
-/* Solaris 8 needs sys/types.h before time.h.  */
-#include <sys/types.h>
+#ifdef HAVE_SYS_TYPES_H
+  /* Solaris 8 needs sys/types.h before time.h.  */
+# include <sys/types.h>
+#endif
 #include <time.h>
 #include <errno.h>
 
index 0843ffd409570a1b0e3ad783dfd7a12460c5a51e..bf615386e190943d3f8e795f86d54c6cd2f910e0 100644 (file)
@@ -26,7 +26,9 @@
 #ifdef HAVE_SYS_TIME_H
 # include <sys/time.h>
 #endif
-#include <sys/stat.h>
+#ifdef HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
 #include <stdlib.h>
 
 #include "data.h"
index 779202e24c64b8994e446ae8495481e840e1b7bd..388b45cc3e25f4cff1a45a386f12b807df2bb5f6 100644 (file)
@@ -25,7 +25,9 @@
 #ifdef HAVE_UNISTD_H
 # include <unistd.h>
 #endif
-#include <sys/types.h>
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
 
 #include "debug.h"
 #include "data.h"
index 34a18d46a3df243c4cb2ce1cf601ece9cfb4d499..0e840655a28b2b2845e914903870eb719dd1035e 100644 (file)
@@ -23,7 +23,9 @@
 #endif
 
 #include <stdio.h>
-#include <sys/types.h>
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
 
 #include "debug.h"
 #include "data.h"
index 79e62ba9b8c5ccf959c2333c335f86eeaab6bc5d..65065e7a8de80aa5fe7e9a7381c1dfcf5308ee65 100644 (file)
@@ -22,7 +22,9 @@
 #include <config.h>
 #endif
 
-#include <sys/types.h>
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
 #include <errno.h>
 
 #include "debug.h"
index 370751d5d6786b2059dd14c0f9049c142cb54fed..1257a8d859ef72073bf96acd0d8b9baf43659cfa 100644 (file)
@@ -25,7 +25,9 @@
 #include <config.h>
 #endif
 
-#include <sys/types.h>
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
 #include <limits.h>
 
 #include "gpgme.h"
index 754c8e1104d198ac0cb94d48200e70cefe0cd427..1d9a40eb08f884d64496e28da3ddecbcdb5494a6 100644 (file)
 #include <errno.h>
 #include <time.h>
 #ifndef HAVE_DOSISH_SYSTEM
+# ifdef HAVE_SYS_TYPES_H
 #  include <sys/types.h>
+# endif
+# ifdef HAVE_SYS_STAT_H
 #  include <sys/stat.h>
-#  include <fcntl.h>
+# endif
+# include <fcntl.h>
 #endif
 #include <assert.h>
 
index e521d6d691f5f32236882814f7e47afcc165dab5..dedb8a127ad5b5dcf467f22b71ea640f56168d0d 100644 (file)
@@ -30,7 +30,9 @@
 
 #include <stdlib.h>
 #include <string.h>
-#include <sys/types.h>
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
 #include <assert.h>
 #ifdef HAVE_UNISTD_H
 # include <unistd.h>
index f3119b5cad56e63fa26dc646cecb17bb937b62ee..6ba49c42008582b6df3058292e1f157a27be526f 100644 (file)
@@ -25,7 +25,9 @@
 
 #include <stdlib.h>
 #include <string.h>
-#include <sys/types.h>
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
 #include <assert.h>
 #ifdef HAVE_UNISTD_H
 # include <unistd.h>
index cf4df568d85758a9a7f64191450dd38150d695ff..990b1b945cf82dfe88d89976ece86bc51a7e473e 100644 (file)
@@ -24,7 +24,9 @@
 
 #include <stdlib.h>
 #include <string.h>
-#include <sys/types.h>
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
 #include <assert.h>
 #ifdef HAVE_UNISTD_H
 # include <unistd.h>
index 8a9cd8932cd1802ab93d21cad130386c105c6a9c..4b7b5a2e9fe574c1ac35b135d842bce7f5f58bf0 100644 (file)
@@ -26,7 +26,9 @@
 
 #include <stdlib.h>
 #include <string.h>
-#include <sys/types.h>
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
 #include <assert.h>
 #ifdef HAVE_UNISTD_H
 # include <unistd.h>
index fec7d7dfc449082489a1db0622b9ba2fdd10c485..92f75363dfb949d8ed391bef44c6a1b127b310c8 100644 (file)
@@ -29,7 +29,9 @@
 
 #include <stdlib.h>
 #include <string.h>
-#include <sys/types.h>
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
 #include <assert.h>
 #ifdef HAVE_UNISTD_H
 # include <unistd.h>
index 6f7c609a742fd5446573ce735b8cc25a36e2d6b2..ccf88a90308405872b0a73dfa34b33219b9f828a 100644 (file)
 #include <fcntl.h>
 #include <ctype.h>
 #include <string.h>
-#include <sys/types.h>
-#include <sys/stat.h>
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
 #include <stdint.h>
 #include <process.h>
 #include <windows.h>
index f76904b0a7285f6f2f63b0178400d4f0c42b0680..8f61a2617736dc0ffb131289f3656a3c8ac78a8f 100644 (file)
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-/* Solaris 8 needs sys/types.h before time.h.  */
-#include <sys/types.h>
+#ifdef HAVE_SYS_TYPES_H
+  /* Solaris 8 needs sys/types.h before time.h.  */
+# include <sys/types.h>
+#endif
 #include <time.h>
 #include <assert.h>
 #include <ctype.h>
index 21662b1bd792784728f02b6f837a10b01a224b9b..16ed6acb65f3760607765be392d49fe65bf041ce 100644 (file)
@@ -52,7 +52,9 @@
 # define LONG_MAX LONG_MAX_32_BITS
 #endif
 
-#include <sys/types.h>
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
 
 #undef __memrchr
 #undef memrchr
index 762051e78016de894f07851a611f4407c2238c52..02782172b7303f3689ce7b1400c7d5c6debbb772 100644 (file)
@@ -34,7 +34,9 @@
 #ifdef HAVE_SYS_TIME_H
 # include <sys/time.h>
 #endif
-#include <sys/types.h>
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
 #include <sys/wait.h>
 #ifdef HAVE_SYS_UIO_H
 # include <sys/uio.h>
index 7ab08dfdad3209bbca75403b969244a3741f86e0..b1808fd9be09d19c97a6568194dd1478498c5852 100644 (file)
@@ -35,7 +35,9 @@
 #ifdef HAVE_SYS_TIME_H
 # include <sys/time.h>
 #endif
-#include <sys/types.h>
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
 
 #include "util.h"
 #include "sema.h"
index 2c9d1e706d7ebad12a1d16f639017a08cc4c468f..9c70d22fae3069ce9f2e63a0488397c528ee476b 100644 (file)
@@ -32,7 +32,9 @@
 #endif
 
 /* For pid_t.  */
-#include <sys/types.h>
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
 
 
 /* A single file descriptor passed to spawn.  For child fds, dup_to
index 5a7e638be223b083414fe8dd645293721b05c408..d85bec9c4355c41ea9744c1358895da5ab7d95cb 100644 (file)
@@ -20,6 +20,7 @@
 # include <config.h>
 #endif
 
+#include <string.h>
 #include <gpg-error.h>
 #define __set_errno(ev) (gpg_err_set_errno (ev))
 
index b7dfbbde708527d44e7bae582c6eef6689c7dfeb..6c2cec69e7bcc6ad0f98f83bc2d6af0d6eda2dcc 100644 (file)
@@ -31,7 +31,9 @@
 #endif
 
 /* For pid_t.  */
-#include <sys/types.h>
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
 
 #include "gpgme.h"
 
index e6c512ce0b912435ee328248f155131ac7371c9b..b7dfc38bc0da67ee7c30fb19bc2b98368dcc139b 100644 (file)
@@ -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;
+}
index f34eb1b3c106daad10ef383a9c27d1274e47f6bb..2bc34ca770e34f3a77f3d1e357c5713dd61ad351 100644 (file)
@@ -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 */
index 6b7cd15062b1adb844a29edfcce935a6e84fee90..5c72f03616e635b3a481493b5c4f20ef66cb6280 100644 (file)
@@ -34,7 +34,9 @@
 #ifdef HAVE_SYS_TIME_H
 # include <sys/time.h>
 #endif
-#include <sys/types.h>
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
 #include <glib.h>
 #include <windows.h>
 #include <io.h>
index d7abbf4c7f444066c75a3c26c58340fe269f70cc..6f7320307f168dd4f4a18ef27a25c7dd4217c794 100644 (file)
@@ -31,7 +31,9 @@
 #ifdef HAVE_SYS_TIME_H
 # include <sys/time.h>
 #endif
-#include <sys/types.h>
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
 #include <io.h>
 
 #include "util.h"
index 33961041b0f4b5c4ddd34058412aa0a33d3924c3..504e6822ed1a7141163d9faa4ad006c79a0eec51 100644 (file)
@@ -31,7 +31,9 @@
 #ifdef HAVE_SYS_TIME_H
 # include <sys/time.h>
 #endif
-#include <sys/types.h>
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
 #include <io.h>
 
 #include "util.h"
index ec2fe50f2aa8b670a24f11708fbc6b1c6ab541db..532f89e950e8178fee1505b44899c422b57bdee4 100644 (file)
 #ifdef HAVE_SYS_TIME_H
 # include <sys/time.h>
 #endif
-#include <sys/types.h>
-#include <sys/stat.h>
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
 #ifdef HAVE_UNISTD_H
 # include <unistd.h>
 #endif
@@ -104,7 +108,6 @@ dlclose (void * hd)
 }  
 #endif /* HAVE_ALLOW_SET_FOREGROUND_WINDOW */
 
-
 void 
 _gpgme_allow_set_foreground_window (pid_t pid)
 {
index febd5bd9e372715edf7daaf3ee844a9f8a03525f..a552b54dca871fda415a15623ed737eaacec097c 100644 (file)
@@ -26,7 +26,9 @@
 #include <string.h>
 #include <assert.h>
 #include <errno.h>
-#include <sys/types.h>
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
 
 #include "util.h"
 #include "context.h"