#Cleanup: Consistently use `char* argv[]` instead of `char**`

PiperOrigin-RevId: 444782296
Change-Id: If8e7647be28f794392675ae001abbe9b809da0ac
pull/171/head
Christian Blichmann 2022-04-27 00:43:17 -07:00 committed by Copybara-Service
parent 30d42a381e
commit 6cbde854d6
37 changed files with 40 additions and 39 deletions

View File

@ -167,7 +167,7 @@ absl::Status GdalMain(std::string filename) {
return absl::OkStatus();
}
int main(int argc, char** argv) {
int main(int argc, char* argv[]) {
// The file to be converted should be specified in the first argument while
// running the program.
if (argc < 2) {

View File

@ -51,7 +51,7 @@ void Usage() {
} // namespace
int main(int argc, char** argv) {
int main(int argc, char* argv[]) {
if (argc < 3 || !sandbox2::file::IsAbsolutePath(argv[2])) {
Usage();
return EXIT_FAILURE;

View File

@ -44,7 +44,7 @@ void Usage() {
} // namespace
int main(int argc, const char** argv) {
int main(int argc, char* argv[]) {
int verbose = 0;
int quality = kDefaultJPEGQuality;
int memlimit_mb = kDefaultMemlimitMB;

View File

@ -38,7 +38,7 @@ static void PrintUsage() {
exit(EXIT_FAILURE);
}
int main(int unused_argc, const char** argv) {
int main(int unused_argc, char* argv[]) {
google::InitGoogleLogging(argv[0]);
const char* filename = nullptr;
int compress;

View File

@ -117,7 +117,7 @@
#define NO_GZIP_CREATE
#endif
int main(int unused_argc, const char** argv) {
int main(int unused_argc, char* argv[]) {
const char* filename = nullptr;
int compress;
int flags;

View File

@ -64,7 +64,7 @@ absl::Status LibPNGMain(const std::string& infile, const std::string& outfile) {
return absl::OkStatus();
}
int main(int argc, const char** argv) {
int main(int argc, char* argv[]) {
if (argc != 3) {
LOG(ERROR) << "usage: example input-file output-file";
return EXIT_FAILURE;

View File

@ -220,7 +220,7 @@ absl::Status LibPNGMain(const std::string& infile, const std::string& outfile) {
return absl::OkStatus();
}
int main(int argc, const char** argv) {
int main(int argc, char* argv[]) {
if (argc != 3) {
LOG(ERROR) << "Usage: example5 infile outfile";
return EXIT_FAILURE;

View File

@ -132,7 +132,7 @@ std::string GetFilePath(const std::string filename) {
} // namespace
int main(int argc, char** argv) {
int main(int argc, char* argv[]) {
gflags::ParseCommandLineFlags(&argc, &argv, true);
std::string srcfile;

View File

@ -205,7 +205,7 @@ absl::Status test_addition(sapi::Sandbox* sandbox, int a, int b, int c) {
} // namespace
int main(int argc, char** argv) {
int main(int argc, char* argv[]) {
gflags::ParseCommandLineFlags(&argc, &argv, true);
google::InitGoogleLogging(argv[0]);

View File

@ -37,7 +37,7 @@
#define Z_STREAM_ERROR (-2)
#define Z_STREAM_END 1
int main(int argc, char** argv) {
int main(int argc, char* argv[]) {
gflags::ParseCommandLineFlags(&argc, &argv, true);
google::InitGoogleLogging(argv[0]);

View File

@ -44,7 +44,7 @@ static uint32_t ComputeCRC4Impl(const uint8_t* ptr, uint64_t len) {
return crc4;
}
int main(int argc, char** argv) {
int main(int argc, char* argv[]) {
gflags::ParseCommandLineFlags(&argc, &argv, false);
// Set-up the sandbox2::Client object, using a file descriptor (1023).

View File

@ -87,7 +87,7 @@ bool SandboxedCRC4(sandbox2::Comms* comms, uint32_t* crc4) {
} // namespace
int main(int argc, char** argv) {
int main(int argc, char* argv[]) {
gflags::ParseCommandLineFlags(&argc, &argv, true);
google::InitGoogleLogging(argv[0]);

View File

@ -37,7 +37,7 @@ static int SandboxeeFunction(sandbox2::Comms* comms) {
return i;
}
int main(int argc, char** argv) {
int main(int argc, char* argv[]) {
// Writing to stderr limits the number of invoked syscalls.
gflags::SetCommandLineOptionWithMode("logtostderr", "true",
gflags::SET_FLAG_IF_DEFAULT);

View File

@ -92,7 +92,7 @@ static int SandboxIteration(sandbox2::ForkClient* fork_client, int32_t i) {
return result.reason_code();
}
int main(int argc, char** argv) {
int main(int argc, char* argv[]) {
gflags::ParseCommandLineFlags(&argc, &argv, true);
google::InitGoogleLogging(argv[0]);

View File

@ -60,7 +60,7 @@ static bool CommunicationTest(int sock) {
return true;
}
int main(int argc, char** argv) {
int main(int argc, char* argv[]) {
// Set-up the sandbox2::Client object, using a file descriptor (1023).
sandbox2::Comms comms(sandbox2::Comms::kSandbox2ClientCommsFD);
sandbox2::Client sandbox2_client(&comms);

View File

@ -162,7 +162,7 @@ bool HandleSandboxee(sandbox2::Comms* comms, int port) {
} // namespace
int main(int argc, char** argv) {
int main(int argc, char* argv[]) {
// This test is incompatible with sanitizers.
// The `SKIP_SANITIZERS_AND_COVERAGE` macro won't work for us here since we
// need to return something.

View File

@ -104,7 +104,7 @@ absl::StatusOr<int> ConnectToServer(int port) {
} // namespace
int main(int argc, char** argv) {
int main(int argc, char* argv[]) {
gflags::ParseCommandLineFlags(&argc, &argv, false);
// Set-up the sandbox2::Client object, using a file descriptor (1023).

View File

@ -112,7 +112,7 @@ void Server(int port) {
} // namespace
int main(int argc, char** argv) {
int main(int argc, char* argv[]) {
// This test is incompatible with sanitizers.
// The `SKIP_SANITIZERS_AND_COVERAGE` macro won't work for us here since we
// need to return something.

View File

@ -25,7 +25,7 @@
#include <cstddef>
#include <cstdio>
int main(int argc, char** argv) {
int main(int argc, char* argv[]) {
char buf[1024];
size_t total_bytes = 0U;

View File

@ -119,7 +119,7 @@ std::unique_ptr<sandbox2::Policy> GetPolicy() {
.BuildOrDie();
}
int main(int argc, char** argv) {
int main(int argc, char* argv[]) {
// This test is incompatible with sanitizers.
// The `SKIP_SANITIZERS_AND_COVERAGE` macro won't work for us here since we
// need to return something.

View File

@ -104,7 +104,7 @@ void OutputFD(int fd) {
} // namespace
int main(int argc, char** argv) {
int main(int argc, char* argv[]) {
gflags::ParseCommandLineFlags(&argc, &argv, true);
google::InitGoogleLogging(argv[0]);

View File

@ -71,7 +71,7 @@ std::unique_ptr<sandbox2::Policy> GetPolicy() {
} // namespace
int main(int argc, char** argv) {
int main(int argc, char* argv[]) {
gflags::ParseCommandLineFlags(&argc, &argv, true);
google::InitGoogleLogging(argv[0]);

View File

@ -19,7 +19,7 @@
#include "sandboxed_api/util/raw_logging.h"
int main(int argc, char** argv) {
int main(int argc, char* argv[]) {
SAPI_RAW_LOG(ERROR, "Raising SIGABRT");
abort();
return EXIT_SUCCESS; // Not reached

View File

@ -21,7 +21,7 @@
#include "sandboxed_api/sandbox2/buffer.h"
#include "sandboxed_api/sandbox2/comms.h"
int main(int argc, char** argv) {
int main(int argc, char* argv[]) {
if (argc != 2) {
absl::FPrintF(stderr, "argc != 2\n");
return EXIT_FAILURE;

View File

@ -23,7 +23,7 @@
#include <cstdlib>
#include <cstring>
int main(int argc, char** argv) {
int main(int argc, char* argv[]) {
if (argc < 2) {
printf("argc < 2\n");
return EXIT_FAILURE;

View File

@ -24,7 +24,7 @@
#include "sandboxed_api/sandbox2/comms.h"
#include "sandboxed_api/util/raw_logging.h"
int main(int argc, char** argv) {
int main(int argc, char* argv[]) {
if (argc < 2) {
printf("argc < 2\n");
return EXIT_FAILURE;

View File

@ -72,7 +72,7 @@ __attribute__((noinline)) int TestAllocaBigAboveLimit() {
return EXIT_FAILURE;
}
int main(int argc, char** argv) {
int main(int argc, char* argv[]) {
// Disable buffering.
setbuf(stdin, nullptr);
setbuf(stdout, nullptr);

View File

@ -15,7 +15,7 @@
// A binary doing nothing and returning 0 or 1.
// It is used to find the minimal syscall policy to allow.
int main(int argc, char** argv) {
int main(int argc, char* argv[]) {
if (argc <= 1) {
return 0;
}

View File

@ -20,7 +20,7 @@
#include <cstdint>
int main(int argc, char** argv) {
int main(int argc, char* argv[]) {
syscall(__NR_personality, uintptr_t{1}, uintptr_t{2}, uintptr_t{3},
uintptr_t{4}, uintptr_t{5}, uintptr_t{6});
return 22;

View File

@ -18,7 +18,7 @@
#include "sandboxed_api/sandbox2/comms.h"
#include "sandboxed_api/util/raw_logging.h"
int main(int argc, char** argv) {
int main(int argc, char* argv[]) {
sandbox2::Comms comms(sandbox2::Comms::kSandbox2ClientCommsFD);
// Exchange data with sandbox sandbox (parent) before sandboxing is enabled.

View File

@ -91,7 +91,7 @@ void TestIsatty() {
exit(EXIT_FAILURE);
}
int main(int argc, char** argv) {
int main(int argc, char* argv[]) {
// Disable buffering.
setbuf(stdin, nullptr);
setbuf(stdout, nullptr);

View File

@ -18,7 +18,7 @@
#include <cstdio>
int main(int argc, char** argv) {
int main(int argc, char* argv[]) {
for (int fd = 0; fd < 4096; fd++) {
if (fcntl(fd, F_GETFD) != -1) {
printf("%d\n", fd);

View File

@ -48,7 +48,7 @@ void TestOpenFd(int fd) {
}
}
int main(int argc, char** argv) {
int main(int argc, char* argv[]) {
// Disable caching.
setbuf(stdin, nullptr);
setbuf(stdout, nullptr);

View File

@ -14,7 +14,7 @@
#include <unistd.h>
int main(int argc, char** argv) {
int main(int argc, char* argv[]) {
sleep(10);
return 0;
}

View File

@ -65,7 +65,7 @@ void RunWritable() {
SAPI_RAW_PCHECK(execv(tmpname.c_str(), argv) == 0, "Executing copied binary");
}
int main(int argc, char** argv) {
int main(int argc, char* argv[]) {
if (argc < 2) {
printf("argc < 3\n");
return EXIT_FAILURE;

View File

@ -33,7 +33,7 @@ void* Sleepy(void*) {
}
}
int main(int argc, char** argv) {
int main(int argc, char* argv[]) {
pthread_t thread;
if (pthread_barrier_init(&g_barrier, nullptr, 2) < 0) {

View File

@ -103,9 +103,10 @@ GeneratorOptions GeneratorOptionsFromFlags(
return options;
}
absl::Status GeneratorMain(int argc, const char** argv) {
absl::Status GeneratorMain(int argc, char* argv[]) {
auto expected_opt_parser = OptionsParser::create(
argc, argv, *sapi::g_tool_category, llvm::cl::ZeroOrMore,
argc, const_cast<const char**>(argv), *sapi::g_tool_category,
llvm::cl::ZeroOrMore,
"Generates a Sandboxed API header for C/C++ translation units.");
if (!expected_opt_parser) {
return absl::InternalError(llvm::toString(expected_opt_parser.takeError()));
@ -149,7 +150,7 @@ absl::Status GeneratorMain(int argc, const char** argv) {
} // namespace sapi
int main(int argc, const char** argv) {
int main(int argc, char* argv[]) {
if (absl::Status status = sapi::GeneratorMain(argc, argv); !status.ok()) {
absl::FPrintF(stderr, "%s\n", status.message());
return EXIT_FAILURE;