Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

core: move rand_util to googleurl #1128

Merged
merged 1 commit into from
Oct 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4093,21 +4093,16 @@ add_library(yass_core STATIC
src/core/safe_strerror.hpp
src/core/debug.cpp
src/core/debug.hpp
src/core/rand_util.cpp
src/core/rand_util.hpp
src/core/scoped_clear_last_error_win.cpp
)

if (WIN32)
target_sources(yass_core PRIVATE src/core/rand_util_win.cpp)
target_sources(yass_core PRIVATE src/core/utils_win.cpp)
elseif (APPLE)
target_sources(yass_core PRIVATE src/config/config_impl_apple.hpp)
target_sources(yass_core PRIVATE src/config/config_impl_apple.mm)
target_sources(yass_core PRIVATE src/core/rand_util_posix.cpp)
target_sources(yass_core PRIVATE src/core/utils_mac.mm)
else()
target_sources(yass_core PRIVATE src/core/rand_util_posix.cpp)
target_sources(yass_core PRIVATE src/core/utils_linux.cpp)
target_sources(yass_core PRIVATE src/core/utils_freebsd.cpp)
endif()
Expand Down
6 changes: 3 additions & 3 deletions src/cli/cli_connection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@

#include <absl/flags/flag.h>
#include <absl/strings/str_cat.h>
#include <base/rand_util.h>
#include <base/strings/string_util.h>

#include "config/config.hpp"
#include "core/rand_util.hpp"
#include "core/utils.hpp"
#include "net/asio.hpp"
#include "net/base64.hpp"
Expand Down Expand Up @@ -2246,9 +2246,9 @@ void CliConnection::connected() {
// originated from naive_proxy_delegate.go;func ServeHTTP
if (padding_support_) {
// Sends client-side padding header regardless of server support
std::string padding(RandInt(16, 32), '~');
std::string padding(gurl_base::RandInt(16, 32), '~');
InitializeNonindexCodes();
FillNonindexHeaderValue(RandUint64(), &padding[0], padding.size());
FillNonindexHeaderValue(gurl_base::RandUint64(), &padding[0], padding.size());
headers.emplace_back("padding"s, padding);
}
int submit_result = adapter_->SubmitRequest(GenerateHeaders(headers), std::move(data_frame), false, nullptr);
Expand Down
4 changes: 2 additions & 2 deletions src/config/config_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@

#include <absl/flags/flag.h>
#include <absl/strings/str_cat.h>
#include <base/rand_util.h>
#include <gmock/gmock.h>
#include <cstdlib>
#include "config/config_impl.hpp"
#include "core/process_utils.hpp"
#include "core/rand_util.hpp"
#include "core/utils_fs.hpp"

using namespace yass;
Expand All @@ -25,7 +25,7 @@ ABSL_FLAG(std::string, test_string, "", "Test string value");
class ConfigTest : public ::testing::Test {
public:
void SetUp() override {
key_prefix_ = absl::StrCat("pid_", GetPID(), "_run_", RandUint64());
key_prefix_ = absl::StrCat("pid_", GetPID(), "_run_", gurl_base::RandUint64());
#if !(defined(_WIN32) || defined(__APPLE__))
original_configfile_ = config::g_configfile;
const char* tmpdir = getenv("TMPDIR");
Expand Down
75 changes: 0 additions & 75 deletions src/core/rand_util.cpp

This file was deleted.

60 changes: 0 additions & 60 deletions src/core/rand_util.hpp

This file was deleted.

111 changes: 0 additions & 111 deletions src/core/rand_util_posix.cpp

This file was deleted.

65 changes: 0 additions & 65 deletions src/core/rand_util_win.cpp

This file was deleted.

Loading