diff options
author | mdldml <mdldml@yandex-team.ru> | 2022-02-10 16:47:32 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:47:32 +0300 |
commit | c6c46dbbfbb6bf6153631790f5248c8cfd84e27a (patch) | |
tree | c6241637987789bb5da7b99f09054fdf8b8c0a19 | |
parent | 40d35c046ee3a61ee2a581f42499c5ce56ac589a (diff) | |
download | ydb-c6c46dbbfbb6bf6153631790f5248c8cfd84e27a.tar.gz |
Restoring authorship annotation for <mdldml@yandex-team.ru>. Commit 1 of 2.
3 files changed, 72 insertions, 72 deletions
diff --git a/build/ymake.core.conf b/build/ymake.core.conf index 081833998b..e04a73810f 100644 --- a/build/ymake.core.conf +++ b/build/ymake.core.conf @@ -5416,9 +5416,9 @@ macro ADD_COMPILABLE_TRANSLIT(TranslitTable, NGrams, Name, Options...) { __ngrams_table=${BINDIR}/ngr_arr_${__translitname_lower}.cpp __gentrie_dir=dict/tools/make_untranslit_trie - RUN_PROGRAM(${__gentrie_dir} -i ${TranslitTable} ${Options} ${__translitname_lower} IN ${TranslitTable} STDOUT ${__untranslit_table}) - RUN_PROGRAM(${__gentrie_dir} -i ${TranslitTable} -n ${Options} ${__translitname_lower} IN ${TranslitTable} STDOUT ${__translit_table}) - RUN_PROGRAM(dict/tools/make_ngrams -i ${NGrams} ${Options} ${__translitname_lower} IN ${NGrams} STDOUT ${__ngrams_table}) + RUN_PROGRAM(${__gentrie_dir} -i ${TranslitTable} ${Options} ${__translitname_lower} IN ${TranslitTable} STDOUT ${__untranslit_table}) + RUN_PROGRAM(${__gentrie_dir} -i ${TranslitTable} -n ${Options} ${__translitname_lower} IN ${TranslitTable} STDOUT ${__translit_table}) + RUN_PROGRAM(dict/tools/make_ngrams -i ${NGrams} ${Options} ${__translitname_lower} IN ${NGrams} STDOUT ${__ngrams_table}) } diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/command_line_interface.cc b/contrib/libs/protoc/src/google/protobuf/compiler/command_line_interface.cc index 7663ea0085..d78adb82d7 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/command_line_interface.cc +++ b/contrib/libs/protoc/src/google/protobuf/compiler/command_line_interface.cc @@ -1573,13 +1573,13 @@ CommandLineInterface::ParseArgumentStatus CommandLineInterface::ParseArguments( << std::endl; return PARSE_ARGUMENT_FAIL; } - if (mode_ != MODE_DECODE && mode_ != MODE_ENCODE && - (!encode_decode_input_.empty() || !encode_decode_output_.empty())) { - std::cerr << "--encode-decode-input and --encode-decode-output are used " - << "only together with --encode or --decode modes." - << std::endl; - return PARSE_ARGUMENT_FAIL; - } + if (mode_ != MODE_DECODE && mode_ != MODE_ENCODE && + (!encode_decode_input_.empty() || !encode_decode_output_.empty())) { + std::cerr << "--encode-decode-input and --encode-decode-output are used " + << "only together with --encode or --decode modes." + << std::endl; + return PARSE_ARGUMENT_FAIL; + } if (!dependency_out_name_.empty() && input_files_.size() > 1) { std::cerr << "Can only process one input file when using --dependency_out=FILE." @@ -1889,35 +1889,35 @@ CommandLineInterface::InterpretArgument(const TProtoStringType& name, codec_type_ = value; - } else if (name == "--encode-decode-input") { - if (!encode_decode_input_.empty()) { - std::cerr << name << " may only be passed once." << std::endl; - return PARSE_ARGUMENT_FAIL; - } - if (value.empty()) { - std::cerr << name << " requires a non-empty value." << std::endl; - return PARSE_ARGUMENT_FAIL; - } - if (access(value.c_str(), F_OK) < 0) { - std::cerr << value << ": encode/decode input file does not exist." - << std::endl; - return PARSE_ARGUMENT_FAIL; - } - - encode_decode_input_ = value; - - } else if (name == "--encode-decode-output") { - if (!encode_decode_output_.empty()) { - std::cerr << name << " may only be passed once." << std::endl; - return PARSE_ARGUMENT_FAIL; - } - if (value.empty()) { - std::cerr << name << " requires a non-empty value." << std::endl; - return PARSE_ARGUMENT_FAIL; - } - - encode_decode_output_ = value; - + } else if (name == "--encode-decode-input") { + if (!encode_decode_input_.empty()) { + std::cerr << name << " may only be passed once." << std::endl; + return PARSE_ARGUMENT_FAIL; + } + if (value.empty()) { + std::cerr << name << " requires a non-empty value." << std::endl; + return PARSE_ARGUMENT_FAIL; + } + if (access(value.c_str(), F_OK) < 0) { + std::cerr << value << ": encode/decode input file does not exist." + << std::endl; + return PARSE_ARGUMENT_FAIL; + } + + encode_decode_input_ = value; + + } else if (name == "--encode-decode-output") { + if (!encode_decode_output_.empty()) { + std::cerr << name << " may only be passed once." << std::endl; + return PARSE_ARGUMENT_FAIL; + } + if (value.empty()) { + std::cerr << name << " requires a non-empty value." << std::endl; + return PARSE_ARGUMENT_FAIL; + } + + encode_decode_output_ = value; + } else if (name == "--deterministic_output") { deterministic_output_ = true; @@ -2395,40 +2395,40 @@ bool CommandLineInterface::EncodeOrDecode(const DescriptorPool* pool) { DynamicMessageFactory dynamic_factory(pool); std::unique_ptr<Message> message(dynamic_factory.GetPrototype(type)->New()); - int in_fd = STDIN_FILENO; - if (!encode_decode_input_.empty()) { - do { - in_fd = open(encode_decode_input_.c_str(), O_RDONLY | O_BINARY); - } while (in_fd < 0 && errno == EINTR); - if (in_fd < 0) { - int error = errno; - std::cerr << encode_decode_input_ << ": " << strerror(error) << std::endl; - return false; - } - } - - int out_fd = STDOUT_FILENO; - if (!encode_decode_output_.empty()) { - do { - out_fd = open(encode_decode_output_.c_str(), O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0666); - } while (out_fd < 0 && errno == EINTR); - if (out_fd < 0) { - int error = errno; - std::cerr << encode_decode_output_ << ": " << strerror(error) << std::endl;; - return false; - } - } - + int in_fd = STDIN_FILENO; + if (!encode_decode_input_.empty()) { + do { + in_fd = open(encode_decode_input_.c_str(), O_RDONLY | O_BINARY); + } while (in_fd < 0 && errno == EINTR); + if (in_fd < 0) { + int error = errno; + std::cerr << encode_decode_input_ << ": " << strerror(error) << std::endl; + return false; + } + } + + int out_fd = STDOUT_FILENO; + if (!encode_decode_output_.empty()) { + do { + out_fd = open(encode_decode_output_.c_str(), O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0666); + } while (out_fd < 0 && errno == EINTR); + if (out_fd < 0) { + int error = errno; + std::cerr << encode_decode_output_ << ": " << strerror(error) << std::endl;; + return false; + } + } + if (mode_ == MODE_ENCODE) { - SetFdToTextMode(in_fd); - SetFdToBinaryMode(out_fd); + SetFdToTextMode(in_fd); + SetFdToBinaryMode(out_fd); } else { - SetFdToBinaryMode(in_fd); - SetFdToTextMode(out_fd); + SetFdToBinaryMode(in_fd); + SetFdToTextMode(out_fd); } - io::FileInputStream in(in_fd); - io::FileOutputStream out(out_fd); + io::FileInputStream in(in_fd); + io::FileOutputStream out(out_fd); if (mode_ == MODE_ENCODE) { // Input is text. diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/command_line_interface.h b/contrib/libs/protoc/src/google/protobuf/compiler/command_line_interface.h index 337475c693..3604723ecb 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/command_line_interface.h +++ b/contrib/libs/protoc/src/google/protobuf/compiler/command_line_interface.h @@ -379,11 +379,11 @@ class PROTOC_EXPORT CommandLineInterface { Mode mode_ = MODE_COMPILE; - // For encode end decode modes only: read from input and write to output - // instead of stdin and stdout. + // For encode end decode modes only: read from input and write to output + // instead of stdin and stdout. TProtoStringType encode_decode_input_; TProtoStringType encode_decode_output_; - + enum PrintMode { PRINT_NONE, // Not in MODE_PRINT PRINT_FREE_FIELDS, // --print_free_fields |