]> git.sesse.net Git - vlc/blob - include/common_win32.h
* Fixed Debian package builds.
[vlc] / include / common_win32.h
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 $
7  *
8  * Authors: Gildas Bazin <gbazin@netcourrier.com>
9  *
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.
14  * 
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.
19  *
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  *****************************************************************************/
24
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 ;-)
29  */
30 #undef ntoh32(x)
31 #undef ntoh16(x)
32 #undef ntoh64(x)
33 #undef hton32(x)
34 #undef hton16(x)
35 #undef hton64(x)
36
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)
44 #else
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)
51 #endif
52
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)
63 #   undef I64C(x)
64 #   define I64C(x)         x##i64
65 #endif
66
67 /* several type definitions */
68 #if defined( __MINGW32__ )
69 #   if !defined( _OFF_T_ )
70 typedef long long _off_t;
71 typedef _off_t off_t;
72 #       define _OFF_T_
73 #   else
74 #       define off_t long long
75 #   endif
76 #endif
77
78 #if defined( _MSC_VER )
79 #   if !defined( _OFF_T_DEFINED )
80 typedef __int64 off_t;
81 #       define _OFF_T_DEFINED
82 #   else
83 #       define off_t __int64
84 #   endif
85 #   define stat _stati64
86 #endif
87
88 #ifndef snprintf
89 #   define snprintf _snprintf  /* snprintf not defined in mingw32 (bug?) */
90 #endif