Revert commit 95c018e2d15ecc3a5bd2a9aab18638316a6d3d46
[pdfium.git] / samples / pdfium_test.cc
index 06799f6..c504bf4 100644 (file)
 #include <string>
 #include <utility>
 
-#include "fpdfsdk/include/fpdf_dataavail.h"
-#include "fpdfsdk/include/fpdf_ext.h"
-#include "fpdfsdk/include/fpdfformfill.h"
-#include "fpdfsdk/include/fpdftext.h"
-#include "fpdfsdk/include/fpdfview.h"
+#include "../fpdfsdk/include/fpdf_dataavail.h"
+#include "../fpdfsdk/include/fpdf_ext.h"
+#include "../fpdfsdk/include/fpdfformfill.h"
+#include "../fpdfsdk/include/fpdftext.h"
+#include "../fpdfsdk/include/fpdfview.h"
 #include "v8/include/v8.h"
 
 #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);
@@ -180,7 +176,7 @@ void RenderPdf(const char* name, const char* pBuf, size_t len,
 
   FPDF_FILEACCESS file_access;
   memset(&file_access, '\0', sizeof(file_access));
-  file_access.m_FileLen = len;
+  file_access.m_FileLen = static_cast<unsigned long>(len);
   file_access.m_GetBlock = Get_Block;
   file_access.m_Param = &loader;
 
@@ -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;