summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2020-10-20 08:18:11 +0200
committerSven Gothel <[email protected]>2020-10-20 08:18:11 +0200
commitbc5b9519034edfa7a24a6667d183f3a3b01f3867 (patch)
treed18e96cef8286dfc6bc20e1f8e8e71b360aba1fd /src
parentaa43800a7722940ac1a902b088a6900e29efd0c9 (diff)
Small footprint compromise: Use jau::nsize_t and jau::snsize_t where appropriate
Revises commit 1f6e924fe05ed45bfa4d0d901af2c4df6c1abab5 Use jau::nsize_t and jau::snsize_t where appropriate - OctetTypes.hpp: TROOctets* - ATTPDUTypes.hpp: AttPDUMsg* - HCITypes.hpp: HCIPacket* - HCIComm.hpp: HCIComm - L2CAPComm.hpp: L2CAPComm - MgmtTypes.hpp: MgmtCommand*, MgmtEvent* - UUID.hpp: uuid_t - DBTManager, GATTHandler, HCIHandler - HCIComm.hpp: HCIComm - BTTypes.hpp - DBTTypes.hpp
Diffstat (limited to 'src')
-rw-r--r--src/direct_bt/ATTPDUTypes.cpp2
-rw-r--r--src/direct_bt/BTTypes.cpp14
-rw-r--r--src/direct_bt/DBTManager.cpp10
-rw-r--r--src/direct_bt/GATTHandler.cpp6
-rw-r--r--src/direct_bt/GATTNumbers.cpp10
-rw-r--r--src/direct_bt/HCIComm.cpp8
-rw-r--r--src/direct_bt/HCIHandler.cpp8
-rw-r--r--src/direct_bt/HCITypes.cpp2
-rw-r--r--src/direct_bt/L2CAPComm.cpp12
-rw-r--r--src/direct_bt/MgmtTypes.cpp6
-rw-r--r--src/direct_bt/UUID.cpp32
11 files changed, 55 insertions, 55 deletions
diff --git a/src/direct_bt/ATTPDUTypes.cpp b/src/direct_bt/ATTPDUTypes.cpp
index 97f33bfd..295cfe9d 100644
--- a/src/direct_bt/ATTPDUTypes.cpp
+++ b/src/direct_bt/ATTPDUTypes.cpp
@@ -115,7 +115,7 @@ std::string AttErrorRsp::getPlainErrorString(const ErrorCode errorCode) noexcept
return "Error Reserved for future use";
}
-std::shared_ptr<const AttPDUMsg> AttPDUMsg::getSpecialized(const uint8_t * buffer, size_t const buffer_size) noexcept {
+std::shared_ptr<const AttPDUMsg> AttPDUMsg::getSpecialized(const uint8_t * buffer, jau::nsize_t const buffer_size) noexcept {
const uint8_t opc = *buffer;
const AttPDUMsg * res;
switch( opc ) {
diff --git a/src/direct_bt/BTTypes.cpp b/src/direct_bt/BTTypes.cpp
index 88b50032..d37b15cf 100644
--- a/src/direct_bt/BTTypes.cpp
+++ b/src/direct_bt/BTTypes.cpp
@@ -374,7 +374,7 @@ ManufactureSpecificData::ManufactureSpecificData(uint16_t const company_) noexce
: company(company_), companyName(std::string(bt_compidtostr(company_))), data(/* intentional zero sized */) {
}
-ManufactureSpecificData::ManufactureSpecificData(uint16_t const company_, uint8_t const * const data_, size_t const data_len) noexcept
+ManufactureSpecificData::ManufactureSpecificData(uint16_t const company_, uint8_t const * const data_, jau::nsize_t const data_len) noexcept
: company(company_), companyName(std::string(bt_compidtostr(company_))), data(data_, data_len) {
}
@@ -696,8 +696,8 @@ int EInfoReport::read_data(uint8_t const * data, uint8_t const data_length) noex
return count;
}
-std::vector<std::shared_ptr<EInfoReport>> EInfoReport::read_ad_reports(uint8_t const * data, size_t const data_length) noexcept {
- size_t const num_reports = (size_t) data[0];
+std::vector<std::shared_ptr<EInfoReport>> EInfoReport::read_ad_reports(uint8_t const * data, jau::nsize_t const data_length) noexcept {
+ jau::nsize_t const num_reports = (jau::nsize_t) data[0];
std::vector<std::shared_ptr<EInfoReport>> ad_reports;
if( 0 == num_reports || num_reports > 0x19 ) {
@@ -707,9 +707,9 @@ std::vector<std::shared_ptr<EInfoReport>> EInfoReport::read_ad_reports(uint8_t c
uint8_t const *limes = data + data_length;
uint8_t const *i_octets = data + 1;
uint8_t ad_data_len[0x19];
- const size_t segment_count = 6;
- size_t read_segments = 0;
- size_t i;
+ const jau::nsize_t segment_count = 6;
+ jau::nsize_t read_segments = 0;
+ jau::nsize_t i;
const uint64_t timestamp = jau::getCurrentMilliseconds();
for(i = 0; i < num_reports && i_octets < limes; i++) {
@@ -742,7 +742,7 @@ std::vector<std::shared_ptr<EInfoReport>> EInfoReport::read_ad_reports(uint8_t c
i_octets++;
read_segments++;
}
- const size_t bytes_left = static_cast<size_t>(limes - i_octets);
+ const jau::nsize_t bytes_left = static_cast<jau::nsize_t>(limes - i_octets);
if( segment_count != read_segments ) {
WARN_PRINT("AD-Reports: Incomplete %zu reports within %zu bytes: Segment read %zu < %zu, data-ptr %zu bytes to limes\n",
diff --git a/src/direct_bt/DBTManager.cpp b/src/direct_bt/DBTManager.cpp
index dcff5ea9..111ef4b1 100644
--- a/src/direct_bt/DBTManager.cpp
+++ b/src/direct_bt/DBTManager.cpp
@@ -89,7 +89,7 @@ void DBTManager::mgmtReaderThreadImpl() noexcept {
}
while( !mgmtReaderShallStop ) {
- ssize_t len;
+ jau::snsize_t len;
if( !comm.isOpen() ) {
// not open
ERR_PRINT("DBTManager::reader: Not connected");
@@ -99,10 +99,10 @@ void DBTManager::mgmtReaderThreadImpl() noexcept {
len = comm.read(rbuffer.get_wptr(), rbuffer.getSize(), env.MGMT_READER_THREAD_POLL_TIMEOUT);
if( 0 < len ) {
- const size_t len2 = static_cast<size_t>(len);
- const size_t paramSize = len2 >= MGMT_HEADER_SIZE ? rbuffer.get_uint16_nc(4) : 0;
+ const jau::nsize_t len2 = static_cast<jau::nsize_t>(len);
+ const jau::nsize_t paramSize = len2 >= MGMT_HEADER_SIZE ? rbuffer.get_uint16_nc(4) : 0;
if( len2 < MGMT_HEADER_SIZE + paramSize ) {
- WARN_PRINT("DBTManager::reader: length mismatch %zu < MGMT_HEADER_SIZE(%zu) + %zu", len2, MGMT_HEADER_SIZE, paramSize);
+ WARN_PRINT("DBTManager::reader: length mismatch %zu < MGMT_HEADER_SIZE(%u) + %u", len2, MGMT_HEADER_SIZE, paramSize);
continue; // discard data
}
std::shared_ptr<MgmtEvent> event = MgmtEvent::getSpecialized(rbuffer.get_ptr(), len2);
@@ -411,7 +411,7 @@ next1:
const uint16_t num_adapter = jau::get_uint16(data, 0, true /* littleEndian */);
WORDY_PRINT("Bluetooth %d adapter", num_adapter);
- const size_t expDataSize = 2 + num_adapter * 2;
+ const jau::nsize_t expDataSize = 2 + num_adapter * 2;
if( res->getDataSize() < expDataSize ) {
ERR_PRINT("Insufficient data for %d adapter indices: res %s", num_adapter, res->toString().c_str());
goto fail;
diff --git a/src/direct_bt/GATTHandler.cpp b/src/direct_bt/GATTHandler.cpp
index 9ab4c31e..977f224c 100644
--- a/src/direct_bt/GATTHandler.cpp
+++ b/src/direct_bt/GATTHandler.cpp
@@ -198,7 +198,7 @@ void GATTHandler::l2capReaderThreadImpl() {
}
while( !l2capReaderShallStop ) {
- ssize_t len;
+ jau::snsize_t len;
if( !validateConnected() ) {
ERR_PRINT("GATTHandler::reader: Invalid IO state -> Stop");
l2capReaderShallStop = true;
@@ -207,7 +207,7 @@ void GATTHandler::l2capReaderThreadImpl() {
len = l2cap.read(rbuffer.get_wptr(), rbuffer.getSize());
if( 0 < len ) {
- std::shared_ptr<const AttPDUMsg> attPDU = AttPDUMsg::getSpecialized(rbuffer.get_ptr(), static_cast<size_t>(len));
+ std::shared_ptr<const AttPDUMsg> attPDU = AttPDUMsg::getSpecialized(rbuffer.get_ptr(), static_cast<jau::nsize_t>(len));
const AttPDUMsg::Opcode opc = attPDU->getOpcode();
if( AttPDUMsg::Opcode::ATT_HANDLE_VALUE_NTF == opc ) {
@@ -262,7 +262,7 @@ void GATTHandler::l2capReaderThreadImpl() {
attPDURing.putBlocking( attPDU );
}
} else if( ETIMEDOUT != errno && !l2capReaderShallStop ) { // expected exits
- IRQ_PRINT("GATTHandler::reader: l2cap read error -> Stop; l2cap.read %zd", len);
+ IRQ_PRINT("GATTHandler::reader: l2cap read error -> Stop; l2cap.read %d", len);
l2capReaderShallStop = true;
has_ioerror = true;
}
diff --git a/src/direct_bt/GATTNumbers.cpp b/src/direct_bt/GATTNumbers.cpp
index 6fec1bd9..80fba5da 100644
--- a/src/direct_bt/GATTNumbers.cpp
+++ b/src/direct_bt/GATTNumbers.cpp
@@ -347,7 +347,7 @@ const GattCharacteristicSpec * direct_bt::findGattCharSpec(const uint16_t uuid16
/********************************************************/
std::string direct_bt::GattNameToString(const TROOctets &v) noexcept {
- const size_t str_len = v.getSize();
+ const jau::nsize_t str_len = v.getSize();
if( 0 == str_len ) {
return std::string(); // empty
}
@@ -364,7 +364,7 @@ GattPeriphalPreferredConnectionParameters::GattPeriphalPreferredConnectionParame
}
std::shared_ptr<GattPeriphalPreferredConnectionParameters> GattPeriphalPreferredConnectionParameters::get(const TROOctets &source) noexcept {
- const size_t reqSize = 8;
+ const jau::nsize_t reqSize = 8;
if( source.getSize() < reqSize ) {
ERR_PRINT("GattPeriphalPreferredConnectionParameters: Insufficient data, less than %d bytes in %s", reqSize, source.toString().c_str());
return nullptr;
@@ -389,7 +389,7 @@ GattPnP_ID::GattPnP_ID(const TROOctets &source) noexcept
product_id(source.get_uint16(3)), product_version(source.get_uint16(5)) {}
std::shared_ptr<GattPnP_ID> GattPnP_ID::get(const TROOctets &source) noexcept {
- const size_t reqSize = 7;
+ const jau::nsize_t reqSize = 7;
if( source.getSize() < reqSize ) {
ERR_PRINT("GattPnP_ID: Insufficient data, less than %d bytes in %s", reqSize, source.toString().c_str());
return nullptr;
@@ -412,8 +412,8 @@ std::string GattDeviceInformationSvc::toString() const noexcept {
}
std::shared_ptr<GattTemperatureMeasurement> GattTemperatureMeasurement::get(const TROOctets &source) noexcept {
- const size_t size = source.getSize();
- size_t reqSize = 1 + 4; // max size = 13
+ const jau::nsize_t size = source.getSize();
+ jau::nsize_t reqSize = 1 + 4; // max size = 13
if( reqSize > size ) {
// min size: flags + temperatureValue
ERR_PRINT("GattTemperatureMeasurement: Insufficient data, less than %d bytes in %s", reqSize, source.toString().c_str());
diff --git a/src/direct_bt/HCIComm.cpp b/src/direct_bt/HCIComm.cpp
index a99125e9..34de0752 100644
--- a/src/direct_bt/HCIComm.cpp
+++ b/src/direct_bt/HCIComm.cpp
@@ -138,8 +138,8 @@ void HCIComm::close() noexcept {
DBG_PRINT("HCIComm::close: End: dd %d", socket_descriptor.load());
}
-ssize_t HCIComm::read(uint8_t* buffer, const size_t capacity, const int32_t timeoutMS) noexcept {
- ssize_t len = 0;
+jau::snsize_t HCIComm::read(uint8_t* buffer, const jau::nsize_t capacity, const int32_t timeoutMS) noexcept {
+ jau::snsize_t len = 0;
if( 0 > socket_descriptor ) {
goto errout;
}
@@ -180,9 +180,9 @@ errout:
return -1;
}
-ssize_t HCIComm::write(const uint8_t* buffer, const size_t size) noexcept {
+jau::snsize_t HCIComm::write(const uint8_t* buffer, const jau::nsize_t size) noexcept {
const std::lock_guard<std::recursive_mutex> lock(mtx_write); // RAII-style acquire and relinquish via destructor
- ssize_t len = 0;
+ jau::snsize_t len = 0;
if( 0 > socket_descriptor ) {
goto errout;
}
diff --git a/src/direct_bt/HCIHandler.cpp b/src/direct_bt/HCIHandler.cpp
index 017c9155..5caa8d41 100644
--- a/src/direct_bt/HCIHandler.cpp
+++ b/src/direct_bt/HCIHandler.cpp
@@ -260,7 +260,7 @@ void HCIHandler::hciReaderThreadImpl() noexcept {
}
while( !hciReaderShallStop ) {
- ssize_t len;
+ jau::snsize_t len;
if( !comm.isOpen() ) {
// not open
ERR_PRINT("HCIHandler::reader: Not connected");
@@ -270,10 +270,10 @@ void HCIHandler::hciReaderThreadImpl() noexcept {
len = comm.read(rbuffer.get_wptr(), rbuffer.getSize(), env.HCI_READER_THREAD_POLL_TIMEOUT);
if( 0 < len ) {
- const size_t len2 = static_cast<size_t>(len);
- const size_t paramSize = len2 >= number(HCIConstSizeT::EVENT_HDR_SIZE) ? rbuffer.get_uint8_nc(2) : 0;
+ const jau::nsize_t len2 = static_cast<jau::nsize_t>(len);
+ const jau::nsize_t paramSize = len2 >= number(HCIConstSizeT::EVENT_HDR_SIZE) ? rbuffer.get_uint8_nc(2) : 0;
if( len2 < number(HCIConstSizeT::EVENT_HDR_SIZE) + paramSize ) {
- WARN_PRINT("HCIHandler::reader: length mismatch %zu < EVENT_HDR_SIZE(%zu) + %zu",
+ WARN_PRINT("HCIHandler::reader: length mismatch %u < EVENT_HDR_SIZE(%u) + %u",
len2, number(HCIConstSizeT::EVENT_HDR_SIZE), paramSize);
continue; // discard data
}
diff --git a/src/direct_bt/HCITypes.cpp b/src/direct_bt/HCITypes.cpp
index ce334788..4a16e181 100644
--- a/src/direct_bt/HCITypes.cpp
+++ b/src/direct_bt/HCITypes.cpp
@@ -272,7 +272,7 @@ std::string getHCIMetaEventTypeString(const HCIMetaEventType op) noexcept {
return "Unknown HCIMetaType";
}
-std::shared_ptr<HCIEvent> HCIEvent::getSpecialized(const uint8_t * buffer, size_t const buffer_size) noexcept {
+std::shared_ptr<HCIEvent> HCIEvent::getSpecialized(const uint8_t * buffer, jau::nsize_t const buffer_size) noexcept {
const HCIPacketType pc = static_cast<HCIPacketType>( jau::get_uint8(buffer, 0) );
if( HCIPacketType::EVENT != pc ) {
return nullptr;
diff --git a/src/direct_bt/L2CAPComm.cpp b/src/direct_bt/L2CAPComm.cpp
index ca83109e..b3493fc6 100644
--- a/src/direct_bt/L2CAPComm.cpp
+++ b/src/direct_bt/L2CAPComm.cpp
@@ -215,10 +215,10 @@ bool L2CAPComm::disconnect() noexcept {
return true;
}
-ssize_t L2CAPComm::read(uint8_t* buffer, const size_t capacity) {
+jau::snsize_t L2CAPComm::read(uint8_t* buffer, const jau::nsize_t capacity) {
const int32_t timeoutMS = env.L2CAP_READER_POLL_TIMEOUT;
- ssize_t len = 0;
- ssize_t err_res = 0;
+ jau::snsize_t len = 0;
+ jau::snsize_t err_res = 0;
tid_read = pthread_self(); // temporary safe tid to allow interruption
@@ -280,10 +280,10 @@ errout:
return err_res;
}
-ssize_t L2CAPComm::write(const uint8_t * buffer, const size_t length) {
+jau::snsize_t L2CAPComm::write(const uint8_t * buffer, const jau::nsize_t length) {
const std::lock_guard<std::recursive_mutex> lock(mtx_write); // RAII-style acquire and relinquish via destructor
- ssize_t len = 0;
- ssize_t err_res = 0;
+ jau::snsize_t len = 0;
+ jau::snsize_t err_res = 0;
if( 0 > socket_descriptor ) {
err_res = -1; // invalid socket_descriptor or capacity
diff --git a/src/direct_bt/MgmtTypes.cpp b/src/direct_bt/MgmtTypes.cpp
index ee4e15fe..cf37e1d6 100644
--- a/src/direct_bt/MgmtTypes.cpp
+++ b/src/direct_bt/MgmtTypes.cpp
@@ -230,7 +230,7 @@ std::string MgmtEvent::getOpcodeString(const Opcode opc) noexcept {
return "Unknown Opcode";
}
-std::shared_ptr<MgmtEvent> MgmtEvent::getSpecialized(const uint8_t * buffer, size_t const buffer_size) noexcept {
+std::shared_ptr<MgmtEvent> MgmtEvent::getSpecialized(const uint8_t * buffer, jau::nsize_t const buffer_size) noexcept {
const MgmtEvent::Opcode opc = static_cast<MgmtEvent::Opcode>( jau::get_uint16(buffer, 0, true /* littleEndian */) );
MgmtEvent * res;
switch( opc ) {
@@ -287,7 +287,7 @@ std::shared_ptr<ConnectionInfo> MgmtEvtCmdComplete::toConnectionInfo() const noe
ERR_PRINT("No Success: %s", toString().c_str());
return nullptr;
}
- const size_t min_size = ConnectionInfo::minimumDataSize();
+ const jau::nsize_t min_size = ConnectionInfo::minimumDataSize();
if( getDataSize() < min_size ) {
ERR_PRINT("Data size < %d: %s", min_size, toString().c_str());
return nullptr;
@@ -311,7 +311,7 @@ std::shared_ptr<NameAndShortName> MgmtEvtCmdComplete::toNameAndShortName() const
ERR_PRINT("No Success: %s", toString().c_str());
return nullptr;
}
- const size_t min_size = MgmtEvtLocalNameChanged::namesDataSize();
+ const jau::nsize_t min_size = MgmtEvtLocalNameChanged::namesDataSize();
if( getDataSize() < min_size ) {
ERR_PRINT("Data size < %d: %s", min_size, toString().c_str());
return nullptr;
diff --git a/src/direct_bt/UUID.cpp b/src/direct_bt/UUID.cpp
index 5b3a744c..97b2fe81 100644
--- a/src/direct_bt/UUID.cpp
+++ b/src/direct_bt/UUID.cpp
@@ -35,7 +35,7 @@ static uint8_t bt_base_uuid_be[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0
0x80, 0x00, 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB };
uuid128_t direct_bt::BT_BASE_UUID( bt_base_uuid_be, 0, false );
-uuid_t::TypeSize uuid_t::toTypeSize(const int size) {
+uuid_t::TypeSize uuid_t::toTypeSize(const jau::nsize_t size) {
switch( static_cast<TypeSize>(size) ) {
case TypeSize::UUID16_SZ: return TypeSize::UUID16_SZ;
case TypeSize::UUID32_SZ: return TypeSize::UUID32_SZ;
@@ -44,7 +44,7 @@ uuid_t::TypeSize uuid_t::toTypeSize(const int size) {
throw jau::IllegalArgumentException("Given size "+std::to_string(size)+", not matching uuid16_t, uuid32_t or uuid128_t", E_FILE_LINE);
}
-std::shared_ptr<const uuid_t> uuid_t::create(TypeSize t, uint8_t const * const buffer, int const byte_offset, bool littleEndian) {
+std::shared_ptr<const uuid_t> uuid_t::create(TypeSize t, uint8_t const * const buffer, jau::nsize_t const byte_offset, bool littleEndian) {
if( TypeSize::UUID16_SZ == t ) {
return std::shared_ptr<const uuid_t>(new uuid16_t(buffer, byte_offset, littleEndian));
} else if( TypeSize::UUID32_SZ == t ) {
@@ -52,64 +52,64 @@ std::shared_ptr<const uuid_t> uuid_t::create(TypeSize t, uint8_t const * const b
} else if( TypeSize::UUID128_SZ == t ) {
return std::shared_ptr<const uuid_t>(new uuid128_t(buffer, byte_offset, littleEndian));
}
- throw jau::IllegalArgumentException("Unknown Type "+std::to_string(static_cast<int>(t)), E_FILE_LINE);
+ throw jau::IllegalArgumentException("Unknown Type "+std::to_string(static_cast<jau::nsize_t>(t)), E_FILE_LINE);
}
-uuid128_t uuid_t::toUUID128(uuid128_t const & base_uuid, int const uuid32_le_octet_index) const noexcept {
+uuid128_t uuid_t::toUUID128(uuid128_t const & base_uuid, jau::nsize_t const uuid32_le_octet_index) const noexcept {
switch(type) {
case TypeSize::UUID16_SZ: return uuid128_t(*((uuid16_t*)this), base_uuid, uuid32_le_octet_index);
case TypeSize::UUID32_SZ: return uuid128_t(*((uuid32_t*)this), base_uuid, uuid32_le_octet_index);
case TypeSize::UUID128_SZ: return uuid128_t(*((uuid128_t*)this));
}
- ABORT("Unknown Type %d", static_cast<int>(type));
+ ABORT("Unknown Type %d", static_cast<jau::nsize_t>(type));
abort(); // never reached
}
-std::string uuid_t::toUUID128String(uuid128_t const & base_uuid, int const le_octet_index) const noexcept {
+std::string uuid_t::toUUID128String(uuid128_t const & base_uuid, jau::nsize_t const le_octet_index) const noexcept {
(void)base_uuid;
(void)le_octet_index;
return "";
}
-uuid128_t::uuid128_t(uuid16_t const & uuid16, uuid128_t const & base_uuid, int const uuid16_le_octet_index) noexcept
+uuid128_t::uuid128_t(uuid16_t const & uuid16, uuid128_t const & base_uuid, jau::nsize_t const uuid16_le_octet_index) noexcept
: uuid_t(TypeSize::UUID128_SZ), value(merge_uint128(uuid16.value, base_uuid.value, uuid16_le_octet_index)) {}
-uuid128_t::uuid128_t(uuid32_t const & uuid32, uuid128_t const & base_uuid, int const uuid32_le_octet_index) noexcept
+uuid128_t::uuid128_t(uuid32_t const & uuid32, uuid128_t const & base_uuid, jau::nsize_t const uuid32_le_octet_index) noexcept
: uuid_t(TypeSize::UUID128_SZ), value(merge_uint128(uuid32.value, base_uuid.value, uuid32_le_octet_index)) {}
std::string uuid16_t::toString() const noexcept {
- const int length = 4;
+ const jau::nsize_t length = 4;
std::string str;
str.reserve(length+1); // including EOS for snprintf
str.resize(length);
- const int count = snprintf(&str[0], str.capacity(), "%.4x", value);
+ const jau::nsize_t count = snprintf(&str[0], str.capacity(), "%.4x", value);
if( length != count ) {
ABORT("UUID16 string not of length %d but %d", length, count);
}
return str;
}
-std::string uuid16_t::toUUID128String(uuid128_t const & base_uuid, int const le_octet_index) const noexcept
+std::string uuid16_t::toUUID128String(uuid128_t const & base_uuid, jau::nsize_t const le_octet_index) const noexcept
{
uuid128_t u128(*this, base_uuid, le_octet_index);
return u128.toString();
}
std::string uuid32_t::toString() const noexcept {
- const int length = 8;
+ const jau::nsize_t length = 8;
std::string str;
str.reserve(length+1); // including EOS for snprintf
str.resize(length);
- const int count = snprintf(&str[0], str.capacity(), "%.8x", value);
+ const jau::nsize_t count = snprintf(&str[0], str.capacity(), "%.8x", value);
if( length != count ) {
ABORT("UUID32 string not of length %d but %d", length, count);
}
return str;
}
-std::string uuid32_t::toUUID128String(uuid128_t const & base_uuid, int const le_octet_index) const noexcept
+std::string uuid32_t::toUUID128String(uuid128_t const & base_uuid, jau::nsize_t const le_octet_index) const noexcept
{
uuid128_t u128(*this, base_uuid, le_octet_index);
return u128.toString();
@@ -124,7 +124,7 @@ std::string uuid128_t::toString() const noexcept {
// BE: low-mem - 87654321-0000-1000-8000-00805F9B34FB - high-mem
// 0 1 2 3 4 5
//
- const int length = 36;
+ const jau::nsize_t length = 36;
std::string str;
str.reserve(length+1); // including EOS for snprintf
str.resize(length);
@@ -150,7 +150,7 @@ std::string uuid128_t::toString() const noexcept {
#else
#error "Unexpected __BYTE_ORDER"
#endif
- const int count = snprintf(&str[0], str.capacity(), "%.8x-%.4x-%.4x-%.4x-%.8x%.4x",
+ const jau::nsize_t count = snprintf(&str[0], str.capacity(), "%.8x-%.4x-%.4x-%.4x-%.8x%.4x",
part0, part1, part2, part3, part4, part5);
if( length != count ) {
ABORT("UUID128 string not of length %d but %d", length, count);