1 /*****************************************************************************
2 * common_win32.h: common definitions specific to Win32
3 * Collection of useful common types and macros definitions
4 *****************************************************************************
5 * Copyright (C) 1998, 1999, 2000 VideoLAN
6 * $Id: common_win32.h,v 1.1 2001/11/25 22:52:21 gbazin Exp $
8 * Authors: Gildas Bazin <gbazin@netcourrier.com>
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
23 *****************************************************************************/
25 /* The ntoh* and hton* bytes swapping functions are provided by winsock
26 * but for conveniency and speed reasons it is better to implement them
27 * ourselves. ( several plugins use them and it is too much assle to link
28 * winsock with each of them ;-)
37 #ifdef WORDS_BIGENDIAN
38 # define ntoh32(x) (x)
39 # define ntoh16(x) (x)
40 # define ntoh64(x) (x)
41 # define hton32(x) (x)
42 # define hton16(x) (x)
43 # define hton64(x) (x)
45 # define ntoh32(x) __bswap_32 (x)
46 # define ntoh16(x) __bswap_16 (x)
47 # define ntoh64(x) __bswap_32 (x)
48 # define hton32(x) __bswap_32 (x)
49 # define hton16(x) __bswap_16 (x)
50 # define hton64(x) __bswap_32 (x)
53 /* win32, cl and icl support */
54 #if defined( _MSC_VER )
55 # define __attribute__(x)
56 # define __inline__ __inline
57 # define strncasecmp strnicmp
58 # define strcasecmp stricmp
59 # define S_ISBLK(m) (0)
60 # define S_ISCHR(m) (0)
61 # define S_ISFIFO(m) (((m)&_S_IFMT) == _S_IFIFO)
62 # define S_ISREG(m) (((m)&_S_IFMT) == _S_IFREG)
64 # define I64C(x) x##i64
67 /* several type definitions */
68 #if defined( __MINGW32__ )
69 # if !defined( _OFF_T_ )
70 typedef long long _off_t;
74 # define off_t long long
78 #if defined( _MSC_VER )
79 # if !defined( _OFF_T_DEFINED )
80 typedef __int64 off_t;
81 # define _OFF_T_DEFINED
83 # define off_t __int64
85 # define stat _stati64
89 # define snprintf _snprintf /* snprintf not defined in mingw32 (bug?) */