From fca3456c45c404bdc233852e0568acccb9c49be9 Mon Sep 17 00:00:00 2001 From: Corentin Le Molgat Date: Thu, 3 Mar 2022 14:08:37 +0100 Subject: [PATCH] Sync from Google --- bazel/README.md | 4 + ortools/algorithms/knapsack_solver.h | 4 +- ortools/base/file.cc | 12 +-- ortools/base/int_type.h | 6 +- ortools/base/jniutil.h | 6 +- ortools/base/logging.cc | 98 +++++++++---------- ortools/base/logging_utilities.cc | 14 +-- ortools/base/python-swig.h | 8 +- ortools/base/threadpool.cc | 2 +- ortools/base/vlog_is_on.cc | 12 +-- .../csharp/constraint_solver.i | 2 +- ortools/graph/flow_problem.proto | 4 +- ortools/java/README.md | 2 +- tools/docker/README.md | 2 +- tools/release/build_delivery_mac.sh | 2 +- 15 files changed, 91 insertions(+), 87 deletions(-) diff --git a/bazel/README.md b/bazel/README.md index 360ff31044..cc6dcb04a0 100644 --- a/bazel/README.md +++ b/bazel/README.md @@ -57,10 +57,12 @@ OR-Tools depends on several mandatory libraries. You must compile OR-Tools using C++20: * on UNIX: + ```sh bazel build --cxxopt=-std=c++20 //...:all ``` * on Windows when using MSVC: + ```sh bazel build --cxxopt="-std:c++20" //...:all ``` @@ -70,10 +72,12 @@ You must compile OR-Tools using C++20: You may run tests using: * on UNIX: + ```sh bazel test --cxxopt=-std=c++20 //...:all ``` * on Windows when using MSVC: + ```sh bazel test --cxxopt="-std:c++20" //...:all ``` diff --git a/ortools/algorithms/knapsack_solver.h b/ortools/algorithms/knapsack_solver.h index b85ffe47ba..063de76c89 100644 --- a/ortools/algorithms/knapsack_solver.h +++ b/ortools/algorithms/knapsack_solver.h @@ -289,8 +289,8 @@ class KnapsackSolver { // TODO(user): Add a new propagator class used as a guide when the problem has // several dimensions. -// ----- KnapsackAssignement ----- -// KnapsackAssignement is a small struct used to pair an item with its +// ----- KnapsackAssignment ----- +// KnapsackAssignment is a small struct used to pair an item with its // assignment. It is mainly used for search nodes and updates. struct KnapsackAssignment { KnapsackAssignment(int _item_id, bool _is_in) diff --git a/ortools/base/file.cc b/ortools/base/file.cc index 69766d0f16..6c21376807 100644 --- a/ortools/base/file.cc +++ b/ortools/base/file.cc @@ -47,7 +47,7 @@ bool File::Flush() { return fflush(f_) == 0; } bool File::Close() { if (fclose(f_) == 0) { - f_ = NULL; + f_ = nullptr; return true; } else { return false; @@ -80,7 +80,7 @@ size_t File::Write(const void* const buf, size_t size) { File* File::OpenOrDie(const char* const name, const char* const flag) { FILE* const f_des = fopen(name, flag); - if (f_des == NULL) { + if (f_des == nullptr) { std::cerr << "Cannot open " << name; exit(1); } @@ -90,7 +90,7 @@ File* File::OpenOrDie(const char* const name, const char* const flag) { File* File::Open(const char* const name, const char* const flag) { FILE* const f_des = fopen(name, flag); - if (f_des == NULL) return NULL; + if (f_des == nullptr) return nullptr; File* const f = new File(f_des, name); return f; } @@ -134,7 +134,7 @@ bool File::WriteLine(const std::string& line) { absl::string_view File::filename() const { return name_; } -bool File::Open() const { return f_ != NULL; } +bool File::Open() const { return f_ != nullptr; } void File::Init() {} @@ -164,7 +164,7 @@ absl::Status GetContents(const absl::string_view& filename, std::string* output, int flags) { if (flags == Defaults()) { File* file = File::Open(filename, "r"); - if (file != NULL) { + if (file != nullptr) { const int64_t size = file->Size(); if (file->ReadToString(output, size) == size) return absl::OkStatus(); #if defined(_MSC_VER) @@ -183,7 +183,7 @@ absl::Status GetContents(const absl::string_view& filename, std::string* output, absl::Status WriteString(File* file, const absl::string_view& contents, int flags) { - if (flags == Defaults() && file != NULL && + if (flags == Defaults() && file != nullptr && file->Write(contents.data(), contents.size()) == contents.size() && file->Close()) { return absl::OkStatus(); diff --git a/ortools/base/int_type.h b/ortools/base/int_type.h index 07d51b9b34..a998ba49cd 100644 --- a/ortools/base/int_type.h +++ b/ortools/base/int_type.h @@ -174,9 +174,9 @@ class IntType; // operators. // // The template parameter IntTypeName defines the name for the int type and must -// be unique within a binary (the convenient DEFINE_INT_TYPE macro at the end of -// the file generates a unique IntTypeName). The parameter ValueType defines -// the integer type value (see supported list above). +// be unique within a binary (the convenient DEFINE_INT_TYPE macro at the +// end of the file generates a unique IntTypeName). The parameter ValueType +// defines the integer type value (see supported list above). // // This class is NOT thread-safe. template diff --git a/ortools/base/jniutil.h b/ortools/base/jniutil.h index c28e60c2e8..e90c9dc569 100644 --- a/ortools/base/jniutil.h +++ b/ortools/base/jniutil.h @@ -25,16 +25,16 @@ class JNIUtil { // Creates a Java jstring from a null-terminated UTF-8 encoded C String. // The caller must delete the jstring reference. static jstring MakeJString(JNIEnv* env, const char* cstr) { - if (cstr == NULL) return NULL; + if (cstr == nullptr) return nullptr; return env->NewStringUTF(cstr); } // Creates a null-terminated UTF-8 encoded C string from a jstring. // The returned string should be "delete[]"-ed when no longer needed. static char* MakeCString(JNIEnv* env, jstring str) { - if (str == NULL) return NULL; + if (str == nullptr) return nullptr; jsize length = env->GetStringUTFLength(str); - const char* src = env->GetStringUTFChars(str, NULL); + const char* src = env->GetStringUTFChars(str, nullptr); char* dst = new char[length + 1]; memcpy(dst, src, length); dst[length] = '\0'; diff --git a/ortools/base/logging.cc b/ortools/base/logging.cc index 57865d539e..3a5cdb6924 100644 --- a/ortools/base/logging.cc +++ b/ortools/base/logging.cc @@ -141,11 +141,11 @@ ABSL_FLAG(int, logbufsecs, 30, static const char* DefaultLogDir() { const char* env; env = getenv("GOOGLE_LOG_DIR"); - if (env != NULL && env[0] != '\0') { + if (env != nullptr && env[0] != '\0') { return env; } env = getenv("TEST_TMPDIR"); - if (env != NULL && env[0] != '\0') { + if (env != nullptr && env[0] != '\0') { return env; } return ""; @@ -229,7 +229,7 @@ static bool TerminalSupportsColor() { #else // On non-Windows platforms, we rely on the TERM variable. const char* const term = getenv("TERM"); - if (term != NULL && term[0] != '\0') { + if (term != nullptr && term[0] != '\0') { term_supports_color = !strcmp(term, "xterm") || !strcmp(term, "xterm-color") || !strcmp(term, "xterm-256color") || !strcmp(term, "screen-256color") || @@ -296,7 +296,7 @@ static const char* GetAnsiColorCode(GLogColor color) { case COLOR_DEFAULT: return ""; } - return NULL; // stop warning about return type. + return nullptr; // stop warning about return type. } #endif // !_MSC_VER @@ -323,9 +323,9 @@ struct LogMessage::LogMessageData { int line_; // line number where logging call is. void (LogMessage::*send_method_)(); // Call this in destructor to send union { // At most one of these is used: union to keep the size low. - LogSink* sink_; // NULL or sink to send message to - std::vector* outvec_; // NULL or vector to push message onto - std::string* message_; // NULL or string to write message into + LogSink* sink_; // null or sink to send message to + std::vector* outvec_; // null or vector to push message onto + std::string* message_; // null or string to write message into }; time_t timestamp_; // Time of creation of LogMessage struct ::tm tm_time_; // Time of creation of LogMessage @@ -509,7 +509,7 @@ class LogDestination { string LogDestination::addresses_; // NOLINT string LogDestination::hostname_; // NOLINT -vector* LogDestination::sinks_ = NULL; +vector* LogDestination::sinks_ = nullptr; absl::Mutex LogDestination::sink_mutex_; bool LogDestination::terminal_supports_color_ = TerminalSupportsColor(); @@ -532,7 +532,7 @@ inline void LogDestination::FlushLogFilesUnsafe(int min_severity) { // about it for (int i = min_severity; i < NUM_SEVERITIES; i++) { LogDestination* log = log_destinations_[i]; - if (log != NULL) { + if (log != nullptr) { // Flush the base fileobject_ logger directly instead of going // through any wrappers to reduce chance of deadlock. log->fileobject_.FlushUnlocked(); @@ -546,7 +546,7 @@ inline void LogDestination::FlushLogFiles(int min_severity) { absl::MutexLock l(&log_mutex); for (int i = min_severity; i < NUM_SEVERITIES; i++) { LogDestination* log = log_destination(i); - if (log != NULL) { + if (log != nullptr) { log->logger_->Flush(); } } @@ -719,7 +719,7 @@ inline void LogDestination::WaitForSinks(LogMessage::LogMessageData* data) { const bool send_to_sink = (data->send_method_ == &LogMessage::SendToSink) || (data->send_method_ == &LogMessage::SendToSinkAndLog); - if (send_to_sink && data->sink_ != NULL) { + if (send_to_sink && data->sink_ != nullptr) { data->sink_->WaitTillSent(); } } @@ -729,7 +729,7 @@ LogDestination* LogDestination::log_destinations_[NUM_SEVERITIES]; inline LogDestination* LogDestination::log_destination(LogSeverity severity) { assert(severity >= 0 && severity < NUM_SEVERITIES); if (!log_destinations_[severity]) { - log_destinations_[severity] = new LogDestination(severity, NULL); + log_destinations_[severity] = new LogDestination(severity, nullptr); } return log_destinations_[severity]; } @@ -737,21 +737,21 @@ inline LogDestination* LogDestination::log_destination(LogSeverity severity) { void LogDestination::DeleteLogDestinations() { for (int severity = 0; severity < NUM_SEVERITIES; ++severity) { delete log_destinations_[severity]; - log_destinations_[severity] = NULL; + log_destinations_[severity] = nullptr; } absl::MutexLock l(&sink_mutex_); delete sinks_; - sinks_ = NULL; + sinks_ = nullptr; } namespace { LogFileObject::LogFileObject(LogSeverity severity, const char* base_filename) - : base_filename_selected_(base_filename != NULL), - base_filename_((base_filename != NULL) ? base_filename : ""), + : base_filename_selected_(base_filename != nullptr), + base_filename_((base_filename != nullptr) ? base_filename : ""), symlink_basename_(logging_internal::ProgramInvocationShortName()), filename_extension_(), - file_(NULL), + file_(nullptr), severity_(severity), bytes_since_flush_(0), dropped_mem_length_(0), @@ -764,9 +764,9 @@ LogFileObject::LogFileObject(LogSeverity severity, const char* base_filename) LogFileObject::~LogFileObject() { absl::MutexLock l(&lock_); - if (file_ != NULL) { + if (file_ != nullptr) { fclose(file_); - file_ = NULL; + file_ = nullptr; } } @@ -775,9 +775,9 @@ void LogFileObject::SetBasename(const char* basename) { base_filename_selected_ = true; if (base_filename_ != basename) { // Get rid of old log file since we are changing names - if (file_ != NULL) { + if (file_ != nullptr) { fclose(file_); - file_ = NULL; + file_ = nullptr; rollover_attempt_ = kRolloverAttemptFrequency - 1; } base_filename_ = basename; @@ -788,9 +788,9 @@ void LogFileObject::SetExtension(const char* ext) { absl::MutexLock l(&lock_); if (filename_extension_ != ext) { // Get rid of old log file since we are changing names - if (file_ != NULL) { + if (file_ != nullptr) { fclose(file_); - file_ = NULL; + file_ = nullptr; rollover_attempt_ = kRolloverAttemptFrequency - 1; } filename_extension_ = ext; @@ -808,7 +808,7 @@ void LogFileObject::Flush() { } void LogFileObject::FlushUnlocked() { - if (file_ != NULL) { + if (file_ != nullptr) { fflush(file_); bytes_since_flush_ = 0; } @@ -832,7 +832,7 @@ bool LogFileObject::CreateLogfile(const string& time_pid_string) { #endif file_ = fdopen(fd, "a"); // Make a FILE*. - if (file_ == NULL) { // Man, we're screwed! + if (file_ == nullptr) { // Man, we're screwed! close(fd); unlink(filename); // Erase the half-baked evidence: an unusable log file return false; @@ -888,14 +888,14 @@ void LogFileObject::Write(bool force_flush, time_t timestamp, } if (static_cast(file_length_ >> 20) >= MaxLogSize()) { - if (file_ != NULL) fclose(file_); - file_ = NULL; + if (file_ != nullptr) fclose(file_); + file_ = nullptr; file_length_ = bytes_since_flush_ = dropped_mem_length_ = 0; rollover_attempt_ = kRolloverAttemptFrequency - 1; } // If there's no destination file, make one before outputting - if (file_ == NULL) { + if (file_ == nullptr) { // Try to rollover the log file every 32 log messages. The only time // this could matter would be when we have trouble creating the log // file. If that happens, we'll lose lots of log messages, of course! @@ -1065,52 +1065,52 @@ LogMessage::LogMessageData::LogMessageData() LogMessage::LogMessage(const char* file, int line, LogSeverity severity, int ctr, void (LogMessage::*send_method)()) - : allocated_(NULL) { + : allocated_(nullptr) { Init(file, line, severity, send_method); data_->stream_.set_ctr(ctr); } LogMessage::LogMessage(const char* file, int line, const CheckOpString& result) - : allocated_(NULL) { + : allocated_(nullptr) { Init(file, line, GLOG_FATAL, &LogMessage::SendToLog); stream() << "Check failed: " << (*result.str_) << " "; } -LogMessage::LogMessage(const char* file, int line) : allocated_(NULL) { +LogMessage::LogMessage(const char* file, int line) : allocated_(nullptr) { Init(file, line, GLOG_INFO, &LogMessage::SendToLog); } LogMessage::LogMessage(const char* file, int line, LogSeverity severity) - : allocated_(NULL) { + : allocated_(nullptr) { Init(file, line, severity, &LogMessage::SendToLog); } LogMessage::LogMessage(const char* file, int line, LogSeverity severity, LogSink* sink, bool also_send_to_log) - : allocated_(NULL) { + : allocated_(nullptr) { Init(file, line, severity, also_send_to_log ? &LogMessage::SendToSinkAndLog : &LogMessage::SendToSink); - data_->sink_ = sink; // override Init()'s setting to NULL + data_->sink_ = sink; // override Init()'s setting to null } LogMessage::LogMessage(const char* file, int line, LogSeverity severity, vector* outvec) - : allocated_(NULL) { + : allocated_(nullptr) { Init(file, line, severity, &LogMessage::SaveOrSendToLog); - data_->outvec_ = outvec; // override Init()'s setting to NULL + data_->outvec_ = outvec; // override Init()'s setting to null } LogMessage::LogMessage(const char* file, int line, LogSeverity severity, string* message) - : allocated_(NULL) { + : allocated_(nullptr) { Init(file, line, severity, &LogMessage::WriteToStringAndLog); - data_->message_ = message; // override Init()'s setting to NULL + data_->message_ = message; // override Init()'s setting to null } void LogMessage::Init(const char* file, int line, LogSeverity severity, void (LogMessage::*send_method)()) { - allocated_ = NULL; + allocated_ = nullptr; if (severity != GLOG_FATAL || !exit_on_dfatal) { // No need for locking, because this is thread local. if (thread_data_available) { @@ -1138,8 +1138,8 @@ void LogMessage::Init(const char* file, int line, LogSeverity severity, data_->severity_ = severity; data_->line_ = line; data_->send_method_ = send_method; - data_->sink_ = NULL; - data_->outvec_ = NULL; + data_->sink_ = nullptr; + data_->outvec_ = nullptr; timespec now_ts = absl::ToTimespec(absl::Now()); data_->timestamp_ = now_ts.tv_sec; localtime_r(&data_->timestamp_, &data_->tm_time_); @@ -1394,7 +1394,7 @@ void LogMessage::Fail() { g_logging_fail_func(); } // L >= log_mutex (callers must hold the log_mutex). void LogMessage::SendToSink() EXCLUSIVE_LOCKS_REQUIRED(log_mutex) { - if (data_->sink_ != NULL) { + if (data_->sink_ != nullptr) { RAW_DCHECK(data_->num_chars_to_log_ > 0 && data_->message_text_[data_->num_chars_to_log_ - 1] == '\n', ""); @@ -1413,7 +1413,7 @@ void LogMessage::SendToSinkAndLog() EXCLUSIVE_LOCKS_REQUIRED(log_mutex) { // L >= log_mutex (callers must hold the log_mutex). void LogMessage::SaveOrSendToLog() EXCLUSIVE_LOCKS_REQUIRED(log_mutex) { - if (data_->outvec_ != NULL) { + if (data_->outvec_ != nullptr) { RAW_DCHECK(data_->num_chars_to_log_ > 0 && data_->message_text_[data_->num_chars_to_log_ - 1] == '\n', ""); @@ -1427,7 +1427,7 @@ void LogMessage::SaveOrSendToLog() EXCLUSIVE_LOCKS_REQUIRED(log_mutex) { } void LogMessage::WriteToStringAndLog() EXCLUSIVE_LOCKS_REQUIRED(log_mutex) { - if (data_->message_ != NULL) { + if (data_->message_ != nullptr) { RAW_DCHECK(data_->num_chars_to_log_ > 0 && data_->message_text_[data_->num_chars_to_log_ - 1] == '\n', ""); @@ -1682,7 +1682,7 @@ static vector* logging_directories_list; const vector& GetLoggingDirectories() { // Not strictly thread-safe but we're called early in InitGoogle(). - if (logging_directories_list == NULL) { + if (logging_directories_list == nullptr) { logging_directories_list = new vector; if (!absl::GetFlag(FLAGS_log_dir).empty()) { @@ -1708,7 +1708,7 @@ void TestOnly_ClearLoggingDirectoriesList() { "TestOnly_ClearLoggingDirectoriesList should only be " "called from test code.\n"); delete logging_directories_list; - logging_directories_list = NULL; + logging_directories_list = nullptr; } void GetExistingTempDirectories(vector* list) { @@ -1731,7 +1731,7 @@ void GetExistingTempDirectories(vector* list) { const char* names) { \ bool equal = s1 == s2 || (s1 && s2 && !func(s1, s2)); \ if (equal == expected) { \ - return NULL; \ + return nullptr; \ } else { \ ostringstream ss; \ if (!s1) s1 = ""; \ @@ -1748,7 +1748,7 @@ DEFINE_CHECK_STROP_IMPL(CHECK_STRCASENE, strcasecmp, false) int posix_strerror_r(int err, char* buf, size_t len) { // Sanity check input parameters - if (buf == NULL || len <= 0) { + if (buf == nullptr || len <= 0) { errno = EINVAL; return -1; } @@ -1878,7 +1878,7 @@ void ShutdownGoogleLogging() { logging_internal::ShutdownGoogleLoggingUtilities(); LogDestination::DeleteLogDestinations(); delete logging_directories_list; - logging_directories_list = NULL; + logging_directories_list = nullptr; } } // namespace google diff --git a/ortools/base/logging_utilities.cc b/ortools/base/logging_utilities.cc index e5c6cba63b..f5c4e68f07 100644 --- a/ortools/base/logging_utilities.cc +++ b/ortools/base/logging_utilities.cc @@ -132,7 +132,7 @@ inline char* strerror_r(int errnum, char* buf, size_t buflen) { namespace google { -static const char* g_program_invocation_short_name = NULL; +static const char* g_program_invocation_short_name = nullptr; static pthread_t g_main_thread_id; } // namespace google @@ -205,14 +205,14 @@ static void DumpStackTrace(int skip_count, DebugWriter* writerfn, void* arg) { } static void DumpStackTraceAndExit() { - DumpStackTrace(1, DebugWriteToStderr, NULL); + DumpStackTrace(1, DebugWriteToStderr, nullptr); abort(); } namespace logging_internal { const char* ProgramInvocationShortName() { - if (g_program_invocation_short_name != NULL) { + if (g_program_invocation_short_name != nullptr) { return g_program_invocation_short_name; } else { // TODO(user): Use /proc/self/cmdline and so? @@ -221,7 +221,7 @@ const char* ProgramInvocationShortName() { } bool IsGoogleLoggingInitialized() { - return g_program_invocation_short_name != NULL; + return g_program_invocation_short_name != nullptr; } unsigned int GetTID() { @@ -251,12 +251,12 @@ static void MyUserNameInitializer() { #else const char* user = getenv("USER"); #endif - if (user != NULL) { + if (user != nullptr) { g_my_user_name = user; } else { #if !defined(_MSC_VER) // Not windows. struct passwd pwd; - struct passwd* result = NULL; + struct passwd* result = nullptr; char buffer[1024] = {'\0'}; uid_t uid = geteuid(); int pwuid_res = getpwuid_r(uid, &pwd, buffer, sizeof(buffer), &result); @@ -318,7 +318,7 @@ void ShutdownGoogleLoggingUtilities() { CHECK(IsGoogleLoggingInitialized()) << "You called ShutdownGoogleLogging() without calling " "InitGoogleLogging() first!"; - g_program_invocation_short_name = NULL; + g_program_invocation_short_name = nullptr; #if !defined(_MSC_VER) closelog(); #endif // !defined(_MSC_VER) diff --git a/ortools/base/python-swig.h b/ortools/base/python-swig.h index a57679d132..4572887ca4 100644 --- a/ortools/base/python-swig.h +++ b/ortools/base/python-swig.h @@ -44,7 +44,7 @@ static inline int PyString_AsStringAndSize(PyObject* obj, char** buf, Py_ssize_t* psize) { if (PyUnicode_Check(obj)) { *buf = const_cast(PyUnicode_AsUTF8AndSize(obj, psize)); - return *buf == NULL ? -1 : 0; + return *buf == nullptr ? -1 : 0; } else if (PyBytes_Check(obj)) { return PyBytes_AsStringAndSize(obj, buf, psize); } @@ -300,15 +300,15 @@ inline bool vector_input_wrap_helper(PyObject* seq, std::vector* out, // into the corresponding Python object. template inline PyObject* list_output_helper(const T* vec, Converter converter) { - if (vec == NULL) Py_RETURN_NONE; // Return a nice out-of-band value. + if (vec == nullptr) Py_RETURN_NONE; // Return a nice out-of-band value. PyObject* lst = PyList_New(vec->size()); - if (lst == NULL) return NULL; + if (lst == nullptr) return nullptr; int i = 0; for (typename T::const_reference pt : *vec) { PyObject* obj = converter(pt); if (!obj) { Py_DECREF(lst); - return NULL; + return nullptr; } PyList_SET_ITEM(lst, i++, obj); } diff --git a/ortools/base/threadpool.cc b/ortools/base/threadpool.cc index 7b393c7e02..692fd4a80c 100644 --- a/ortools/base/threadpool.cc +++ b/ortools/base/threadpool.cc @@ -19,7 +19,7 @@ namespace operations_research { void RunWorker(void* data) { ThreadPool* const thread_pool = reinterpret_cast(data); std::function work = thread_pool->GetNextTask(); - while (work != NULL) { + while (work != nullptr) { work(); work = thread_pool->GetNextTask(); } diff --git a/ortools/base/vlog_is_on.cc b/ortools/base/vlog_is_on.cc index 5ac3a1077e..a9b8fbf045 100644 --- a/ortools/base/vlog_is_on.cc +++ b/ortools/base/vlog_is_on.cc @@ -116,9 +116,9 @@ static void VLOG2Initializer() { const std::string vmodule_flag = absl::GetFlag(FLAGS_vmodule); const char* vmodule = vmodule_flag.c_str(); const char* sep; - VModuleInfo* head = NULL; - VModuleInfo* tail = NULL; - while ((sep = strchr(vmodule, '=')) != NULL) { + VModuleInfo* head = nullptr; + VModuleInfo* tail = nullptr; + while ((sep = strchr(vmodule, '=')) != nullptr) { std::string pattern(vmodule, sep - vmodule); int module_level; if (sscanf(sep, "=%d", &module_level) == 1) { @@ -133,7 +133,7 @@ static void VLOG2Initializer() { } // Skip past this entry vmodule = strchr(sep, ','); - if (vmodule == NULL) break; + if (vmodule == nullptr) break; vmodule++; // Skip past "," } if (head) { // Put them into the list at the head: @@ -150,7 +150,7 @@ int SetVLOGLevel(const char* module_pattern, int log_level) { bool found = false; { absl::MutexLock l(&vmodule_lock); // protect whole read-modify-write - for (const VModuleInfo* info = vmodule_list; info != NULL; + for (const VModuleInfo* info = vmodule_list; info != nullptr; info = info->next) { if (info->module_pattern == module_pattern) { if (!found) { @@ -210,7 +210,7 @@ bool InitVLOG3__(int32_t** vmodule_info, bool* initialized, const char* fname, // find target in vector of modules, replace site_flag_value with // a module-specific verbose level, if any. - for (const VModuleInfo* info = vmodule_list; info != NULL; + for (const VModuleInfo* info = vmodule_list; info != nullptr; info = info->next) { if (SafeFNMatch_(info->module_pattern.c_str(), info->module_pattern.size(), base, base_length)) { diff --git a/ortools/constraint_solver/csharp/constraint_solver.i b/ortools/constraint_solver/csharp/constraint_solver.i index e406a86d69..81d276788d 100644 --- a/ortools/constraint_solver/csharp/constraint_solver.i +++ b/ortools/constraint_solver/csharp/constraint_solver.i @@ -966,7 +966,7 @@ PROTO2_RETURN(operations_research::CpModel, namespace operations_research { // Globals -// IMPORTANT(user): Global will be placed in operations_research_constraint_solver.cs +// IMPORTANT(corentinl): Global will be placed in operations_research_constraint_solver.cs // Ignored: %ignore FillValues; } // namespace operations_research diff --git a/ortools/graph/flow_problem.proto b/ortools/graph/flow_problem.proto index 327694e401..b0cdff18f1 100644 --- a/ortools/graph/flow_problem.proto +++ b/ortools/graph/flow_problem.proto @@ -35,12 +35,12 @@ syntax = "proto2"; +package operations_research; + option java_package = "com.google.ortools.graph"; option java_multiple_files = true; option csharp_namespace = "Google.OrTools.Graph"; -package operations_research; - message FlowArcProto { // A directed arc goes from a tail node to a head node. // Node ids must be non-negative (>= 0). diff --git a/ortools/java/README.md b/ortools/java/README.md index c3022ee7d4..14e8b72a84 100644 --- a/ortools/java/README.md +++ b/ortools/java/README.md @@ -249,4 +249,4 @@ Image has been generated using [plantuml](http://plantuml.com/): ```bash plantuml -Tsvg docs/{file}.dot ``` -So you can find the dot source files in [doc](doc). +So you can find the dot source files in [docs](docs). diff --git a/tools/docker/README.md b/tools/docker/README.md index 332405bdeb..5b0954c8c7 100644 --- a/tools/docker/README.md +++ b/tools/docker/README.md @@ -38,7 +38,7 @@ make alpine-edge_test Dockerfile is split in several stages. -![docker](doc/deps.svg) +![docker](docs/deps.svg) ### Docker aarch64 on x86_64 machine diff --git a/tools/release/build_delivery_mac.sh b/tools/release/build_delivery_mac.sh index 382963050d..a2d5f20d6c 100755 --- a/tools/release/build_delivery_mac.sh +++ b/tools/release/build_delivery_mac.sh @@ -277,7 +277,7 @@ function build_python() { echo "DONE" | tee -a build.log PY_PATH="/Library/Frameworks/Python.framework/Versions/$i" - if [ ! -d "$PY_PATH" ]; then + if [[ ! -d "$PY_PATH" ]]; then echo "Error: Python $i is not found (${PY_PATH})." | tee -a build.log exit 1 fi