Use int64_t rather than long long as the integer type in the accessor

implementation.

This matches what core uses for integers, and avoids ambiguity that
otherwise results when `int64_t` is declared as `long` rather than `long long`.
This commit is contained in:
Mark Rowe 2017-05-22 20:17:35 -07:00
parent 75f8b28831
commit b108d06231

View File

@ -73,7 +73,7 @@ public:
T unbox(ValueType value, bool create = false, bool update = false); T unbox(ValueType value, bool create = false, bool update = false);
ValueType box(bool boolean) { return Value::from_boolean(m_ctx, boolean); } ValueType box(bool boolean) { return Value::from_boolean(m_ctx, boolean); }
ValueType box(long long number) { return Value::from_number(m_ctx, number); } ValueType box(int64_t number) { return Value::from_number(m_ctx, number); }
ValueType box(float number) { return Value::from_number(m_ctx, number); } ValueType box(float number) { return Value::from_number(m_ctx, number); }
ValueType box(double number) { return Value::from_number(m_ctx, number); } ValueType box(double number) { return Value::from_number(m_ctx, number); }
ValueType box(StringData string) { return Value::from_string(m_ctx, string.data()); } ValueType box(StringData string) { return Value::from_string(m_ctx, string.data()); }
@ -134,8 +134,8 @@ struct Unbox<JSEngine, bool> {
}; };
template<typename JSEngine> template<typename JSEngine>
struct Unbox<JSEngine, long long> { struct Unbox<JSEngine, int64_t> {
static long long call(NativeAccessor<JSEngine> *ctx, typename JSEngine::Value const& value, bool, bool) { static int64_t call(NativeAccessor<JSEngine> *ctx, typename JSEngine::Value const& value, bool, bool) {
return js::Value<JSEngine>::validated_to_number(ctx->m_ctx, value, "Property"); return js::Value<JSEngine>::validated_to_number(ctx->m_ctx, value, "Property");
} }
}; };
@ -162,8 +162,8 @@ struct Unbox<JSEngine, util::Optional<bool>> {
}; };
template<typename JSEngine> template<typename JSEngine>
struct Unbox<JSEngine, util::Optional<long long>> { struct Unbox<JSEngine, util::Optional<int64_t>> {
static util::Optional<long long> call(NativeAccessor<JSEngine> *ctx, typename JSEngine::Value const& value, bool, bool) { static util::Optional<int64_t> call(NativeAccessor<JSEngine> *ctx, typename JSEngine::Value const& value, bool, bool) {
return js::Value<JSEngine>::validated_to_number(ctx->m_ctx, value, "Property"); return js::Value<JSEngine>::validated_to_number(ctx->m_ctx, value, "Property");
} }
}; };