[svn] gpgme - r1498 - in trunk: . contrib contrib/conf-w32ce-msc src

svn author wk cvs at cvs.gnupg.org
Wed Nov 3 10:56:31 CET 2010


Author: wk
Date: 2010-11-03 10:56:27 +0100 (Wed, 03 Nov 2010)
New Revision: 1498

Modified:
   trunk/ChangeLog
   trunk/configure.ac
   trunk/contrib/ChangeLog
   trunk/contrib/conf-w32ce-msc/build.mk
   trunk/src/ChangeLog
   trunk/src/ath.c
   trunk/src/ath.h
   trunk/src/conversion.c
   trunk/src/data-compat.c
   trunk/src/data-fd.c
   trunk/src/data-stream.c
   trunk/src/data-user.c
   trunk/src/data.h
   trunk/src/debug.c
   trunk/src/engine-assuan.c
   trunk/src/engine-g13.c
   trunk/src/engine-gpgconf.c
   trunk/src/engine-gpgsm.c
   trunk/src/engine-uiserver.c
   trunk/src/gpgme-w32spawn.c
   trunk/src/keylist.c
   trunk/src/memrchr.c
   trunk/src/posix-io.c
   trunk/src/posix-sema.c
   trunk/src/priv-io.h
   trunk/src/setenv.c
   trunk/src/util.h
   trunk/src/w32-ce.c
   trunk/src/w32-ce.h
   trunk/src/w32-glib-io.c
   trunk/src/w32-io.c
   trunk/src/w32-sema.c
   trunk/src/w32-util.c
   trunk/src/wait.c
Log:
More include guards.
Provide access for Wince.
Install dummy sehmap.h


Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2010-11-02 20:17:57 UTC (rev 1497)
+++ trunk/ChangeLog	2010-11-03 09:56:27 UTC (rev 1498)
@@ -1,3 +1,8 @@
+2010-11-03  Werner Koch  <wk at g10code.com>
+
+	* configure.ac (AC_CHECK_HEADERS): Check for sys/types.h and
+	sys.stat.h.
+
 2010-11-02  Werner Koch  <wk at g10code.com>
 
 	* configure.ac (AC_CHECK_HEADERS): Check for sys.time.h.

Modified: trunk/contrib/ChangeLog
===================================================================
--- trunk/contrib/ChangeLog	2010-11-02 20:17:57 UTC (rev 1497)
+++ trunk/contrib/ChangeLog	2010-11-03 09:56:27 UTC (rev 1498)
@@ -1,3 +1,7 @@
+2010-11-03  Werner Koch  <wk at g10code.com>
+
+	* conf-w32ce-msc/build.mk (copy-built-source): Create dummy sehmap.h.
+
 2010-11-01  Werner Koch  <wk at g10code.com>
 
 	* conf-w32ce-msc/config.h: New.

Modified: trunk/src/ChangeLog
===================================================================
--- trunk/src/ChangeLog	2010-11-02 20:17:57 UTC (rev 1497)
+++ trunk/src/ChangeLog	2010-11-03 09:56:27 UTC (rev 1498)
@@ -1,3 +1,13 @@
+2010-11-03  Werner Koch  <wk at 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 at g10code.com>
 
 	* data-fd.c (read, write, lseek) [W32CE && ! __MINGW32CE__]: New.

Modified: trunk/configure.ac
===================================================================
--- trunk/configure.ac	2010-11-02 20:17:57 UTC (rev 1497)
+++ trunk/configure.ac	2010-11-03 09:56:27 UTC (rev 1498)
@@ -774,7 +774,7 @@
 # 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.

Modified: trunk/contrib/conf-w32ce-msc/build.mk
===================================================================
--- trunk/contrib/conf-w32ce-msc/build.mk	2010-11-02 20:17:57 UTC (rev 1497)
+++ trunk/contrib/conf-w32ce-msc/build.mk	2010-11-03 09:56:27 UTC (rev 1498)
@@ -219,15 +219,21 @@
 	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:

Modified: trunk/src/ath.c
===================================================================
--- trunk/src/ath.c	2010-11-02 20:17:57 UTC (rev 1497)
+++ trunk/src/ath.c	2010-11-03 09:56:27 UTC (rev 1498)
@@ -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 @@
 }
 #else
 # ifdef __linux
-#include <sys/types.h>
 #include <sys/syscall.h>
 uintptr_t
 ath_self (void)

