aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2010-11-03 09:56:27 +0000
committerWerner Koch <[email protected]>2010-11-03 09:56:27 +0000
commit21eb91ae3a8578b678d71083f4513de67b2e4e0f (patch)
treef4a1f78ee8611b006c726f829283ac4ec7001f80 /src
parentMight now build for CE using MSC. (diff)
downloadgpgme-21eb91ae3a8578b678d71083f4513de67b2e4e0f.tar.gz
gpgme-21eb91ae3a8578b678d71083f4513de67b2e4e0f.zip
More include guards.
Provide access for Wince. Install dummy sehmap.h
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog10
-rw-r--r--src/ath.c5
-rw-r--r--src/ath.h4
-rw-r--r--src/conversion.c6
-rw-r--r--src/data-compat.c4
-rw-r--r--src/data-fd.c4
-rw-r--r--src/data-stream.c4
-rw-r--r--src/data-user.c4
-rw-r--r--src/data.h4
-rw-r--r--src/debug.c6
-rw-r--r--src/engine-assuan.c4
-rw-r--r--src/engine-g13.c4
-rw-r--r--src/engine-gpgconf.c4
-rw-r--r--src/engine-gpgsm.c4
-rw-r--r--src/engine-uiserver.c4
-rw-r--r--src/gpgme-w32spawn.c8
-rw-r--r--src/keylist.c6
-rw-r--r--src/memrchr.c4
-rw-r--r--src/posix-io.c4
-rw-r--r--src/posix-sema.c4
-rw-r--r--src/priv-io.h4
-rw-r--r--src/setenv.c1
-rw-r--r--src/util.h4
-rw-r--r--src/w32-ce.c34
-rw-r--r--src/w32-ce.h4
-rw-r--r--src/w32-glib-io.c4
-rw-r--r--src/w32-io.c4
-rw-r--r--src/w32-sema.c4
-rw-r--r--src/w32-util.c9
-rw-r--r--src/wait.c4
30 files changed, 134 insertions, 35 deletions
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 <[email protected]>
+
+ * 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 <[email protected]>
* 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 <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)
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 <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*/
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 <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>
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 <sys/time.h>
#endif
-#include <sys/stat.h>
+#ifdef HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
#include <stdlib.h>
#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 <unistd.h>
#endif
-#include <sys/types.h>
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#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 <stdio.h>
-#include <sys/types.h>
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#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 <config.h>
#endif
-#include <sys/types.h>
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
#include <errno.h>
#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 <config.h>
#endif
-#include <sys/types.h>
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
#include <limits.h>
#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 <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>
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 <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>
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 <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>
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 <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>
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 <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>
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 <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>
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 <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>
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 <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>
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 <sys/types.h>
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#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 <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>
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 <sys/time.h>
#endif
-#include <sys/types.h>
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#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 <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
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 <config.h>
#endif
+#include <string.h>
#include <gpg-error.h>
#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 <sys/types.h>
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#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 <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>
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 <sys/time.h>
#endif
-#include <sys/types.h>
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
#include <io.h>
#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 <sys/time.h>
#endif
-#include <sys/types.h>
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
#include <io.h>
#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 <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)
{
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 <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"