remove default image in the example and rewrite usage

This commit is contained in:
Alexandra Latysheva 2020-10-30 12:36:42 +00:00
parent 2e2e0c741e
commit bfbb4f70c4
2 changed files with 6 additions and 13 deletions

View File

@ -16,8 +16,6 @@ add_executable(sandboxed
main_sandboxed.cc main_sandboxed.cc
../sandboxed.h ../sandboxed.h
../test/data.h ../test/data.h
../test/helper.h
../test/helper.cc
) )
target_link_libraries(sandboxed PRIVATE target_link_libraries(sandboxed PRIVATE

View File

@ -14,9 +14,8 @@
#include <cstdlib> #include <cstdlib>
#include "../sandboxed.h" // NOLINT(build/include) #include "../sandboxed.h" // NOLINT(build/include)
#include "../test/data.h" // NOLINT(build/include) #include "../test/data.h" // NOLINT(build/include)
#include "../test/helper.h" // NOLINT(build/include)
#include "absl/algorithm/container.h" #include "absl/algorithm/container.h"
#include "absl/strings/str_join.h" #include "absl/strings/str_join.h"
#include "sandboxed_api/sandbox2/util/fileops.h" #include "sandboxed_api/sandbox2/util/fileops.h"
@ -250,16 +249,12 @@ absl::Status LibTIFFMain(const std::string& srcfile) {
int main(int argc, char** argv) { int main(int argc, char** argv) {
gflags::ParseCommandLineFlags(&argc, &argv, true); gflags::ParseCommandLineFlags(&argc, &argv, true);
std::string srcfile; if (argc != 2) {
std::string srcfilerel = "quad-tile.jpg.tiff"; LOG(ERROR) << "usage: sandboxed input";
return EXIT_FAILURE;
if (argc < 2) {
srcfile = GetFilePath(srcfilerel);
} else {
srcfile = GetFilePath(argv[1], srcfilerel);
} }
absl::Status status = LibTIFFMain(srcfile); absl::Status status = LibTIFFMain(argv[1]);
if (!status.ok()) { if (!status.ok()) {
LOG(ERROR) << "LibTIFFMain failed with error:\n" LOG(ERROR) << "LibTIFFMain failed with error:\n"
<< status.ToString() << '\n'; << status.ToString() << '\n';