ronantakizawa/codereview-bench huggingface dataset:
Repository: oatpp/oatpp
File: src/oatpp/core/data/share/MemoryLabel.hpp (C++)

Code before:
    return !operator==(other);
  }

  inline bool operator < (const StringKeyLabelCI &other) const {
    return utils::String::compareCI_ASCII(m_data, m_size, other.m_data, other.m_size) < 0;
  }

  inline bool operator > (const StringKeyLabelCI &other) const {
    return utils::String::compareCI_ASCII(m_data, m_size, other.m_data, other.m_size) > 0;
  }

};
  
}}}

namespace std {
  
  template<>
  struct hash<oatpp::data::share::StringKeyLabel> {
    
    typedef oatpp::data::share::StringKeyLabel argument_type;
    typedef v_uint64 result_type;
    
    result_type operator()(oatpp::data::share::StringKeyLabel const& s) const noexcept {

      auto data = reinterpret_cast<p_char8>(const_cast<void*>(s.getData()));
      result_type result = 0;
      for(v_buff_size i = 0; i < s.getSize(); i++) {
        v_char8 c = data[i];
        result = (31 * result) + c;
      }

      return result;

    }
  };
  
  template<>
  struct hash<oatpp::data::share::StringKeyLabelCI> {
    
    typedef oatpp::data::share::StringKeyLabelCI argument_type;
    typedef v_uint64 result_type;
    
    result_type operator()(oatpp::data::share::StringKeyLabelCI const& s) const noexcept {

      auto data = reinterpret_cast<p_char8>(const_cast<void*>(s.getData()));
      result_type result = 0;
      for(v_buff_size i = 0; i < s.getSize(); i++) {
        v_char8 c = data[i] | 32;
        result = (31 * result) + c;
      }

Review comment (suggestion):
Let's use

```cpp
auto data = reinterpret_cast<const char*>(s.getData());
```

Code after:
    return !operator==(other);
  }

  inline bool operator < (const StringKeyLabelCI &other) const {
    return utils::String::compareCI_ASCII(m_data, m_size, other.m_data, other.m_size) < 0;
  }

  inline bool operator > (const StringKeyLabelCI &other) const {
    return utils::String::compareCI_ASCII(m_data, m_size, other.m_data, other.m_size) > 0;
  }

};
  
}}}

namespace std {
  
  template<>
  struct hash<oatpp::data::share::StringKeyLabel> {
    
    typedef oatpp::data::share::StringKeyLabel argument_type;
    typedef v_uint64 result_type;
    
    result_type operator()(oatpp::data::share::StringKeyLabel const& s) const noexcept {

      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];
        result = (31 * result) + c;
      }

      return result;

    }
  };
  
  template<>
  struct hash<oatpp::data::share::StringKeyLabelCI> {
    
    typedef oatpp::data::share::StringKeyLabelCI argument_type;
    typedef v_uint64 result_type;
    
    result_type operator()(oatpp::data::share::StringKeyLabelCI const& s) const noexcept {

      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;
        result = (31 * result) + c;
      }
Repository: oatpp/oatpp
File: src/oatpp/core/data/share/MemoryLabel.hpp (C++)

Code before:
    typedef oatpp::data::share::StringKeyLabel argument_type;
    typedef v_uint64 result_type;
    
    result_type operator()(oatpp::data::share::StringKeyLabel const& s) const noexcept {

      auto data = reinterpret_cast<p_char8>(const_cast<void*>(s.getData()));
      result_type result = 0;
      for(v_buff_size i = 0; i < s.getSize(); i++) {
        v_char8 c = data[i];
        result = (31 * result) + c;
      }

      return result;

    }
  };
  
  template<>
  struct hash<oatpp::data::share::StringKeyLabelCI> {
    
    typedef oatpp::data::share::StringKeyLabelCI argument_type;
    typedef v_uint64 result_type;
    
    result_type operator()(oatpp::data::share::StringKeyLabelCI const& s) const noexcept {

      auto data = reinterpret_cast<p_char8>(const_cast<void*>(s.getData()));
      result_type result = 0;
      for(v_buff_size i = 0; i < s.getSize(); i++) {
        v_char8 c = data[i] | 32;
        result = (31 * result) + c;
      }

      return result;

    }
  };
  
}

