diff --git a/hphp/runtime/base/type_array.cpp b/hphp/runtime/base/type_array.cpp index 6c20d4be6..4ac64f3ce 100644 --- a/hphp/runtime/base/type_array.cpp +++ b/hphp/runtime/base/type_array.cpp @@ -298,13 +298,6 @@ Array Array::slice(int offset, int length, bool preserve_keys) const { return ArrayUtil::Slice(m_px, offset, length, preserve_keys); } -/////////////////////////////////////////////////////////////////////////////// -// type conversions - -Object Array::toObject() const { - return HPHP::toObject(m_px); -} - /////////////////////////////////////////////////////////////////////////////// // comparisons diff --git a/hphp/runtime/base/type_array.h b/hphp/runtime/base/type_array.h index cec27e3dc..f4090da68 100644 --- a/hphp/runtime/base/type_array.h +++ b/hphp/runtime/base/type_array.h @@ -243,7 +243,6 @@ class Array : protected SmartPtr { int64_t toInt64 () const { return (m_px && !m_px->empty()) ? 1 : 0;} double toDouble () const { return (m_px && !m_px->empty()) ? 1.0 : 0.0;} String toString () const { return m_px ? "Array" : "";} - Object toObject () const; /** * Comparisons diff --git a/hphp/runtime/base/type_conversions.cpp b/hphp/runtime/base/type_conversions.cpp deleted file mode 100644 index 3dfa32e12..000000000 --- a/hphp/runtime/base/type_conversions.cpp +++ /dev/null @@ -1,34 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | HipHop for PHP | - +----------------------------------------------------------------------+ - | Copyright (c) 2010-2013 Facebook, Inc. (http://www.facebook.com) | - +----------------------------------------------------------------------+ - | This source file is subject to version 3.01 of the PHP license, | - | that is bundled with this package in the file LICENSE, and is | - | available through the world-wide-web at the following url: | - | http://www.php.net/license/3_01.txt | - | If you did not receive a copy of the PHP license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@php.net so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ -*/ - -#include "hphp/runtime/base/types.h" -#include "hphp/runtime/base/complex_types.h" -#include "hphp/runtime/base/type_conversions.h" - -#include "hphp/system/lib/systemlib.h" - -namespace HPHP { -/////////////////////////////////////////////////////////////////////////////// -Object toObject(ArrayData *v) { - return v ? v->toObject() : Object(SystemLib::AllocStdClassObject()); -} - -Object toObject(ObjectData *v) { - return v ? v : SystemLib::AllocStdClassObject(); -} - -/////////////////////////////////////////////////////////////////////////////// -} diff --git a/hphp/runtime/base/type_conversions.h b/hphp/runtime/base/type_conversions.h index 84732028c..00d192bf6 100644 --- a/hphp/runtime/base/type_conversions.h +++ b/hphp/runtime/base/type_conversions.h @@ -45,36 +45,6 @@ inline bool toBoolean(const ObjectData *v) { inline bool toBoolean(CObjRef v) { return toBoolean(v.get());} inline bool toBoolean(CVarRef v) { return v.toBoolean();} -inline char toByte(bool v) { return v ? 1 : 0;} -inline char toByte(char v) { return v;} -inline char toByte(short v) { return v;} -inline char toByte(int v) { return v;} -inline char toByte(int64_t v) { return v;} -inline char toByte(double v) { return (char)v;} -inline char toByte(litstr v) = delete; -inline char toByte(const StringData *v) { return v ? v->toByte() : 0;} -inline char toByte(CStrRef v) { return toByte(v.get());} -inline char toByte(const ArrayData *v) { return (v && !v->empty()) ? 1 : 0;} -inline char toByte(CArrRef v) { return toByte(v.get());} -inline char toByte(const ObjectData *v) { return v ? v->o_toInt64() : 0;} -inline char toByte(CObjRef v) { return toByte(v.get());} -inline char toByte(CVarRef v) { return v.toByte();} - -inline short toInt16(bool v) { return v ? 1 : 0;} -inline short toInt16(char v) { return v;} -inline short toInt16(short v) { return v;} -inline short toInt16(int v) { return v;} -inline short toInt16(int64_t v) { return v;} -inline short toInt16(double v) { return (short)v;} -inline short toInt16(litstr v) = delete; -inline short toInt16(const StringData *v) { return v ? v->toInt16() : 0;} -inline short toInt16(CStrRef v) { return toInt16(v.get());} -inline short toInt16(const ArrayData *v) { return (v && !v->empty()) ? 1 : 0;} -inline short toInt16(CArrRef v) { return toInt16(v.get());} -inline short toInt16(const ObjectData *v) { return v ? v->o_toInt64() : 0;} -inline short toInt16(CObjRef v) { return toInt16(v.get());} -inline short toInt16(CVarRef v) { return v.toInt16();} - inline int toInt32(bool v) { return v ? 1 : 0;} inline int toInt32(char v) { return v;} inline int toInt32(short v) { return v;} @@ -165,25 +135,6 @@ inline Array toArray(const ObjectData *v) { inline Array toArray(CObjRef v) { return toArray(v.get());} inline Array toArray(CVarRef v) { return v.toArray();} -inline Object toObject(bool v) { return Variant(v).toObject();} -inline Object toObject(char v) { return Variant(v).toObject();} -inline Object toObject(short v) { return Variant(v).toObject();} -inline Object toObject(int v) { return Variant(v).toObject();} -inline Object toObject(int64_t v) { return Variant(v).toObject();} -inline Object toObject(double v) { return Variant(v).toObject();} -inline Object toObject(litstr v) = delete; -inline Object toObject(const StringData *v) { return Variant(StrNR(v)).toObject();} -inline Object toObject(CStrRef v) { return Variant(v).toObject();} -Object toObject(ArrayData *v); -inline Object toObject(CArrRef v) { return toObject(v.get());} -Object toObject(ObjectData *v); -inline Object toObject(CObjRef v) { return toObject(v.get());} -inline Object toObject(CVarRef v) { return v.toObject();} - -inline const String *toSPOD(CStrRef v) { return &v;} -inline const Variant *toVPOD(CVarRef v) { return &v;} -inline const Object *toOPOD(CObjRef v) { return &v;} - /////////////////////////////////////////////////////////////////////////////// } diff --git a/hphp/runtime/ext/ext_curl.cpp b/hphp/runtime/ext/ext_curl.cpp index 96989035b..8b2b84a1c 100644 --- a/hphp/runtime/ext/ext_curl.cpp +++ b/hphp/runtime/ext/ext_curl.cpp @@ -1044,7 +1044,7 @@ public: void remove(CurlResource *curle) { for (ArrayIter iter(m_easyh); iter; ++iter) { - if (toObject(iter.second()).getTyped()->get(true) == + if (iter.second().toObject().getTyped()->get(true) == curle->get()) { m_easyh.remove(iter.first()); return; @@ -1054,7 +1054,7 @@ public: Object find(CURL *cp) { for (ArrayIter iter(m_easyh); iter; ++iter) { - if (toObject(iter.second()).getTyped()->get(true) == cp) { + if (iter.second().toObject().getTyped()->get(true) == cp) { return iter.second(); } } diff --git a/hphp/runtime/ext/thrift/binary.cpp b/hphp/runtime/ext/thrift/binary.cpp index 4a0ee2d18..e3779015d 100644 --- a/hphp/runtime/ext/thrift/binary.cpp +++ b/hphp/runtime/ext/thrift/binary.cpp @@ -357,7 +357,7 @@ void binary_serialize(int8_t thrift_typeID, PHPOutputTransport& transport, "type as a T_STRUCT", INVALID_DATA); } binary_serialize_spec(value, transport, - f_hphp_get_static_property(toObject(value)-> + f_hphp_get_static_property(value.toObject()-> o_getClassName(), s_TSPEC).toArray()); } return;