Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
# https://github.com/hedronvision/bazel-compile-commands-extractor
git_override(
module_name = "hedron_compile_commands",
# While waiting for
# https://github.com/hedronvision/bazel-compile-commands-extractor/pull/219
# to be merged.
commit = "f5fbd4cee671d8d908f37c83abaf70fba5928fc7",
remote = "https://github.com/mikael-s-persson/bazel-compile-commands-extractor",
# Upstream is unmaintained, see
# https://github.com/helly25/bazel-compile-commands-extractor/blob/1f9360db1834d115c48279d38a97f30d64d3fd4a/FORK.md
commit = "1f9360db1834d115c48279d38a97f30d64d3fd4a",
remote = "https://github.com/helly25/bazel-compile-commands-extractor.git",
)
9 changes: 1 addition & 8 deletions base/cvd/cuttlefish/host/commands/cvd/fetch/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ cf_cc_library(
"//cuttlefish/common/libs/utils:files",
"//cuttlefish/common/libs/utils:json",
"//cuttlefish/host/commands/cvd/fetch:build_api_flags",
"//cuttlefish/host/commands/cvd/fetch:credential_flags",
"//cuttlefish/host/libs/web:credential_source",
"//cuttlefish/host/libs/web/http_client",
"//cuttlefish/result",
"@abseil-cpp//absl/log",
"@jsoncpp",
],
)