#endif /* oatpp_data_share_MemoryLabel_hpp */


Review comment (suggestion):
Let's use

```cpp
auto data = reinterpret_cast<const char*>(s.getData());
```

Code after:
    typedef oatpp::data::share::StringKeyLabel argument_type;
    typedef v_uint64 result_type;
    
    result_type operator()(oatpp::data::share::StringKeyLabel const& s) const noexcept {

      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];
        result = (31 * result) + c;
      }

      return result;

    }
  };
  
  template<>
  struct hash<oatpp::data::share::StringKeyLabelCI> {
    
    typedef oatpp::data::share::StringKeyLabelCI argument_type;
    typedef v_uint64 result_type;
    
    result_type operator()(oatpp::data::share::StringKeyLabelCI const& s) const noexcept {

      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;
        result = (31 * result) + c;
      }

      return result;

    }
  };
  
}

#endif /* oatpp_data_share_MemoryLabel_hpp */
Repository: oatpp/oatpp
File: src/oatpp/core/utils/String.cpp (C++)

Code before:
  if(data1 == nullptr) return -1;
  if(data2 == nullptr) return 1;

  if(size1 < size2) {
    auto res = std::memcmp(data1, data2, size1);
    if(res == 0) return -1;
    return res;
  }

  if(size1 > size2) {
    auto res = std::memcmp(data1, data2, size2);
    if(res == 0) return 1;
    return res;
  }

  return std::memcmp(data1, data2, size1);

}

v_buff_size String::compareCI_ASCII(const void* data1, v_buff_size size1, const void* data2, v_buff_size size2) {

  if(data1 == data2) return 0;
  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));

  v_buff_size size = size1;
  if(size2 < size1) size = size2;

  for(v_buff_size i = 0; i < size; i ++) {

    v_char8 a = d1[i];
    v_char8 b = d2[i];

    if(a >= 'A' && a <= 'Z') a |= 32;
    if(b >= 'A' && b <= 'Z') b |= 32;

    if(a != b) {
      return static_cast<int>(a) - static_cast<int>(b);
    }

  }

  if(size1 < size2) return -1;
  if(size1 > size2) return  1;

  return 0;

}

Review comment (suggestion):
Let use

```cpp
auto d1 = reinterpret_cast<const char*>(data1);
auto d2 = ..."..."...
```

Code after:
  if(data1 == nullptr) return -1;
  if(data2 == nullptr) return 1;

  if(size1 < size2) {
    auto res = std::memcmp(data1, data2, size1);
    if(res == 0) return -1;
    return res;
  }

  if(size1 > size2) {
    auto res = std::memcmp(data1, data2, size2);
    if(res == 0) return 1;
    return res;
  }

  return std::memcmp(data1, data2, size1);

}

v_buff_size String::compareCI_ASCII(const void* data1, v_buff_size size1, const void* data2, v_buff_size size2) {

  if(data1 == data2) return 0;
  if(data1 == nullptr) return -1;
  if(data2 == nullptr) return 1;

  auto d1 = reinterpret_cast<const char*>(data1);
  auto d2 = reinterpret_cast<const char*>(data2);

  v_buff_size size = size1;
  if(size2 < size1) size = size2;

  for(v_buff_size i = 0; i < size; i ++) {

    v_char8 a = d1[i];
    v_char8 b = d2[i];

    if(a >= 'A' && a <= 'Z') a |= 32;
    if(b >= 'A' && b <= 'Z') b |= 32;

    if(a != b) {
      return static_cast<v_buff_size>(a) - static_cast<v_buff_size>(b);
    }

  }

  if(size1 < size2) return -1;
  if(size1 > size2) return  1;

  return 0;

}
Repository: oatpp/oatpp
File: src/oatpp/core/utils/String.cpp (C++)

