More include guards.

Provide access for Wince.
Install dummy sehmap.h
This commit is contained in:
Werner Koch 2010-11-03 09:56:27 +00:00
parent 753375ffcf
commit 21eb91ae3a
34 changed files with 152 additions and 38 deletions

View File

@ -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> 2010-11-02 Werner Koch <wk@g10code.com>
* configure.ac (AC_CHECK_HEADERS): Check for sys.time.h. * configure.ac (AC_CHECK_HEADERS): Check for sys.time.h.

View File

@ -774,7 +774,7 @@ AC_CHECK_FUNCS(getgid getegid)
# Replacement functions. # Replacement functions.
AC_REPLACE_FUNCS(stpcpy) AC_REPLACE_FUNCS(stpcpy)
# Check for unistd.h for setenv replacement function. # 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) AC_REPLACE_FUNCS(setenv)
# Assuan check for descriptor passing. # Assuan check for descriptor passing.

View 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> 2010-11-01 Werner Koch <wk@g10code.com>
* conf-w32ce-msc/config.h: New. * conf-w32ce-msc/config.h: New.

View File

@ -219,13 +219,19 @@ copy-static-source:
cd ../contrib/conf-w32ce-msc ; \ cd ../contrib/conf-w32ce-msc ; \
cp -t $(targetsrc)/gpgme/src $(conf_sources) 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: copy-built-source:
@if [ ! -f ./gpgme.h ]; then \ @if [ ! -f ./gpgme.h ]; then \
echo "Please build using ./autogen.sh --build-w32ce first"; \ echo "Please build using ./autogen.sh --build-w32ce first"; \
exit 1; \ exit 1; \
fi fi
cp -t $(targetsrc)/gpgme/src $(built_sources) 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

View 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> 2010-11-02 Werner Koch <wk@g10code.com>
* data-fd.c (read, write, lseek) [W32CE && ! __MINGW32CE__]: New. * data-fd.c (read, write, lseek) [W32CE && ! __MINGW32CE__]: New.

View File

@ -33,7 +33,9 @@
# include <sys/time.h> # include <sys/time.h>
# endif # endif
#endif #endif
#include <sys/types.h> #ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#ifndef HAVE_W32_SYSTEM #ifndef HAVE_W32_SYSTEM
#include <sys/wait.h> #include <sys/wait.h>
#endif #endif
@ -60,7 +62,6 @@ ath_self (void)
} }
#else #else
# ifdef __linux # ifdef __linux
#include <sys/types.h>
#include <sys/syscall.h> #include <sys/syscall.h>
uintptr_t uintptr_t
ath_self (void) ath_self (void)

View File

@ -40,7 +40,9 @@
# include <sys/time.h> # include <sys/time.h>
# endif # endif
# endif # endif
# include <sys/types.h> # ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
# endif
# include <sys/socket.h> # include <sys/socket.h>
#endif /*!HAVE_W32_SYSTEM*/ #endif /*!HAVE_W32_SYSTEM*/

View File

@ -25,8 +25,10 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
/* Solaris 8 needs sys/types.h before time.h. */ #ifdef HAVE_SYS_TYPES_H
#include <sys/types.h> /* Solaris 8 needs sys/types.h before time.h. */
# include <sys/types.h>
#endif
#include <time.h> #include <time.h>
#include <errno.h> #include <errno.h>

View File

@ -26,7 +26,9 @@
#ifdef HAVE_SYS_TIME_H #ifdef HAVE_SYS_TIME_H
# include <sys/time.h> # include <sys/time.h>
#endif #endif
#include <sys/stat.h> #ifdef HAVE_SYS_STAT_H
# include <sys/stat.h>
#endif
#include <stdlib.h> #include <stdlib.h>
#include "data.h" #include "data.h"

View File

@ -25,7 +25,9 @@
#ifdef HAVE_UNISTD_H #ifdef HAVE_UNISTD_H
# include <unistd.h> # include <unistd.h>
#endif #endif
#include <sys/types.h> #ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#include "debug.h" #include "debug.h"
#include "data.h" #include "data.h"

View File

@ -23,7 +23,9 @@
#endif #endif
#include <stdio.h> #include <stdio.h>
#include <sys/types.h> #ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#include "debug.h" #include "debug.h"
#include "data.h" #include "data.h"

View File

