Imported Upstream version 1.1.2
[platform/upstream/libzip.git] / src / compat.h
1 #ifndef HAD_COMPAT_H
2 #define HAD_COMPAT_H
3
4 /*
5   compat.h -- compatibility defines
6   Copyright (C) 2012-2014 Dieter Baron and Thomas Klausner
7
8   This file is part of libzip, a library to manipulate ZIP archives.
9   The authors can be contacted at <libzip@nih.at>
10
11   Redistribution and use in source and binary forms, with or without
12   modification, are permitted provided that the following conditions
13   are met:
14   1. Redistributions of source code must retain the above copyright
15      notice, this list of conditions and the following disclaimer.
16   2. Redistributions in binary form must reproduce the above copyright
17      notice, this list of conditions and the following disclaimer in
18      the documentation and/or other materials provided with the
19      distribution.
20   3. The names of the authors may not be used to endorse or promote
21      products derived from this software without specific prior
22      written permission.
23  
24   THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
25   OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
26   WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27   ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
28   DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29   DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
30   GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
32   IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
33   OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
34   IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35 */
36
37 #ifndef _HAD_ZIP_H
38 #error zip.h has to be included first
39 #endif
40
41 #ifndef PRId64
42 #ifdef _MSC_VER
43 #define PRId64 "I64d"
44 #else
45 #define PRId64 "lld"
46 #endif
47 #endif
48
49 #ifndef PRIu64
50 #ifdef _MSC_VER
51 #define PRIu64 "I64u"
52 #else
53 #define PRIu64 "llu"
54 #endif
55 #endif
56
57 #ifndef S_ISDIR
58 #define S_ISDIR(mode)   (((mode) & S_IFMT) == S_IFDIR)
59 #endif
60
61 #endif