Code before:
  return std::memcmp(data1, data2, size1);

}

v_buff_size String::compareCI_ASCII(const void* data1, v_buff_size size1, const void* data2, v_buff_size size2) {

  if(data1 == data2) return 0;
  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));

  v_buff_size size = size1;
  if(size2 < size1) size = size2;

  for(v_buff_size i = 0; i < size; i ++) {

    v_char8 a = d1[i];
    v_char8 b = d2[i];

    if(a >= 'A' && a <= 'Z') a |= 32;
    if(b >= 'A' && b <= 'Z') b |= 32;

    if(a != b) {
      return static_cast<int>(a) - static_cast<int>(b);
    }

  }

  if(size1 < size2) return -1;
  if(size1 > size2) return  1;

  return 0;

}

void String::lowerCase_ASCII(void* data, v_buff_size size) {
  for(v_buff_size i = 0; i < size; i++) {
    v_char8 a = (reinterpret_cast<p_char8>(data))[i];
    if(a >= 'A' && a <= 'Z') (reinterpret_cast<p_char8>(data))[i] = a | 32;
  }
}

void String::upperCase_ASCII(void* data, v_buff_size size) {
  for(v_buff_size i = 0; i < size; i++) {
    v_char8 a = (reinterpret_cast<p_char8>(data))[i];
    if(a >= 'a' && a <= 'z') (reinterpret_cast<p_char8>(data))[i] = a & 223;
  }
}


Review comment (suggestion):
```cpp
static_cast<v_buff_size>(a) - static_cast<v_buff_size>(b);
```

Code after:
  return std::memcmp(data1, data2, size1);

}

v_buff_size String::compareCI_ASCII(const void* data1, v_buff_size size1, const void* data2, v_buff_size size2) {

  if(data1 == data2) return 0;
  if(data1 == nullptr) return -1;
  if(data2 == nullptr) return 1;

  auto d1 = reinterpret_cast<const char*>(data1);
  auto d2 = reinterpret_cast<const char*>(data2);

  v_buff_size size = size1;
  if(size2 < size1) size = size2;

  for(v_buff_size i = 0; i < size; i ++) {

    v_char8 a = d1[i];
    v_char8 b = d2[i];

    if(a >= 'A' && a <= 'Z') a |= 32;
    if(b >= 'A' && b <= 'Z') b |= 32;

    if(a != b) {
      return static_cast<v_buff_size>(a) - static_cast<v_buff_size>(b);
    }

  }

  if(size1 < size2) return -1;
  if(size1 > size2) return  1;

  return 0;

}

void String::lowerCase_ASCII(void* data, v_buff_size size) {
  for(v_buff_size i = 0; i < size; i++) {
    v_char8 a = (reinterpret_cast<p_char8>(data))[i];
    if(a >= 'A' && a <= 'Z') (reinterpret_cast<p_char8>(data))[i] = a | 32;
  }
}

void String::upperCase_ASCII(void* data, v_buff_size size) {
  for(v_buff_size i = 0; i < size; i++) {
    v_char8 a = (reinterpret_cast<p_char8>(data))[i];
    if(a >= 'a' && a <= 'z') (reinterpret_cast<p_char8>(data))[i] = a & 223;
  }
}
Repository: oatpp/oatpp
File: src/oatpp/encoding/Hex.cpp (C++)

Code before:
  }
  return 0;
}
  