@ -22,7 +22,9 @@
#include <config.h> #include <config.h>
#endif #endif
#include <sys/types.h> #ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#include <errno.h> #include <errno.h>
#include "debug.h" #include "debug.h"

View File

@ -25,7 +25,9 @@
#include <config.h> #include <config.h>
#endif #endif
#include <sys/types.h> #ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#include <limits.h> #include <limits.h>
#include "gpgme.h" #include "gpgme.h"

View File

@ -33,9 +33,13 @@
#include <errno.h> #include <errno.h>
#include <time.h> #include <time.h>
#ifndef HAVE_DOSISH_SYSTEM #ifndef HAVE_DOSISH_SYSTEM
# ifdef HAVE_SYS_TYPES_H
# include <sys/types.h> # include <sys/types.h>
# endif
# ifdef HAVE_SYS_STAT_H
# include <sys/stat.h> # include <sys/stat.h>
# include <fcntl.h> # endif
# include <fcntl.h>
#endif #endif
#include <assert.h> #include <assert.h>

View File

@ -30,7 +30,9 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <sys/types.h> #ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#include <assert.h> #include <assert.h>
#ifdef HAVE_UNISTD_H #ifdef HAVE_UNISTD_H
# include <unistd.h> # include <unistd.h>

View File

@ -25,7 +25,9 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <sys/types.h> #ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#include <assert.h> #include <assert.h>
#ifdef HAVE_UNISTD_H #ifdef HAVE_UNISTD_H
# include <unistd.h> # include <unistd.h>

View File

@ -24,7 +24,9 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <sys/types.h> #ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#include <assert.h> #include <assert.h>
#ifdef HAVE_UNISTD_H #ifdef HAVE_UNISTD_H
# include <unistd.h> # include <unistd.h>

View File

@ -26,7 +26,9 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <sys/types.h> #ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#include <assert.h> #include <assert.h>
#ifdef HAVE_UNISTD_H #ifdef HAVE_UNISTD_H
# include <unistd.h> # include <unistd.h>

View File

@ -29,7 +29,9 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <sys/types.h> #ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#include <assert.h> #include <assert.h>
#ifdef HAVE_UNISTD_H #ifdef HAVE_UNISTD_H
# include <unistd.h> # include <unistd.h>

View File

@ -28,8 +28,12 @@
#include <fcntl.h> #include <fcntl.h>
#include <ctype.h> #include <ctype.h>
#include <string.h> #include <string.h>
#include <sys/types.h> #ifdef HAVE_SYS_TYPES_H
#include <sys/stat.h> # include <sys/types.h>
#endif
#ifdef HAVE_SYS_STAT_H
# include <sys/stat.h>
#endif
#include <stdint.h> #include <stdint.h>
#include <process.h> #include <process.h>
#include <windows.h> #include <windows.h>

View File

@ -25,8 +25,10 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
/* Solaris 8 needs sys/types.h before time.h. */ #ifdef HAVE_SYS_TYPES_H
#include <sys/types.h> /* Solaris 8 needs sys/types.h before time.h. */
# include <sys/types.h>
#endif
#include <time.h> #include <time.h>
#include <assert.h> #include <assert.h>
#include <ctype.h> #include <ctype.h>

View File

@ -52,7 +52,9 @@
# define LONG_MAX LONG_MAX_32_BITS # define LONG_MAX LONG_MAX_32_BITS
#endif #endif
#include <sys/types.h> #ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#undef __memrchr #undef __memrchr
#undef memrchr #undef memrchr

View File

@ -34,7 +34,9 @@
#ifdef HAVE_SYS_TIME_H #ifdef HAVE_SYS_TIME_H
# include <sys/time.h> # include <sys/time.h>
#endif #endif
#include <sys/types.h> #ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#include <sys/wait.h> #include <sys/wait.h>
#ifdef HAVE_SYS_UIO_H #ifdef HAVE_SYS_UIO_H
# include <sys/uio.h> # include <sys/uio.h>

View File

@ -35,7 +35,9 @@
#ifdef HAVE_SYS_TIME_H #ifdef HAVE_SYS_TIME_H
# include <sys/time.h> # include <sys/time.h>
#endif #endif
#include <sys/types.h> #ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#include "util.h" #include "util.h"
#include "sema.h" #include "sema.h"

View File