Modified: trunk/src/ath.h
===================================================================
--- trunk/src/ath.h	2010-11-02 20:17:57 UTC (rev 1497)
+++ trunk/src/ath.h	2010-11-03 09:56:27 UTC (rev 1498)
@@ -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*/

Modified: trunk/src/conversion.c
===================================================================
--- trunk/src/conversion.c	2010-11-02 20:17:57 UTC (rev 1497)
+++ trunk/src/conversion.c	2010-11-03 09:56:27 UTC (rev 1498)
@@ -25,8 +25,10 @@
 
 #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>
 

Modified: trunk/src/data-compat.c
===================================================================
--- trunk/src/data-compat.c	2010-11-02 20:17:57 UTC (rev 1497)
+++ trunk/src/data-compat.c	2010-11-03 09:56:27 UTC (rev 1498)
@@ -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"

Modified: trunk/src/data-fd.c
===================================================================
--- trunk/src/data-fd.c	2010-11-02 20:17:57 UTC (rev 1497)
+++ trunk/src/data-fd.c	2010-11-03 09:56:27 UTC (rev 1498)
@@ -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"

Modified: trunk/src/data-stream.c
===================================================================
--- trunk/src/data-stream.c	2010-11-02 20:17:57 UTC (rev 1497)
+++ trunk/src/data-stream.c	2010-11-03 09:56:27 UTC (rev 1498)
@@ -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"

Modified: trunk/src/data-user.c
===================================================================
--- trunk/src/data-user.c	2010-11-02 20:17:57 UTC (rev 1497)
+++ trunk/src/data-user.c	2010-11-03 09:56:27 UTC (rev 1498)
@@ -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"

Modified: trunk/src/data.h
===================================================================
--- trunk/src/data.h	2010-11-02 20:17:57 UTC (rev 1497)
+++ trunk/src/data.h	2010-11-03 09:56:27 UTC (rev 1498)
@@ -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"

Modified: trunk/src/debug.c
===================================================================
--- trunk/src/debug.c	2010-11-02 20:17:57 UTC (rev 1497)
+++ trunk/src/debug.c	2010-11-03 09:56:27 UTC (rev 1498)
@@ -33,9 +33,13 @@
 #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>
 

Modified: trunk/src/engine-assuan.c
===================================================================
--- trunk/src/engine-assuan.c	2010-11-02 20:17:57 UTC (rev 1497)
+++ trunk/src/engine-assuan.c	2010-11-03 09:56:27 UTC (rev 1498)
@@ -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>

Modified: trunk/src/engine-g13.c
===================================================================
--- trunk/src/engine-g13.c	2010-11-02 20:17:57 UTC (rev 1497)
+++ trunk/src/engine-g13.c	2010-11-03 09:56:27 UTC (rev 1498)
@@ -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>

Modified: trunk/src/engine-gpgconf.c
===================================================================
--- trunk/src/engine-gpgconf.c	2010-11-02 20:17:57 UTC (rev 1497)
+++ trunk/src/engine-gpgconf.c	2010-11-03 09:56:27 UTC (rev 1498)
@@ -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>

Modified: trunk/src/engine-gpgsm.c
===================================================================
--- trunk/src/engine-gpgsm.c	2010-11-02 20:17:57 UTC (rev 1497)
+++ trunk/src/engine-gpgsm.c	2010-11-03 09:56:27 UTC (rev 1498)
@@ -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>

Modified: trunk/src/engine-uiserver.c
===================================================================
--- trunk/src/engine-uiserver.c	2010-11-02 20:17:57 UTC (rev 1497)
+++ trunk/src/engine-uiserver.c	2010-11-03 09:56:27 UTC (rev 1498)
@@ -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>

Modified: trunk/src/gpgme-w32spawn.c
===================================================================
--- trunk/src/gpgme-w32spawn.c	2010-11-02 20:17:57 UTC (rev 1497)
+++ trunk/src/gpgme-w32spawn.c	2010-11-03 09:56:27 UTC (rev 1498)
@@ -28,8 +28,12 @@
 #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>

Modified: trunk/src/keylist.c
===================================================================
--- trunk/src/keylist.c	2010-11-02 20:17:57 UTC (rev 1497)
+++ trunk/src/keylist.c	2010-11-03 09:56:27 UTC (rev 1498)
@@ -25,8 +25,10 @@
 #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>

