mirror of
https://github.com/oatpp/oatpp.git
synced 2025-01-30 16:59:30 +08:00
Fix comparison of signed and unsigned integers.
This commit is contained in:
parent
4a8e571e67
commit
a40ea0b5c9
@ -172,7 +172,7 @@ bool StrBuffer::equals(const void* data, v_buff_size size) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool StrBuffer::equals(const char* data) const {
|
bool StrBuffer::equals(const char* data) const {
|
||||||
if(m_size == std::strlen(data)) {
|
if(static_cast<std::size_t>(m_size) == std::strlen(data)) {
|
||||||
return equals(m_data, data, m_size);
|
return equals(m_data, data, m_size);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@ -228,7 +228,7 @@ bool StrBuffer::equals(const void* data1, const void* data2, v_buff_size size) {
|
|||||||
bool StrBuffer::equals(const char* data1, const char* data2) {
|
bool StrBuffer::equals(const char* data1, const char* data2) {
|
||||||
if(data1 == data2) return true;
|
if(data1 == data2) return true;
|
||||||
if(data1 == nullptr && data2 == nullptr) return false;
|
if(data1 == nullptr && data2 == nullptr) return false;
|
||||||
v_buff_size size = std::strlen(data1);
|
const auto size = std::strlen(data1);
|
||||||
return (size == std::strlen(data2) && std::memcmp(data1, data2, size) == 0);
|
return (size == std::strlen(data2) && std::memcmp(data1, data2, size) == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -255,7 +255,7 @@ bool StrBuffer::equalsCI(const void* data1, const void* data2, v_buff_size size)
|
|||||||
bool StrBuffer::equalsCI(const char* data1, const char* data2) {
|
bool StrBuffer::equalsCI(const char* data1, const char* data2) {
|
||||||
if(data1 == data2) return true;
|
if(data1 == data2) return true;
|
||||||
if(data1 == nullptr && data2 == nullptr) return false;
|
if(data1 == nullptr && data2 == nullptr) return false;
|
||||||
v_buff_size size = std::strlen(data1);
|
const auto size = std::strlen(data1);
|
||||||
return (size == std::strlen(data2) && equalsCI(data1, data2, size) == 0);
|
return (size == std::strlen(data2) && equalsCI(data1, data2, size) == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -278,7 +278,7 @@ bool StrBuffer::equalsCI_FAST(const void* data1, const void* data2, v_buff_size
|
|||||||
bool StrBuffer::equalsCI_FAST(const char* data1, const char* data2) {
|
bool StrBuffer::equalsCI_FAST(const char* data1, const char* data2) {
|
||||||
if(data1 == data2) return true;
|
if(data1 == data2) return true;
|
||||||
if(data1 == nullptr && data2 == nullptr) return false;
|
if(data1 == nullptr && data2 == nullptr) return false;
|
||||||
v_buff_size size = std::strlen(data1);
|
const auto size = std::strlen(data1);
|
||||||
return (size == std::strlen(data2) && equalsCI_FAST(data1, data2, size) == 0);
|
return (size == std::strlen(data2) && equalsCI_FAST(data1, data2, size) == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,7 +88,7 @@ void InlineWriteData::setEof() {
|
|||||||
ProcessingPipeline::ProcessingPipeline(const std::vector<base::ObjectHandle<Processor>>& processors)
|
ProcessingPipeline::ProcessingPipeline(const std::vector<base::ObjectHandle<Processor>>& processors)
|
||||||
: m_processors(processors)
|
: m_processors(processors)
|
||||||
{
|
{
|
||||||
for(v_int32 i = 0; i < m_processors.size() - 1; i ++) {
|
for(v_uint32 i = 0; i < m_processors.size() - 1; i ++) {
|
||||||
m_intermediateData.push_back(data::buffer::InlineReadData());
|
m_intermediateData.push_back(data::buffer::InlineReadData());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -118,7 +118,7 @@ v_int32 ProcessingPipeline::iterate(data::buffer::InlineReadData& dataIn,
|
|||||||
}
|
}
|
||||||
|
|
||||||
data::buffer::InlineReadData* currDataOut = &dataOut;
|
data::buffer::InlineReadData* currDataOut = &dataOut;
|
||||||
if(i < m_intermediateData.size()) {
|
if(i < static_cast<v_int32>(m_intermediateData.size())) {
|
||||||
currDataOut = &m_intermediateData[i];
|
currDataOut = &m_intermediateData[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -126,6 +126,8 @@ v_int32 ProcessingPipeline::iterate(data::buffer::InlineReadData& dataIn,
|
|||||||
res = p->iterate(*currDataIn, *currDataOut);
|
res = p->iterate(*currDataIn, *currDataOut);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const v_int32 numOfProcessors = m_processors.size();
|
||||||
|
|
||||||
switch (res) {
|
switch (res) {
|
||||||
case Error::PROVIDE_DATA_IN:
|
case Error::PROVIDE_DATA_IN:
|
||||||
if (i > 0) {
|
if (i > 0) {
|
||||||
@ -136,7 +138,7 @@ v_int32 ProcessingPipeline::iterate(data::buffer::InlineReadData& dataIn,
|
|||||||
|
|
||||||
|
|
||||||
case Error::FLUSH_DATA_OUT:
|
case Error::FLUSH_DATA_OUT:
|
||||||
if (i < m_processors.size() - 1) {
|
if (i < numOfProcessors - 1) {
|
||||||
i ++;
|
i ++;
|
||||||
res = Error::OK;
|
res = Error::OK;
|
||||||
}
|
}
|
||||||
@ -144,7 +146,7 @@ v_int32 ProcessingPipeline::iterate(data::buffer::InlineReadData& dataIn,
|
|||||||
|
|
||||||
|
|
||||||
case Error::FINISHED:
|
case Error::FINISHED:
|
||||||
if (i < m_processors.size() - 1) {
|
if (i < numOfProcessors - 1) {
|
||||||
i ++;
|
i ++;
|
||||||
res = Error::OK;
|
res = Error::OK;
|
||||||
}
|
}
|
||||||
|
@ -60,7 +60,7 @@ Deserializer::Deserializer(const std::shared_ptr<Config>& config)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Deserializer::setDeserializerMethod(const data::mapping::type::ClassId& classId, DeserializerMethod method) {
|
void Deserializer::setDeserializerMethod(const data::mapping::type::ClassId& classId, DeserializerMethod method) {
|
||||||
auto id = classId.id;
|
const v_uint32 id = classId.id;
|
||||||
if(id < m_methods.size()) {
|
if(id < m_methods.size()) {
|
||||||
m_methods[id] = method;
|
m_methods[id] = method;
|
||||||
} else {
|
} else {
|
||||||
|
@ -59,7 +59,7 @@ Serializer::Serializer(const std::shared_ptr<Config>& config)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Serializer::setSerializerMethod(const data::mapping::type::ClassId& classId, SerializerMethod method) {
|
void Serializer::setSerializerMethod(const data::mapping::type::ClassId& classId, SerializerMethod method) {
|
||||||
auto id = classId.id;
|
const v_uint32 id = classId.id;
|
||||||
if(id < m_methods.size()) {
|
if(id < m_methods.size()) {
|
||||||
m_methods[id] = method;
|
m_methods[id] = method;
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user