mirror of
https://git.sr.ht/~grimler/Heimdall
synced 2025-01-31 09:41:46 +00:00
719edaff9e
We should only need to define it for old versions of MSVC. On linux it seems that defining nullptr does not really have any downsides, but on android we get some obscure compiler errors due to how nullptr is defined. Fix nullptr check and thereby make heimdall compile on android. Error message looked something like: [ 6%] Building CXX object libpit/CMakeFiles/pit.dir/source/libpit.cpp.o In file included from /data/data/com.termux/files/home/Heimdall/libpit/source/libpit.cpp:22: In file included from /data/data/com.termux/files/home/Heimdall/libpit/source/libpit.h:38: In file included from /data/data/com.termux/files/usr/include/c++/v1/string:504: In file included from /data/data/com.termux/files/usr/include/c++/v1/string_view:175: In file included from /data/data/com.termux/files/usr/include/c++/v1/__string:57: In file included from /data/data/com.termux/files/usr/include/c++/v1/algorithm:643: /data/data/com.termux/files/usr/include/c++/v1/memory:2268:9: error: cannot initialize a member subobject of type 'libpit::PitEntry **' with an rvalue of type 'int' : __value_(_VSTD::forward<_Up>(__u)) ^ ~~~~~~~~~~~~~~~~~~~~~~~~ /data/data/com.termux/files/usr/include/c++/v1/memory:2353:9: note: in instantiation of function template specialization 'std::__compressed_pair_elem<libpit::PitEntry **, 0, false>::__compressed_pair_elem<int, void>' requested here : _Base1(std::forward<_U1>(__t1)), _Base2(std::forward<_U2>(__t2)) {} ^ /data/data/com.termux/files/usr/include/c++/v1/vector:436:7: note: in instantiation of function template specialization 'std::__compressed_pair<libpit::PitEntry **, std::allocator<libpit::PitEntry *>>::__compressed_pair<int, std::__default_init_tag>' requested here __end_cap_(nullptr, __default_init_tag()) ^ /data/data/com.termux/files/usr/include/c++/v1/vector:495:5: note: in instantiation of member function 'std::__vector_base<libpit::PitEntry *, std::allocator<libpit::PitEntry *>>::__vector_base' requested here vector() _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value) ^ /data/data/com.termux/files/home/projects/Heimdall/libpit/source/libpit.cpp:65:10: note: in instantiation of member function 'std::vector<libpit::PitEntry *>::vector' requested here PitData::PitData() ^
64 lines
2.0 KiB
C
64 lines
2.0 KiB
C
/* Copyright (c) 2010-2017 Benjamin Dobell, Glass Echidna
|
|
|
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
of this software and associated documentation files (the "Software"), to deal
|
|
in the Software without restriction, including without limitation the rights
|
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
copies of the Software, and to permit persons to whom the Software is
|
|
furnished to do so, subject to the following conditions:
|
|
|
|
The above copyright notice and this permission notice shall be included in
|
|
all copies or substantial portions of the Software.
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
THE SOFTWARE.*/
|
|
|
|
#ifndef HEIMDALL_H
|
|
#define HEIMDALL_H
|
|
|
|
#ifdef _MSC_VER // Microsoft Visual C Standard Library
|
|
|
|
#include <Windows.h>
|
|
#undef GetBinaryType
|
|
|
|
#ifndef va_copy
|
|
#define va_copy(d, s) ((d) = (s))
|
|
#endif
|
|
|
|
#define FileOpen(FILE, MODE) fopen(FILE, MODE)
|
|
#define FileClose(FILE) fclose(FILE)
|
|
#define FileSeek(FILE, OFFSET, ORIGIN) _fseeki64(FILE, OFFSET, ORIGIN)
|
|
#define FileTell(FILE) _ftelli64(FILE)
|
|
#define FileRewind(FILE) rewind(FILE)
|
|
|
|
#else // POSIX Standard Library
|
|
|
|
#ifdef AUTOCONF
|
|
#include "../config.h"
|
|
#endif
|
|
|
|
#include <unistd.h>
|
|
|
|
#define Sleep(t) usleep(1000*t)
|
|
|
|
#define FileOpen(FILE, MODE) fopen(FILE, MODE)
|
|
#define FileClose(FILE) fclose(FILE)
|
|
#define FileSeek(FILE, OFFSET, ORIGIN) fseeko(FILE, OFFSET, ORIGIN)
|
|
#define FileTell(FILE) ftello(FILE)
|
|
#define FileRewind(FILE) rewind(FILE)
|
|
|
|
#endif
|
|
|
|
#if defined(_MSC_VER) && (_MSC_VER < 1700)
|
|
# ifndef nullptr
|
|
# define nullptr 0
|
|
# endif
|
|
#endif
|
|
|
|
#endif
|