v_int32 Hex::readUInt32(const char* buffer, v_uint32& value) {
  value = 0;
  for(v_int32 i = 0; i < 8; i++){
    v_char8 a = buffer[i];
    if(a >= '0' && a <= '9') {
      value |= (a - '0') << ((7 - i) << 2);
    } else if (a >= 'A' && a <= 'F') {
      value |= (a - 'A' + 10) << ((7 - i) << 2);
    } else if (a >= 'a' && a <= 'f') {
      value |= (a - 'a' + 10) << ((7 - i) << 2);
    } else {
      return ERROR_UNKNOWN_SYMBOL;
    }
  }
  return 0;
}

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));
  v_char8 oneByteBuffer[2];
  for(v_buff_size i = 0; i < size; i ++) {
    auto c = buffer[i];
    v_char8 b1 = 0x0F & (c >> 4);
    v_char8 b2 = 0x0F & (c);
    oneByteBuffer[0] = alphabet[b1];
    oneByteBuffer[1] = alphabet[b2];
    stream->writeSimple(oneByteBuffer, 2);
  }
}

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));
  v_char8 byte = 0;
  v_int32 shift = 4;
  for(v_buff_size i = 0; i < size; i ++) {

    auto a = buffer[i];

    if(a >= '0' && a <= '9') {
      byte |= (a - '0') << shift;
      shift -= 4;
    } else if (a >= 'A' && a <= 'F') {

Review comment (suggestion):
No need to remove const:

```cpp
auto buffer = reinterpret_cast<const char*>(data);
```

Code after:
  }
  return 0;
}
  
v_int32 Hex::readUInt32(const char* buffer, v_uint32& value) {
  value = 0;
  for(v_int32 i = 0; i < 8; i++){
    v_char8 a = buffer[i];
    if(a >= '0' && a <= '9') {
      value |= (a - '0') << ((7 - i) << 2);
    } else if (a >= 'A' && a <= 'F') {
      value |= (a - 'A' + 10) << ((7 - i) << 2);
    } else if (a >= 'a' && a <= 'f') {
      value |= (a - 'a' + 10) << ((7 - i) << 2);
    } else {
      return ERROR_UNKNOWN_SYMBOL;
    }
  }
  return 0;
}

void Hex::encode(data::stream::ConsistentOutputStream* stream,
                 const void* data, v_buff_size size,
                 const char* alphabet)
{
  auto buffer = reinterpret_cast<const char*>(data);
  v_char8 oneByteBuffer[2];
  for(v_buff_size i = 0; i < size; i ++) {
    auto c = buffer[i];
    v_char8 b1 = 0x0F & (c >> 4);
    v_char8 b2 = 0x0F & (c);
    oneByteBuffer[0] = alphabet[b1];
    oneByteBuffer[1] = alphabet[b2];
    stream->writeSimple(oneByteBuffer, 2);
  }
}

void Hex::decode(data::stream::ConsistentOutputStream* stream,
                 const void* data, v_buff_size size, bool allowSeparators)
{
  auto buffer = reinterpret_cast<const char*>(data);
  v_char8 byte = 0;
  v_int32 shift = 4;
  for(v_buff_size i = 0; i < size; i ++) {

    auto a = buffer[i];

    if(a >= '0' && a <= '9') {
      byte |= (a - '0') << shift;
      shift -= 4;
    } else if (a >= 'A' && a <= 'F') {
Repository: oatpp/oatpp
File: src/oatpp/encoding/Hex.cpp (C++)

Code before:
      return ERROR_UNKNOWN_SYMBOL;
    }
  }
  return 0;
}

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));
  v_char8 oneByteBuffer[2];
  for(v_buff_size i = 0; i < size; i ++) {
    auto c = buffer[i];
    v_char8 b1 = 0x0F & (c >> 4);
    v_char8 b2 = 0x0F & (c);
    oneByteBuffer[0] = alphabet[b1];
    oneByteBuffer[1] = alphabet[b2];
    stream->writeSimple(oneByteBuffer, 2);
  }
}

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));
  v_char8 byte = 0;
  v_int32 shift = 4;
  for(v_buff_size i = 0; i < size; i ++) {

    auto a = buffer[i];

    if(a >= '0' && a <= '9') {
      byte |= (a - '0') << shift;
      shift -= 4;
    } else if (a >= 'A' && a <= 'F') {
      byte |= (a - 'A' + 10) << shift;
      shift -= 4;
    } else if (a >= 'a' && a <= 'f') {
      byte |= (a - 'a' + 10) << shift;
      shift -= 4;
    } else if(!allowSeparators) {
      throw DecodingError("Invalid Character");
    }

    if(shift < 0) {
      stream->writeCharSimple(byte);
      byte = 0;
      shift = 4;
    }


Review comment (suggestion):
No need to remove const:

```cpp
auto buffer = reinterpret_cast<const char*>(data);
```

Code after:
      return ERROR_UNKNOWN_SYMBOL;
    }
  }
  return 0;
}

