diff --git a/hphp/runtime/base/comparisons.h b/hphp/runtime/base/comparisons.h index 3be48bdec..d9da3df14 100644 --- a/hphp/runtime/base/comparisons.h +++ b/hphp/runtime/base/comparisons.h @@ -89,10 +89,10 @@ inline bool more(CVarRef v1, CVarRef v2) { return v1.more(v2);} /////////////////////////////////////////////////////////////////////////////// // bool -inline bool same(bool v1, bool v2) { return v1 == v2;} -inline bool same(bool v1, int v2) { return false;} -inline bool same(bool v1, int64_t v2) { return false;} -inline bool same(bool v1, double v2) { return false;} +inline bool same(bool v1, bool v2) = delete; +inline bool same(bool v1, int v2) = delete; +inline bool same(bool v1, int64_t v2) = delete; +inline bool same(bool v1, double v2) = delete; inline bool same(bool v1, const StringData *v2) { return false;} inline bool same(bool v1, CStrRef v2) { return false;} inline bool same(bool v1, litstr v2) { return false;} @@ -154,10 +154,10 @@ inline bool more(bool v1, CVarRef v2) { return less(v2,v1);} /////////////////////////////////////////////////////////////////////////////// // int -inline bool same(int v1, bool v2) { return same(v2, v1);} -inline bool same(int v1, int v2) { return v1 == v2;} -inline bool same(int v1, int64_t v2) { return v1 == v2;} -inline bool same(int v1, double v2) { return (double)v1 == v2;} +inline bool same(int v1, bool v2) = delete; +inline bool same(int v1, int v2) = delete; +inline bool same(int v1, int64_t v2) = delete; +inline bool same(int v1, double v2) = delete; inline bool same(int v1, const StringData *v2) { return false;} inline bool same(int v1, CStrRef v2) { return false;} inline bool same(int v1, litstr v2) { return false;} @@ -220,10 +220,10 @@ inline bool more(int v1, CVarRef v2) { return less(v2, v1);} /////////////////////////////////////////////////////////////////////////////// // int64 -inline bool same(int64_t v1, bool v2) { return same(v2, v1);} -inline bool same(int64_t v1, int v2) { return same(v2, v1);} -inline bool same(int64_t v1, int64_t v2) { return v1 == v2;} -inline bool same(int64_t v1, double v2) { return (double)v1 == v2;} +inline bool same(int64_t v1, bool v2) = delete; +inline bool same(int64_t v1, int v2) = delete; +inline bool same(int64_t v1, int64_t v2) = delete; +inline bool same(int64_t v1, double v2) = delete; inline bool same(int64_t v1, const StringData *v2) { return false;} inline bool same(int64_t v1, CStrRef v2) { return false;} inline bool same(int64_t v1, litstr v2) { return false;} @@ -289,10 +289,10 @@ inline bool more(int64_t v1, CVarRef v2) { return less(v2, v1);} /////////////////////////////////////////////////////////////////////////////// // double -inline bool same(double v1, bool v2) { return same(v2, v1);} -inline bool same(double v1, int v2) { return same(v2, v1);} -inline bool same(double v1, int64_t v2) { return same(v2, v1);} -inline bool same(double v1, double v2) { return v1 == v2;} +inline bool same(double v1, bool v2) = delete; +inline bool same(double v1, int v2) = delete; +inline bool same(double v1, int64_t v2) = delete; +inline bool same(double v1, double v2) = delete; inline bool same(double v1, const StringData *v2) { return false;} inline bool same(double v1, CStrRef v2) { return false;} inline bool same(double v1, litstr v2) { return false;} diff --git a/hphp/runtime/ext/ext_imagesprite.cpp b/hphp/runtime/ext/ext_imagesprite.cpp index 00d6e9b16..46b825a0d 100644 --- a/hphp/runtime/ext/ext_imagesprite.cpp +++ b/hphp/runtime/ext/ext_imagesprite.cpp @@ -546,7 +546,7 @@ Object c_ImageSprite::t_clear(CVarRef files /* = null */) { } Object c_ImageSprite::t_loaddims(bool block /* = false */) { - if (same(m_current, true)) { + if (m_current) { return this; } @@ -574,7 +574,7 @@ Object c_ImageSprite::t_loaddims(bool block /* = false */) { } Object c_ImageSprite::t_loadimages(bool block /* = false */) { - if (same(m_current, true)) { + if (m_current) { return this; } @@ -613,14 +613,14 @@ Object c_ImageSprite::t_loadimages(bool block /* = false */) { std::vector, \ ImageSprite::BlockAreaComparator> -static const StaticString +const StaticString s_x("x"), s_y("y"), s_images("images"), s_sprite("sprite"); void c_ImageSprite::map() { - if (same(m_current, true)) { + if (m_current) { return; } diff --git a/hphp/test/ext/test_ext_network.cpp b/hphp/test/ext/test_ext_network.cpp index bb9030bc7..645ad4a7c 100644 --- a/hphp/test/ext/test_ext_network.cpp +++ b/hphp/test/ext/test_ext_network.cpp @@ -179,7 +179,7 @@ bool TestExtNetwork::test_fsockopen() { "Connection: Close\r\n" "\r\n"); StringBuffer response; - while (!same(f_feof(f), true)) { + while (!f_feof(f)) { Variant line = f_fgets(f, 128); response.append(line.toString()); } diff --git a/hphp/test/ext/test_ext_socket.cpp b/hphp/test/ext/test_ext_socket.cpp index 32249ddb8..cc89273e7 100644 --- a/hphp/test/ext/test_ext_socket.cpp +++ b/hphp/test/ext/test_ext_socket.cpp @@ -299,7 +299,7 @@ bool TestExtSocket::test_socket_close() { bool TestExtSocket::test_socket_strerror() { Variant s = f_socket_create(k_AF_INET, k_SOCK_STREAM, k_SOL_TCP); f_socket_bind(s, "127.0.0.1", 80); - if (same(f_socket_last_error(s), 13)) { + if (f_socket_last_error(s) == 13) { VS(f_socket_strerror(13), "Permission denied"); f_socket_clear_error(s); }