fixes/improvements from work
- improved form of noncopyable that avoids inheritance warnings - PCH updates to allow more restrictive MINIMAL_PCH sound/SoundGroup.cpp: fix copy-paste error This was SVN commit r7498.
This commit is contained in:
parent
f33706bf8b
commit
ef602c3dfd
@ -105,7 +105,7 @@ public:
|
||||
}
|
||||
|
||||
// allocate uninitialized storage
|
||||
pointer allocate(size_type numElements, const void* hint = 0)
|
||||
pointer allocate(size_type numElements)
|
||||
{
|
||||
const size_type alignment = x86_x64_L1CacheLineSize();
|
||||
const size_type elementSize = round_up(sizeof(T), alignment);
|
||||
@ -115,7 +115,7 @@ public:
|
||||
}
|
||||
|
||||
// deallocate storage of elements that have been destroyed
|
||||
void deallocate(pointer p, size_type num)
|
||||
void deallocate(pointer p, size_type UNUSED(num))
|
||||
{
|
||||
rtl_FreeAligned((void*)p);
|
||||
}
|
||||
|
@ -153,27 +153,15 @@ template<> struct static_assert_<true>
|
||||
**/
|
||||
#define cassert2(expr) extern u8 CASSERT_FAILURE[1][(expr)]
|
||||
|
||||
|
||||
// copied from boost::noncopyable; this definition avoids warnings when
|
||||
// an exported class derives from noncopyable.
|
||||
|
||||
namespace noncopyable_ // protection from unintended ADL
|
||||
{
|
||||
class noncopyable
|
||||
{
|
||||
protected:
|
||||
noncopyable() {}
|
||||
~noncopyable() {}
|
||||
private: // emphasize the following members are private
|
||||
noncopyable(const noncopyable&);
|
||||
const noncopyable& operator=(const noncopyable&);
|
||||
};
|
||||
}
|
||||
|
||||
typedef noncopyable_::noncopyable noncopyable;
|
||||
|
||||
// this form avoids ICC 11 W4 warnings about non-virtual dtors and
|
||||
// suppression of the copy assignment operator.
|
||||
// indicate a class is noncopyable (usually due to const or reference members).
|
||||
// example:
|
||||
// class C {
|
||||
// NONCOPYABLE(C);
|
||||
// public: // etc.
|
||||
// };
|
||||
// this is preferable to inheritance from boost::noncopyable because it
|
||||
// avoids ICC 11 W4 warnings about non-virtual dtors and suppression of
|
||||
// the copy assignment operator.
|
||||
#define NONCOPYABLE(className)\
|
||||
private:\
|
||||
className(const className&);\
|
||||
|
@ -28,6 +28,7 @@
|
||||
|
||||
class RealDirectory : public IFileLoader
|
||||
{
|
||||
NONCOPYABLE(RealDirectory);
|
||||
public:
|
||||
RealDirectory(const fs::wpath& path, size_t priority, size_t flags);
|
||||
|
||||
@ -56,9 +57,6 @@ public:
|
||||
void Watch();
|
||||
|
||||
private:
|
||||
RealDirectory(const RealDirectory& rhs); // noncopyable due to const members
|
||||
RealDirectory& operator=(const RealDirectory& rhs);
|
||||
|
||||
// note: paths are relative to the root directory, so storing the
|
||||
// entire path instead of just the portion relative to the mount point
|
||||
// is not all too wasteful.
|
||||
|
@ -60,7 +60,6 @@ scope
|
||||
#ifndef INCLUDED_LIB
|
||||
#define INCLUDED_LIB
|
||||
|
||||
#include <stddef.h>
|
||||
#include <math.h> // fabsf
|
||||
#include <limits> // numeric_limits
|
||||
#include <stdexcept> // out_of_range
|
||||
|
@ -37,6 +37,7 @@
|
||||
# include "lib/sysdep/os/win/wposix/wposix_types.h"
|
||||
#else
|
||||
|
||||
#include <math.h>
|
||||
#include <wchar.h>
|
||||
#include <sys/types.h>
|
||||
#include <stddef.h>
|
||||
|
@ -48,6 +48,7 @@
|
||||
# pragma warning(disable:4201) // nameless struct (Matrix3D)
|
||||
# pragma warning(disable:4244) // conversion from uintN to uint8
|
||||
// .. permanently 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:4996) // function is deprecated
|
||||
# pragma warning(disable:4786) // identifier truncated to 255 chars
|
||||
@ -69,33 +70,26 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if ICC_VERSION
|
||||
#include <mathimf.h> // (must come before <cmath> or <math.h> (replaces them))
|
||||
double __cdecl abs(double x); // not declared by mathimf
|
||||
long double __cdecl abs(long double x); // required for Eigen
|
||||
#endif
|
||||
|
||||
|
||||
//
|
||||
// headers made available everywhere for convenience
|
||||
//
|
||||
|
||||
// (must come before any system headers because it fixes off_t)
|
||||
#include "lib/posix/posix_types.h"
|
||||
|
||||
#include "lib/posix/posix_types.h" // (must come before any system headers because it fixes off_t)
|
||||
#include "lib/code_annotation.h"
|
||||
|
||||
// (must come before any use of <math.h> due to incompatibility with ICC's mathimf.h)
|
||||
#if ICC_VERSION
|
||||
#include <mathimf.h>
|
||||
#endif
|
||||
|
||||
#include "lib/sysdep/arch.h"
|
||||
|
||||
#include "lib/sysdep/stl.h"
|
||||
#include "lib/lib_api.h"
|
||||
#include "lib/types.h"
|
||||
|
||||
#if !MINIMAL_PCH
|
||||
#include "lib/sysdep/stl.h"
|
||||
#include "lib/lib.h"
|
||||
#include "lib/lib_errors.h"
|
||||
#include "lib/secure_crt.h"
|
||||
#include "lib/debug.h"
|
||||
#endif // !MINIMAL_PCH
|
||||
|
||||
// Boost
|
||||
// .. if this package isn't going to be statically linked, we're better off
|
||||
@ -105,10 +99,9 @@
|
||||
# define BOOST_ALL_DYN_LINK
|
||||
#endif
|
||||
|
||||
// work around Boost bug (missing #pragma pack(pop)?)
|
||||
#pragma pack(push, lib_precompiled)
|
||||
// the following boost libraries have been included in TR1 and are
|
||||
// thus deemed usable:
|
||||
#include "lib/external_libraries/boost_filesystem.h"
|
||||
#include <boost/shared_ptr.hpp>
|
||||
using boost::shared_ptr;
|
||||
#if !MINIMAL_PCH
|
||||
@ -121,12 +114,9 @@ using boost::mem_fn;
|
||||
using boost::function;
|
||||
#include <boost/bind.hpp>
|
||||
using boost::bind;
|
||||
#include "lib/external_libraries/boost_filesystem.h"
|
||||
#endif // !MINIMAL_PCH
|
||||
#pragma pack(pop, lib_precompiled)
|
||||
|
||||
// (this must come after boost and common lib headers)
|
||||
#include "lib/posix/posix.h"
|
||||
#include "lib/posix/posix.h" // (must come after boost and common lib headers)
|
||||
|
||||
|
||||
//
|
||||
@ -170,8 +160,13 @@ using boost::bind;
|
||||
#endif // !MINIMAL_PCH
|
||||
|
||||
#if MINIMAL_PCH < 2
|
||||
// all C++98 STL headers
|
||||
// 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>
|
||||
@ -183,7 +178,6 @@ using boost::bind;
|
||||
#include <set>
|
||||
#include <stack>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
#endif
|
||||
|
||||
#if !MINIMAL_PCH
|
||||
|
@ -29,6 +29,8 @@
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "lib/lib_errors.h"
|
||||
|
||||
namespace ERR
|
||||
{
|
||||
const LibError STRING_NOT_TERMINATED = -100600;
|
||||
|
@ -27,6 +27,8 @@
|
||||
#ifndef INCLUDED_WMI
|
||||
#define INCLUDED_WMI
|
||||
|
||||
#include <map>
|
||||
|
||||
// note: we expose the VARIANT value as returned by WMI. this allows other
|
||||
// modules to use the values they want directly, rather than forcing
|
||||
// everything to be converted to/parsed from strings. it does drag in
|
||||
|
@ -27,6 +27,8 @@
|
||||
#include "precompiled.h"
|
||||
#include "lib/sysdep/os/win/wposix/waio.h"
|
||||
|
||||
#include <map>
|
||||
|
||||
#include "lib/sysdep/os/win/wposix/crt_posix.h" // correct definitions of _open() etc.
|
||||
|
||||
#include "lib/sysdep/os/win/wposix/wposix_internal.h"
|
||||
|
@ -152,8 +152,9 @@ void CSoundGroup::PlayNext(const CVector3D& position)
|
||||
// (note: previously snd_group[m_index] was used in place of hs)
|
||||
const VfsPath pathname(m_filepath/filenames[m_index]);
|
||||
Handle hs = snd_open(pathname);
|
||||
if(hs < 0)
|
||||
{
|
||||
HandleError(L"PlayNext: snd_open failed", pathname, (LibError)m_hReplacement);
|
||||
HandleError(L"PlayNext: snd_open failed", pathname, (LibError)hs);
|
||||
return;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user