forked from 0ad/0ad
Fix some line endings.
This was SVN commit r9093.
This commit is contained in:
parent
83271ec816
commit
5b7ea2371f
@ -1,65 +1,65 @@
|
||||
/* Copyright (c) 2010 Wildfire Games
|
||||
*
|
||||
* 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 INCLUDED_NATIVE_PATH
|
||||
#define INCLUDED_NATIVE_PATH
|
||||
|
||||
#include <string>
|
||||
|
||||
// rationale:
|
||||
// this is conceptually a different kind of path, not a superset of VfsPath,
|
||||
// hence NativePath instead of Path (PathUtil is a bit clunky as a
|
||||
// namespace anyway).
|
||||
// a typedef instead of wrapper class avoids the need for accessor functions
|
||||
// (e.g. boost::filesystem::string()) at the cost of somewhat diminished safety.
|
||||
// users are responsible for ensuring the path doesn't contain any forbidden
|
||||
// characters (including any code points >= 0x100 on anything but Windows)
|
||||
typedef std::wstring NativePath;
|
||||
|
||||
static inline NativePath NativePathFromString(const std::string& string)
|
||||
{
|
||||
return NativePath(string.begin(), string.end());
|
||||
}
|
||||
|
||||
#if OS_WIN
|
||||
|
||||
static inline std::wstring StringFromNativePath(const NativePath& npath)
|
||||
{
|
||||
return npath;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
static inline std::string StringFromNativePath(const NativePath& npath)
|
||||
{
|
||||
std::string string(npath.length(), '\0');
|
||||
for(size_t i = 0; i < npath.length(); i++)
|
||||
{
|
||||
debug_assert(npath[i] <= UCHAR_MAX);
|
||||
string[i] = npath[i];
|
||||
}
|
||||
return string;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif // #ifndef INCLUDED_NATIVE_PATH
|
||||
/* Copyright (c) 2010 Wildfire Games
|
||||
*
|
||||
* 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 INCLUDED_NATIVE_PATH
|
||||
#define INCLUDED_NATIVE_PATH
|
||||
|
||||
#include <string>
|
||||
|
||||
// rationale:
|
||||
// this is conceptually a different kind of path, not a superset of VfsPath,
|
||||
// hence NativePath instead of Path (PathUtil is a bit clunky as a
|
||||
// namespace anyway).
|
||||
// a typedef instead of wrapper class avoids the need for accessor functions
|
||||
// (e.g. boost::filesystem::string()) at the cost of somewhat diminished safety.
|
||||
// users are responsible for ensuring the path doesn't contain any forbidden
|
||||
// characters (including any code points >= 0x100 on anything but Windows)
|
||||
typedef std::wstring NativePath;
|
||||
|
||||
static inline NativePath NativePathFromString(const std::string& string)
|
||||
{
|
||||
return NativePath(string.begin(), string.end());
|
||||
}
|
||||
|
||||
#if OS_WIN
|
||||
|
||||
static inline std::wstring StringFromNativePath(const NativePath& npath)
|
||||
{
|
||||
return npath;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
static inline std::string StringFromNativePath(const NativePath& npath)
|
||||
{
|
||||
std::string string(npath.length(), '\0');
|
||||
for(size_t i = 0; i < npath.length(); i++)
|
||||
{
|
||||
debug_assert(npath[i] <= UCHAR_MAX);
|
||||
string[i] = npath[i];
|
||||
}
|
||||
return string;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif // #ifndef INCLUDED_NATIVE_PATH
|
||||
|
@ -1,40 +1,40 @@
|
||||
#ifndef INCLUDED_PCH_BOOST
|
||||
#define INCLUDED_PCH_BOOST
|
||||
|
||||
#include "lib/external_libraries/suppress_boost_warnings.h"
|
||||
|
||||
#if MSC_VERSION >= 1600
|
||||
# define BOOST_HAS_STDINT_H
|
||||
#endif
|
||||
|
||||
// Boost
|
||||
// .. if this package isn't going to be statically linked, we're better off
|
||||
// using Boost via DLL. (otherwise, we would have to ensure the exact same
|
||||
// compiler is used, which is a pain because MSC8, MSC9 and ICC 10 are in use)
|
||||
#ifndef LIB_STATIC_LINK
|
||||
# define BOOST_ALL_DYN_LINK
|
||||
#endif
|
||||
|
||||
// the following boost libraries have been included in TR1 and are
|
||||
// thus deemed usable:
|
||||
#define BOOST_FILESYSTEM_VERSION 2
|
||||
#include <boost/filesystem.hpp>
|
||||
namespace fs = boost::filesystem;
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
// (these ones are used more rarely, so we don't enable them in minimal configurations)
|
||||
#if !MINIMAL_PCH
|
||||
#include <boost/array.hpp>
|
||||
using boost::array;
|
||||
|
||||
#include <boost/mem_fn.hpp>
|
||||
using boost::mem_fn;
|
||||
|
||||
#include <boost/function.hpp>
|
||||
using boost::function;
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
using boost::bind;
|
||||
#endif // !MINIMAL_PCH
|
||||
|
||||
#endif // #ifndef INCLUDED_PCH_BOOST
|
||||
#ifndef INCLUDED_PCH_BOOST
|
||||
#define INCLUDED_PCH_BOOST
|
||||
|
||||
#include "lib/external_libraries/suppress_boost_warnings.h"
|
||||
|
||||
#if MSC_VERSION >= 1600
|
||||
# define BOOST_HAS_STDINT_H
|
||||
#endif
|
||||
|
||||
// Boost
|
||||
// .. if this package isn't going to be statically linked, we're better off
|
||||
// using Boost via DLL. (otherwise, we would have to ensure the exact same
|
||||
// compiler is used, which is a pain because MSC8, MSC9 and ICC 10 are in use)
|
||||
#ifndef LIB_STATIC_LINK
|
||||
# define BOOST_ALL_DYN_LINK
|
||||
#endif
|
||||
|
||||
// the following boost libraries have been included in TR1 and are
|
||||
// thus deemed usable:
|
||||
#define BOOST_FILESYSTEM_VERSION 2
|
||||
#include <boost/filesystem.hpp>
|
||||
namespace fs = boost::filesystem;
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
// (these ones are used more rarely, so we don't enable them in minimal configurations)
|
||||
#if !MINIMAL_PCH
|
||||
#include <boost/array.hpp>
|
||||
using boost::array;
|
||||
|
||||
#include <boost/mem_fn.hpp>
|
||||
using boost::mem_fn;
|
||||
|
||||
#include <boost/function.hpp>
|
||||
using boost::function;
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
using boost::bind;
|
||||
#endif // !MINIMAL_PCH
|
||||
|
||||
#endif // #ifndef INCLUDED_PCH_BOOST
|
||||
|
@ -1,85 +1,85 @@
|
||||
#ifndef INCLUDED_PCH_STDLIB
|
||||
#define INCLUDED_PCH_STDLIB
|
||||
|
||||
#if !MINIMAL_PCH
|
||||
// all new-form C library headers
|
||||
#include <cassert>
|
||||
#include <cctype>
|
||||
#include <cerrno>
|
||||
#include <cfloat>
|
||||
//#include <ciso646> // defines e.g. "and" to "&". unnecessary and causes trouble with asm.
|
||||
#include <climits>
|
||||
#include <clocale>
|
||||
#include <cmath>
|
||||
//#include <csetjmp> // incompatible with libpng on Debian/Ubuntu
|
||||
#include <csignal>
|
||||
#include <cstdarg>
|
||||
#include <cstddef>
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <ctime>
|
||||
#include <cwchar>
|
||||
#include <cwctype>
|
||||
#endif // !MINIMAL_PCH
|
||||
|
||||
#if MINIMAL_PCH < 2
|
||||
// common C++98 STL headers
|
||||
#include <algorithm>
|
||||
#include <vector>
|
||||
#endif
|
||||
|
||||
#if MINIMAL_PCH < 3
|
||||
// all other C++98 STL headers
|
||||
#include <deque>
|
||||
#include <functional>
|
||||
#include <iterator>
|
||||
#include <list>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <numeric>
|
||||
#include <queue>
|
||||
#include <set>
|
||||
#include <stack>
|
||||
#include <utility>
|
||||
#endif
|
||||
|
||||
#if !MINIMAL_PCH
|
||||
// all other C++98 headers
|
||||
#include <bitset>
|
||||
#include <complex>
|
||||
#include <exception>
|
||||
#include <fstream>
|
||||
#include <iomanip>
|
||||
#include <ios>
|
||||
#include <iosfwd>
|
||||
#include <iostream>
|
||||
#include <istream>
|
||||
#include <limits>
|
||||
#include <locale>
|
||||
#include <new>
|
||||
#include <ostream>
|
||||
#include <sstream>
|
||||
#include <stdexcept>
|
||||
#include <streambuf>
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include <typeinfo>
|
||||
#include <valarray>
|
||||
#endif // !MINIMAL_PCH
|
||||
|
||||
#if !MINIMAL_PCH
|
||||
// STL extensions
|
||||
#if GCC_VERSION >= 402 // (see comment in stl.h about GCC versions)
|
||||
# include <tr1/unordered_map>
|
||||
# include <tr1/unordered_set>
|
||||
#elif GCC_VERSION
|
||||
# include <ext/hash_map>
|
||||
# include <ext/hash_set>
|
||||
#else
|
||||
# include <hash_map>
|
||||
# include <hash_set>
|
||||
#endif
|
||||
#endif // !MINIMAL_PCH
|
||||
|
||||
#endif // #ifndef INCLUDED_PCH_STDLIB
|
||||
#ifndef INCLUDED_PCH_STDLIB
|
||||
#define INCLUDED_PCH_STDLIB
|
||||
|
||||
#if !MINIMAL_PCH
|
||||
// all new-form C library headers
|
||||
#include <cassert>
|
||||
#include <cctype>
|
||||
#include <cerrno>
|
||||
#include <cfloat>
|
||||
//#include <ciso646> // defines e.g. "and" to "&". unnecessary and causes trouble with asm.
|
||||
#include <climits>
|
||||
#include <clocale>
|
||||
#include <cmath>
|
||||
//#include <csetjmp> // incompatible with libpng on Debian/Ubuntu
|
||||
#include <csignal>
|
||||
#include <cstdarg>
|
||||
#include <cstddef>
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <ctime>
|
||||
#include <cwchar>
|
||||
#include <cwctype>
|
||||
#endif // !MINIMAL_PCH
|
||||
|
||||
#if MINIMAL_PCH < 2
|
||||
// common C++98 STL headers
|
||||
#include <algorithm>
|
||||
#include <vector>
|
||||
#endif
|
||||
|
||||
#if MINIMAL_PCH < 3
|
||||
// all other C++98 STL headers
|
||||
#include <deque>
|
||||
#include <functional>
|
||||
#include <iterator>
|
||||
#include <list>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <numeric>
|
||||
#include <queue>
|
||||
#include <set>
|
||||
#include <stack>
|
||||
#include <utility>
|
||||
#endif
|
||||
|
||||
#if !MINIMAL_PCH
|
||||
// all other C++98 headers
|
||||
#include <bitset>
|
||||
#include <complex>
|
||||
#include <exception>
|
||||
#include <fstream>
|
||||
#include <iomanip>
|
||||
#include <ios>
|
||||
#include <iosfwd>
|
||||
#include <iostream>
|
||||
#include <istream>
|
||||
#include <limits>
|
||||
#include <locale>
|
||||
#include <new>
|
||||
#include <ostream>
|
||||
#include <sstream>
|
||||
#include <stdexcept>
|
||||
#include <streambuf>
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include <typeinfo>
|
||||
#include <valarray>
|
||||
#endif // !MINIMAL_PCH
|
||||
|
||||
#if !MINIMAL_PCH
|
||||
// STL extensions
|
||||
#if GCC_VERSION >= 402 // (see comment in stl.h about GCC versions)
|
||||
# include <tr1/unordered_map>
|
||||
# include <tr1/unordered_set>
|
||||
#elif GCC_VERSION
|
||||
# include <ext/hash_map>
|
||||
# include <ext/hash_set>
|
||||
#else
|
||||
# include <hash_map>
|
||||
# include <hash_set>
|
||||
#endif
|
||||
#endif // !MINIMAL_PCH
|
||||
|
||||
#endif // #ifndef INCLUDED_PCH_STDLIB
|
||||
|
@ -1,54 +1,54 @@
|
||||
#ifndef INCLUDED_PCH_WARNINGS
|
||||
#define INCLUDED_PCH_WARNINGS
|
||||
|
||||
#include "lib/sysdep/compiler.h" // MSC_VERSION
|
||||
|
||||
#if MSC_VERSION
|
||||
// .. unimportant but not entirely senseless W4
|
||||
# pragma warning(disable:4201) // nameless struct (Matrix3D)
|
||||
# pragma warning(disable:4244) // conversion from uintN to uint8
|
||||
// .. always disabled W4
|
||||
# pragma warning(disable:4103) // alignment changed after including header (boost has #pragma pack/pop in separate headers)
|
||||
# pragma warning(disable:4127) // conditional expression is constant; rationale: see STMT in lib.h.
|
||||
# pragma warning(disable:4351) // yes, default init of array entries is desired
|
||||
# pragma warning(disable:4355) // 'this' used in base member initializer list
|
||||
# pragma warning(disable:4718) // recursive call has no side effects, deleting
|
||||
# pragma warning(disable:4786) // identifier truncated to 255 chars
|
||||
# pragma warning(disable:4996) // function is deprecated
|
||||
// .. VS2005 code analysis (very frequent ones)
|
||||
# if MSC_VERSION >= 1400
|
||||
# pragma warning(disable:6011) // dereferencing NULL pointer
|
||||
# pragma warning(disable:6246) // local declaration hides declaration of the same name in outer scope
|
||||
# endif
|
||||
// .. Intel-specific
|
||||
# if ICC_VERSION
|
||||
# pragma warning(disable:383) // value copied to temporary, reference to temporary used
|
||||
# pragma warning(disable:981) // operands are evaluated in unspecified order
|
||||
# pragma warning(disable:1418) // external function definition with no prior declaration (raised for all non-static function templates)
|
||||
# pragma warning(disable:1572) // floating-point equality and inequality comparisons are unreliable
|
||||
# pragma warning(disable:1684) // conversion from pointer to same-sized integral type
|
||||
# pragma warning(disable:1786) // function is deprecated (disabling 4996 isn't sufficient)
|
||||
# pragma warning(disable:2415) // variable of static storage duration was declared but never referenced (raised by Boost)
|
||||
# endif
|
||||
// .. disabled by default in W4, ENABLE them
|
||||
# pragma warning(default:4062) // enumerator is not handled
|
||||
# pragma warning(default:4254) // [bit field] conversion, possible loss of data
|
||||
# pragma warning(default:4265) // class has virtual functions, but destructor is not virtual
|
||||
# pragma warning(default:4296) // [unsigned comparison vs. 0 =>] expression is always false
|
||||
# pragma warning(default:4545 4546 4547 4549) // ill-formed comma expressions; exclude 4548 since _SECURE_SCL triggers it frequently
|
||||
# pragma warning(default:4557) // __assume contains effect
|
||||
# pragma warning(default:4710) // function not inlined
|
||||
# pragma warning(default:4836) // local types or unnamed types cannot be used as template arguments
|
||||
# pragma warning(default:4905) // wide string literal cast to LPSTR
|
||||
# pragma warning(default:4906) // string literal cast to LPWSTR
|
||||
# pragma warning(default:4928) // illegal copy-initialization; more than one user-defined conversion has been implicitly applied
|
||||
# pragma warning(default:4946) // reinterpret_cast used between related classes
|
||||
// .. disabled by default in W4, leave them that way
|
||||
//# pragma warning(default:4191) // unsafe conversion (false alarms for function pointers)
|
||||
//# pragma warning(default:4263) // member function does not override any base class virtual member function (happens in GUI)
|
||||
//# pragma warning(default:4555) // expression has no effect (triggered by STL unused)
|
||||
//# pragma warning(default:4619) // #pragma warning: there is no [such] warning number (false alarms in STL)
|
||||
//# pragma warning(default:4668) // not defined as a preprocessor macro, replacing with '0' (frequent in Windows)
|
||||
#endif
|
||||
|
||||
#endif // #ifndef INCLUDED_PCH_WARNINGS
|
||||
#ifndef INCLUDED_PCH_WARNINGS
|
||||
#define INCLUDED_PCH_WARNINGS
|
||||
|
||||
#include "lib/sysdep/compiler.h" // MSC_VERSION
|
||||
|
||||
#if MSC_VERSION
|
||||
// .. unimportant but not entirely senseless W4
|
||||
# pragma warning(disable:4201) // nameless struct (Matrix3D)
|
||||
# pragma warning(disable:4244) // conversion from uintN to uint8
|
||||
// .. always disabled W4
|
||||
# pragma warning(disable:4103) // alignment changed after including header (boost has #pragma pack/pop in separate headers)
|
||||
# pragma warning(disable:4127) // conditional expression is constant; rationale: see STMT in lib.h.
|
||||
# pragma warning(disable:4351) // yes, default init of array entries is desired
|
||||
# pragma warning(disable:4355) // 'this' used in base member initializer list
|
||||
# pragma warning(disable:4718) // recursive call has no side effects, deleting
|
||||
# pragma warning(disable:4786) // identifier truncated to 255 chars
|
||||
# pragma warning(disable:4996) // function is deprecated
|
||||
// .. VS2005 code analysis (very frequent ones)
|
||||
# if MSC_VERSION >= 1400
|
||||
# pragma warning(disable:6011) // dereferencing NULL pointer
|
||||
# pragma warning(disable:6246) // local declaration hides declaration of the same name in outer scope
|
||||
# endif
|
||||
// .. Intel-specific
|
||||
# if ICC_VERSION
|
||||
# pragma warning(disable:383) // value copied to temporary, reference to temporary used
|
||||
# pragma warning(disable:981) // operands are evaluated in unspecified order
|
||||
# pragma warning(disable:1418) // external function definition with no prior declaration (raised for all non-static function templates)
|
||||
# pragma warning(disable:1572) // floating-point equality and inequality comparisons are unreliable
|
||||
# pragma warning(disable:1684) // conversion from pointer to same-sized integral type
|
||||
# pragma warning(disable:1786) // function is deprecated (disabling 4996 isn't sufficient)
|
||||
# pragma warning(disable:2415) // variable of static storage duration was declared but never referenced (raised by Boost)
|
||||
# endif
|
||||
// .. disabled by default in W4, ENABLE them
|
||||
# pragma warning(default:4062) // enumerator is not handled
|
||||
# pragma warning(default:4254) // [bit field] conversion, possible loss of data
|
||||
# pragma warning(default:4265) // class has virtual functions, but destructor is not virtual
|
||||
# pragma warning(default:4296) // [unsigned comparison vs. 0 =>] expression is always false
|
||||
# pragma warning(default:4545 4546 4547 4549) // ill-formed comma expressions; exclude 4548 since _SECURE_SCL triggers it frequently
|
||||
# pragma warning(default:4557) // __assume contains effect
|
||||
# pragma warning(default:4710) // function not inlined
|
||||
# pragma warning(default:4836) // local types or unnamed types cannot be used as template arguments
|
||||
# pragma warning(default:4905) // wide string literal cast to LPSTR
|
||||
# pragma warning(default:4906) // string literal cast to LPWSTR
|
||||
# pragma warning(default:4928) // illegal copy-initialization; more than one user-defined conversion has been implicitly applied
|
||||
# pragma warning(default:4946) // reinterpret_cast used between related classes
|
||||
// .. disabled by default in W4, leave them that way
|
||||
//# pragma warning(default:4191) // unsafe conversion (false alarms for function pointers)
|
||||
//# pragma warning(default:4263) // member function does not override any base class virtual member function (happens in GUI)
|
||||
//# pragma warning(default:4555) // expression has no effect (triggered by STL unused)
|
||||
//# pragma warning(default:4619) // #pragma warning: there is no [such] warning number (false alarms in STL)
|
||||
//# pragma warning(default:4668) // not defined as a preprocessor macro, replacing with '0' (frequent in Windows)
|
||||
#endif
|
||||
|
||||
#endif // #ifndef INCLUDED_PCH_WARNINGS
|
||||
|
Loading…
Reference in New Issue
Block a user