blob: 307c89aeb2596bc4a1a72b96349ad13a3dbf4078 [file] [log] [blame]
Stefan Reinauer6ed57e52010-04-24 01:15:17 +02001/*
2 * Decompression utility for AMI BIOSes.
3 *
4 * Copyright (C) 2009-2010 coresystems GmbH
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2, or (at your option)
9 * any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; see the file COPYING. If not, write to
18 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
19 */
20
21#ifdef __APPLE__
Anton Kochkov8f9427f2013-04-07 13:20:30 +040022void *memmem(const void *haystack, size_t haystacklen, const void *needle,
23 size_t needlelen);
Stefan Reinauer6ed57e52010-04-24 01:15:17 +020024size_t strnlen(const char *s, size_t maxlen);
25char *strndup(const char *s, size_t n);
26#endif
27
28// "endian.h" does not exist on (at least) these platforms:
Idwer Vollering0ab44552012-09-23 01:22:20 +020029// NetBSD, OSF/Tru64, HP-UX 10, Solaris, A/UX, Ultrix and
30// AIX. It exists on FreeBSD, Linux and Irix.
Stefan Reinauer6ed57e52010-04-24 01:15:17 +020031#ifdef __linux__
32#include <endian.h>
Vikas N Kumare3f4ed72012-12-14 14:56:32 -050033#include <sys/stat.h>
Idwer Vollering0ab44552012-09-23 01:22:20 +020034#elif __FreeBSD__
35#include <sys/endian.h>
36#include <sys/stat.h>
Stefan Reinauer6ed57e52010-04-24 01:15:17 +020037#endif
38
39#if !defined(le32toh) || !defined(le16toh)
40#if BYTE_ORDER == LITTLE_ENDIAN
41#define le32toh(x) (x)
42#define le16toh(x) (x)
43#else
44#include <byteswap.h>
45#define le32toh(x) bswap_32(x)
46#define le16toh(x) bswap_16(x)
47#endif
48#endif