From 8d266d39414c49fa7c95c3faf2fedd7cd291e50d Mon Sep 17 00:00:00 2001 From: Mayukha Vadari Date: Mon, 29 Sep 2025 15:43:10 -0400 Subject: [PATCH] remove STInt64 (#5815) --- include/xrpl/protocol/SField.h | 1 - include/xrpl/protocol/STInteger.h | 1 - include/xrpl/protocol/STObject.h | 4 --- src/libxrpl/protocol/STInteger.cpp | 49 ----------------------------- src/libxrpl/protocol/STObject.cpp | 12 ------- src/libxrpl/protocol/STVar.cpp | 3 -- src/libxrpl/protocol/Serializer.cpp | 6 ---- 7 files changed, 76 deletions(-) diff --git a/include/xrpl/protocol/SField.h b/include/xrpl/protocol/SField.h index b6ae98b48f..e25447c394 100644 --- a/include/xrpl/protocol/SField.h +++ b/include/xrpl/protocol/SField.h @@ -359,7 +359,6 @@ using SF_UINT384 = TypedField>; using SF_UINT512 = TypedField>; using SF_INT32 = TypedField>; -using SF_INT64 = TypedField>; using SF_ACCOUNT = TypedField; using SF_AMOUNT = TypedField; diff --git a/include/xrpl/protocol/STInteger.h b/include/xrpl/protocol/STInteger.h index f86d302348..154ee7f203 100644 --- a/include/xrpl/protocol/STInteger.h +++ b/include/xrpl/protocol/STInteger.h @@ -82,7 +82,6 @@ using STUInt32 = STInteger; using STUInt64 = STInteger; using STInt32 = STInteger; -using STInt64 = STInteger; template inline STInteger::STInteger(Integer v) : value_(v) diff --git a/include/xrpl/protocol/STObject.h b/include/xrpl/protocol/STObject.h index 34f14254f8..1c22b08aba 100644 --- a/include/xrpl/protocol/STObject.h +++ b/include/xrpl/protocol/STObject.h @@ -233,8 +233,6 @@ public: getFieldH256(SField const& field) const; std::int32_t getFieldI32(SField const& field) const; - std::int64_t - getFieldI64(SField const& field) const; AccountID getAccountID(SField const& field) const; @@ -371,8 +369,6 @@ public: void setFieldI32(SField const& field, std::int32_t); void - setFieldI64(SField const& field, std::int64_t); - void setFieldVL(SField const& field, Blob const&); void setFieldVL(SField const& field, Slice const&); diff --git a/src/libxrpl/protocol/STInteger.cpp b/src/libxrpl/protocol/STInteger.cpp index ca2e3b9c98..355fa4c113 100644 --- a/src/libxrpl/protocol/STInteger.cpp +++ b/src/libxrpl/protocol/STInteger.cpp @@ -278,53 +278,4 @@ STInt32::getJson(JsonOptions) const return value_; } -//------------------------------------------------------------------------------ - -template <> -STInteger::STInteger(SerialIter& sit, SField const& name) - : STInteger(name, sit.get64()) -{ -} - -template <> -SerializedTypeID -STInt64::getSType() const -{ - return STI_INT64; -} - -template <> -std::string -STInt64::getText() const -{ - return std::to_string(value_); -} - -template <> -Json::Value -STInt64::getJson(JsonOptions) const -{ - auto convertToString = [](int64_t const value, int const base) { - XRPL_ASSERT( - base == 10 || base == 16, - "ripple::STInt64::getJson : base 10 or 16"); - std::string str( - base == 10 ? 20 : 16, 0); // Allocate space depending on base - auto ret = - std::to_chars(str.data(), str.data() + str.size(), value, base); - XRPL_ASSERT( - ret.ec == std::errc(), - "ripple::STInt64::getJson : to_chars succeeded"); - str.resize(std::distance(str.data(), ret.ptr)); - return str; - }; - - if (auto const& fName = getFName(); fName.shouldMeta(SField::sMD_BaseTen)) - { - return convertToString(value_, 10); // Convert to base 10 - } - - return convertToString(value_, 16); // Convert to base 16 -} - } // namespace ripple diff --git a/src/libxrpl/protocol/STObject.cpp b/src/libxrpl/protocol/STObject.cpp index 384ab52770..77e5fd1ad9 100644 --- a/src/libxrpl/protocol/STObject.cpp +++ b/src/libxrpl/protocol/STObject.cpp @@ -653,12 +653,6 @@ STObject::getFieldI32(SField const& field) const return getFieldByValue(field); } -std::int64_t -STObject::getFieldI64(SField const& field) const -{ - return getFieldByValue(field); -} - AccountID STObject::getAccountID(SField const& field) const { @@ -779,12 +773,6 @@ STObject::setFieldI32(SField const& field, std::int32_t v) setFieldUsingSetValue(field, v); } -void -STObject::setFieldI64(SField const& field, std::int64_t v) -{ - setFieldUsingSetValue(field, v); -} - void STObject::setFieldV256(SField const& field, STVector256 const& v) { diff --git a/src/libxrpl/protocol/STVar.cpp b/src/libxrpl/protocol/STVar.cpp index 72b348091c..c46effb47e 100644 --- a/src/libxrpl/protocol/STVar.cpp +++ b/src/libxrpl/protocol/STVar.cpp @@ -211,9 +211,6 @@ STVar::constructST(SerializedTypeID id, int depth, Args&&... args) case STI_INT32: construct(std::forward(args)...); return; - case STI_INT64: - construct(std::forward(args)...); - return; case STI_VECTOR256: construct(std::forward(args)...); return; diff --git a/src/libxrpl/protocol/Serializer.cpp b/src/libxrpl/protocol/Serializer.cpp index d85f25ec8b..098e68d2b2 100644 --- a/src/libxrpl/protocol/Serializer.cpp +++ b/src/libxrpl/protocol/Serializer.cpp @@ -89,12 +89,6 @@ Serializer::addInteger(std::int32_t i) { return add32(i); } -template <> -int -Serializer::addInteger(std::int64_t i) -{ - return add64(i); -} int Serializer::addRaw(Blob const& vector)