diff --git a/source/lib/lib.h b/source/lib/lib.h index bb5b53f123..69a666580f 100644 --- a/source/lib/lib.h +++ b/source/lib/lib.h @@ -207,7 +207,8 @@ STMT(\ **/ #define NO_COPY_CTOR(class_name)\ private:\ - class_name& operator=(const class_name&) + class_name& operator=(const class_name&);\ + class_name(const class_name&) /** diff --git a/source/lib/res/file/vfs_mount.cpp b/source/lib/res/file/vfs_mount.cpp index 5442b1b795..4e3ee09e9a 100644 --- a/source/lib/res/file/vfs_mount.cpp +++ b/source/lib/res/file/vfs_mount.cpp @@ -353,7 +353,15 @@ struct TDirAndPath TDirAndPath(TDir* d, const char* p) : td(d), path(p) {} - NO_COPY_CTOR(TDirAndPath); + // copy ctor needed for STL + TDirAndPath(const TDirAndPath& rhs) + : td(rhs.td), path(rhs.path) {} + + // can't implement or generate assignment operator because of the + // const member. just disallow its use. + // NB: can't use NO_COPY_CTOR because we need one for STL. +private: + TDirAndPath& operator=(const TDirAndPath& rhs); }; typedef std::deque DirQueue; diff --git a/source/lib/sysdep/sysdep.h b/source/lib/sysdep/sysdep.h index 278effacee..5466d917f1 100644 --- a/source/lib/sysdep/sysdep.h +++ b/source/lib/sysdep/sysdep.h @@ -144,6 +144,13 @@ extern void* alloca(size_t size); # define isinf(d) (fpclassify(d) == FP_NAN|FP_NORMAL) # define isnormal(d) (fpclassify(d) == FP_NORMAL) //# define signbit +#else +// Some systems have C99 support but in C++ they provide only std::isfinite +// and not isfinite. C99 specifies that isfinite is a macro, so define it if +// it doesn't already exist. +# ifndef isfinite +# define isfinite std::isfinite +# endif #endif // C99 restrict diff --git a/source/scripting/JSConversions.cpp b/source/scripting/JSConversions.cpp index ecd03047fa..d2af7d26bd 100644 --- a/source/scripting/JSConversions.cpp +++ b/source/scripting/JSConversions.cpp @@ -151,7 +151,7 @@ template<> jsval ToJSVal( double& Native ) template<> bool ToPrimitive( JSContext* cx, jsval v, double& Storage ) { JSBool ok = JS_ValueToNumber(cx, v, &Storage); - if (ok == JS_FALSE || !std::isfinite( Storage ) ) + if (ok == JS_FALSE || !isfinite( Storage ) ) return false; return true; }