Add missing #include to fix the OPK Linux build

Merged from https://widevine-internal-review.googlesource.com/185856
Merged from https://widevine-internal-review.googlesource.com/185910

Change-Id: I51d7a0fed2475333f459030005e796c2055fecc7
This commit is contained in:
Ian Benz
2023-10-10 00:47:12 +00:00
committed by Robert Shih
parent 36d4c4c4b7
commit 343324e97c
2 changed files with 10 additions and 2 deletions

View File

@@ -1,12 +1,14 @@
/* Copyright 2020 Google LLC. All rights reserved. This file and proprietary */ /* Copyright 2020 Google LLC. All rights reserved. This file and proprietary */
/* source code may only be used and distributed under the Widevine */ /* source code may only be used and distributed under the Widevine */
/* License Agreement. */ /* License Agreement. */
#include "oemcrypto_corpus_generator_helper.h" #include "oemcrypto_corpus_generator_helper.h"
#include <fstream> #include <fstream>
#include <iostream> #include <iostream>
namespace wvoec { namespace wvoec {
bool g_generate_corpus; bool g_generate_corpus;
void AppendToFile(const std::string& file_name, const char* message, void AppendToFile(const std::string& file_name, const char* message,
@@ -32,7 +34,7 @@ void AppendSeparator(const std::string& file_name) {
std::string GetFileName(const char* directory) { std::string GetFileName(const char* directory) {
std::string file_name(PATH_TO_CORPUS); std::string file_name(PATH_TO_CORPUS);
file_name += directory; file_name += directory;
file_name += "/"; file_name += '/';
file_name += std::to_string(rand()); file_name += std::to_string(rand());
return file_name; return file_name;
} }
@@ -40,5 +42,7 @@ std::string GetFileName(const char* directory) {
void SetGenerateCorpus(bool should_generate_corpus) { void SetGenerateCorpus(bool should_generate_corpus) {
g_generate_corpus = should_generate_corpus; g_generate_corpus = should_generate_corpus;
} }
bool ShouldGenerateCorpus() { return g_generate_corpus; } bool ShouldGenerateCorpus() { return g_generate_corpus; }
} // namespace wvoec } // namespace wvoec

View File

@@ -1,16 +1,18 @@
/* Copyright 2020 Google LLC. All rights reserved. This file and proprietary */ /* Copyright 2020 Google LLC. All rights reserved. This file and proprietary */
/* source code may only be used and distributed under the Widevine */ /* source code may only be used and distributed under the Widevine */
/* License Agreement. */ /* License Agreement. */
#ifndef CDM_OEMCRYPTO_CORPUS_GENERATOR_HELPER_H_ #ifndef CDM_OEMCRYPTO_CORPUS_GENERATOR_HELPER_H_
#define CDM_OEMCRYPTO_CORPUS_GENERATOR_HELPER_H_ #define CDM_OEMCRYPTO_CORPUS_GENERATOR_HELPER_H_
#define PATH_TO_CORPUS "./oemcrypto/test/fuzz_tests/corpus/" #define PATH_TO_CORPUS "./oemcrypto/test/fuzz_tests/corpus/"
#include <stdio.h> #include <stdint.h>
#include <stdlib.h> #include <stdlib.h>
#include <string> #include <string>
namespace wvoec { namespace wvoec {
const uint8_t kFuzzDataSeparator[] = {'-', '_', '^', '_'}; const uint8_t kFuzzDataSeparator[] = {'-', '_', '^', '_'};
void AppendToFile(const std::string& file_name, const char* message, void AppendToFile(const std::string& file_name, const char* message,
@@ -22,9 +24,11 @@ void AppendSeparator(const std::string& file_name);
std::string GetFileName(const char* directory); std::string GetFileName(const char* directory);
void SetGenerateCorpus(bool should_generate_corpus); void SetGenerateCorpus(bool should_generate_corpus);
// Output of this function decides if binary data needs to be written // Output of this function decides if binary data needs to be written
// to corpus files or not. Controlled by --generate_corpus flag. // to corpus files or not. Controlled by --generate_corpus flag.
bool ShouldGenerateCorpus(); bool ShouldGenerateCorpus();
} // namespace wvoec } // namespace wvoec
#endif // CDM_OEMCRYPTO_CORPUS_GENERATOR_HELPER_H_ #endif // CDM_OEMCRYPTO_CORPUS_GENERATOR_HELPER_H_