Hopefully last changes for building with MSC.

This commit is contained in:
Werner Koch 2010-11-03 10:33:10 +00:00
parent 21eb91ae3a
commit 83d88d444e
6 changed files with 63 additions and 8 deletions

View File

@ -1,10 +1,18 @@
2010-11-03 Werner Koch <wk@g10code.com> 2010-11-03 Werner Koch <wk@g10code.com>
* debug.c (_gpgme_debug) [W32CE]: Replace locatime by GetLocalTime.
* signers.c (gpgme_signers_clear): Remove useless return.
Reported by Patrick Spendrin.
* w32-util.c: s/__inline__/GPG_ERR_INLINE/
* setenv.c: Include string.h due to our strerror replacement. * setenv.c: Include string.h due to our strerror replacement.
* w32-ce.h (access): New macro. * w32-ce.h (access, bsearch): New macros.
* w32-ce.c (_gpgme_wince_access): New. * w32-ce.c (_gpgme_wince_access): New.
(RegQueryValueExA): Change DATA to a void*. (RegQueryValueExA): Change DATA to a void*.
(_gpgme_wince_bsearch): New. Taken from glibc 2.6.
Guard include of sys/stat.h and sys/types.h. Guard include of sys/stat.h and sys/types.h.

View File

@ -209,6 +209,15 @@ _gpgme_debug (int level, const char *format, ...)
va_start (arg_ptr, format); va_start (arg_ptr, format);
LOCK (debug_lock); LOCK (debug_lock);
{ {
#ifdef HAVE_W32CE_SYSTEM
SYSTEMTIME t;
GetLocalTime (&t);
fprintf (errfp, "GPGME %04d-%02d-%02d %02d:%02d:%02d <0x%04llx> ",
t.wYear, t.wMonth, t.wDay,
t.wHour, t.wMinute, t.wSecond,
(unsigned long long) ath_self ());
#else
struct tm *tp; struct tm *tp;
time_t atime = time (NULL); time_t atime = time (NULL);
@ -217,6 +226,7 @@ _gpgme_debug (int level, const char *format, ...)
1900+tp->tm_year, tp->tm_mon+1, tp->tm_mday, 1900+tp->tm_year, tp->tm_mon+1, tp->tm_mday,
tp->tm_hour, tp->tm_min, tp->tm_sec, tp->tm_hour, tp->tm_min, tp->tm_sec,
(unsigned long long) ath_self ()); (unsigned long long) ath_self ());
#endif
} }
#ifdef FRAME_NR #ifdef FRAME_NR
{ {

View File

@ -57,7 +57,7 @@ void
gpgme_signers_clear (gpgme_ctx_t ctx) gpgme_signers_clear (gpgme_ctx_t ctx)
{ {
TRACE (DEBUG_CTX, "gpgme_signers_clear", ctx); TRACE (DEBUG_CTX, "gpgme_signers_clear", ctx);
return _gpgme_signers_clear (ctx); _gpgme_signers_clear (ctx);
} }

View File

@ -1,5 +1,6 @@
/* w32-ce.h /* w32-ce.h
Copyright (C) 2010 g10 Code GmbH Copyright (C) 2010 g10 Code GmbH
Copyright (C) 1991,92,97,2000,02 Free Software Foundation, Inc.
This file is part of GPGME. This file is part of GPGME.
@ -14,9 +15,8 @@
Lesser General Public License for more details. Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public You should have received a copy of the GNU Lesser General Public
License along with this program; if not, write to the Free Software License along with this program; if not, see <http://www.gnu.org/licenses/>.
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA */
02111-1307, USA. */
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include <config.h> #include <config.h>
@ -473,3 +473,35 @@ _gpgme_wince_access (const char *fname, int mode)
} }
return 0; return 0;
} }
/* Perform a binary search for KEY in BASE which has NMEMB elements
of SIZE bytes each. The comparisons are done by (*COMPAR)().
Code taken from glibc-2.6. */
void *
_gpgme_wince_bsearch (const void *key, const void *base,
size_t nmemb, size_t size,
int (*compar) (const void *, const void *))
{
size_t l, u, idx;
const void *p;
int comparison;
l = 0;
u = nmemb;
while (l < u)
{
idx = (l + u) / 2;
p = (void *) (((const char *) base) + (idx * size));
comparison = (*compar) (key, p);
if (comparison < 0)
u = idx;
else if (comparison > 0)
l = idx + 1;
else
return (void *) p;
}
return NULL;
}

View File

@ -70,6 +70,11 @@ BOOL SHGetSpecialFolderPathA(HWND,LPSTR,int,BOOL);
int _gpgme_wince_access (const char *fname, int mode); int _gpgme_wince_access (const char *fname, int mode);
#define access(a,b) _gpgme_wince_access ((a), (b)) #define access(a,b) _gpgme_wince_access ((a), (b))
void *_gpgme_wince_bsearch (const void *key, const void *base,
size_t nmemb, size_t size,
int (*compar) (const void *, const void *));
#define bsearch(a,b,c,d,e) _gpgme_wince_bsearch ((a),(b),(c),(d),(e))
#endif /* GPGME_W32_CE_H */ #endif /* GPGME_W32_CE_H */

View File

@ -76,14 +76,14 @@ DEFINE_STATIC_LOCK (get_path_lock);
#define RTLD_LAZY 0 #define RTLD_LAZY 0
static __inline__ void * static GPG_ERR_INLINE void *
dlopen (const char * name, int flag) dlopen (const char * name, int flag)
{ {
void * hd = LoadLibrary (name); void * hd = LoadLibrary (name);
return hd; return hd;
} }
static __inline__ void * static GPG_ERR_INLINE void *
dlsym (void * hd, const char * sym) dlsym (void * hd, const char * sym)
{ {
if (hd && sym) if (hd && sym)
@ -96,7 +96,7 @@ dlsym (void * hd, const char * sym)
return NULL; return NULL;
} }
static __inline__ int static GPG_ERR_INLINE int
dlclose (void * hd) dlclose (void * hd)
{ {
if (hd) if (hd)