Expand All @@ -59,7 +59,6 @@ cf_cc_library(
"//cuttlefish/host/libs/web:android_build_url",
"//cuttlefish/host/libs/web/cas:cas_flags",
"//cuttlefish/result",
"//libbase",
"@abseil-cpp//absl/strings",
],
)
Expand Down Expand Up @@ -127,9 +126,7 @@ cf_cc_library(
"//cuttlefish/common/libs/utils:environment",
"//cuttlefish/host/commands/cvd/fetch:build_api_credentials",
"//cuttlefish/host/commands/cvd/fetch:build_api_flags",
"//cuttlefish/host/commands/cvd/fetch:fetch_cvd_parser",
"//cuttlefish/host/libs/web:android_build_api",
"//cuttlefish/host/libs/web:android_build_api_key",
"//cuttlefish/host/libs/web:android_build_url",
"//cuttlefish/host/libs/web:build_api",
"//cuttlefish/host/libs/web:caching_build_api",
Expand Down Expand Up @@ -173,7 +170,6 @@ cf_cc_library(
srcs = ["fetch_context.cc"],
hdrs = ["fetch_context.h"],
deps = [
"//cuttlefish/common/libs/utils:archive",
"//cuttlefish/common/libs/utils:files",
"//cuttlefish/host/commands/cvd/fetch:builds",
"//cuttlefish/host/commands/cvd/fetch:de_android_sparse",
Expand All @@ -187,7 +183,6 @@ cf_cc_library(
"//cuttlefish/host/libs/web:build_api_zip",
"//cuttlefish/host/libs/zip:zip_file",
"//cuttlefish/host/libs/zip/libzip_cc:archive",
"//cuttlefish/posix:strerror",
"//cuttlefish/result",
"//libbase",
"@abseil-cpp//absl/strings",
Expand All @@ -214,7 +209,6 @@ cf_cc_library(
"//cuttlefish/host/commands/cvd/fetch:fetch_tracer",
"//cuttlefish/host/commands/cvd/fetch:host_package",
"//cuttlefish/host/commands/cvd/fetch:host_tools_target",
"//cuttlefish/host/commands/cvd/fetch:substitute",
"//cuttlefish/host/commands/cvd/fetch:target_directories",
"//cuttlefish/host/commands/cvd/utils:common",
"//cuttlefish/host/libs/config:fetcher_config",
Expand All @@ -226,7 +220,6 @@ cf_cc_library(
"//cuttlefish/host/libs/web:chrome_os_build_string",
"//cuttlefish/host/libs/web:luci_build_api",
"//cuttlefish/host/libs/web/http_client:curl_global_init",
"//cuttlefish/host/libs/zip:zip_string",
"//cuttlefish/host/libs/zip/libzip_cc:archive",
"//cuttlefish/io",
"//cuttlefish/io:string",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
#include <utility>

#include "absl/log/log.h"
#include "json/reader.h"
#include "json/value.h"

#include "cuttlefish/common/libs/utils/environment.h"
#include "cuttlefish/common/libs/utils/files.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
#include "cuttlefish/host/commands/cvd/fetch/build_api_flags.h"

#include <chrono>
#include <cstddef>
#include <string>
#include <vector>

Expand Down
1 change: 0 additions & 1 deletion base/cvd/cuttlefish/host/commands/cvd/fetch/downloaders.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#include "cuttlefish/common/libs/utils/environment.h"
#include "cuttlefish/host/commands/cvd/fetch/build_api_credentials.h"
#include "cuttlefish/host/commands/cvd/fetch/build_api_flags.h"
#include "cuttlefish/host/commands/cvd/fetch/fetch_cvd_parser.h"
#include "cuttlefish/host/libs/web/android_build_api.h"
#include "cuttlefish/host/libs/web/android_build_url.h"
#include "cuttlefish/host/libs/web/build_api.h"
Expand Down
2 changes: 1 addition & 1 deletion base/cvd/cuttlefish/host/commands/cvd/fetch/downloaders.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include <memory>
#include <string>

#include "cuttlefish/host/commands/cvd/fetch/fetch_cvd_parser.h"
#include "cuttlefish/host/commands/cvd/fetch/build_api_flags.h"
#include "cuttlefish/host/libs/web/build_api.h"
#include "cuttlefish/host/libs/web/luci_build_api.h"
#include "cuttlefish/result/result.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -400,8 +400,8 @@ void CallService::HandleHangup(const Client& client,
CommandParser cmd(command);
cmd.SkipPrefix();

std::string action(*cmd);
int n = std::stoi(action.substr(0, 1));
const std::string action(*cmd);
const int n = action.empty() ? -1 : (action[0] - '0');
int index = -1;
if (cmd->length() > 1) {
index = std::stoi(action.substr(1));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ void ChannelMonitor::AcceptIncomingConnection() {
}

void ChannelMonitor::ReadCommand(Client& client) {
std::vector<char> buffer(kMaxCommandLength);
auto bytes_read = client.client_read_fd_->Read(buffer.data(), buffer.size());
char buffer[kMaxCommandLength];
auto bytes_read = client.client_read_fd_->Read(buffer, kMaxCommandLength);
if (bytes_read <= 0) {
if (errno == EAGAIN && client.type == Client::REMOTE &&
client.first_read_command_) {
Expand All @@ -105,13 +105,9 @@ void ChannelMonitor::ReadCommand(Client& client) {
return;
}

std::string& incomplete_command = client.incomplete_command;

// Add the incomplete command from the last read
auto commands = std::string{incomplete_command.data()};
commands.append(buffer.data());

incomplete_command.clear();
std::string commands(std::move(client.incomplete_command));
commands.append(buffer, bytes_read);

// Replacing '\n' with '\r'
absl::StrReplaceAll({{"\n", "\r"}}, &commands);
Expand All @@ -132,8 +128,8 @@ void ChannelMonitor::ReadCommand(Client& client) {
}
pos = r_pos + 1; // Skip '\r'
} else if (pos < commands.length()) { // Incomplete command
incomplete_command = commands.substr(pos);
VLOG(1) << "incomplete command: " << incomplete_command;
client.incomplete_command = commands.substr(pos);
VLOG(1) << "incomplete command: " << client.incomplete_command;
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,13 @@ CommandHandler::CommandHandler(const std::string& command, p_func handler)
p_command_handler(handler) {}

int CommandHandler::Compare(const std::string& command) const {
int result = -1;
if (match_mode == PARTIAL_MATCH) {
result =
command.compare(2, command_prefix.size(), command_prefix); // skip "AT"
} else {
result = command.compare(2, command.size(), command_prefix);
if (command.size() < 2) { // the "AT" prefix
return -1;
}
return result;

return (match_mode == PARTIAL_MATCH)
? command.compare(2, command_prefix.size(), command_prefix)
: command.compare(2, command.size(), command_prefix);
}

void CommandHandler::HandleCommand(const Client& client,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ void SmsService::HandleSendSMSPDU(const Client& client, std::string& command) {
thread_looper_->Post(
makeSafeCallback<SmsService>(
this,
[&sms_pdu](SmsService* me) { me->HandleReceiveSMS(sms_pdu); }),
[sms_pdu](SmsService* me) { me->HandleReceiveSMS(sms_pdu); }),
std::chrono::seconds(1));
} else { // Send SMS to remote host port
SendSmsToRemote(remote_host_port, sms_pdu);
Expand Down
Loading
Loading