Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(785)

Unified Diff: samples/pdfium_test.cc

Issue 343303004: Explicitly use binary mode when opening files in the pdfium_test sample. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « AUTHORS ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: samples/pdfium_test.cc
diff --git a/samples/pdfium_test.cc b/samples/pdfium_test.cc
index 0c641498fe0aeecfd302e7a34dbb622ee279d9d1..c504bf482346a20ff4097bbdc1290f1875ecab2e 100644
--- a/samples/pdfium_test.cc
+++ b/samples/pdfium_test.cc
@@ -20,10 +20,6 @@
#ifdef _WIN32
#define snprintf _snprintf
- /* in Windows, rb for open and read binary file */
- #define FOPEN_READ "rb"
-#else
- #define FOPEN_READ "r"
#endif
static void WritePpm(const char* pdf_name, int num,
@@ -39,7 +35,7 @@ static void WritePpm(const char* pdf_name, int num,
char filename[256];
snprintf(filename, sizeof(filename), "%s.%d.ppm", pdf_name, num);
- FILE* fp = fopen(filename, "w");
+ FILE* fp = fopen(filename, "wb");
if (!fp)
return;
fprintf(fp, "P6\n# PDF test render\n%d %d\n255\n", width, height);
@@ -283,7 +279,7 @@ int main(int argc, const char* argv[]) {
while (!files.empty()) {
const char* filename = files.front();
files.pop_front();
- FILE* file = fopen(filename, FOPEN_READ);
+ FILE* file = fopen(filename, "rb");
if (!file) {
fprintf(stderr, "Failed to open: %s\n", filename);
continue;
« no previous file with comments | « AUTHORS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698