cppcheck/oss-fuzz/translate.cpp
Oliver Stöneberg b59f49e286
more OSS-Fuzz client work (#2581)
* cleaned up oss-fuzz targets / use LIB_FUZZING_ENGINE for actual client

* fixed some compiler warnings in oss-fuzz sources

* only build the fuzz-client in Travis

* make fuzz-client CMake target work with CMake < 3
2020-04-01 18:02:25 +02:00

30 lines
630 B
C++

#include <fstream>
#include <iostream>
#include "type2.h"
int main(int argc, char **argv)
{
const char *filename = argc==2 ? argv[1] : nullptr;
if (!filename) {
std::cout << "Invalid args, no filename\n";
return 1;
}
std::ifstream f(filename);
if (!f.is_open()) {
std::cout << "failed to open file:" << filename << "\n";
return 1;
}
std::string str((std::istreambuf_iterator<char>(f)),
std::istreambuf_iterator<char>());
std::cout << generateCode2(reinterpret_cast<const uint8_t *>(str.data()), str.size()) << std::endl;
return 0;
}