@ -32,7 +32,9 @@
#endif #endif
/* For pid_t. */ /* 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 /* A single file descriptor passed to spawn. For child fds, dup_to

View File

@ -20,6 +20,7 @@
# include <config.h> # include <config.h>
#endif #endif
#include <string.h>
#include <gpg-error.h> #include <gpg-error.h>
#define __set_errno(ev) (gpg_err_set_errno (ev)) #define __set_errno(ev) (gpg_err_set_errno (ev))

View File

@ -31,7 +31,9 @@
#endif #endif
/* For pid_t. */ /* For pid_t. */
#include <sys/types.h> #ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#include "gpgme.h" #include "gpgme.h"

View File

@ -290,7 +290,7 @@ RegQueryValueExA (HKEY hKey, LPCSTR lpValueName, LPDWORD lpReserved,
{ {
wchar_t *name; wchar_t *name;
LONG err; LONG err;
BYTE *data; void *data;
DWORD data_len; DWORD data_len;
DWORD type; DWORD type;
@ -335,8 +335,8 @@ RegQueryValueExA (HKEY hKey, LPCSTR lpValueName, LPDWORD lpReserved,
int data_c_len; int data_c_len;
/* This is valid since we allocated one more above. */ /* This is valid since we allocated one more above. */
data[data_len] = '\0'; ((char*)data)[data_len] = '\0';
data[data_len + 1] = '\0'; ((char*)data)[data_len + 1] = '\0';
data_c = wchar_to_utf8 ((wchar_t*) data); data_c = wchar_to_utf8 ((wchar_t*) data);
if (!data_c) if (!data_c)
@ -445,3 +445,31 @@ SHGetSpecialFolderPathA (HWND hwndOwner, LPSTR lpszPath, int nFolder,
lpszPath[MAX_PATH - 1] = '\0'; lpszPath[MAX_PATH - 1] = '\0';
return result; 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;
}

View File

@ -67,5 +67,9 @@ DWORD GetTempPathA(DWORD,LPSTR);
#define SHGetSpecialFolderPathA _gpgme_wince_SHGetSpecialFolderPathA #define SHGetSpecialFolderPathA _gpgme_wince_SHGetSpecialFolderPathA
BOOL SHGetSpecialFolderPathA(HWND,LPSTR,int,BOOL); 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 */ #endif /* GPGME_W32_CE_H */

View File

@ -34,7 +34,9 @@
#ifdef HAVE_SYS_TIME_H #ifdef HAVE_SYS_TIME_H
# include <sys/time.h> # include <sys/time.h>
#endif #endif
#include <sys/types.h> #ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#include <glib.h> #include <glib.h>
#include <windows.h> #include <windows.h>
#include <io.h> #include <io.h>

View File

@ -31,7 +31,9 @@
#ifdef HAVE_SYS_TIME_H #ifdef HAVE_SYS_TIME_H
# include <sys/time.h> # include <sys/time.h>
#endif #endif
#include <sys/types.h> #ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#include <io.h> #include <io.h>
#include "util.h" #include "util.h"

View File

@ -31,7 +31,9 @@
#ifdef HAVE_SYS_TIME_H #ifdef HAVE_SYS_TIME_H
# include <sys/time.h> # include <sys/time.h>
#endif #endif
#include <sys/types.h> #ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#include <io.h> #include <io.h>
#include "util.h" #include "util.h"

View File

@ -32,8 +32,12 @@
#ifdef HAVE_SYS_TIME_H #ifdef HAVE_SYS_TIME_H
# include <sys/time.h> # include <sys/time.h>
#endif #endif
#include <sys/types.h> #ifdef HAVE_SYS_TYPES_H
#include <sys/stat.h> # include <sys/types.h>
#endif
#ifdef HAVE_SYS_STAT_H
# include <sys/stat.h>
#endif
#ifdef HAVE_UNISTD_H #ifdef HAVE_UNISTD_H
# include <unistd.h> # include <unistd.h>
#endif #endif
@ -104,7 +108,6 @@ dlclose (void * hd)
} }
#endif /* HAVE_ALLOW_SET_FOREGROUND_WINDOW */ #endif /* HAVE_ALLOW_SET_FOREGROUND_WINDOW */
void void
_gpgme_allow_set_foreground_window (pid_t pid) _gpgme_allow_set_foreground_window (pid_t pid)
{ {

View File

@ -26,7 +26,9 @@
#include <string.h> #include <string.h>
#include <assert.h> #include <assert.h>
#include <errno.h> #include <errno.h>
#include <sys/types.h> #ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#include "util.h" #include "util.h"
#include "context.h" #include "context.h"