Process review comments

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
This commit is contained in:
Ferry Huberts 2023-08-11 09:07:15 +02:00
parent 8ff0b0f948
commit e872a75594
11 changed files with 17 additions and 16 deletions

View File

@ -64,7 +64,7 @@ p_uint32 CRC32::generateTable(v_uint32 poly) {
v_uint32 CRC32::calc(const void *buffer, v_buff_size size, v_uint32 crc, v_uint32 initValue, v_uint32 xorOut, p_uint32 table) {
p_uint8 data = reinterpret_cast<p_uint8>(const_cast<void*>(buffer));
auto data = reinterpret_cast<const char*>(buffer);
crc = crc ^ initValue;
for(v_buff_size i = 0; i < size; i++) {

View File

@ -239,7 +239,7 @@ v_io_size FIFOBuffer::write(const void *data, v_buff_size count) {
size2 = count - size;
}
std::memcpy(m_buffer, &(reinterpret_cast<p_char8>(const_cast<void*>(data)))[size], static_cast<size_t>(size2));
std::memcpy(m_buffer, &(reinterpret_cast<const char*>(data))[size], static_cast<size_t>(size2));
m_writePosition = size2;
return (size + size2);

View File

@ -102,7 +102,7 @@ v_int32 ProcessingPipeline::iterate(data::buffer::InlineReadData& dataIn,
return Error::FLUSH_DATA_OUT;
}
v_int32 i = 0;
v_buff_size i = 0;
v_int32 res = Error::OK;
while(res == Error::OK) {
@ -115,7 +115,7 @@ v_int32 ProcessingPipeline::iterate(data::buffer::InlineReadData& dataIn,
}
data::buffer::InlineReadData* currDataOut = &dataOut;
if(i < static_cast<v_int32>(m_intermediateData.size())) {
if(i < m_intermediateData.size()) {
currDataOut = &m_intermediateData[i];
}

View File

@ -308,7 +308,7 @@ namespace std {
result_type operator()(oatpp::data::share::StringKeyLabel const& s) const noexcept {
auto data = reinterpret_cast<p_char8>(const_cast<void*>(s.getData()));
auto data = reinterpret_cast<const char*>(s.getData());
result_type result = 0;
for(v_buff_size i = 0; i < s.getSize(); i++) {
v_char8 c = data[i];
@ -328,7 +328,7 @@ namespace std {
result_type operator()(oatpp::data::share::StringKeyLabelCI const& s) const noexcept {
auto data = reinterpret_cast<p_char8>(const_cast<void*>(s.getData()));
auto data = reinterpret_cast<const char*>(s.getData());
result_type result = 0;
for(v_buff_size i = 0; i < s.getSize(); i++) {
v_char8 c = data[i] | 32;

View File

@ -230,7 +230,7 @@ public:
* @return - actual number of bytes written. &id:oatpp::v_io_size;.
*/
v_io_size writeSimple(const char* data){
return writeSimple(reinterpret_cast<p_char8>(const_cast<char*>(data)), std::strlen(data));
return writeSimple(data, std::strlen(data));
}
/**

View File

@ -55,8 +55,8 @@ v_buff_size String::compareCI_ASCII(const void* data1, v_buff_size size1, const
if(data1 == nullptr) return -1;
if(data2 == nullptr) return 1;
auto d1 = reinterpret_cast<p_char8>(const_cast<void*>(data1));
auto d2 = reinterpret_cast<p_char8>(const_cast<void*>(data2));
auto d1 = reinterpret_cast<const char*>(data1);
auto d2 = reinterpret_cast<const char*>(data2);
v_buff_size size = size1;
if(size2 < size1) size = size2;
@ -70,7 +70,7 @@ v_buff_size String::compareCI_ASCII(const void* data1, v_buff_size size1, const
if(b >= 'A' && b <= 'Z') b |= 32;
if(a != b) {
return static_cast<int>(a) - static_cast<int>(b);
return static_cast<v_buff_size>(a) - static_cast<v_buff_size>(b);
}
}

View File

@ -86,7 +86,7 @@ void Hex::encode(data::stream::ConsistentOutputStream* stream,
const void* data, v_buff_size size,
const char* alphabet)
{
p_char8 buffer = reinterpret_cast<p_char8>(const_cast<void*>(data));
auto buffer = reinterpret_cast<const char*>(data);
v_char8 oneByteBuffer[2];
for(v_buff_size i = 0; i < size; i ++) {
auto c = buffer[i];
@ -101,7 +101,7 @@ void Hex::encode(data::stream::ConsistentOutputStream* stream,
void Hex::decode(data::stream::ConsistentOutputStream* stream,
const void* data, v_buff_size size, bool allowSeparators)
{
p_char8 buffer = reinterpret_cast<p_char8>(const_cast<void*>(data));
auto buffer = reinterpret_cast<const char*>(data);
v_char8 byte = 0;
v_int32 shift = 4;
for(v_buff_size i = 0; i < size; i ++) {

View File

@ -65,7 +65,7 @@ void Url::Config::disallowCharRange(v_char8 from, v_char8 to) {
void Url::encode(data::stream::ConsistentOutputStream *stream, const void *data, v_buff_size size, const Config& config) {
p_char8 pdata = reinterpret_cast<p_char8>(const_cast<void*>(data));
auto pdata = reinterpret_cast<const char*>(data);
for(v_buff_size i = 0; i < size; i++) {
v_char8 c = pdata[i];
@ -83,7 +83,7 @@ void Url::encode(data::stream::ConsistentOutputStream *stream, const void *data,
void Url::decode(data::stream::ConsistentOutputStream* stream, const void* data, v_buff_size size) {
p_char8 pdata = reinterpret_cast<p_char8>(const_cast<void*>(data));
auto pdata = reinterpret_cast<const char*>(data);
v_buff_size i = 0;
while (i < size) {

View File

@ -53,7 +53,7 @@ v_io_size Beautifier::write(const void *data, v_buff_size count, async::Action&
for(v_buff_size i = 0; i < count; i ++) {
v_char8 c = (reinterpret_cast<p_char8>(const_cast<void*>(data))) [i];
v_char8 c = (reinterpret_cast<const char*>(data)) [i];
if(m_isCharEscaped) {
m_isCharEscaped = false;

View File

@ -42,6 +42,7 @@ void StringTest::onRun() {
oatpp::String s;
OATPP_ASSERT(!s);
OATPP_ASSERT(s == nullptr);
OATPP_ASSERT(s == static_cast<const char*>(nullptr));
OATPP_ASSERT(s.getValueType() == oatpp::String::Class::getType());
OATPP_LOGI(TAG, "OK");
}

View File

@ -51,7 +51,7 @@ void BufferStreamTest::onRun() {
OATPP_ASSERT(stream.toString() == oatpp::utils::conversion::float32ToStr(101.1f));
stream.setCurrentPosition(0);
stream << 101.1;
stream << static_cast<v_float64>(101.1);
OATPP_ASSERT(stream.toString() == oatpp::utils::conversion::float64ToStr(101.1));
stream.setCurrentPosition(0);