diff options
Diffstat (limited to 'odb/oracle/details')
-rw-r--r-- | odb/oracle/details/number.cxx | 10 | ||||
-rw-r--r-- | odb/oracle/details/number.hxx | 7 |
2 files changed, 11 insertions, 6 deletions
diff --git a/odb/oracle/details/number.cxx b/odb/oracle/details/number.cxx index 044a99b..d328b1f 100644 --- a/odb/oracle/details/number.cxx +++ b/odb/oracle/details/number.cxx @@ -102,7 +102,7 @@ namespace odb } void - int64_to_number (char* b, long long v) + int64_to_number (char* b, size_t& n, long long v) { // We assume that b is long enough to contain a long long VARNUM // representation, that being 12 bytes. @@ -121,8 +121,8 @@ namespace odb } bool sig (false); - size_t n (0); unsigned char t[11], *m (t); + n = 0; if (v < 0) { @@ -169,6 +169,7 @@ namespace odb // Set the length. // ub[0] = static_cast<unsigned char> (m - t + 1); + n = static_cast<size_t> (ub[0] + 1); // Set the significant digits in big-endian byte order and the // terminator, if any. @@ -227,7 +228,7 @@ namespace odb } void - uint64_to_number (char* b, unsigned long long v) + uint64_to_number (char* b, size_t& n, unsigned long long v) { // We assume that b is long enough to contain an unsigned long long // VARNUM representation, that being 12 bytes. @@ -246,8 +247,8 @@ namespace odb } bool sig (false); - size_t n (0); unsigned char t[11], *m (t); + n = 0; while (v != 0) { @@ -268,6 +269,7 @@ namespace odb // Set the length. // ub[0] = static_cast<unsigned char> (m - t + 1); + n = static_cast<size_t> (ub[0] + 1); // Set the significant digits in big-endian byte order. // diff --git a/odb/oracle/details/number.hxx b/odb/oracle/details/number.hxx index fe355da..90fb038 100644 --- a/odb/oracle/details/number.hxx +++ b/odb/oracle/details/number.hxx @@ -7,6 +7,9 @@ #define ODB_ORACLE_NUMBER_HXX #include <odb/pre.hxx> + +#include <cstddef> // std::size_t + #include <odb/oracle/details/export.hxx> namespace odb @@ -27,13 +30,13 @@ namespace odb number_to_int64 (const char* buffer); LIBODB_ORACLE_EXPORT void - int64_to_number (char* buffer, long long value); + int64_to_number (char* buffer, std::size_t& n, long long val); LIBODB_ORACLE_EXPORT unsigned long long number_to_uint64 (const char* buffer); LIBODB_ORACLE_EXPORT void - uint64_to_number (char* buffer, unsigned long long value); + uint64_to_number (char* buffer, std::size_t& n, unsigned long long val); } } } |