Commit e0f372c8 authored by zhaoqin's avatar zhaoqin Committed by Commit bot

Fix pdfium_fuzzer build failure on Windows

- update ProgramPath to obtain program path on Windows

R=aizatsky@chromium.org
BUG=

Review URL: https://codereview.chromium.org/1635793002

Cr-Commit-Position: refs/heads/master@{#371859}
parent 77a444dc
......@@ -9,7 +9,12 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifdef _MSC_VER
#include <Windows.h>
#else
#include <unistd.h>
#endif
#include <list>
#include <sstream>
......@@ -164,6 +169,14 @@ static void RenderPdf(const char* pBuf, size_t len) {
}
std::string ProgramPath() {
#ifdef _MSC_VER
wchar_t wpath[MAX_PATH];
char path[MAX_PATH];
DWORD res = GetModuleFileName(NULL, wpath, MAX_PATH);
assert(res != 0);
wcstombs(path, wpath, MAX_PATH);
return std::string(path, res);
#else
char *path = new char[PATH_MAX + 1];
assert(path);
ssize_t sz = readlink("/proc/self/exe", path, PATH_MAX);
......@@ -171,6 +184,7 @@ std::string ProgramPath() {
std::string result(path, sz);
delete[] path;
return result;
#endif
}
struct TestCase {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment