diff options
Diffstat (limited to 'navit/support/libc')
37 files changed, 0 insertions, 2788 deletions
diff --git a/navit/support/libc/CMakeLists.txt b/navit/support/libc/CMakeLists.txt deleted file mode 100644 index 9a91d41b6..000000000 --- a/navit/support/libc/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ -supportlib_add_library(support_libc libc.c libc_init.c unlink.c rename.c time.c open.c abort.c mkdir.c lseek.c stat.c close.c chsize.c read.c write.c strcasecmp.c localtime.c gmtime.c mktime.c timeutil.c calloc.c bsearch.c) diff --git a/navit/support/libc/_mingw.h b/navit/support/libc/_mingw.h deleted file mode 100644 index 977334d1a..000000000 --- a/navit/support/libc/_mingw.h +++ /dev/null @@ -1,304 +0,0 @@ -#ifndef __MINGW_H -/* - * _mingw.h - * - * Mingw specific macros included by ALL include files. - * - * This file is part of the Mingw32 package. - * - * Contributors: - * Created by Mumit Khan <khan@xraylith.wisc.edu> - * - * THIS SOFTWARE IS NOT COPYRIGHTED - * - * This source code is offered for use in the public domain. You may - * use, modify or distribute it freely. - * - * This code is distributed in the hope that it will be useful but - * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY - * DISCLAIMED. This includes but is not limited to warranties of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - */ -#define __MINGW_H - -#define __MINGW32_VERSION 3.16 -#define __MINGW32_MAJOR_VERSION 3 -#define __MINGW32_MINOR_VERSION 16 -#define __MINGW32_PATCHLEVEL 0 - -#if __GNUC__ >= 3 -#pragma GCC system_header -#endif - -/* These are defined by the user (or the compiler) - to specify how identifiers are imported from a DLL. - - __DECLSPEC_SUPPORTED Defined if dllimport attribute is supported. - __MINGW_IMPORT The attribute definition to specify imported - variables/functions. - _CRTIMP As above. For MS compatibility. - __MINGW32_VERSION Runtime version. - __MINGW32_MAJOR_VERSION Runtime major version. - __MINGW32_MINOR_VERSION Runtime minor version. - __MINGW32_BUILD_DATE Runtime build date. - - Macros to enable MinGW features which deviate from standard MSVC - compatible behaviour; these may be specified directly in user code, - activated implicitly, (e.g. by specifying _POSIX_C_SOURCE or such), - or by inclusion in __MINGW_FEATURES__: - - __USE_MINGW_ANSI_STDIO Select a more ANSI C99 compatible - implementation of printf() and friends. - - Other macros: - - __int64 define to be long long. Using a typedef - doesn't work for "unsigned __int64" - - All headers should include this first, and then use __DECLSPEC_SUPPORTED - to choose between the old ``__imp__name'' style or __MINGW_IMPORT - style declarations. */ - - -/* Manifest definitions identifying the flag bits, controlling activation - * of MinGW features, as specified by the user in __MINGW_FEATURES__. - */ -#define __MINGW_ANSI_STDIO__ 0x0000000000000001ULL -/* - * The following three are not yet formally supported; they are - * included here, to document anticipated future usage. - */ -#define __MINGW_LC_EXTENSIONS__ 0x0000000000000050ULL -#define __MINGW_LC_MESSAGES__ 0x0000000000000010ULL -#define __MINGW_LC_ENVVARS__ 0x0000000000000040ULL - -/* Try to avoid problems with outdated checks for GCC __attribute__ support. */ -#undef __attribute__ - -#if defined (__PCC__) -# undef __DECLSPEC_SUPPORTED -# ifndef __MINGW_IMPORT -# define __MINGW_IMPORT extern -# endif -# ifndef _CRTIMP -# define _CRTIMP -# endif -# ifndef __cdecl -# define __cdecl _Pragma("cdecl") -# endif -# ifndef __stdcall -# define __stdcall _Pragma("stdcall") -# endif -# ifndef __int64 -# define __int64 long long -# endif -# ifndef __int32 -# define __int32 long -# endif -# ifndef __int16 -# define __int16 short -# endif -# ifndef __int8 -# define __int8 char -# endif -# ifndef __small -# define __small char -# endif -# ifndef __hyper -# define __hyper long long -# endif -# ifndef __volatile__ -# define __volatile__ volatile -# endif -# ifndef __restrict__ -# define __restrict__ restrict -# endif -# define NONAMELESSUNION -#elif defined(__GNUC__) -# ifdef __declspec -# ifndef __MINGW_IMPORT - /* Note the extern. This is needed to work around GCC's - limitations in handling dllimport attribute. */ -# define __MINGW_IMPORT extern __attribute__ ((__dllimport__)) -# endif -# ifndef _CRTIMP -# ifdef __USE_CRTIMP -# define _CRTIMP __attribute__ ((dllimport)) -# else -# define _CRTIMP -# endif -# endif -# define __DECLSPEC_SUPPORTED -# else /* __declspec */ -# undef __DECLSPEC_SUPPORTED -# undef __MINGW_IMPORT -# ifndef _CRTIMP -# define _CRTIMP -# endif -# endif /* __declspec */ -/* - * The next two defines can cause problems if user code adds the - * __cdecl attribute like so: - * void __attribute__ ((__cdecl)) foo(void); - */ -# ifndef __cdecl -# define __cdecl __attribute__ ((__cdecl__)) -# endif -# ifndef __stdcall -# define __stdcall __attribute__ ((__stdcall__)) -# endif -# ifndef __int64 -# define __int64 long long -# endif -# ifndef __int32 -# define __int32 long -# endif -# ifndef __int16 -# define __int16 short -# endif -# ifndef __int8 -# define __int8 char -# endif -# ifndef __small -# define __small char -# endif -# ifndef __hyper -# define __hyper long long -# endif -#else /* ! __GNUC__ && ! __PCC__ */ -# ifndef __MINGW_IMPORT -# define __MINGW_IMPORT __declspec(dllimport) -# endif -# ifndef _CRTIMP -# define _CRTIMP __declspec(dllimport) -# endif -# define __DECLSPEC_SUPPORTED -# define __attribute__(x) /* nothing */ -#endif - -#if defined (__GNUC__) && defined (__GNUC_MINOR__) -#define __MINGW_GNUC_PREREQ(major, minor) \ - (__GNUC__ > (major) \ - || (__GNUC__ == (major) && __GNUC_MINOR__ >= (minor))) -#else -#define __MINGW_GNUC_PREREQ(major, minor) 0 -#endif - -#ifdef __cplusplus -# define __CRT_INLINE inline -#else -# if __GNUC_STDC_INLINE__ -# define __CRT_INLINE extern inline __attribute__((__gnu_inline__)) -# else -# ifdef __COREDLL__ - /* There isn't any out-of-line version of most of - these functions in coredll.dll, so we need this for -O0, - or for -fno-inline. This is still problematic if the user - tries t o take the address of these functions. We will slowly - add out-of-line copies as those cases are found. - Note: We can't use static inline here, as most of these functions - will be declared elsew here with external linkage, and gcc will - barf on that. */ -# define __CRT_INLINE extern __inline__ __attribute__((__always_inline__)) -# else -# define __CRT_INLINE -# endif -# endif -#endif - -#ifdef __cplusplus -# define __UNUSED_PARAM(x) -#else -# ifdef __GNUC__ -# define __UNUSED_PARAM(x) x __attribute__ ((__unused__)) -# else -# define __UNUSED_PARAM(x) x -# endif -#endif - -#ifdef __GNUC__ -#define __MINGW_ATTRIB_NORETURN __attribute__ ((__noreturn__)) -#define __MINGW_ATTRIB_CONST __attribute__ ((__const__)) -#else -#define __MINGW_ATTRIB_NORETURN -#define __MINGW_ATTRIB_CONST -#endif - -#if __MINGW_GNUC_PREREQ (3, 0) -#define __MINGW_ATTRIB_MALLOC __attribute__ ((__malloc__)) -#define __MINGW_ATTRIB_PURE __attribute__ ((__pure__)) -#else -#define __MINGW_ATTRIB_MALLOC -#define __MINGW_ATTRIB_PURE -#endif - -/* Attribute `nonnull' was valid as of gcc 3.3. We don't use GCC's - variadiac macro facility, because variadic macros cause syntax - errors with --traditional-cpp. */ -#if __MINGW_GNUC_PREREQ (3, 3) -#define __MINGW_ATTRIB_NONNULL(arg) __attribute__ ((__nonnull__ (arg))) -#else -#define __MINGW_ATTRIB_NONNULL(arg) -#endif /* GNUC >= 3.3 */ - -#if defined(UNDER_CE) && defined(__arm__) -/* ARM Windows CE is not underscored. */ -# define __U(SYM) _ ## SYM -# define __IMP(S) __imp_ ## S -#elif defined(UNDER_CE) && defined(i386) -/* i386 Windows CE versions are underscored. */ -# define __U(SYM) SYM -# define __IMP(S) _imp__ ## S -#else -/* Desktop i386 Windows versions are underscored. */ -# define __U(SYM) SYM -# define __IMP(S) _imp__ ## S -#endif - -#if __MINGW_GNUC_PREREQ (3, 1) -#define __MINGW_ATTRIB_DEPRECATED __attribute__ ((__deprecated__)) -#else -#define __MINGW_ATTRIB_DEPRECATED -#endif /* GNUC >= 3.1 */ - -#if __MINGW_GNUC_PREREQ (3, 3) -#define __MINGW_NOTHROW __attribute__ ((__nothrow__)) -#else -#define __MINGW_NOTHROW -#endif /* GNUC >= 3.3 */ - - -/* TODO: Mark (almost) all CRT functions as __MINGW_NOTHROW. This will -allow GCC to optimize away some EH unwind code, at least in DW2 case. */ - -#if defined __MSVCRT__ && !defined (__MSVCRT_VERSION__) -/* High byte is the major version, low byte is the minor. */ -# define __MSVCRT_VERSION__ 0x0600 -#endif - -/* Activation of MinGW specific extended features: - */ -#ifndef __USE_MINGW_ANSI_STDIO -/* - * If user didn't specify it explicitly... - */ -# if defined __STRICT_ANSI__ || defined _ISOC99_SOURCE \ - || defined _POSIX_SOURCE || defined _POSIX_C_SOURCE \ - || defined _XOPEN_SOURCE || defined _XOPEN_SOURCE_EXTENDED \ - || defined _GNU_SOURCE || defined _BSD_SOURCE \ - || defined _SVID_SOURCE - /* - * but where any of these source code qualifiers are specified, - * then assume ANSI I/O standards are preferred over Microsoft's... - */ -# define __USE_MINGW_ANSI_STDIO 1 -# else - /* - * otherwise use whatever __MINGW_FEATURES__ specifies... - */ -# define __USE_MINGW_ANSI_STDIO (__MINGW_FEATURES__ & __MINGW_ANSI_STDIO__) -# endif -#endif - -#endif /* __MINGW_H */ diff --git a/navit/support/libc/abort.c b/navit/support/libc/abort.c deleted file mode 100644 index 11d405c5b..000000000 --- a/navit/support/libc/abort.c +++ /dev/null @@ -1,9 +0,0 @@ -#include <windows.h> - -/* Only needed on Windows CE. */ - -void abort(void) -{ - TerminateProcess (GetCurrentProcess(), 1); - while (1); /* Kill 'noreturn function does return' warning. */ -} diff --git a/navit/support/libc/bsearch.c b/navit/support/libc/bsearch.c deleted file mode 100644 index 2708688ce..000000000 --- a/navit/support/libc/bsearch.c +++ /dev/null @@ -1,81 +0,0 @@ -/*- - * Copyright (c) 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/* <wince> */ - -/* bsearch is in both stdlib.h and search.h. We include both - to catch possible differences. */ -#include <stdlib.h> -/* #include <search.h> */ -#include <stdint.h> - -/* </wince> */ - - -/* - * Perform a binary search. - * - * The code below is a bit sneaky. After a comparison fails, we - * divide the work in half by moving either left or right. If lim - * is odd, moving left simply involves halving lim: e.g., when lim - * is 5 we look at item 2, so we change lim to 2 so that we will - * look at items 0 & 1. If lim is even, the same applies. If lim - * is odd, moving right again involes halving lim, this time moving - * the base up one item past p: e.g., when lim is 5 we change base - * to item 3 and make lim 2 so that we will look at items 3 and 4. - * If lim is even, however, we have to shrink it by one before - * halving: e.g., when lim is 4, we still looked at item 2, so we - * have to make lim 3, then halve, obtaining 1, so that we will only - * look at item 3. - */ -void * -bsearch(key, base0, nmemb, size, compar) - const void *key; - const void *base0; - size_t nmemb; - size_t size; - int (*compar)(const void *, const void *); -{ - const char *base = base0; - size_t lim; - int cmp; - const void *p; - - for (lim = nmemb; lim != 0; lim >>= 1) { - p = base + (lim >> 1) * size; - cmp = (*compar)(key, p); - if (cmp == 0) - return ((void *)(unsigned int *)p); - if (cmp > 0) { /* key > p: move right */ - base = (const char *)p + size; - lim--; - } /* else move left */ - } - return (NULL); -} diff --git a/navit/support/libc/calloc.c b/navit/support/libc/calloc.c deleted file mode 100644 index 147ea73a4..000000000 --- a/navit/support/libc/calloc.c +++ /dev/null @@ -1,8 +0,0 @@ -void * -calloc(int nelem, int size) -{ - void *ret=malloc(nelem*size); - if (ret) - memset(ret, 0, nelem*size); - return ret; -} diff --git a/navit/support/libc/chsize.c b/navit/support/libc/chsize.c deleted file mode 100644 index 778949a46..000000000 --- a/navit/support/libc/chsize.c +++ /dev/null @@ -1,51 +0,0 @@ -/* - * chsize.c: _chsize and chsize implementations for WinCE. - * - * This file has no copyright assigned and is placed in the Public - * Domain. This file is a part of the mingw32ce package. No - * warranty is given; refer to the file DISCLAIMER within the package. - * - * Written by Pedro Alves <pedro_alves@portugalmail.pt> 24 Jun 2007 - * - */ - -#define WIN32_LEAN_AND_MEAN -#include <windows.h> - -int -_chsize (int fd, long size) -{ - DWORD cur; - DWORD new; - HANDLE h; - BOOL ret; - - h = (HANDLE) fd; - if (h == INVALID_HANDLE_VALUE) - { - SetLastError (ERROR_INVALID_PARAMETER); - return -1; - } - - cur = SetFilePointer (h, 0, NULL, FILE_CURRENT); - if (cur == 0xffffffff) - return -1; - - /* Move to where we want it. */ - new = SetFilePointer (h, size, NULL, FILE_BEGIN); - if (new == 0xffffffff) - return -1; - - /* And commit it as eof, effectivelly growing or shrinking. */ - ret = SetEndOfFile (h); - - SetFilePointer (h, cur, NULL, FILE_BEGIN); - - return ret ? 0 : -1; -} - -int -chsize (int fd, long size) -{ - return _chsize (fd, size); -} diff --git a/navit/support/libc/close.c b/navit/support/libc/close.c deleted file mode 100644 index 3b04734ce..000000000 --- a/navit/support/libc/close.c +++ /dev/null @@ -1,27 +0,0 @@ -/* - * close.c: close implementation for WinCE. - * - * This file has no copyright assigned and is placed in the Public Domain. - * This file is a part of the mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within the package. - * - * Written by Pedro Alves <pedro_alves@portugalmail.pt> Feb 2007 - * - */ - -#include <windows.h> -#include <unistd.h> - -int -_close (int fildes) -{ - if (CloseHandle ((HANDLE) fildes)) - return 0; - return -1; -} - -int -close (int fildes) -{ - return _close (fildes); -} diff --git a/navit/support/libc/errno.h b/navit/support/libc/errno.h deleted file mode 100644 index 9b7104e89..000000000 --- a/navit/support/libc/errno.h +++ /dev/null @@ -1,72 +0,0 @@ -/** - * errno.h - * included from mingw32ce/../errno.h - */ - -#ifndef _ERRNO_2_H_ -#define _ERRNO_2_H_ - -#ifndef RC_INVOKED - -#ifdef __cplusplus -extern "C" { -#endif - -extern int errno; -int* _errno(void); -char *strerror(int num); - -#ifdef __cplusplus -} -#endif - -#endif /* Not RC_INVOKED */ - - -#define EPERM 1 /* Operation not permitted */ -#define ENOFILE 2 /* No such file or directory */ -#define ENOENT 2 -#define ESRCH 3 /* No such process */ -#define EINTR 4 /* Interrupted function call */ -#define EIO 5 /* Input/output error */ -#define ENXIO 6 /* No such device or address */ -#define E2BIG 7 /* Arg list too long */ -#define ENOEXEC 8 /* Exec format error */ -#define EBADF 9 /* Bad file descriptor */ -#define ECHILD 10 /* No child processes */ -#define EAGAIN 11 /* Resource temporarily unavailable */ -#define ENOMEM 12 /* Not enough space */ -#define EACCES 13 /* Permission denied */ -#define EFAULT 14 /* Bad address */ -/* 15 - Unknown Error */ -#define EBUSY 16 /* strerror reports "Resource device" */ -#define EEXIST 17 /* File exists */ -#define EXDEV 18 /* Improper link (cross-device link?) */ -#define ENODEV 19 /* No such device */ -#define ENOTDIR 20 /* Not a directory */ -#define EISDIR 21 /* Is a directory */ -#define EINVAL 22 /* Invalid argument */ -#define ENFILE 23 /* Too many open files in system */ -#define EMFILE 24 /* Too many open files */ -#define ENOTTY 25 /* Inappropriate I/O control operation */ -/* 26 - Unknown Error */ -#define EFBIG 27 /* File too large */ -#define ENOSPC 28 /* No space left on device */ -#define ESPIPE 29 /* Invalid seek (seek on a pipe?) */ -#define EROFS 30 /* Read-only file system */ -#define EMLINK 31 /* Too many links */ -#define EPIPE 32 /* Broken pipe */ -#define EDOM 33 /* Domain error (math functions) */ -#define ERANGE 34 /* Result too large (possibly too small) */ -/* 35 - Unknown Error */ -#define EDEADLOCK 36 /* Resource deadlock avoided (non-Cyg) */ -#define EDEADLK 36 -/* 37 - Unknown Error */ -#define ENAMETOOLONG 38 /* Filename too long (91 in Cyg?) */ -#define ENOLCK 39 /* No locks available (46 in Cyg?) */ -#define ENOSYS 40 /* Function not implemented (88 in Cyg?) */ -#define ENOTEMPTY 41 /* Directory not empty (90 in Cyg?) */ -#define EILSEQ 42 /* Illegal byte sequence */ - -#endif /* Not _ERRNO_2_H_ */ - diff --git a/navit/support/libc/fcntl.h b/navit/support/libc/fcntl.h deleted file mode 100644 index 9bff9352a..000000000 --- a/navit/support/libc/fcntl.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - * fcntl.h - * This file has no copyright assigned and is placed in the Public Domain. - * This file is a part of the mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within the package. - * - * Access constants for _open. Note that the permissions constants are - * in sys/stat.h (ick). - * - */ -#ifndef _FCNTL_H_ -#define _FCNTL_H_ - -/* All the headers include this file. */ -#include <_mingw.h> - -/* - * It appears that fcntl.h should include io.h for compatibility... - */ -#include <io.h> - -/* Specifiy one of these flags to define the access mode. */ -#define _O_RDONLY 0 -#define _O_WRONLY 1 -#define _O_RDWR 2 - -/* Mask for access mode bits in the _open flags. */ -#define _O_ACCMODE (_O_RDONLY|_O_WRONLY|_O_RDWR) - -#define _O_APPEND 0x0008 /* Writes will add to the end of the file. */ - -#define _O_RANDOM 0x0010 -#define _O_SEQUENTIAL 0x0020 -#define _O_TEMPORARY 0x0040 /* Make the file dissappear after closing. - * WARNING: Even if not created by _open! */ -#define _O_NOINHERIT 0x0080 - -#define _O_CREAT 0x0100 /* Create the file if it does not exist. */ -#define _O_TRUNC 0x0200 /* Truncate the file if it does exist. */ -#define _O_EXCL 0x0400 /* Open only if the file does not exist. */ - -#define _O_SHORT_LIVED 0x1000 - -/* NOTE: Text is the default even if the given _O_TEXT bit is not on. */ -#define _O_TEXT 0x4000 /* CR-LF in file becomes LF in memory. */ -#define _O_BINARY 0x8000 /* Input and output is not translated. */ -#define _O_RAW _O_BINARY - -#if (__MSVCRT_VERSION__ >= 0x0800) -#define _O_WTEXT 0x10000 -#define _O_U16TEXT 0x20000 -#define _O_U8TEXT 0x40000 -#endif - -#ifndef _NO_OLDNAMES - -/* POSIX/Non-ANSI names for increased portability */ -#define O_RDONLY _O_RDONLY -#define O_WRONLY _O_WRONLY -#define O_RDWR _O_RDWR -#define O_ACCMODE _O_ACCMODE -#define O_APPEND _O_APPEND -#define O_CREAT _O_CREAT -#define O_TRUNC _O_TRUNC -#define O_EXCL _O_EXCL -#define O_TEXT _O_TEXT -#define O_BINARY _O_BINARY -#define O_TEMPORARY _O_TEMPORARY -#define O_NOINHERIT _O_NOINHERIT -#define O_SEQUENTIAL _O_SEQUENTIAL -#define O_RANDOM _O_RANDOM - -#endif /* Not _NO_OLDNAMES */ - -#endif /* Not _FCNTL_H_ */ diff --git a/navit/support/libc/getopt.h b/navit/support/libc/getopt.h deleted file mode 100644 index 406bbf594..000000000 --- a/navit/support/libc/getopt.h +++ /dev/null @@ -1,111 +0,0 @@ -#ifndef __GETOPT_H__ -/* - * getopt.h - * - * $Id: getopt.h,v 1.4 2009/01/04 17:35:36 keithmarshall Exp $ - * - * Defines constants and function prototypes required to implement - * the `getopt', `getopt_long' and `getopt_long_only' APIs. - * - * This file is part of the MinGW32 package set. - * - * Contributed by Keith Marshall <keithmarshall@users.sourceforge.net> - * - * - * THIS SOFTWARE IS NOT COPYRIGHTED - * - * This source code is offered for use in the public domain. You may - * use, modify or distribute it freely. - * - * This code is distributed in the hope that it will be useful but - * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY - * DISCLAIMED. This includes but is not limited to warranties of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * $Revision: 1.4 $ - * $Author: keithmarshall $ - * $Date: 2009/01/04 17:35:36 $ - * - */ -#define __GETOPT_H__ - -/* All the headers include this file. */ -#include <_mingw.h> - -#ifdef __cplusplus -extern "C" { -#endif - -extern int optind; /* index of first non-option in argv */ -extern int optopt; /* single option character, as parsed */ -extern int opterr; /* flag to enable built-in diagnostics... */ - /* (user may set to zero, to suppress) */ - -extern char *optarg; /* pointer to argument of current option */ - -extern int getopt( int, char * const [], const char * ); - -#ifdef _BSD_SOURCE -/* - * BSD adds the non-standard `optreset' feature, for reinitialisation - * of `getopt' parsing. We support this feature, for applications which - * proclaim their BSD heritage, before including this header; however, - * to maintain portability, developers are advised to avoid it. - */ -# define optreset __mingw_optreset - -extern int optreset; -#endif -#ifdef __cplusplus -} -#endif -/* - * POSIX requires the `getopt' API to be specified in `unistd.h'; - * thus, `unistd.h' includes this header. However, we do not want - * to expose the `getopt_long' or `getopt_long_only' APIs, when - * included in this manner. Thus, close the standard __GETOPT_H__ - * declarations block, and open an additional __GETOPT_LONG_H__ - * specific block, only when *not* __UNISTD_H_SOURCED__, in which - * to declare the extended API. - */ -#endif /* !defined(__GETOPT_H__) */ -#if !defined(__UNISTD_H_SOURCED__) && !defined(__GETOPT_LONG_H__) -#define __GETOPT_LONG_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -struct option /* specification for a long form option... */ -{ - const char *name; /* option name, without leading hyphens */ - int has_arg; /* does it take an argument? */ - int *flag; /* where to save its status, or NULL */ - int val; /* its associated status value */ -}; - -enum /* permitted values for its `has_arg' field... */ -{ - no_argument = 0, /* option never takes an argument */ - required_argument, /* option always requires an argument */ - optional_argument /* option may take an argument */ -}; - -extern int getopt_long( int, char * const [], const char *, const struct option *, int * ); -extern int getopt_long_only( int, char * const [], const char *, const struct option *, int * ); -/* - * Previous MinGW implementation had... - */ -#ifndef HAVE_DECL_GETOPT -/* - * ...for the long form API only; keep this for compatibility. - */ -# define HAVE_DECL_GETOPT 1 -#endif - -#ifdef __cplusplus -} -#endif - -#endif /* !defined(__UNISTD_H_SOURCED__) && !defined(__GETOPT_LONG_H__) */ -/* $RCSfile: getopt.h,v $Revision: 1.4 $: end of file */ diff --git a/navit/support/libc/gmtime.c b/navit/support/libc/gmtime.c deleted file mode 100644 index aa33e0906..000000000 --- a/navit/support/libc/gmtime.c +++ /dev/null @@ -1,25 +0,0 @@ -/* - * gmtime.c: gmtime implementation for WinCE. - * - * This file has no copyright assigned and is placed in the Public Domain. - * This file is a part of the mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within the package. - * - * Written by Pedro Alves <pedro_alves@portugalmail.pt> Feb 2007 - * - */ - -#include "timeutil.h" - -struct tm * -gmtime(const time_t *t) -{ - FILETIME f; - SYSTEMTIME s; - static struct tm tms; - - __time_t_to_FILETIME (*t, &f); - FileTimeToSystemTime (&f, &s); - __SYSTEMTIME_to_tm (&s, &tms); - return &tms; -} diff --git a/navit/support/libc/io.h b/navit/support/libc/io.h deleted file mode 100644 index 9c3da7c5d..000000000 --- a/navit/support/libc/io.h +++ /dev/null @@ -1,372 +0,0 @@ -/* - * io.h - * This file has no copyright assigned and is placed in the Public Domain. - * This file is a part of the mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within the package. - * - * System level I/O functions and types. - * - */ -#ifndef _IO_H_ -#define _IO_H_ - -/* All the headers include this file. */ -#include <_mingw.h> - -/* MSVC's io.h contains the stuff from dir.h, so I will too. - * NOTE: This also defines off_t, the file offset type, through - * an inclusion of sys/types.h */ - -#include <sys/types.h> /* To get time_t. */ - -/* - * Attributes of files as returned by _findfirst et al. - */ -#define _A_NORMAL 0x00000000 -#define _A_RDONLY 0x00000001 -#define _A_HIDDEN 0x00000002 -#define _A_SYSTEM 0x00000004 -#define _A_VOLID 0x00000008 -#define _A_SUBDIR 0x00000010 -#define _A_ARCH 0x00000020 - - -#ifndef RC_INVOKED - -#ifndef _INTPTR_T_DEFINED -#define _INTPTR_T_DEFINED -#ifdef _WIN64 - typedef __int64 intptr_t; -#else - typedef int intptr_t; -#endif -#endif - -#ifndef _FSIZE_T_DEFINED -typedef unsigned long _fsize_t; -#define _FSIZE_T_DEFINED -#endif - -/* - * The maximum length of a file name. You should use GetVolumeInformation - * instead of this constant. But hey, this works. - * Also defined in stdio.h. - */ -#ifndef FILENAME_MAX -#define FILENAME_MAX (260) -#endif - -/* - * The following structure is filled in by _findfirst or _findnext when - * they succeed in finding a match. - */ -#ifndef _FINDDATA_T_DEFINED -struct _finddata_t -{ - unsigned attrib; /* Attributes, see constants above. */ - time_t time_create; - time_t time_access; /* always midnight local time */ - time_t time_write; - _fsize_t size; - char name[FILENAME_MAX]; /* may include spaces. */ -}; - -#ifndef __COREDLL__ - -struct _finddatai64_t { - unsigned attrib; - time_t time_create; - time_t time_access; - time_t time_write; - __int64 size; - char name[FILENAME_MAX]; -}; - -#if __MSVCRT_VERSION__ >= 0x0601 -struct __finddata64_t { - unsigned attrib; - __time64_t time_create; - __time64_t time_access; - __time64_t time_write; -/* 8 bytes are returned so it can't be _fsize_t */ - __int64 size; - char name[FILENAME_MAX]; -}; -#endif - -#endif - -#define _FINDDATA_T_DEFINED -#endif /* _FINDDATA_T_DEFINED */ - -#ifndef _WFINDDATA_T_DEFINED -struct _wfinddata_t { - unsigned attrib; - time_t time_create; /* -1 for FAT file systems */ - time_t time_access; /* -1 for FAT file systems */ - time_t time_write; - _fsize_t size; - wchar_t name[FILENAME_MAX]; /* may include spaces. */ -}; - -#ifndef __COREDLL__ - -struct _wfinddatai64_t { - unsigned attrib; - time_t time_create; - time_t time_access; - time_t time_write; - __int64 size; - wchar_t name[FILENAME_MAX]; -}; - -#if __MSVCRT_VERSION__ >= 0x0601 -struct __wfinddata64_t { - unsigned attrib; - __time64_t time_create; - __time64_t time_access; - __time64_t time_write; -/* 8 bytes are returned so it can't be _fsize_t */ - __int64 size; - wchar_t name[FILENAME_MAX]; -}; -#endif - -#endif /* __COREDLL__ */ - -#define _WFINDDATA_T_DEFINED -#endif - - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Functions for searching for files. _findfirst returns -1 if no match - * is found. Otherwise it returns a handle to be used in _findnext and - * _findclose calls. _findnext also returns -1 if no match could be found, - * and 0 if a match was found. Call _findclose when you are finished. - */ -/* FIXME: Should these all use intptr_t, as per recent MSDN docs? */ -_CRTIMP long __cdecl __MINGW_NOTHROW _findfirst (const char*, struct _finddata_t*); -_CRTIMP int __cdecl __MINGW_NOTHROW _findnext (long, struct _finddata_t*); -_CRTIMP int __cdecl __MINGW_NOTHROW _findclose (long); - -#ifndef UNDER_CE -_CRTIMP int __cdecl __MINGW_NOTHROW _chdir (const char*); -_CRTIMP char* __cdecl __MINGW_NOTHROW _getcwd (char*, int); -_CRTIMP char* __cdecl __MINGW_NOTHROW _mktemp (char*); -#endif -_CRTIMP int __cdecl __MINGW_NOTHROW _mkdir (const char*); -_CRTIMP int __cdecl __MINGW_NOTHROW _rmdir (const char*); -_CRTIMP int __cdecl __MINGW_NOTHROW _chmod (const char*, int); - -#ifdef __MSVCRT__ -_CRTIMP __int64 __cdecl __MINGW_NOTHROW _filelengthi64(int); -_CRTIMP long __cdecl __MINGW_NOTHROW _findfirsti64(const char*, struct _finddatai64_t*); -_CRTIMP int __cdecl __MINGW_NOTHROW _findnexti64(long, struct _finddatai64_t*); -_CRTIMP __int64 __cdecl __MINGW_NOTHROW _lseeki64(int, __int64, int); -_CRTIMP __int64 __cdecl __MINGW_NOTHROW _telli64(int); -/* These require newer versions of msvcrt.dll (6.1 or higher). */ -#if __MSVCRT_VERSION__ >= 0x0601 -_CRTIMP intptr_t __cdecl __MINGW_NOTHROW _findfirst64(const char*, struct __finddata64_t*); -_CRTIMP intptr_t __cdecl __MINGW_NOTHROW _findnext64(intptr_t, struct __finddata64_t*); -#endif /* __MSVCRT_VERSION__ >= 0x0601 */ -#ifndef __NO_MINGW_LFS -__CRT_INLINE off64_t lseek64 (int, off64_t, int); -__CRT_INLINE off64_t lseek64 (int fd, off64_t offset, int whence) -{ - return _lseeki64(fd, (__int64) offset, whence); -} -#endif - -#endif /* __MSVCRT__ */ - -#ifndef _NO_OLDNAMES - -#ifndef _UWIN -#ifndef UNDER_CE -_CRTIMP int __cdecl __MINGW_NOTHROW chdir (const char*); -_CRTIMP char* __cdecl __MINGW_NOTHROW getcwd (char*, int); -_CRTIMP char* __cdecl __MINGW_NOTHROW mktemp (char*); -#endif -_CRTIMP int __cdecl __MINGW_NOTHROW mkdir (const char*); -_CRTIMP int __cdecl __MINGW_NOTHROW rmdir (const char*); -_CRTIMP int __cdecl __MINGW_NOTHROW chmod (const char*, int); -#endif /* _UWIN */ - -#endif /* Not _NO_OLDNAMES */ - -#ifdef __cplusplus -} -#endif - -#endif /* Not RC_INVOKED */ - -/* TODO: Maximum number of open handles has not been tested, I just set - * it the same as FOPEN_MAX. */ -#define HANDLE_MAX FOPEN_MAX - -/* Some defines for _access nAccessMode (MS doesn't define them, but - * it doesn't seem to hurt to add them). */ -#define F_OK 0 /* Check for file existence */ -/* Well maybe it does hurt. On newer versions of MSVCRT, an access mode - of 1 causes invalid parameter error. */ -#define X_OK 1 /* MS access() doesn't check for execute permission. */ -#define W_OK 2 /* Check for write permission */ -#define R_OK 4 /* Check for read permission */ - -#ifndef RC_INVOKED - -#ifdef __cplusplus -extern "C" { -#endif - -_CRTIMP int __cdecl __MINGW_NOTHROW _access (const char*, int); -_CRTIMP int __cdecl __MINGW_NOTHROW _chsize (int, long); -_CRTIMP int __cdecl __MINGW_NOTHROW _close (int); -_CRTIMP int __cdecl __MINGW_NOTHROW _commit(int); - -/* NOTE: The only significant bit in unPermissions appears to be bit 7 (0x80), - * the "owner write permission" bit (on FAT). */ -_CRTIMP int __cdecl __MINGW_NOTHROW _creat (const char*, int); - -_CRTIMP int __cdecl __MINGW_NOTHROW _dup (int); -_CRTIMP int __cdecl __MINGW_NOTHROW _dup2 (int, int); -_CRTIMP long __cdecl __MINGW_NOTHROW _filelength (int); -_CRTIMP long __cdecl __MINGW_NOTHROW _get_osfhandle (int); -_CRTIMP int __cdecl __MINGW_NOTHROW _isatty (int); - -/* In a very odd turn of events this function is excluded from those - * files which define _STREAM_COMPAT. This is required in order to - * build GNU libio because of a conflict with _eof in streambuf.h - * line 107. Actually I might just be able to change the name of - * the enum member in streambuf.h... we'll see. TODO */ -#ifndef _STREAM_COMPAT -_CRTIMP int __cdecl __MINGW_NOTHROW _eof (int); -#endif - -/* LK_... locking commands defined in sys/locking.h. */ -_CRTIMP int __cdecl __MINGW_NOTHROW _locking (int, int, long); - -_CRTIMP long __cdecl __MINGW_NOTHROW _lseek (int, long, int); - -/* Optional third argument is unsigned unPermissions. */ -_CRTIMP int __cdecl __MINGW_NOTHROW _open (const char*, int, ...); - -#ifndef __COREDLL__ -_CRTIMP int __cdecl __MINGW_NOTHROW _open_osfhandle (long, int); -_CRTIMP int __cdecl __MINGW_NOTHROW _pipe (int *, unsigned int, int); -#endif /* __COREDLL__ */ -_CRTIMP int __cdecl __MINGW_NOTHROW _read (int, void*, unsigned int); -#ifndef __COREDLL__ -_CRTIMP int __cdecl __MINGW_NOTHROW _setmode (int, int); -/* MS puts remove & rename (but not wide versions) in io.h as well - as in stdio.h. */ -_CRTIMP int __cdecl __MINGW_NOTHROW remove (const char*); -#endif -_CRTIMP int __cdecl __MINGW_NOTHROW rename (const char*, const char*); -#ifndef __COREDLL__ -/* SH_... flags for nShFlags defined in share.h - * Optional fourth argument is unsigned unPermissions */ -_CRTIMP int __cdecl __MINGW_NOTHROW _sopen (const char*, int, int, ...); - -_CRTIMP long __cdecl __MINGW_NOTHROW _tell (int); -/* Should umask be in sys/stat.h and/or sys/types.h instead? */ -_CRTIMP int __cdecl __MINGW_NOTHROW _umask (int); -#endif /* __COREDLL__ */ -_CRTIMP int __cdecl __MINGW_NOTHROW _unlink (const char*); -_CRTIMP int __cdecl __MINGW_NOTHROW _write (int, const void*, unsigned int); - -/* Wide character versions. Also declared in wchar.h. */ -/* Not in crtdll.dll */ -#if !defined (_WIO_DEFINED) -#if defined (__MSVCRT__) -_CRTIMP int __cdecl __MINGW_NOTHROW _waccess(const wchar_t*, int); -_CRTIMP int __cdecl __MINGW_NOTHROW _wchmod(const wchar_t*, int); -_CRTIMP int __cdecl __MINGW_NOTHROW _wcreat(const wchar_t*, int); -#endif -#if defined (__MSVCRT__) || defined (__COREDLL__) -_CRTIMP long __cdecl __MINGW_NOTHROW _wfindfirst(const wchar_t*, struct _wfinddata_t*); -_CRTIMP int __cdecl __MINGW_NOTHROW _wfindnext(long, struct _wfinddata_t *); -_CRTIMP int __cdecl __MINGW_NOTHROW _wopen(const wchar_t*, int, ...); -#endif -#if defined (__MSVCRT__) -_CRTIMP int __cdecl __MINGW_NOTHROW _wunlink(const wchar_t*); -_CRTIMP int __cdecl __MINGW_NOTHROW _wsopen(const wchar_t*, int, int, ...); -_CRTIMP wchar_t * __cdecl __MINGW_NOTHROW _wmktemp(wchar_t*); -_CRTIMP long __cdecl __MINGW_NOTHROW _wfindfirsti64(const wchar_t*, struct _wfinddatai64_t*); -_CRTIMP int __cdecl __MINGW_NOTHROW _wfindnexti64(long, struct _wfinddatai64_t*); -#if __MSVCRT_VERSION__ >= 0x0601 -_CRTIMP intptr_t __cdecl __MINGW_NOTHROW _wfindfirst64(const wchar_t*, struct __wfinddata64_t*); -_CRTIMP intptr_t __cdecl __MINGW_NOTHROW _wfindnext64(intptr_t, struct __wfinddata64_t*); -#endif -#endif /* defined (__MSVCRT__) */ -#define _WIO_DEFINED -#endif /* _WIO_DEFINED */ - -#ifndef _NO_OLDNAMES -/* - * Non-underscored versions of non-ANSI functions to improve portability. - * These functions live in libmoldname.a. - */ - -#ifndef _UWIN -_CRTIMP int __cdecl __MINGW_NOTHROW access (const char*, int); -_CRTIMP int __cdecl __MINGW_NOTHROW chsize (int, long ); -_CRTIMP int __cdecl __MINGW_NOTHROW close (int); -#ifndef __COREDLL__ -_CRTIMP int __cdecl __MINGW_NOTHROW creat (const char*, int); -_CRTIMP int __cdecl __MINGW_NOTHROW dup (int); -_CRTIMP int __cdecl __MINGW_NOTHROW dup2 (int, int); -_CRTIMP int __cdecl __MINGW_NOTHROW eof (int); -_CRTIMP long __cdecl __MINGW_NOTHROW filelength (int); -#endif /* __COREDLL__ */ -_CRTIMP int __cdecl __MINGW_NOTHROW isatty (int); -_CRTIMP long __cdecl __MINGW_NOTHROW lseek (int, long, int); -_CRTIMP int __cdecl __MINGW_NOTHROW open (const char*, int, ...); -_CRTIMP int __cdecl __MINGW_NOTHROW read (int, void*, unsigned int); -#ifndef __COREDLL__ -_CRTIMP int __cdecl __MINGW_NOTHROW setmode (int, int); -_CRTIMP int __cdecl __MINGW_NOTHROW sopen (const char*, int, int, ...); -_CRTIMP long __cdecl __MINGW_NOTHROW tell (int); -_CRTIMP int __cdecl __MINGW_NOTHROW umask (int); -#endif /* __COREDLL__ */ -_CRTIMP int __cdecl __MINGW_NOTHROW unlink (const char*); -_CRTIMP int __cdecl __MINGW_NOTHROW write (int, const void*, unsigned int); -#endif /* _UWIN */ - -#ifdef __USE_MINGW_ACCESS -/* Old versions of MSVCRT access() just ignored X_OK, while the version - shipped with Vista, returns an error code. This will restore the - old behaviour */ -static inline int __mingw_access (const char* __fname, int __mode) - { return _access (__fname, __mode & ~X_OK); } -#define access(__f,__m) __mingw_access (__f, __m) -#endif - -/* Wide character versions. Also declared in wchar.h. */ -/* Where do these live? Not in libmoldname.a nor in libmsvcrt.a */ -#if 0 -int waccess(const wchar_t *, int); -int wchmod(const wchar_t *, int); -int wcreat(const wchar_t *, int); -long wfindfirst(wchar_t *, struct _wfinddata_t *); -int wfindnext(long, struct _wfinddata_t *); -int wunlink(const wchar_t *); -int wrename(const wchar_t *, const wchar_t *); -int wopen(const wchar_t *, int, ...); -int wsopen(const wchar_t *, int, int, ...); -wchar_t * wmktemp(wchar_t *); -#endif - -#endif /* Not _NO_OLDNAMES */ - -#ifdef __cplusplus -} -#endif - -#endif /* Not RC_INVOKED */ - -#endif /* _IO_H_ not defined */ diff --git a/navit/support/libc/libc.c b/navit/support/libc/libc.c deleted file mode 100644 index a71f32994..000000000 --- a/navit/support/libc/libc.c +++ /dev/null @@ -1,254 +0,0 @@ -#include "locale.h" -#include <stdlib.h> -#include <string.h> -#ifdef HAVE_UNISTD_H -#include <unistd.h> -#endif -#ifdef PLATFORM_WINDOWS -#include "windows.h" -#endif - -int errno; - -#define MAXENV 32 -static char *envnames[MAXENV]; -static char *envvars[MAXENV]; - -static void cleanup_libc(void) -#ifndef _MSC_VER -__attribute__((destructor)) -#endif -; -static void cleanup_libc(void) -{ - int i; - for (i=0; i <MAXENV; i++) { - if (envnames[i]) - free(envnames[i]); - if (envvars[i]) - free(envvars[i]); - } -} - -char * -getenv(const char *name) -{ - int i; - for (i=0; i < MAXENV; i++) { - if (envnames[i] && !strcmp(envnames[i], name)) - return envvars[i]; - } - return NULL; -} - -int -setenv(const char *name, const char *value, int overwrite) -{ - int i; - char *val; - for (i=0; i < MAXENV; i++) { - if (envnames[i] && !strcmp(envnames[i], name)) { - if (overwrite) { - val = g_strdup(value); - if (!val) - return -1; - if (envvars[i]) - free(envvars[i]); - envvars[i] = val; - } - return 0; - } - } - for (i=0; i < MAXENV; i++) { - if (!envnames[i]) { - envnames[i] = g_strdup(name); - envvars[i] = g_strdup(value); - if (!envnames[i] || !envvars[i]) { - if (envnames[i]) - free(envnames[i]); - if (envvars[i]) - free(envvars[i]); - envnames[i] = NULL; - envvars[i] = NULL; - return -1; - } - return 0; - } - } - return -1; -} - -int unsetenv(const char *name) -{ - int i; - for (i=0; i < MAXENV; i++) { - if (envnames[i] && !strcmp(envnames[i], name)) { - free(envnames[i]); - envnames[i] = NULL; - if (envvars[i]) - free(envvars[i]); - envvars[i] = NULL; - } - } - return 0; -} - -char * -getcwd(char *buf, int size) -{ - return "dummy"; -} - -char * -getwd(char *buf) -{ - return "dummy"; -} - -char *strtok_r(char *str, const char *delim, char **saveptr) -{ - return strtok(str, delim); -} - -void -perror(const char *x) -{ -} - -void -raise(int signal) -{ -} - -void * -popen(void) -{ - return 0; -} - -int pclose(FILE *stream) -{ - return 0; -} - -void -rewind(void) -{ -} - -int -GetThreadLocale(void) -{ - return 0; -} - -int signal(int signum, int handler) -{ - return 0; -} - -char * setlocale ( int category, const char * locale ) -{ - return 0; -} - -static struct lconv localedata={"."}; - -struct lconv * -localeconv(void) -{ - return &localedata; -} - -unsigned int -alarm(unsigned int seconds) -{ - return 0; -} - -char * -strerror(int num) -{ - return "unknown"; -} - -#ifdef _MSC_VER - -size_t strftime (char *s, size_t maxsize, const char *format, const struct tm *tp) -{ - return 0; -} - -__int64 _lseeki64(int FileHandle, __int64 Offset, int Origin) -{ - return 0; -} - -int * _get_osfhandle(int FileHandle) -{ - return 0; -} - -#ifdef _MSC_VER - -HANDLE FindFirstFileA(char* pFileName, LPWIN32_FIND_DATAA pFindFileData) -{ - HANDLE hRetVal = INVALID_HANDLE_VALUE; - WIN32_FIND_DATAW wFindFileData; - wchar_t wFileName[MAX_PATH]; - - if (MultiByteToWideChar(CP_UTF8, MB_PRECOMPOSED, pFileName, -1, wFileName, MAX_PATH) != 0) - { - hRetVal = FindFirstFileW(wFileName, &wFindFileData); - - pFindFileData->dwFileAttributes = wFindFileData.dwFileAttributes; - pFindFileData->ftCreationTime = wFindFileData.ftCreationTime; - pFindFileData->ftLastAccessTime = wFindFileData.ftLastAccessTime; - pFindFileData->ftLastWriteTime = wFindFileData.ftLastWriteTime; - pFindFileData->nFileSizeHigh = wFindFileData.nFileSizeHigh; - pFindFileData->nFileSizeLow = wFindFileData.nFileSizeLow; - - if (WideCharToMultiByte(CP_UTF8, WC_SEPCHARS, wFileName, -1, pFindFileData->cFileName, MAX_PATH, NULL, NULL) == 0) - { - hRetVal = INVALID_HANDLE_VALUE; - } - } - - return hRetVal; -} - -BOOL FindNextFileA(HANDLE hFindFile, LPWIN32_FIND_DATAA pFindFileData) -{ - BOOL boRetVal = FALSE; - WIN32_FIND_DATAW wFindFileData; - - wFindFileData.dwFileAttributes = pFindFileData->dwFileAttributes; - wFindFileData.ftCreationTime = pFindFileData->ftCreationTime; - wFindFileData.ftLastAccessTime = pFindFileData->ftLastAccessTime; - wFindFileData.ftLastWriteTime = pFindFileData->ftLastWriteTime; - wFindFileData.nFileSizeHigh = pFindFileData->nFileSizeHigh; - wFindFileData.nFileSizeLow = pFindFileData->nFileSizeLow; - - if (MultiByteToWideChar(CP_UTF8, MB_PRECOMPOSED, pFindFileData->cFileName, -1, wFindFileData.cFileName, MAX_PATH) != 0) - { - boRetVal = FindNextFileW(hFindFile, &wFindFileData); - - pFindFileData->dwFileAttributes = wFindFileData.dwFileAttributes; - pFindFileData->ftCreationTime = wFindFileData.ftCreationTime; - pFindFileData->ftLastAccessTime = wFindFileData.ftLastAccessTime; - pFindFileData->ftLastWriteTime = wFindFileData.ftLastWriteTime; - pFindFileData->nFileSizeHigh = wFindFileData.nFileSizeHigh; - pFindFileData->nFileSizeLow = wFindFileData.nFileSizeLow; - - if (WideCharToMultiByte(CP_UTF8, WC_SEPCHARS, wFindFileData.cFileName, -1, pFindFileData->cFileName, MAX_PATH, NULL, NULL) == 0) - { - boRetVal = FALSE; - } - } - - return boRetVal; -} - -#endif - -#endif diff --git a/navit/support/libc/libc.h b/navit/support/libc/libc.h deleted file mode 100644 index 4125fa735..000000000 --- a/navit/support/libc/libc.h +++ /dev/null @@ -1,51 +0,0 @@ -#ifndef _SUPPORT_LIBC_H -#define _SUPPORT_LIBC_H 1 - - -void *popen(const char *command, const char *type); - -int pclose(void *stream); - -char* getenv (const char*); - -int setenv(const char *name, const char *value, int overwrite); - -void raise(int signal); - -char * setlocale ( int category, const char * locale ); - -struct lconv *localeconv(void); - -int signal(int signum, void *handler); - -#ifdef _MSC_VER - -#define GetWindowLongPtr GetWindowLong -#define SetWindowLongPtr SetWindowLong - -#define DWLP_MSGRESULT 0 -#define DWLP_DLGPROC DWLP_MSGRESULT + sizeof(LRESULT) -#define DWLP_USER DWLP_DLGPROC + sizeof(DLGPROC) - -struct tm *localtime (const time_t *t); - -size_t strftime (char *s, size_t maxsize, const char *format, const struct tm *tp); - -#define mkdir _mkdir -#define open _open -#define close _close -#define read _read -#define write _write -#define lseek _lseek -#define vsnprintf _vsnprintf - -#else - -#ifndef _GNU_SOURCE -# define _GNU_SOURCE 1 -#endif - -#endif - - -#endif diff --git a/navit/support/libc/libc_init.c b/navit/support/libc/libc_init.c deleted file mode 100644 index 32be387da..000000000 --- a/navit/support/libc/libc_init.c +++ /dev/null @@ -1,6 +0,0 @@ -#include "plugin.h" - -void -plugin_init(void) -{ -} diff --git a/navit/support/libc/locale.h b/navit/support/libc/locale.h deleted file mode 100644 index 320c3ac2d..000000000 --- a/navit/support/libc/locale.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef _LOCALE_H -#define _LOCALE_H 1 - -#ifndef SUBLANG_BENGALI_BANGLADESH -#define SUBLANG_BENGALI_BANGLADESH 0x02 -#endif -#ifndef SUBLANG_PUNJABI_PAKISTAN -#define SUBLANG_PUNJABI_PAKISTAN 0x02 -#endif -#ifndef SUBLANG_ROMANIAN_MOLDOVA -#define SUBLANG_ROMANIAN_MOLDOVA 0x02 -#endif -struct lconv { - char *decimal_point; -}; - -#define LC_ALL 1 -#define LC_NUMERIC 2 -#ifndef PATH_MAX -#define PATH_MAX 1024 -#endif -#endif diff --git a/navit/support/libc/localtime.c b/navit/support/libc/localtime.c deleted file mode 100644 index 245b51c5a..000000000 --- a/navit/support/libc/localtime.c +++ /dev/null @@ -1,38 +0,0 @@ -/* - * localtime.c: localtime implementation for WinCE. - * - * This file has no copyright assigned and is placed in the Public Domain. - * This file is a part of the mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within the package. - * - * Written by Pedro Alves <pedro_alves@portugalmail.pt> Feb 2007 - * - */ - -#include "timeutil.h" - -struct tm * -localtime(const time_t *timer) -{ - SYSTEMTIME ss, ls, s; - FILETIME sf, lf, f; - long long t, diff; - - static struct tm tms; - - GetSystemTime (&ss); - GetLocalTime (&ls); - - SystemTimeToFileTime (&ss, &sf); - SystemTimeToFileTime (&ls, &lf); - - diff = __FILETIME_to_ll (&sf) - __FILETIME_to_ll (&lf); - - __time_t_to_FILETIME (*timer, &f); - t = __FILETIME_to_ll (&f) - diff; - __ll_to_FILETIME (t, &f); - FileTimeToSystemTime (&f, &s); - __SYSTEMTIME_to_tm (&s, &tms); - - return &tms; -} diff --git a/navit/support/libc/lseek.c b/navit/support/libc/lseek.c deleted file mode 100644 index 4600c0d11..000000000 --- a/navit/support/libc/lseek.c +++ /dev/null @@ -1,41 +0,0 @@ -/* - * lseek.c: lseek implementation for WinCE. - * - * This file has no copyright assigned and is placed in the Public Domain. - * This file is a part of the mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within the package. - * - * Written by Pedro Alves <pedro_alves@portugalmail.pt> Feb 2007 - * - */ - -#include <windows.h> -#include <unistd.h> - -long -_lseek (int fildes, long offset, int whence) -{ - DWORD mode; - switch (whence) - { - case SEEK_SET: - mode = FILE_BEGIN; - break; - case SEEK_CUR: - mode = FILE_CURRENT; - break; - case SEEK_END: - mode = FILE_END; - break; - default: - /* Specify an invalid mode so SetFilePointer catches it. */ - mode = (DWORD)-1; - } - return (long) SetFilePointer ((HANDLE) fildes, offset, NULL, mode); -} - -long -lseek (int fildes, long offset, int whence) -{ - return _lseek (fildes, offset, whence); -} diff --git a/navit/support/libc/math.h b/navit/support/libc/math.h deleted file mode 100644 index e85a89455..000000000 --- a/navit/support/libc/math.h +++ /dev/null @@ -1,13 +0,0 @@ -#define M_E 2.7182818284590452354 -#define M_LOG2E 1.4426950408889634074 -#define M_LOG10E 0.43429448190325182765 -#define M_LN2 0.69314718055994530942 -#define M_LN10 2.30258509299404568402 -#define M_PI 3.14159265358979323846 -#define M_PI_2 1.57079632679489661923 -#define M_PI_4 0.78539816339744830962 -#define M_1_PI 0.31830988618379067154 -#define M_2_PI 0.63661977236758134308 -#define M_2_SQRTPI 1.12837916709551257390 -#define M_SQRT2 1.41421356237309504880 -#define M_SQRT1_2 0.70710678118654752440 diff --git a/navit/support/libc/mkdir.c b/navit/support/libc/mkdir.c deleted file mode 100644 index ae8d21d85..000000000 --- a/navit/support/libc/mkdir.c +++ /dev/null @@ -1,29 +0,0 @@ -/* - * mkdir.c: mkdir implementation for WinCE. - * - * This file has no copyright assigned and is placed in the Public - * Domain. This file is a part of the mingw32ce package. No - * warranty is given; refer to the file DISCLAIMER within the package. - * - * Written by Pedro Alves <pedro_alves@portugalmail.pt> 24 Jun 2007 - * - */ - -#include <windows.h> -#include <io.h> - -int -_mkdir (const char *dirname) -{ - wchar_t dirnamew[MAX_PATH]; - mbstowcs (dirnamew, dirname, MAX_PATH); - if (!CreateDirectoryW (dirnamew, NULL)) - return -1; - return 0; -} - -int -mkdir (const char *dirname) -{ - return _mkdir (dirname); -} diff --git a/navit/support/libc/mktime.c b/navit/support/libc/mktime.c deleted file mode 100644 index bd34fbf61..000000000 --- a/navit/support/libc/mktime.c +++ /dev/null @@ -1,32 +0,0 @@ -/* - * mktime.c: mktime implementation for WinCE. - * - * This file has no copyright assigned and is placed in the Public Domain. - * This file is a part of the mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within the package. - * - * Written by Pedro Alves <pedro_alves@portugalmail.pt> Feb 2007 - * - */ - -#include "timeutil.h" - -time_t -mktime (struct tm *pt) -{ - SYSTEMTIME ss, ls, s; - FILETIME sf, lf, f; - long long diff; - - GetSystemTime (&ss); - GetLocalTime (&ls); - SystemTimeToFileTime (&ss, &sf); - SystemTimeToFileTime (&ls, &lf); - - diff = __FILETIME_to_ll (&lf) - __FILETIME_to_ll (&sf); - diff /= _onesec_in100ns; - - __tm_to_SYSTEMTIME (pt, &s); - SystemTimeToFileTime (&s, &f); - return __FILETIME_to_time_t (&f) - (time_t)diff; -} diff --git a/navit/support/libc/open.c b/navit/support/libc/open.c deleted file mode 100644 index 210281706..000000000 --- a/navit/support/libc/open.c +++ /dev/null @@ -1,135 +0,0 @@ -/* - * open.c: open, _open and_wopen implementations for WinCE. - * - * This file has no copyright assigned and is placed in the Public Domain. - * This file is a part of the mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within the package. - * - * Written by Pedro Alves <pedro_alves@portugalmail.pt> Feb 2007 - * - */ - -#include <windows.h> -#include <unistd.h> -#include <fcntl.h> -#include <sys/stat.h> - -static int -vwopen (const wchar_t *wpath, int oflag, va_list ap) -{ - DWORD fileaccess; - DWORD fileshare; - DWORD filecreate; - DWORD fileattrib; - HANDLE hnd; - - switch (oflag & (O_RDONLY | O_WRONLY | O_RDWR)) - { - case O_RDONLY: - fileaccess = GENERIC_READ; - break; - case O_WRONLY: - fileaccess = GENERIC_WRITE; - break; - case O_RDWR: - fileaccess = GENERIC_READ | GENERIC_WRITE; - break; - default: - return -1; - } - - switch (oflag & (O_CREAT | O_EXCL | O_TRUNC)) - { - case 0: - case O_EXCL: /* ignore EXCL w/o CREAT */ - filecreate = OPEN_EXISTING; - break; - case O_CREAT: - filecreate = OPEN_ALWAYS; - break; - case O_CREAT | O_EXCL: - case O_CREAT | O_TRUNC | O_EXCL: - filecreate = CREATE_NEW; - break; - - case O_TRUNC: - case O_TRUNC | O_EXCL: /* ignore EXCL w/o CREAT */ - filecreate = TRUNCATE_EXISTING; - break; - case O_CREAT | O_TRUNC: - filecreate = CREATE_ALWAYS; - break; - default: - /* this can't happen ... all cases are covered */ - return -1; - } - - fileshare = 0; - if (oflag & O_CREAT) - { - int pmode = va_arg (ap, int); - if ((pmode & S_IREAD) == S_IREAD) - fileshare |= FILE_SHARE_READ; - if ((pmode & S_IWRITE) == S_IWRITE) - fileshare |= FILE_SHARE_WRITE; - } - - fileattrib = FILE_ATTRIBUTE_NORMAL; - - hnd = CreateFileW (wpath, fileaccess, fileshare, NULL, filecreate, - fileattrib, NULL); - if (hnd == INVALID_HANDLE_VALUE) - return -1; - - if (oflag & O_APPEND) - SetFilePointer (hnd, 0, NULL, FILE_END); - - return (int) hnd; -} - -static int -vopen (const char *path, int oflag, va_list ap) -{ - wchar_t wpath[MAX_PATH]; - - size_t path_len = strlen (path); - if (path_len >= MAX_PATH) - return -1; - - mbstowcs (wpath, path, path_len + 1); - - return vwopen (wpath, oflag, ap); -} - -int -_open (const char *path, int oflag, ...) -{ - va_list ap; - int ret; - va_start (ap, oflag); - ret = vopen (path, oflag, ap); - va_end (ap); - return ret; -} - -int -open (const char *path, int oflag, ...) -{ - va_list ap; - int ret; - va_start (ap, oflag); - ret = vopen (path, oflag, ap); - va_end (ap); - return ret; -} - -int -_wopen (const wchar_t *path, int oflag, ...) -{ - va_list ap; - int ret; - va_start (ap, oflag); - ret = vwopen (path, oflag, ap); - va_end (ap); - return ret; -} diff --git a/navit/support/libc/process.h b/navit/support/libc/process.h deleted file mode 100644 index ecd67a555..000000000 --- a/navit/support/libc/process.h +++ /dev/null @@ -1,147 +0,0 @@ -/* - * process.h - * This file has no copyright assigned and is placed in the Public Domain. - * This file is a part of the mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within the package. - * - * Function calls for spawning child processes. - * - */ - -#ifndef _PROCESS_H_ -#define _PROCESS_H_ -#if 0 - -/* All the headers include this file. */ -#include <_mingw.h> - -#include <sys/types.h> /* For _pid_t and pid_t. */ -#include <stdint.h> /* For intptr_t. */ -/* - * Constants for cwait actions. - * Obsolete for Win32. - */ -#define _WAIT_CHILD 0 -#define _WAIT_GRANDCHILD 1 - -#ifndef _NO_OLDNAMES -#define WAIT_CHILD _WAIT_CHILD -#define WAIT_GRANDCHILD _WAIT_GRANDCHILD -#endif /* Not _NO_OLDNAMES */ - -/* - * Mode constants for spawn functions. - */ -#define _P_WAIT 0 -#define _P_NOWAIT 1 -#define _P_OVERLAY 2 -#define _OLD_P_OVERLAY _P_OVERLAY -#define _P_NOWAITO 3 -#define _P_DETACH 4 - -#ifndef _NO_OLDNAMES -#define P_WAIT _P_WAIT -#define P_NOWAIT _P_NOWAIT -#define P_OVERLAY _P_OVERLAY -#define OLD_P_OVERLAY _OLD_P_OVERLAY -#define P_NOWAITO _P_NOWAITO -#define P_DETACH _P_DETACH -#endif /* Not _NO_OLDNAMES */ - - -#ifndef RC_INVOKED - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef __COREDLL__ - -_CRTIMP void __cdecl __MINGW_NOTHROW _cexit(void); -_CRTIMP void __cdecl __MINGW_NOTHROW _c_exit(void); - -_CRTIMP int __cdecl __MINGW_NOTHROW _cwait (int*, _pid_t, int); - -_CRTIMP _pid_t __cdecl __MINGW_NOTHROW _getpid(void); - -_CRTIMP intptr_t __cdecl __MINGW_NOTHROW _execl (const char*, const char*, ...); -_CRTIMP intptr_t __cdecl __MINGW_NOTHROW _execle (const char*, const char*, ...); -_CRTIMP intptr_t __cdecl __MINGW_NOTHROW _execlp (const char*, const char*, ...); -_CRTIMP intptr_t __cdecl __MINGW_NOTHROW _execlpe (const char*, const char*, ...); -_CRTIMP intptr_t __cdecl __MINGW_NOTHROW _execv (const char*, const char* const*); -_CRTIMP intptr_t __cdecl __MINGW_NOTHROW _execve (const char*, const char* const*, const char* const*); -_CRTIMP intptr_t __cdecl __MINGW_NOTHROW _execvp (const char*, const char* const*); -_CRTIMP intptr_t __cdecl __MINGW_NOTHROW _execvpe (const char*, const char* const*, const char* const*); - -_CRTIMP intptr_t __cdecl __MINGW_NOTHROW _spawnl (int, const char*, const char*, ...); -_CRTIMP intptr_t __cdecl __MINGW_NOTHROW _spawnle (int, const char*, const char*, ...); -_CRTIMP intptr_t __cdecl __MINGW_NOTHROW _spawnlp (int, const char*, const char*, ...); -_CRTIMP intptr_t __cdecl __MINGW_NOTHROW _spawnlpe (int, const char*, const char*, ...); -_CRTIMP intptr_t __cdecl __MINGW_NOTHROW _spawnv (int, const char*, const char* const*); -_CRTIMP intptr_t __cdecl __MINGW_NOTHROW _spawnve (int, const char*, const char* const*, const char* const*); -_CRTIMP intptr_t __cdecl __MINGW_NOTHROW _spawnvp (int, const char*, const char* const*); -_CRTIMP intptr_t __cdecl __MINGW_NOTHROW _spawnvpe (int, const char*, const char* const*, const char* const*); - -#endif /* !__COREDLL__*/ - -/* - * The functions _beginthreadex and _endthreadex are not provided by CRTDLL. - * They are provided by MSVCRT. - * - * NOTE: Apparently _endthread calls CloseHandle on the handle of the thread, - * making for race conditions if you are not careful. Basically you have to - * make sure that no-one is going to do *anything* with the thread handle - * after the thread calls _endthread or returns from the thread function. - * - * NOTE: No old names for these functions. Use the underscore. - */ -#if defined (__MSVCRT__) || defined (__CRTDLL__) -_CRTIMP unsigned long __cdecl __MINGW_NOTHROW - _beginthread (void (*)(void *), unsigned, void*); -_CRTIMP void __cdecl __MINGW_NOTHROW _endthread (void); -#endif - -#ifdef __MSVCRT__ -_CRTIMP unsigned long __cdecl __MINGW_NOTHROW - _beginthreadex (void *, unsigned, unsigned (__stdcall *) (void *), - void*, unsigned, unsigned*); -_CRTIMP void __cdecl __MINGW_NOTHROW _endthreadex (unsigned); -#endif - - -#ifndef _NO_OLDNAMES -#ifndef __COREDLL__ -/* - * Functions without the leading underscore, for portability. These functions - * live in liboldnames.a. - */ -_CRTIMP int __cdecl __MINGW_NOTHROW cwait (int*, pid_t, int); -_CRTIMP pid_t __cdecl __MINGW_NOTHROW getpid (void); -_CRTIMP intptr_t __cdecl __MINGW_NOTHROW execl (const char*, const char*, ...); -_CRTIMP intptr_t __cdecl __MINGW_NOTHROW execle (const char*, const char*, ...); -_CRTIMP intptr_t __cdecl __MINGW_NOTHROW execlp (const char*, const char*, ...); -_CRTIMP intptr_t __cdecl __MINGW_NOTHROW execlpe (const char*, const char*,...); -_CRTIMP intptr_t __cdecl __MINGW_NOTHROW execv (const char*, const char* const*); -_CRTIMP intptr_t __cdecl __MINGW_NOTHROW execve (const char*, const char* const*, const char* const*); -_CRTIMP intptr_t __cdecl __MINGW_NOTHROW execvp (const char*, const char* const*); -_CRTIMP intptr_t __cdecl __MINGW_NOTHROW execvpe (const char*, const char* const*, const char* const*); -_CRTIMP intptr_t __cdecl __MINGW_NOTHROW spawnl (int, const char*, const char*, ...); -_CRTIMP intptr_t __cdecl __MINGW_NOTHROW spawnle (int, const char*, const char*, ...); -_CRTIMP intptr_t __cdecl __MINGW_NOTHROW spawnlp (int, const char*, const char*, ...); -_CRTIMP intptr_t __cdecl __MINGW_NOTHROW spawnlpe (int, const char*, const char*, ...); -_CRTIMP intptr_t __cdecl __MINGW_NOTHROW spawnv (int, const char*, const char* const*); -_CRTIMP intptr_t __cdecl __MINGW_NOTHROW spawnve (int, const char*, const char* const*, const char* const*); -_CRTIMP intptr_t __cdecl __MINGW_NOTHROW spawnvp (int, const char*, const char* const*); -_CRTIMP intptr_t __cdecl __MINGW_NOTHROW spawnvpe (int, const char*, const char* const*, const char* const*); -#endif /* Not __COREDLL__ */ - -#endif /* Not _NO_OLDNAMES */ - -#ifdef __cplusplus -} -#endif - -#endif /* Not RC_INVOKED */ -#endif - -#endif /* _PROCESS_H_ not defined */ diff --git a/navit/support/libc/read.c b/navit/support/libc/read.c deleted file mode 100644 index 8ce99d8ff..000000000 --- a/navit/support/libc/read.c +++ /dev/null @@ -1,30 +0,0 @@ -/* - * read.c: read and _read implementations for WinCE. - * - * This file has no copyright assigned and is placed in the Public Domain. - * This file is a part of the mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within the package. - * - * Written by Pedro Alves <pedro_alves@portugalmail.pt> Feb 2007 - * - */ - -#include <windows.h> -#include <unistd.h> - -int -_read (int fildes, void *buf, unsigned int bufsize) -{ - DWORD NumberOfBytesRead; - if (bufsize > 0x7fffffff) - bufsize = 0x7fffffff; - if (!ReadFile ((HANDLE) fildes, buf, bufsize, &NumberOfBytesRead, NULL)) - return -1; - return (int) NumberOfBytesRead; -} - -int -read (int fildes, void *buf, unsigned int bufsize) -{ - return _read (fildes, buf, bufsize); -} diff --git a/navit/support/libc/rename.c b/navit/support/libc/rename.c deleted file mode 100644 index 23ca19630..000000000 --- a/navit/support/libc/rename.c +++ /dev/null @@ -1,27 +0,0 @@ -/* - * rename.c: rename implementation for WinCE. - * - * This file has no copyright assigned and is placed in the Public Domain. - * This file is a part of the mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within the package. - * - * Written by Pedro Alves <pedro_alves@portugalmail.pt> Feb 2007 - * - */ - -#include <windows.h> - -/* We return an error if the TO file already exists, - like the Windows NT/9x 'rename' does. */ - -int -rename (const char* from, const char* to) -{ - wchar_t fromw[MAX_PATH + 1]; - wchar_t tow[MAX_PATH + 1]; - mbstowcs (fromw, from, MAX_PATH); - mbstowcs (tow, to, MAX_PATH); - if (MoveFileW (fromw, tow)) - return 0; - return -1; -} diff --git a/navit/support/libc/signal.h b/navit/support/libc/signal.h deleted file mode 100644 index 18b65399b..000000000 --- a/navit/support/libc/signal.h +++ /dev/null @@ -1,2 +0,0 @@ -#define SIGFPE 8 -#define SIGSEGV 11 diff --git a/navit/support/libc/stat.c b/navit/support/libc/stat.c deleted file mode 100644 index 586dcf714..000000000 --- a/navit/support/libc/stat.c +++ /dev/null @@ -1,151 +0,0 @@ -/* - * stat.c: _stat, stat and fstat implementations for WinCE. - * - * This file has no copyright assigned and is placed in the Public Domain. - * This file is a part of the mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within the package. - * - * Written by Pedro Alves <pedro_alves@portugalmail.pt> 10 Feb 2007 - * - */ - -#include <windows.h> -#include <time.h> -#include <fcntl.h> -#include <io.h> -#include <sys/stat.h> -#include <stdio.h> -#include "debug.h" - -#include "timeutil.h" - -struct stat_file_info_t -{ - DWORD dwFileAttributes; - FILETIME ftLastWriteTime; - FILETIME ftCreationTime; - FILETIME ftLastAccessTime; - DWORD nFileSizeLow; -}; - -#define COPY_MEMBER(DEST, SRC, MEMBER) \ - do { \ - (DEST)->MEMBER = (SRC)->MEMBER; \ - } while (0) - -#define TO_STAT_FILE_INFO(DEST, SRC) \ - do { \ - COPY_MEMBER (DEST, SRC, dwFileAttributes); \ - COPY_MEMBER (DEST, SRC, ftLastWriteTime); \ - COPY_MEMBER (DEST, SRC, ftCreationTime); \ - COPY_MEMBER (DEST, SRC, ftLastAccessTime); \ - COPY_MEMBER (DEST, SRC, nFileSizeLow); \ - } while (0) - -static int -__stat_by_file_info (struct stat_file_info_t *fi, struct _stat *st, int exec) -{ - int permission = _S_IREAD; - - memset (st, 0, sizeof (*st)); - - st->st_size = fi->nFileSizeLow; - st->st_mode = _S_IFREG; - - if((fi->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0) - st->st_mode = _S_IFDIR | _S_IEXEC; - else if (exec) - permission |= _S_IEXEC; - - if((fi->dwFileAttributes & FILE_ATTRIBUTE_READONLY) == 0) - permission |= _S_IWRITE; - - st->st_mode |= permission | (permission >> 3) | (permission >> 6); - - st->st_nlink = 1; /* always 1? */ - st->st_rdev = 1; /* Where to get drive info? */ - st->st_ino = 0; /* always 0 on Windows */ - - st->st_mtime = __FILETIME_to_time_t (&fi->ftLastWriteTime); - st->st_ctime = __FILETIME_to_time_t (&fi->ftCreationTime); - st->st_atime = __FILETIME_to_time_t (&fi->ftLastAccessTime); - - /* Looks like the code below is never triggered. - Windows CE always only keeps the LastWriteTime, and - copies it to the CreationTime and LastAccessTime fields. */ - if (st->st_ctime == 0) - st->st_ctime = st->st_mtime; - if (st->st_atime == 0) - { - /* On XP, at least, the st_atime is always set to the same as - the st_mtime, except the hour/min/sec == 00:00:00. */ - SYSTEMTIME s; - FILETIME f = fi->ftLastWriteTime; - FileTimeToSystemTime (&f, &s); - s.wHour = 0; s.wMinute = 0; - s.wSecond = 0; s.wMilliseconds = 0; - SystemTimeToFileTime (&s, &f); - st->st_atime = __FILETIME_to_time_t (&f); - /* st->st_atime = st->st_mtime; */ - } - return 0; -} - -int -_fstat (int fd, struct _stat *st) -{ - BY_HANDLE_FILE_INFORMATION fi; - struct stat_file_info_t sfi; - - if (!GetFileInformationByHandle ((HANDLE) fd, &fi)) - return -1; - TO_STAT_FILE_INFO (&sfi, &fi); - return __stat_by_file_info (&sfi, st, 0); -} - -int -fstat (int fd, struct stat *st) -{ - return _fstat (fd, (struct _stat *)st); -} - -int -_stat (const char *path, struct _stat *st) -{ - WIN32_FIND_DATAW fd; - HANDLE h; - int ret; - struct stat_file_info_t sfi; - wchar_t pathw[MAX_PATH + 1]; - size_t len; - int exec; - - dbg(lvl_debug,"path=%s\n",path); - mbstowcs (pathw, path, MAX_PATH); - dbg(lvl_debug,"wide path=%S\n",pathw); - if((h = FindFirstFileW (pathw, &fd)) == INVALID_HANDLE_VALUE) - { - DWORD dwError = GetLastError (); - dbg(lvl_error,"no file\n"); - if(dwError == ERROR_NO_MORE_FILES) - /* Convert error to something more sensible. */ - SetLastError (ERROR_FILE_NOT_FOUND); - return -1; - } - - TO_STAT_FILE_INFO (&sfi, &fd); - - len = strlen (path); - exec = (len >= 4 - && strcasecmp (path + len - 4, ".exe") == 0); - ret = __stat_by_file_info (&sfi, st, exec); - dbg(lvl_debug,"ret=%d\n",ret); - FindClose (h); - return ret; -} - -int -stat (const char *path, struct stat *st) -{ - return _stat (path, (struct _stat *)st); -} diff --git a/navit/support/libc/strcasecmp.c b/navit/support/libc/strcasecmp.c deleted file mode 100644 index a238e22f2..000000000 --- a/navit/support/libc/strcasecmp.c +++ /dev/null @@ -1,21 +0,0 @@ -/* - * strcasecmp.c - * This file has no copyright assigned and is placed in the Public Domain. - * This file is a part of the mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within the package. - * - * Oldnames from ANSI header string.h - * - * Some wrapper functions for those old name functions whose appropriate - * equivalents are not simply underscore prefixed. - * - */ - -#include <string.h> - -int -strcasecmp (const char *sz1, const char *sz2) -{ - return _stricmp (sz1, sz2); -} - diff --git a/navit/support/libc/sys/stat.h b/navit/support/libc/sys/stat.h deleted file mode 100644 index 3bd462714..000000000 --- a/navit/support/libc/sys/stat.h +++ /dev/null @@ -1,196 +0,0 @@ -/* - * stat.h - * This file has no copyright assigned and is placed in the Public Domain. - * This file is a part of the mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within the package. - * - * Symbolic constants for opening and creating files, also stat, fstat and - * chmod functions. - * - */ - -#ifndef _STAT_H_ -#define _STAT_H_ - -/* All the headers include this file. */ -#include <_mingw.h> - -#define __need_size_t -#define __need_wchar_t -#ifndef RC_INVOKED -#include <stddef.h> -#endif /* Not RC_INVOKED */ - -#include <sys/types.h> - -/* - * Constants for the stat st_mode member. - */ -#define _S_IFIFO 0x1000 /* FIFO */ -#define _S_IFCHR 0x2000 /* Character */ -#define _S_IFBLK 0x3000 /* Block: Is this ever set under w32? */ -#define _S_IFDIR 0x4000 /* Directory */ -#define _S_IFREG 0x8000 /* Regular */ - -#define _S_IFMT 0xF000 /* File type mask */ - -#define _S_IEXEC 0x0040 -#define _S_IWRITE 0x0080 -#define _S_IREAD 0x0100 - -#define _S_IRWXU (_S_IREAD | _S_IWRITE | _S_IEXEC) -#define _S_IXUSR _S_IEXEC -#define _S_IWUSR _S_IWRITE -#define _S_IRUSR _S_IREAD - -#define _S_ISDIR(m) (((m) & _S_IFMT) == _S_IFDIR) -#define _S_ISFIFO(m) (((m) & _S_IFMT) == _S_IFIFO) -#define _S_ISCHR(m) (((m) & _S_IFMT) == _S_IFCHR) -#define _S_ISBLK(m) (((m) & _S_IFMT) == _S_IFBLK) -#define _S_ISREG(m) (((m) & _S_IFMT) == _S_IFREG) - -#ifndef _NO_OLDNAMES - -#define S_IFIFO _S_IFIFO -#define S_IFCHR _S_IFCHR -#define S_IFBLK _S_IFBLK -#define S_IFDIR _S_IFDIR -#define S_IFREG _S_IFREG -#define S_IFMT _S_IFMT -#define S_IEXEC _S_IEXEC -#define S_IWRITE _S_IWRITE -#define S_IREAD _S_IREAD -#define S_IRWXU _S_IRWXU -#define S_IXUSR _S_IXUSR -#define S_IWUSR _S_IWUSR -#define S_IRUSR _S_IRUSR - -#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) -#define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO) -#define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR) -#define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK) -#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) - -#endif /* Not _NO_OLDNAMES */ - -#ifndef RC_INVOKED - -#ifndef _STAT_DEFINED -/* - * The structure manipulated and returned by stat and fstat. - * - * NOTE: If called on a directory the values in the time fields are not only - * invalid, they will cause localtime et. al. to return NULL. And calling - * asctime with a NULL pointer causes an Invalid Page Fault. So watch it! - */ -struct _stat -{ - _dev_t st_dev; /* Equivalent to drive number 0=A 1=B ... */ - _ino_t st_ino; /* Always zero ? */ - _mode_t st_mode; /* See above constants */ - short st_nlink; /* Number of links. */ - short st_uid; /* User: Maybe significant on NT ? */ - short st_gid; /* Group: Ditto */ - _dev_t st_rdev; /* Seems useless (not even filled in) */ - _off_t st_size; /* File size in bytes */ - time_t st_atime; /* Accessed date (always 00:00 hrs local - * on FAT) */ - time_t st_mtime; /* Modified time */ - time_t st_ctime; /* Creation time */ -}; - -#ifndef _NO_OLDNAMES -/* NOTE: Must be the same as _stat above. */ -struct stat -{ - dev_t st_dev; /* Equivalent to drive number 0=A 1=B ... */ - ino_t st_ino; /* Always zero ? */ - mode_t st_mode; /* See above constants */ - short st_nlink; /* Number of links. */ - short st_uid; /* User: Maybe significant on NT ? */ - short st_gid; /* Group: Ditto */ - dev_t st_rdev; /* Seems useless (not even filled in) */ - off_t st_size; /* File size in bytes */ - time_t st_atime; /* Accessed date (always 00:00 hrs local - * on FAT) */ - time_t st_mtime; /* Modified time */ - time_t st_ctime; /* Creation time */ -}; -#endif /* _NO_OLDNAMES */ - -#if defined (__MSVCRT__) -struct _stati64 { - _dev_t st_dev; - _ino_t st_ino; - _mode_t st_mode; - short st_nlink; - short st_uid; - short st_gid; - _dev_t st_rdev; - __int64 st_size; - time_t st_atime; - time_t st_mtime; - time_t st_ctime; -}; -#if __MSVCRT_VERSION__ >= 0x0601 -struct __stat64 -{ - _dev_t st_dev; - _ino_t st_ino; - _mode_t st_mode; - short st_nlink; - short st_uid; - short st_gid; - _dev_t st_rdev; - __int64 st_size; - __time64_t st_atime; - __time64_t st_mtime; - __time64_t st_ctime; -}; -#endif /* __MSVCRT_VERSION__ */ -#endif /* __MSVCRT__ */ -#define _STAT_DEFINED -#endif /* _STAT_DEFINED */ - -#ifdef __cplusplus -extern "C" { -#endif - -_CRTIMP int __cdecl __MINGW_NOTHROW _fstat (int, struct _stat*); -_CRTIMP int __cdecl __MINGW_NOTHROW _chmod (const char*, int); -_CRTIMP int __cdecl __MINGW_NOTHROW _stat (const char*, struct _stat*); - -#ifndef _NO_OLDNAMES - -/* These functions live in liboldnames.a. */ -_CRTIMP int __cdecl __MINGW_NOTHROW fstat (int, struct stat*); -_CRTIMP int __cdecl __MINGW_NOTHROW chmod (const char*, int); -_CRTIMP int __cdecl __MINGW_NOTHROW stat (const char*, struct stat*); - -#endif /* Not _NO_OLDNAMES */ - -#if defined (__MSVCRT__) -_CRTIMP int __cdecl __MINGW_NOTHROW _fstati64(int, struct _stati64 *); -_CRTIMP int __cdecl __MINGW_NOTHROW _stati64(const char *, struct _stati64 *); -/* These require newer versions of msvcrt.dll (6.10 or higher). */ -#if __MSVCRT_VERSION__ >= 0x0601 -_CRTIMP int __cdecl __MINGW_NOTHROW _fstat64 (int, struct __stat64*); -_CRTIMP int __cdecl __MINGW_NOTHROW _stat64 (const char*, struct __stat64*); -#endif /* __MSVCRT_VERSION__ >= 0x0601 */ -#if !defined ( _WSTAT_DEFINED) /* also declared in wchar.h */ -_CRTIMP int __cdecl __MINGW_NOTHROW _wstat(const wchar_t*, struct _stat*); -_CRTIMP int __cdecl __MINGW_NOTHROW _wstati64 (const wchar_t*, struct _stati64*); -#if __MSVCRT_VERSION__ >= 0x0601 -_CRTIMP int __cdecl __MINGW_NOTHROW _wstat64 (const wchar_t*, struct __stat64*); -#endif /* __MSVCRT_VERSION__ >= 0x0601 */ -#define _WSTAT_DEFINED -#endif /* _WSTAT_DEFIND */ -#endif /* __MSVCRT__ */ - -#ifdef __cplusplus -} -#endif - -#endif /* Not RC_INVOKED */ - -#endif /* Not _STAT_H_ */ diff --git a/navit/support/libc/sys/time.h b/navit/support/libc/sys/time.h deleted file mode 100644 index 871da3f1b..000000000 --- a/navit/support/libc/sys/time.h +++ /dev/null @@ -1,56 +0,0 @@ -#ifndef _SYS_TIME_H_ -#define _SYS_TIME_H_ -#include <time.h> - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef _TIMEVAL_DEFINED /* also in winsock[2].h */ -#define _TIMEVAL_DEFINED -struct timeval { - long tv_sec; - long tv_usec; -}; -#define timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec) -#define timercmp(tvp, uvp, cmp) \ - (((tvp)->tv_sec != (uvp)->tv_sec) ? \ - ((tvp)->tv_sec cmp (uvp)->tv_sec) : \ - ((tvp)->tv_usec cmp (uvp)->tv_usec)) -#define timerclear(tvp) (tvp)->tv_sec = (tvp)->tv_usec = 0 -#endif /* _TIMEVAL_DEFINED */ - -/* Provided for compatibility with code that assumes that - the presence of gettimeofday function implies a definition - of struct timezone. */ -#ifndef _TIMEZONE_DEFINED -struct timezone -{ - int tz_minuteswest; /* of Greenwich */ - int tz_dsttime; /* type of dst correction to apply */ -}; -#define _TIMEZONE_DEFINED -#endif - -/* - Implementation as per: - The Open Group Base Specifications, Issue 6 - IEEE Std 1003.1, 2004 Edition - - The timezone pointer arg is ignored. Errors are ignored. -*/ - -#if 0 -#define __restrict__ -int __cdecl __MINGW_NOTHROW gettimeofday(struct timeval *__restrict__, - void *__restrict__ /* tzp (unused) */); -#else -int gettimeofday(struct timeval *, void *); -#endif - -#ifdef __cplusplus -} -#endif - - -#endif /* _SYS_TIME_H_ */ diff --git a/navit/support/libc/sys/types.h b/navit/support/libc/sys/types.h deleted file mode 100644 index ed25e5270..000000000 --- a/navit/support/libc/sys/types.h +++ /dev/null @@ -1,124 +0,0 @@ -/* - * types.h - * This file has no copyright assigned and is placed in the Public Domain. - * This file is a part of the mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within the package. - * - * The definition of constants, data types and global variables. - * - */ - -#ifndef _TYPES_H_ -#define _TYPES_H_ - -/* All the headers include this file. */ -#include <_mingw.h> - -#define __need_wchar_t -#define __need_size_t -#define __need_ptrdiff_t -#ifndef RC_INVOKED -#include <stddef.h> -#endif /* Not RC_INVOKED */ - -#ifndef RC_INVOKED - -#ifndef _TIME_T_DEFINED -typedef long time_t; -#define _TIME_T_DEFINED -#endif - -#ifndef _TIME64_T_DEFINED -typedef __int64 __time64_t; -#define _TIME64_T_DEFINED -#endif - -#ifndef _OFF_T_ -#define _OFF_T_ -typedef long _off_t; - -#ifndef _NO_OLDNAMES -typedef _off_t off_t; -#endif -#endif /* Not _OFF_T_ */ - - -#ifndef _DEV_T_ -#define _DEV_T_ -#ifdef __MSVCRT__ -typedef unsigned int _dev_t; -#else -typedef short _dev_t; -#endif - -#ifndef _NO_OLDNAMES -typedef _dev_t dev_t; -#endif -#endif /* Not _DEV_T_ */ - - -#ifndef _INO_T_ -#define _INO_T_ -typedef short _ino_t; - -#ifndef _NO_OLDNAMES -typedef _ino_t ino_t; -#endif -#endif /* Not _INO_T_ */ - - -#ifndef _PID_T_ -#define _PID_T_ -typedef int _pid_t; - -#ifndef _NO_OLDNAMES -typedef _pid_t pid_t; -#endif -#endif /* Not _PID_T_ */ - - -#ifndef _MODE_T_ -#define _MODE_T_ -typedef unsigned short _mode_t; - -#ifndef _NO_OLDNAMES -typedef _mode_t mode_t; -#endif -#endif /* Not _MODE_T_ */ - - -#ifndef _SIGSET_T_ -#define _SIGSET_T_ -typedef int _sigset_t; - -#ifndef _NO_OLDNAMES -typedef _sigset_t sigset_t; -#endif -#endif /* Not _SIGSET_T_ */ - -#ifndef _SSIZE_T_ -#define _SSIZE_T_ -typedef long _ssize_t; - -#ifndef _NO_OLDNAMES -typedef _ssize_t ssize_t; -#endif -#endif /* Not _SSIZE_T_ */ - -#ifndef _FPOS64_T_ -#define _FPOS64_T_ -typedef long long fpos64_t; -#endif - -#ifndef _OFF64_T_ -#define _OFF64_T_ -typedef long long off64_t; -#endif - -#if !defined __NO_ISOCEXT -typedef unsigned int useconds_t; -#endif /* Not __NO_ISOCEXT */ - -#endif /* Not RC_INVOKED */ - -#endif /* Not _TYPES_H_ */ diff --git a/navit/support/libc/time.c b/navit/support/libc/time.c deleted file mode 100644 index b167d5e30..000000000 --- a/navit/support/libc/time.c +++ /dev/null @@ -1,28 +0,0 @@ -/* - * time.c: time implementation for WinCE. - * - * This file has no copyright assigned and is placed in the Public Domain. - * This file is a part of the mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within the package. - * - * Written by Pedro Alves <pedro_alves@portugalmail.pt> Feb 2007 - * - */ - -#include "timeutil.h" - -time_t -time (time_t *timer) -{ - SYSTEMTIME s; - FILETIME f; - time_t t; - - if (timer == NULL) - timer = &t; - - GetSystemTime (&s); - SystemTimeToFileTime (&s, &f); - *timer = __FILETIME_to_time_t (&f); - return *timer; -} diff --git a/navit/support/libc/timeutil.c b/navit/support/libc/timeutil.c deleted file mode 100644 index 433bbbb58..000000000 --- a/navit/support/libc/timeutil.c +++ /dev/null @@ -1,126 +0,0 @@ -#include "timeutil.h" - -/* Originally based on code found in the Ruby WinCE support, which - had the following notice: */ - -/* start original header */ - -/*************************************************************** - time.c - - author : uema2 - date : Nov 30, 2002 - - You can freely use, copy, modify, and redistribute - the whole contents. -***************************************************************/ - -/* end original header */ - -/* Note: The original filename was: wince/time_wce.c */ - -/* Adapted to mingw32ce by Pedro Alves <pedro_alves@portugalmail.pt> - 10 Feb 2007 - Initial revision. */ - -#define DELTA_EPOCH 116444736000000000LL - -#if 0 -how_to_calc_delta_epoch () -{ - FILETIME f1601, f1970; - __FILETIME_from_Year (1601, &f1601); - __FILETIME_from_Year (1970, &f1970); - DELTA_EPOCH = __FILETIME_to_ll (&f1970) - __FILETIME_to_ll (&f1601); -} -#endif - -long long -__FILETIME_to_ll (const FILETIME *f) -{ - long long t; - t = (long long)f->dwHighDateTime << 32; - t |= f->dwLowDateTime; - return t; -} - -void -__ll_to_FILETIME (long long t, FILETIME* f) -{ - f->dwHighDateTime = (DWORD)((t >> 32) & 0x00000000FFFFFFFF); - f->dwLowDateTime = (DWORD)(t & 0x00000000FFFFFFFF); -} - -void -__tm_to_SYSTEMTIME (struct tm *t, SYSTEMTIME *s) -{ - s->wYear = t->tm_year + 1900; - s->wMonth = t->tm_mon + 1; - s->wDayOfWeek = t->tm_wday; - s->wDay = t->tm_mday; - s->wHour = t->tm_hour; - s->wMinute = t->tm_min; - s->wSecond = t->tm_sec; - s->wMilliseconds = 0; -} - -static void -__FILETIME_from_Year (WORD year, FILETIME *f) -{ - SYSTEMTIME s = {0}; - - s.wYear = year; - s.wMonth = 1; - s.wDayOfWeek = 1; - s.wDay = 1; - - SystemTimeToFileTime (&s, f); -} - -static int -__Yday_from_SYSTEMTIME (const SYSTEMTIME *s) -{ - long long t; - FILETIME f1, f2; - - __FILETIME_from_Year (s->wYear, &f1); - SystemTimeToFileTime (s, &f2); - - t = __FILETIME_to_ll (&f2) - __FILETIME_to_ll (&f1); - - return ((t / _onesec_in100ns) / (60 * 60 * 24)); -} - -void -__SYSTEMTIME_to_tm (SYSTEMTIME *s, struct tm *tm) -{ - tm->tm_year = s->wYear - 1900; - tm->tm_mon = s->wMonth- 1; - tm->tm_wday = s->wDayOfWeek; - tm->tm_mday = s->wDay; - tm->tm_yday = __Yday_from_SYSTEMTIME (s); - tm->tm_hour = s->wHour; - tm->tm_min = s->wMinute; - tm->tm_sec = s->wSecond; - tm->tm_isdst = 0; -} - -time_t -__FILETIME_to_time_t (const FILETIME* f) -{ - long long t; - t = __FILETIME_to_ll (f); - t -= DELTA_EPOCH; - return (time_t)(t / _onesec_in100ns); -} - -void -__time_t_to_FILETIME (time_t t, FILETIME *f) -{ - long long time; - - time = t; - time *= _onesec_in100ns; - time += DELTA_EPOCH; - - __ll_to_FILETIME (time, f); -} diff --git a/navit/support/libc/timeutil.h b/navit/support/libc/timeutil.h deleted file mode 100644 index 9e5f70886..000000000 --- a/navit/support/libc/timeutil.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef __TIMEUTIL_H -#define __TIMEUTIL_H - -#include <windows.h> -#include <sys/time.h> -#include <_mingw.h> - -#define _onesec_in100ns 10000000LL - -extern long long __FILETIME_to_ll (const FILETIME *f); -extern void __ll_to_FILETIME (long long t, FILETIME* f); -extern void __tm_to_SYSTEMTIME (struct tm *, SYSTEMTIME *); -extern void __SYSTEMTIME_to_tm (SYSTEMTIME *, struct tm *); -extern time_t __FILETIME_to_time_t (const FILETIME *); -extern void __time_t_to_FILETIME (time_t, FILETIME *); - -#endif diff --git a/navit/support/libc/unistd.h b/navit/support/libc/unistd.h deleted file mode 100644 index d1a435168..000000000 --- a/navit/support/libc/unistd.h +++ /dev/null @@ -1,48 +0,0 @@ -#ifndef _UNISTD_H -/* - * This file is part of the Mingw32 package. - * - * unistd.h maps (roughly) to io.h - * Other headers included by unistd.h may be selectively processed; - * __UNISTD_H_SOURCED__ enables such selective processing. - */ -#define _UNISTD_H -#define __UNISTD_H_SOURCED__ 1 - -#include <io.h> -#include <process.h> -#include <getopt.h> - -/* These are also defined in stdio.h. */ -#ifndef SEEK_SET -#define SEEK_SET 0 -#endif - -#ifndef SEEK_CUR -#define SEEK_CUR 1 -#endif - -#ifndef SEEK_END -#define SEEK_END 2 -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -#if !defined __NO_ISOCEXT -#include <sys/types.h> /* For useconds_t. */ - -int __cdecl __MINGW_NOTHROW usleep(useconds_t useconds); -#endif /* Not __NO_ISOCEXT */ - -/* This is defined as a real library function to allow autoconf - to verify its existence. */ -int ftruncate(int, off_t); - -#ifdef __cplusplus -} -#endif - -#undef __UNISTD_H_SOURCED__ -#endif /* _UNISTD_H */ diff --git a/navit/support/libc/unlink.c b/navit/support/libc/unlink.c deleted file mode 100644 index 9e3f9b582..000000000 --- a/navit/support/libc/unlink.c +++ /dev/null @@ -1,29 +0,0 @@ -/* - * unlink.c: unlink and _unlink implementations for WinCE. - * - * This file has no copyright assigned and is placed in the Public Domain. - * This file is a part of the mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within the package. - * - * Written by Pedro Alves <pedro_alves@portugalmail.pt> Feb 2007 - * - */ - -#include <stdio.h> -#include <windows.h> - -int -_unlink (const char *file) -{ - wchar_t wfile[MAX_PATH]; - size_t conv = mbstowcs (wfile, file, MAX_PATH); - if (conv > 0 && conv < MAX_PATH && DeleteFileW (wfile)) - return 0; - return -1; -} - -int -unlink (const char *file) -{ - return _unlink (file); -} diff --git a/navit/support/libc/write.c b/navit/support/libc/write.c deleted file mode 100644 index b9521aefc..000000000 --- a/navit/support/libc/write.c +++ /dev/null @@ -1,29 +0,0 @@ -/* - * write.c: write and _write implementations for WinCE. - * - * This file has no copyright assigned and is placed in the Public Domain. - * This file is a part of the mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within the package. - * - * Written by Pedro Alves <pedro_alves@portugalmail.pt> Feb 2007 - * - */ -#include <windows.h> -#include <unistd.h> - -int -_write (int fildes, const void *buf, unsigned int bufsize) -{ - DWORD NumberOfBytesWritten; - if (bufsize > 0x7fffffff) - bufsize = 0x7fffffff; - if (!WriteFile ((HANDLE) fildes, buf, bufsize, &NumberOfBytesWritten, NULL)) - return -1; - return (int) NumberOfBytesWritten; -} - -int -write (int fildes, const void *buf, unsigned int bufsize) -{ - return _write (fildes, buf, bufsize); -} |