utils::Random: fix namespace

This commit is contained in:
Leonid Stryzhevskyi 2024-05-16 08:50:39 +03:00
parent 8377409391
commit d091b4a0d0
6 changed files with 9 additions and 9 deletions

View File

@ -42,7 +42,7 @@ TemporaryFile::FileHandle::~FileHandle() {
oatpp::String TemporaryFile::constructRandomFilename(const oatpp::String &dir, v_int32 randomWordSizeBytes, const oatpp::String &extension) {
std::unique_ptr<v_char8[]> buff(new v_char8[static_cast<unsigned long>(randomWordSizeBytes)]);
utils::random::Random::randomBytes(buff.get(), randomWordSizeBytes);
utils::Random::randomBytes(buff.get(), randomWordSizeBytes);
data::stream::BufferOutputStream s(randomWordSizeBytes * 2 + 4);
encoding::Hex::encode(&s, buff.get(), randomWordSizeBytes, encoding::Hex::ALPHABET_LOWER);
if (extension->at(0) != '.') {

View File

@ -151,7 +151,7 @@ void Serializer::serializePairs(State& state) {
if(!nestedState.errorStack.empty()) {
state.errorStack.splice(nestedState.errorStack);
state.errorStack.push("[oatpp::json::Serializer::serializeMap()]: key='" + pair.first + "'");
state.errorStack.push("[oatpp::json::Serializer::serializePairs()]: key='" + pair.first + "'");
return;
}
}

View File

@ -24,7 +24,7 @@
#include "Random.hpp"
namespace oatpp { namespace utils { namespace random {
namespace oatpp { namespace utils {
#ifndef OATPP_COMPAT_BUILD_NO_THREAD_LOCAL
thread_local std::mt19937 Random::RANDOM_GENERATOR(std::random_device{}());
@ -47,4 +47,4 @@ void Random::randomBytes(p_char8 buffer, v_buff_size bufferSize) {
}
}}}
}}

View File

@ -29,7 +29,7 @@
#include "oatpp/Types.hpp"
#include <random>
namespace oatpp { namespace utils { namespace random {
namespace oatpp { namespace utils {
/**
* Utility class for random values.
@ -53,6 +53,6 @@ public:
};
}}}
}}
#endif // oatpp_utils_Random_hpp

View File

@ -59,7 +59,7 @@ void Multipart::writeNextPartSimple(const std::shared_ptr<Part>& part) {
oatpp::String Multipart::generateRandomBoundary(v_int32 boundarySize) {
std::unique_ptr<v_char8[]> buffer(new v_char8[static_cast<unsigned long>(boundarySize)]);
utils::random::Random::randomBytes(buffer.get(), boundarySize);
utils::Random::randomBytes(buffer.get(), boundarySize);
return encoding::Base64::encode(buffer.get(), boundarySize, encoding::Base64::ALPHABET_BASE64_URL_SAFE);
}

View File

@ -38,7 +38,7 @@ void UrlTest::onRun(){
for(v_int32 i = 0; i < 100; i++) {
oatpp::String buff(100);
utils::random::Random::randomBytes(reinterpret_cast<p_char8>(buff->data()), static_cast<v_buff_size>(buff->size()));
utils::Random::randomBytes(reinterpret_cast<p_char8>(buff->data()), static_cast<v_buff_size>(buff->size()));
auto encoded = oatpp::encoding::Url::encode(buff, config);
auto decoded = oatpp::encoding::Url::decode(encoded);
OATPP_ASSERT(decoded == buff)
@ -51,7 +51,7 @@ void UrlTest::onRun(){
for(v_int32 i = 0; i < 100; i++) {
oatpp::String buff(100);
utils::random::Random::randomBytes(reinterpret_cast<p_char8>(buff->data()), static_cast<v_buff_size>(buff->size()));
utils::Random::randomBytes(reinterpret_cast<p_char8>(buff->data()), static_cast<v_buff_size>(buff->size()));
auto encoded = oatpp::encoding::Url::encode(buff, config);
auto decoded = oatpp::encoding::Url::decode(encoded);
OATPP_ASSERT(decoded == buff)