void Hex::encode(data::stream::ConsistentOutputStream* stream,
                 const void* data, v_buff_size size,
                 const char* alphabet)
{
  auto buffer = reinterpret_cast<const char*>(data);
  v_char8 oneByteBuffer[2];
  for(v_buff_size i = 0; i < size; i ++) {
    auto c = buffer[i];
    v_char8 b1 = 0x0F & (c >> 4);
    v_char8 b2 = 0x0F & (c);
    oneByteBuffer[0] = alphabet[b1];
    oneByteBuffer[1] = alphabet[b2];
    stream->writeSimple(oneByteBuffer, 2);
  }
}

void Hex::decode(data::stream::ConsistentOutputStream* stream,
                 const void* data, v_buff_size size, bool allowSeparators)
{
  auto buffer = reinterpret_cast<const char*>(data);
  v_char8 byte = 0;
  v_int32 shift = 4;
  for(v_buff_size i = 0; i < size; i ++) {

    auto a = buffer[i];

    if(a >= '0' && a <= '9') {
      byte |= (a - '0') << shift;
      shift -= 4;
    } else if (a >= 'A' && a <= 'F') {
      byte |= (a - 'A' + 10) << shift;
      shift -= 4;
    } else if (a >= 'a' && a <= 'f') {
      byte |= (a - 'a' + 10) << shift;
      shift -= 4;
    } else if(!allowSeparators) {
      throw DecodingError("Invalid Character");
    }

    if(shift < 0) {
      stream->writeCharSimple(byte);
      byte = 0;
      shift = 4;
    }
Repository: oatpp/oatpp
File: src/oatpp/encoding/Url.cpp (C++)

Code before:

}

void Url::Config::allowChar(v_char8 c) {
  allowedChars[c] = true;
}

void Url::Config::allowCharRange(v_char8 from, v_char8 to) {
  for(v_int32 i = from; i <= to; i++) {
    allowedChars[i] = true;
  }
}

void Url::Config::disallowChar(v_char8 c) {
  allowedChars[c] = false;
}

void Url::Config::disallowCharRange(v_char8 from, v_char8 to) {
  for(v_int32 i = from; i <= to; i++) {
    allowedChars[i] = false;
  }
}

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));

  for(v_buff_size i = 0; i < size; i++) {
    v_char8 c = pdata[i];
    if(config.allowedChars[c]) {
      stream->writeCharSimple(c);
    } else if(c == ' ' && config.spaceToPlus) {
      stream->writeCharSimple('+');
    } else {
        stream->writeCharSimple('%');
        Hex::encode(stream, pdata + i, 1, config.hexAlphabet);
    }
  }

}

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));
  v_buff_size i = 0;

  while (i < size) {

    v_char8 c = pdata[i];
    if(c == '%') {
      if(size - i > 1) {

Review comment (suggestion):
No need to remove const:

```cpp
auto pdata = reinterpret_cast<const char*>(data);
```

Code after:

}

void Url::Config::allowChar(v_char8 c) {
  allowedChars[c] = true;
}

void Url::Config::allowCharRange(v_char8 from, v_char8 to) {
  for(v_int32 i = from; i <= to; i++) {
    allowedChars[i] = true;
  }
}

void Url::Config::disallowChar(v_char8 c) {
  allowedChars[c] = false;
}

void Url::Config::disallowCharRange(v_char8 from, v_char8 to) {
  for(v_int32 i = from; i <= to; i++) {
    allowedChars[i] = false;
  }
}

void Url::encode(data::stream::ConsistentOutputStream *stream, const void *data, v_buff_size size, const Config& config) {

  auto pdata = reinterpret_cast<const char*>(data);

  for(v_buff_size i = 0; i < size; i++) {
    v_char8 c = pdata[i];
    if(config.allowedChars[c]) {
      stream->writeCharSimple(c);
    } else if(c == ' ' && config.spaceToPlus) {
      stream->writeCharSimple('+');
    } else {
        stream->writeCharSimple('%');
        Hex::encode(stream, pdata + i, 1, config.hexAlphabet);
    }
  }

}

void Url::decode(data::stream::ConsistentOutputStream* stream, const void* data, v_buff_size size) {

  auto pdata = reinterpret_cast<const char*>(data);
  v_buff_size i = 0;

  while (i < size) {

    v_char8 c = pdata[i];
    if(c == '%') {
      if(size - i > 1) {
Repository: oatpp/oatpp
File: src/oatpp/encoding/Url.cpp (C++)

Code before:
  for(v_int32 i = from; i <= to; i++) {
    allowedChars[i] = false;
  }
}

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));

  for(v_buff_size i = 0; i < size; i++) {
    v_char8 c = pdata[i];
    if(config.allowedChars[c]) {
      stream->writeCharSimple(c);
    } else if(c == ' ' && config.spaceToPlus) {
      stream->writeCharSimple('+');
    } else {
        stream->writeCharSimple('%');
        Hex::encode(stream, pdata + i, 1, config.hexAlphabet);
    }
  }

}

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));
  v_buff_size i = 0;

  while (i < size) {

    v_char8 c = pdata[i];
    if(c == '%') {
      if(size - i > 1) {
        Hex::decode(stream, pdata + i + 1, 2);
        i += 3;
      } else {
        break;
      }
    } else if (c == '+') {
      stream->writeCharSimple(' ');
      i ++;
    } else {
        stream->writeCharSimple(c);
        i ++;
    }

  }

}