Modified: trunk/src/memrchr.c
===================================================================
--- trunk/src/memrchr.c	2010-11-02 20:17:57 UTC (rev 1497)
+++ trunk/src/memrchr.c	2010-11-03 09:56:27 UTC (rev 1498)
@@ -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

Modified: trunk/src/posix-io.c
===================================================================
--- trunk/src/posix-io.c	2010-11-02 20:17:57 UTC (rev 1497)
+++ trunk/src/posix-io.c	2010-11-03 09:56:27 UTC (rev 1498)
@@ -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>

Modified: trunk/src/posix-sema.c
===================================================================
--- trunk/src/posix-sema.c	2010-11-02 20:17:57 UTC (rev 1497)
+++ trunk/src/posix-sema.c	2010-11-03 09:56:27 UTC (rev 1498)
@@ -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"

Modified: trunk/src/priv-io.h
===================================================================
--- trunk/src/priv-io.h	2010-11-02 20:17:57 UTC (rev 1497)
+++ trunk/src/priv-io.h	2010-11-03 09:56:27 UTC (rev 1498)
@@ -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

Modified: trunk/src/setenv.c
===================================================================
--- trunk/src/setenv.c	2010-11-02 20:17:57 UTC (rev 1497)
+++ trunk/src/setenv.c	2010-11-03 09:56:27 UTC (rev 1498)
@@ -20,6 +20,7 @@
 # include <config.h>
 #endif
 
+#include <string.h>
 #include <gpg-error.h>
 #define __set_errno(ev) (gpg_err_set_errno (ev))
 

Modified: trunk/src/util.h
===================================================================
--- trunk/src/util.h	2010-11-02 20:17:57 UTC (rev 1497)
+++ trunk/src/util.h	2010-11-03 09:56:27 UTC (rev 1498)
@@ -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"
 

Modified: trunk/src/w32-ce.c
===================================================================
--- trunk/src/w32-ce.c	2010-11-02 20:17:57 UTC (rev 1497)
+++ trunk/src/w32-ce.c	2010-11-03 09:56:27 UTC (rev 1498)
@@ -290,7 +290,7 @@
 {
   wchar_t *name;
   LONG err;
-  BYTE *data;
+  void *data;
   DWORD data_len;
   DWORD type;
 
@@ -335,8 +335,8 @@
       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 @@
   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;
+}

Modified: trunk/src/w32-ce.h
===================================================================
--- trunk/src/w32-ce.h	2010-11-02 20:17:57 UTC (rev 1497)
+++ trunk/src/w32-ce.h	2010-11-03 09:56:27 UTC (rev 1498)
@@ -67,5 +67,9 @@
 #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 */

Modified: trunk/src/w32-glib-io.c
===================================================================
--- trunk/src/w32-glib-io.c	2010-11-02 20:17:57 UTC (rev 1497)
+++ trunk/src/w32-glib-io.c	2010-11-03 09:56:27 UTC (rev 1498)
@@ -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>

Modified: trunk/src/w32-io.c
===================================================================
--- trunk/src/w32-io.c	2010-11-02 20:17:57 UTC (rev 1497)
+++ trunk/src/w32-io.c	2010-11-03 09:56:27 UTC (rev 1498)
@@ -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"

Modified: trunk/src/w32-sema.c
===================================================================
--- trunk/src/w32-sema.c	2010-11-02 20:17:57 UTC (rev 1497)
+++ trunk/src/w32-sema.c	2010-11-03 09:56:27 UTC (rev 1498)
@@ -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"

Modified: trunk/src/w32-util.c
===================================================================
--- trunk/src/w32-util.c	2010-11-02 20:17:57 UTC (rev 1497)
+++ trunk/src/w32-util.c	2010-11-03 09:56:27 UTC (rev 1498)
@@ -32,8 +32,12 @@
 #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 @@
 }  
 #endif /* HAVE_ALLOW_SET_FOREGROUND_WINDOW */
 
-
 void 
 _gpgme_allow_set_foreground_window (pid_t pid)
 {

Modified: trunk/src/wait.c
===================================================================
--- trunk/src/wait.c	2010-11-02 20:17:57 UTC (rev 1497)
+++ trunk/src/wait.c	2010-11-03 09:56:27 UTC (rev 1498)
@@ -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"





More information about the Gnupg-commits mailing list