oatpp::String Url::encode(const oatpp::String data, const Config& config) {

Review comment (suggestion):
No need to remove const:

```cpp
auto pdata = reinterpret_cast<const char*>(data);
```

Code after:
  for(v_int32 i = from; i <= to; i++) {
    allowedChars[i] = false;
  }
}

void Url::encode(data::stream::ConsistentOutputStream *stream, const void *data, v_buff_size size, const Config& config) {

  auto pdata = reinterpret_cast<const char*>(data);

  for(v_buff_size i = 0; i < size; i++) {
    v_char8 c = pdata[i];
    if(config.allowedChars[c]) {
      stream->writeCharSimple(c);
    } else if(c == ' ' && config.spaceToPlus) {
      stream->writeCharSimple('+');
    } else {
        stream->writeCharSimple('%');
        Hex::encode(stream, pdata + i, 1, config.hexAlphabet);
    }
  }

}

void Url::decode(data::stream::ConsistentOutputStream* stream, const void* data, v_buff_size size) {

  auto pdata = reinterpret_cast<const char*>(data);
  v_buff_size i = 0;

  while (i < size) {

    v_char8 c = pdata[i];
    if(c == '%') {
      if(size - i > 1) {
        Hex::decode(stream, pdata + i + 1, 2);
        i += 3;
      } else {
        break;
      }
    } else if (c == '+') {
      stream->writeCharSimple(' ');
      i ++;
    } else {
        stream->writeCharSimple(c);
        i ++;
    }

  }

}

oatpp::String Url::encode(const oatpp::String data, const Config& config) {