Index: makefile.msvc
===================================================================
--- makefile.msvc	(révision 2827)
+++ makefile.msvc	(copie de travail)
@@ -11,9 +11,22 @@
 CFG=dbg
 !endif
 
+# the PLATFORM env var is usually set in the x64 and x64 cross tools Visual Studio command prompt,
+# otherwise it has to be set manually
+!ifdef PLATFORM
+BUILDPLATFORM = $(PLATFORM)
+!else
+BUILDPLATFORM = X86
+!endif
+
 # O is directory where object and binary files go
 O = obj-$(CFG)
 
+# for x86 : obj-dbg and obj-rel ; for x64 : obj-dbg64 and obj-rel64
+!if "$(BUILDPLATFORM)"=="X64"
+O = $(O)64
+!endif
+
 !if "$(MUPDF_DIR)"==""
 MUPDF_DIR=mupdf
 !endif
Index: src/PdfEngine.cc
===================================================================
--- src/PdfEngine.cc	(révision 2827)
+++ src/PdfEngine.cc	(copie de travail)
@@ -209,7 +209,7 @@
 char *tstr_to_pdfdoc(TCHAR *tstr)
 {
     WCHAR *wstr = tstr_to_wstr(tstr);
-    int len = wstr_len(wstr);
+    int len = (int) wstr_len(wstr);
     char *docstr = SAZA(char, len + 1);
 
     for (int i = 0; i < len; i++) {
Index: src/SumatraPDF.cpp
===================================================================
--- src/SumatraPDF.cpp	(révision 2827)
+++ src/SumatraPDF.cpp	(copie de travail)
@@ -3925,7 +3925,7 @@
     }
 
     const TCHAR * previousFind = win_get_text(win->hwndFindBox);
-    DWORD state = SendMessage(win->hwndToolbar, TB_GETSTATE, IDM_FIND_MATCH, 0);
+    DWORD state = (DWORD) SendMessage(win->hwndToolbar, TB_GETSTATE, IDM_FIND_MATCH, 0);
     bool matchCase = (state & TBSTATE_CHECKED) != 0;
 
     TCHAR * findString = Dialog_Find(win->hwndFrame, previousFind, &matchCase);
@@ -4261,7 +4261,7 @@
 
 static void OnMenuFindMatchCase(WindowInfo *win)
 {
-    DWORD state = SendMessage(win->hwndToolbar, TB_GETSTATE, IDM_FIND_MATCH, 0);
+    DWORD state = (DWORD) SendMessage(win->hwndToolbar, TB_GETSTATE, IDM_FIND_MATCH, 0);
     win->dm->SetFindMatchCase((state & TBSTATE_CHECKED) != 0);
     Edit_SetModify(win->hwndFindBox, TRUE);
 }
@@ -4644,11 +4644,11 @@
         }
     }
     else if (WM_KEYDOWN == message) {
-        if (OnKeydown(win, wParam, lParam, true))
+        if (OnKeydown(win, (int) wParam, lParam, true))
             return 0;
     }
 
-    int ret = CallWindowProc(DefWndProcFindBox, hwnd, message, wParam, lParam);
+    int ret = (int) CallWindowProc(DefWndProcFindBox, hwnd, message, wParam, lParam);
 
     if (WM_CHAR  == message ||
         WM_PASTE == message ||
@@ -4903,7 +4903,7 @@
             Edit_SetRectNoPaint(hwnd, &r);
         }
     } else if (WM_KEYDOWN == message) {
-        if (OnKeydown(win, wParam, lParam, true))
+        if (OnKeydown(win, (int) wParam, lParam, true))
             return 0;
     }
 
@@ -5672,20 +5672,20 @@
         case WM_LBUTTONDBLCLK:
             if (win) {
                 if ((win->fullScreen || win->presentation) && !gGlobalPrefs.m_enableTeXEnhancements)
-                    OnMouseLeftButtonDown(win, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), wParam);
+                    OnMouseLeftButtonDown(win, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), (int) wParam);
                 else
-                    OnMouseLeftButtonDblClk(win, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), wParam);
+                    OnMouseLeftButtonDblClk(win, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), (int) wParam);
             }
             break;
 
         case WM_LBUTTONDOWN:
             if (win)
-                OnMouseLeftButtonDown(win, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), wParam);
+                OnMouseLeftButtonDown(win, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), (int) wParam);
             break;
 
         case WM_LBUTTONUP:
             if (win)
-                OnMouseLeftButtonUp(win, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), wParam);
+                OnMouseLeftButtonUp(win, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), (int) wParam);
             break;
 
         case WM_MBUTTONDOWN:
@@ -5693,23 +5693,23 @@
             {
                 SetTimer(hwnd, SMOOTHSCROLL_TIMER_ID, SMOOTHSCROLL_DELAY_IN_MS, NULL);
                 // TODO: Create window that shows location of initial click for reference
-                OnMouseMiddleButtonDown(win, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), wParam);
+                OnMouseMiddleButtonDown(win, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), (int) wParam);
             }
             return 0;
 
         case WM_RBUTTONDOWN:
             if (win)
-                OnMouseRightButtonDown(win, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), wParam);
+                OnMouseRightButtonDown(win, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), (int) wParam);
             break;
 
         case WM_RBUTTONUP:
             if (win)
-                OnMouseRightButtonUp(win, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), wParam);
+                OnMouseRightButtonUp(win, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), (int) wParam);
             break;
 
         case WM_SETCURSOR:
             if (!win)
-                return DefWindowProc(hwnd, message, wParam, lParam);
+                return DefWindowProc(hwnd, message, (int) wParam, lParam);
 
             switch (win->state) {
             case WS_ABOUT:
@@ -6202,11 +6202,11 @@
             return DefWindowProc(hwnd, message, wParam, lParam);
 
         case WM_CHAR:
-            OnChar(win, wParam);
+            OnChar(win, (int) wParam);
             break;
 
         case WM_KEYDOWN:
-            OnKeydown(win, wParam, lParam);
+            OnKeydown(win, (int) wParam, lParam);
             break;
 
         case WM_INITMENUPOPUP:
@@ -6722,5 +6722,5 @@
     Translations_FreeData();
     SerializableGlobalPrefs_Deinit();
 
-    return msg.wParam;
+    return (int) msg.wParam;
 }
Index: src/SumatraAbout.cpp
===================================================================
--- src/SumatraAbout.cpp	(révision 2827)
+++ src/SumatraAbout.cpp	(copie de travail)
@@ -50,6 +50,11 @@
     { _T("programming"),    _T("Krzysztof Kowalczyk"),  _T("http://blog.kowalczyk.info"), 0 },
     { _T("programming"),    _T("Simon B\xFCnzli"),      _T("http://www.zeniko.ch/#SumatraPDF"), 0 },
     { _T("programming"),    _T("William Blum"),         _T("http://william.famille-blum.org/"), 0 },
+#ifdef WIN64
+    { _T("x64 build"),      _T("Gabriel Hautclocq"),    _T("http://www.gabsoftware.com/"), 0 },
+#else
+    { _T("x86 tweaks"),     _T("Gabriel Hautclocq"),    _T("http://www.gabsoftware.com/"), 0 },
+#endif
 #ifdef SVN_PRE_RELEASE_VER
     { _T("a note"),         _T("Pre-release version, for testing only!"), NULL, 0 },
 #endif
Index: src/SumatraDialogs.cc
===================================================================
--- src/SumatraDialogs.cc	(révision 2827)
+++ src/SumatraDialogs.cc	(copie de travail)
@@ -371,7 +371,7 @@
                 assert(IDC_CHANGE_LANG_LANG_LIST == LOWORD(wParam));
                 langList = GetDlgItem(hDlg, IDC_CHANGE_LANG_LANG_LIST);
                 assert(langList == (HWND)lParam);
-                data->langId = lb_get_selection(langList);
+                data->langId = (int) lb_get_selection(langList);
                 EndDialog(hDlg, DIALOG_OK_PRESSED);
                 return FALSE;
             }
@@ -379,7 +379,7 @@
             {
                 case IDOK:
                     langList = GetDlgItem(hDlg, IDC_CHANGE_LANG_LANG_LIST);
-                    data->langId = lb_get_selection(langList);
+                    data->langId = (int) lb_get_selection(langList);
                     EndDialog(hDlg, DIALOG_OK_PRESSED);
                     return TRUE;
 
@@ -506,7 +506,7 @@
 {
     float newZoom = defaultZoom;
 
-    int ix = SendDlgItemMessage(hDlg, idComboBox, CB_GETCURSEL, 0, 0);
+    int ix = (int) SendDlgItemMessage(hDlg, idComboBox, CB_GETCURSEL, 0, 0);
     if (ix == -1) {
         TCHAR *customZoom = win_get_text(GetDlgItem(hDlg, idComboBox));
         float zoom = (float)_tstof(customZoom);
Index: src/WindowInfo.cpp
===================================================================
--- src/WindowInfo.cpp	(révision 2827)
+++ src/WindowInfo.cpp	(copie de travail)
@@ -258,7 +258,7 @@
     if (!this->dm)
         return;
 
-    DWORD state = SendMessage(this->hwndToolbar, TB_GETSTATE, IDT_VIEW_FIT_WIDTH, 0);
+    DWORD state = (DWORD) SendMessage(this->hwndToolbar, TB_GETSTATE, IDT_VIEW_FIT_WIDTH, 0);
     if (this->dm->displayMode() == DM_CONTINUOUS && this->dm->zoomVirtual() == ZOOM_FIT_WIDTH)
         state |= TBSTATE_CHECKED;
     else
@@ -267,7 +267,7 @@
 
     bool isChecked = (state & TBSTATE_CHECKED);
 
-    state = SendMessage(this->hwndToolbar, TB_GETSTATE, IDT_VIEW_FIT_PAGE, 0);
+    state = (DWORD) SendMessage(this->hwndToolbar, TB_GETSTATE, IDT_VIEW_FIT_PAGE, 0);
     if (this->dm->displayMode() == DM_SINGLE_PAGE && this->dm->zoomVirtual() == ZOOM_FIT_PAGE)
         state |= TBSTATE_CHECKED;
     else
Index: src/Benchmark.cpp
===================================================================
--- src/Benchmark.cpp	(révision 2827)
+++ src/Benchmark.cpp	(copie de travail)
@@ -123,7 +123,7 @@
 
 void Bench(VStrList& filesToBench)
 {
-    int n = filesToBench.size() / 2;
+    int n = (int) filesToBench.size() / 2;
     for (int i = 0; i < n; i++)
         BenchFile(filesToBench[2*i], filesToBench[2*i + 1]);
 }
Index: src/PdfSync.cpp
===================================================================
--- src/PdfSync.cpp	(révision 2827)
+++ src/PdfSync.cpp	(copie de travail)
@@ -111,7 +111,7 @@
     LPTSTR out = cmdline;
     size_t cchOut = cchCmdline;
     while (perc = tstr_find_char(pattern, '%')) {
-        int u = perc-pattern;
+        int u = (int) (perc-pattern);
         
         tstr_copyn(out, cchOut, pattern, u);
         len = tstr_len(out);
@@ -154,9 +154,9 @@
         int n = (int)(rightsection - leftsection + 1);
         // a single section?
         if (n == 1)
-            return leftsection;
+            return (int) leftsection;
         else {
-            int split = leftsection + (n>>1);
+            int split = (int) leftsection + (n>>1);
             int splitvalue = record_sections[split].firstrecord;
             if (record_index >= splitvalue)
                 leftsection=split;
Index: src/translations.cpp
===================================================================
--- src/translations.cpp	(révision 2827)
+++ src/translations.cpp	(copie de travail)
@@ -57,7 +57,7 @@
         return txt;
     }
 
-    idx = res - g_transTranslations;
+    idx = (int) (res - g_transTranslations);
     const char *translation = g_transTranslations[(currLangIdx * g_transTranslationsCount) + idx];
     return translation ? translation : txt;
 }
Index: src/PdfSearch.cc
===================================================================
--- src/PdfSearch.cc	(révision 2827)
+++ src/PdfSearch.cc	(copie de travail)
@@ -106,7 +106,7 @@
     if (wholeWords && end > pageText && iswordchar(end[-1]) && iswordchar(end[0]))
         return -1;
 
-    return end - start;
+    return (int) (end - start);
 }
 
 // TODO: use Boyer-Moore algorithm here (if it proves to be faster)
@@ -127,13 +127,13 @@
             found = StrRStrI(pageText, pageText + findIndex, anchor);
         if (!found)
             return false;
-        findIndex = found - pageText + (forward ? 1 : 0);
+        findIndex = (int) (found - pageText + (forward ? 1 : 0));
         length = MatchLen(found);
     } while (length <= 0);
 
-    StartAt(pageNo, found - pageText);
-    SelectUpTo(pageNo, found - pageText + length);
-    findIndex = found - pageText + (forward ? length : 0);
+    StartAt(pageNo, (int) (found - pageText));
+    SelectUpTo(pageNo, (int) (found - pageText + length));
+    findIndex = (int) (found - pageText + (forward ? length : 0));
 
     // try again if the found text is completely outside the page's mediabox
     if (result.len == 0)
Index: src/SumatraPDF.rc
===================================================================
--- src/SumatraPDF.rc	(révision 2827)
+++ src/SumatraPDF.rc	(copie de travail)
@@ -1,7 +1,6 @@
 // Microsoft Visual C++ generated resource script.
 //
-#include "Resource.h"
-#include "Version.h"
+#include "resource.h"
 
 #define APSTUDIO_READONLY_SYMBOLS
 /////////////////////////////////////////////////////////////////////////////
@@ -16,42 +15,48 @@
 #undef APSTUDIO_READONLY_SYMBOLS
 
 /////////////////////////////////////////////////////////////////////////////
-// English (U.S.) resources
+// English (United States) resources
 
 #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
-#ifdef _WIN32
 LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
 #pragma code_page(1252)
-#endif //_WIN32
 
-VS_VERSION_INFO    VERSIONINFO     MOVEABLE IMPURE LOADONCALL DISCARDABLE
-  FILEVERSION    VER_RESOURCE
-  PRODUCTVERSION VER_RESOURCE
-  FILEFLAGS     0
-  FILEOS        VOS_NT_WINDOWS32
-  FILETYPE      VFT_APP
-  FILESUBTYPE   0       // not used
+/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION 1,4,0,0
+ PRODUCTVERSION 1,4,0,0
+ FILEFLAGSMASK 0x0L
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x40004L
+ FILETYPE 0x1L
+ FILESUBTYPE 0x0L
 BEGIN
-  BLOCK "StringFileInfo"
-  BEGIN
-    BLOCK "040904E4"
-    //language ID = U.S. English, char set = Windows, Multilingual
-
+    BLOCK "StringFileInfo"
     BEGIN
-      VALUE "FileDescription",  "SumatraPDF"
-      VALUE "FileVersion",      VER_RESOURCE_STR
-      VALUE "LegalCopyright",   COPYRIGHT_STR
-      VALUE "OriginalFilename", "SumatraPDF.exe"
-      VALUE "ProductName",      "SumatraPDF"
-      VALUE "ProductVersion",   VER_RESOURCE_STR
-      VALUE "Comments",         "SumatraPDF viewer"
-      VALUE "CompanyName",      "Krzysztof Kowalczyk"
+        BLOCK "040904e4"
+        BEGIN
+            VALUE "Comments", "SumatraPDF viewer (x64 build by GabSoftware)"
+            VALUE "CompanyName", "Krzysztof Kowalczyk"
+            VALUE "FileDescription", "SumatraPDF"
+            VALUE "FileVersion", "1.4.0.0"
+            VALUE "LegalCopyright", "Copyright 2006-2011 all authors (GPLv3)"
+            VALUE "OriginalFilename", "SumatraPDF.exe"
+            VALUE "ProductName", "SumatraPDF (x64 build by GabSoftware)"
+            VALUE "ProductVersion", "1.4.0.0"
+        END
     END
-  END
-  BLOCK "VarFileInfo"
-  BEGIN
-    VALUE "Translation", 0x0409, 1252
-  END
+    BLOCK "VarFileInfo"
+    BEGIN
+        VALUE "Translation", 0x409, 1252
+    END
 END
 
 
@@ -70,7 +75,7 @@
 // Accelerator
 //
 
-IDC_SUMATRAPDF ACCELERATORS 
+IDC_SUMATRAPDF ACCELERATORS
 BEGIN
     "A",            IDM_SELECT_ALL,         VIRTKEY, CONTROL
     "C",            IDM_COPY_SELECTION,     VIRTKEY, CONTROL
@@ -93,22 +98,22 @@
     VK_NUMPAD2,     IDM_ZOOM_FIT_WIDTH,     VIRTKEY, CONTROL
     "3",            IDM_ZOOM_FIT_CONTENT,   VIRTKEY, CONTROL
     VK_NUMPAD3,     IDM_ZOOM_FIT_CONTENT,   VIRTKEY, CONTROL
-    VK_ADD,         IDT_VIEW_ZOOMIN,        VIRTKEY
+    VK_ADD,         IDT_VIEW_ZOOMIN,        VIRTKEY 
     VK_ADD,         IDT_VIEW_ZOOMIN,        VIRTKEY, CONTROL
     VK_ADD,         IDM_VIEW_ROTATE_RIGHT,  VIRTKEY, SHIFT, CONTROL
     VK_OEM_PLUS,    IDT_VIEW_ZOOMIN,        VIRTKEY, CONTROL
     VK_OEM_PLUS,    IDM_VIEW_ROTATE_RIGHT,  VIRTKEY, SHIFT, CONTROL
-    VK_DIVIDE,      IDM_VIEW_ROTATE_LEFT,   VIRTKEY
+    VK_DIVIDE,      IDM_VIEW_ROTATE_LEFT,   VIRTKEY 
     VK_INSERT,      IDM_COPY_SELECTION,     VIRTKEY, CONTROL
     VK_F3,          IDM_FIND_NEXT,          VIRTKEY 
     VK_F3,          IDM_FIND_PREV,          VIRTKEY, SHIFT
-    VK_F5,          IDM_VIEW_PRESENTATION_MODE, VIRTKEY
-    VK_F6,          IDM_MOVE_FRAME_FOCUS,   VIRTKEY
+    VK_F5,          IDM_VIEW_PRESENTATION_MODE, VIRTKEY 
+    VK_F6,          IDM_MOVE_FRAME_FOCUS,   VIRTKEY 
     VK_F11,         IDM_VIEW_PRESENTATION_MODE, VIRTKEY 
     VK_F11,         IDM_VIEW_FULLSCREEN,    VIRTKEY, SHIFT
     VK_F12,         IDM_VIEW_BOOKMARKS,     VIRTKEY 
-    VK_MULTIPLY,    IDM_VIEW_ROTATE_RIGHT,  VIRTKEY
-    VK_SUBTRACT,    IDT_VIEW_ZOOMOUT,       VIRTKEY
+    VK_MULTIPLY,    IDM_VIEW_ROTATE_RIGHT,  VIRTKEY 
+    VK_SUBTRACT,    IDT_VIEW_ZOOMOUT,       VIRTKEY 
     VK_SUBTRACT,    IDT_VIEW_ZOOMOUT,       VIRTKEY, CONTROL
     VK_SUBTRACT,    IDM_VIEW_ROTATE_LEFT,   VIRTKEY, SHIFT, CONTROL
     VK_OEM_MINUS,   IDT_VIEW_ZOOMOUT,       VIRTKEY, CONTROL
@@ -175,7 +180,8 @@
     LTEXT           "Enter password for test.pdf",IDC_GET_PASSWORD_LABEL,6,6,170,9
     LTEXT           "&Password:",IDC_STATIC,6,22,64,9
     EDITTEXT        IDC_GET_PASSWORD_EDIT,70,20,106,13,ES_PASSWORD | ES_AUTOHSCROLL
-    CONTROL         "&Remember the password for this file",IDC_REMEMBER_PASSWORD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,37,170,9
+    CONTROL         "&Remember the password for this file",IDC_REMEMBER_PASSWORD,
+                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,37,170,9
     DEFPUSHBUTTON   "OK",IDOK,70,51,50,14
     PUSHBUTTON      "Cancel",IDCANCEL,126,51,50,14
 END
@@ -223,7 +229,7 @@
     PUSHBUTTON      "Make SumatraPDF a default PDF reader",IDC_SET_DEFAULT_READER,12,124,216,14
     GROUPBOX        "Set inverse search command-line",IDC_SECTION_INVERSESEARCH,6,150,228,52
     LTEXT           "Enter the command-line to invoke when you double-click on the PDF document:",IDC_CMDLINE_LABEL,12,162,216,18
-    COMBOBOX        IDC_CMDLINE,12,182,216,13,CBS_AUTOHSCROLL | CBS_DROPDOWN | WS_TABSTOP | CBS_DISABLENOSCROLL | CBS_HASSTRINGS
+    COMBOBOX        IDC_CMDLINE,12,182,216,13,CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_HASSTRINGS | CBS_DISABLENOSCROLL | WS_TABSTOP
     DEFPUSHBUTTON   "OK",IDOK,128,150,50,14
     PUSHBUTTON      "Cancel",IDCANCEL,184,150,50,14
 END
@@ -239,22 +245,29 @@
     PUSHBUTTON      "Cancel",IDCANCEL,60,40,50,14
 END
 
-
 IDD_PROPSHEET_PRINT_ADVANCED DIALOGEX 0, 0, 292, 122
 STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
 CAPTION "Advanced"
 FONT 8, "MS Shell Dlg", 400, 0, 0x1
 BEGIN
     GROUPBOX        "Print range",IDC_SECTION_PRINT_RANGE,7,7,278,52
-    CONTROL         "&All selected pages",IDC_PRINT_RANGE_ALL,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP | WS_GROUP,13,18,266,9
+    CONTROL         "&All selected pages",IDC_PRINT_RANGE_ALL,"Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,13,18,266,9
     CONTROL         "&Odd pages only",IDC_PRINT_RANGE_ODD,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,13,31,266,9
     CONTROL         "&Even pages only",IDC_PRINT_RANGE_EVEN,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,13,44,266,9
     GROUPBOX        "Page scaling",IDC_SECTION_PRINT_SCALE,6,62,280,53
-    CONTROL         "&Shrink pages to printable area (if necessary)",IDC_PRINT_SCALE_SHRINK,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP | WS_GROUP,13,74,266,9
-    CONTROL         "&Fit pages to printable area",IDC_PRINT_SCALE_FIT,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,13,87,266,9
+    CONTROL         "&Shrink pages to printable area (if necessary)",IDC_PRINT_SCALE_SHRINK,
+                    "Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,13,74,266,9
+    CONTROL         "&Fit pages to printable area",IDC_PRINT_SCALE_FIT,
+                    "Button",BS_AUTORADIOBUTTON | WS_TABSTOP,13,87,266,9
     CONTROL         "&Use original page sizes",IDC_PRINT_SCALE_NONE,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,13,100,266,9
 END
 
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// RT_MANIFEST
+//
+
 1                       RT_MANIFEST             "SumatraPDF.exe.manifest"
 
 #ifdef APSTUDIO_INVOKED
@@ -291,7 +304,7 @@
 //
 
 #ifdef APSTUDIO_INVOKED
-GUIDELINES DESIGNINFO 
+GUIDELINES DESIGNINFO
 BEGIN
     IDD_DIALOG_GOTO_PAGE, DIALOG
     BEGIN
@@ -321,8 +334,7 @@
 //
 
 IDC_CURSORDRAG          CURSOR                  "dragcursor.cur"
-
-#endif    // English (U.S.) resources
+#endif    // English (United States) resources
 /////////////////////////////////////////////////////////////////////////////
 
 
Index: baseutils/vstrlist.h
===================================================================
--- baseutils/vstrlist.h	(révision 2827)
+++ baseutils/vstrlist.h	(copie de travail)
@@ -103,12 +103,12 @@
     tchar_t *join(tchar_t *joint=NULL)
     {
         int len = 0;
-        int jointLen = joint ? tstr_len(joint) : 0;
+        int jointLen = joint ? (int) tstr_len(joint) : 0;
         tchar_t *result, *tmp;
 
         size_t n = size();
         for (size_t i = n; i > 0; i--)
-            len += tstr_len(at(i - 1)) + jointLen;
+            len += (int) tstr_len(at(i - 1)) + jointLen;
         len -= jointLen;
         if (len <= 0)
             return (tchar_t *)calloc(1, sizeof(tchar_t));
Index: baseutils/benc_util.c
===================================================================
--- baseutils/benc_util.c	(révision 2827)
+++ baseutils/benc_util.c	(copie de travail)
@@ -1101,7 +1101,7 @@
 {
     int txtLen = 0;
     if (txt)
-        txtLen = strlen(txt);
+        txtLen = (int) strlen(txt);
     return benc_obj_from_data(txt, txtLen);
 }
 
@@ -1222,7 +1222,7 @@
     benc_obj * bobj = benc_obj_from_txt(txt);
     assert(bobj);
     assert(BOT_ARRAY == bobj->m_type);
-    realLen = benc_obj_len(bobj);
+    realLen = (int) benc_obj_len(bobj);
     assert(realLen == expectedLen);
     assert_serialized(bobj, txt, strlen(txt));
     benc_obj_delete(bobj);
@@ -1251,7 +1251,7 @@
     benc_obj * bobj = benc_obj_from_txt(txt);
     assert(bobj);
     assert(BOT_DICT == bobj->m_type);
-    realLen = benc_obj_len(bobj);
+    realLen = (int) benc_obj_len(bobj);
     assert(realLen == expectedLen);
     assert_serialized(bobj, txt, strlen(txt));
     benc_obj_delete(bobj);
@@ -1286,7 +1286,7 @@
     for (i = 1; i <= ITERATION_COUNT; i++) {
         benc_obj* obj = (benc_obj*)benc_int64_new((int64_t)i);
         benc_array_append(arr, obj);
-        arrLen = benc_array_len(arr);
+        arrLen = (int) benc_array_len(arr);
         assert(i == arrLen);
     }
     for (i = 1; i <= ITERATION_COUNT; i++) {
Index: baseutils/str_util.c
===================================================================
--- baseutils/str_util.c	(révision 2827)
+++ baseutils/str_util.c	(copie de travail)
@@ -125,7 +125,7 @@
 /* return true if 'str' starts with 'txt', case-sensitive */
 int str_startswith(const char *str, const char *txt)
 {
-    return str_eqn(str, txt, strlen(txt));
+    return str_eqn(str, txt, (int) strlen(txt));
 }
 
 /* return true if 'str' starts with 'txt', NOT case-sensitive */
Index: baseutils/file_util.c
===================================================================
--- baseutils/file_util.c	(révision 2827)
+++ baseutils/file_util.c	(copie de travail)
@@ -285,7 +285,7 @@
     if (h == INVALID_HANDLE_VALUE)
         return FALSE;
 
-    f_ok = WriteFile(h, data, data_len, &size, NULL);
+    f_ok = WriteFile(h, data, (DWORD) data_len, &size, NULL);
     assert(!f_ok || (data_len == size));
     CloseHandle(h);
     return f_ok;
Index: baseutils/WinUtil.cpp
===================================================================
--- baseutils/WinUtil.cpp	(révision 2827)
+++ baseutils/WinUtil.cpp	(copie de travail)
@@ -173,7 +173,7 @@
 
 bool WriteRegStr(HKEY keySub, const TCHAR *keyName, const TCHAR *valName, const TCHAR *value)
 {
-    LONG res = SHSetValue(keySub, keyName, valName, REG_SZ, (const VOID *)value, (tstr_len(value) + 1) * sizeof(TCHAR));
+    LONG res = SHSetValue(keySub, keyName, valName, REG_SZ, (const VOID *)value, (DWORD) ((tstr_len(value) + 1) * sizeof(TCHAR)));
     if (ERROR_SUCCESS != res)
         SeeLastError(res);
     return ERROR_SUCCESS == res;
Index: baseutils/wstr_util.c
===================================================================
--- baseutils/wstr_util.c	(révision 2827)
+++ baseutils/wstr_util.c	(copie de travail)
@@ -111,7 +111,7 @@
 /* return true if 'str' starts with 'txt', case-sensitive */
 int wstr_startswith(const WCHAR *str, const WCHAR *txt)
 {
-    return wstr_eqn(str, txt, wcslen(txt));
+    return wstr_eqn(str, txt, (int) wcslen(txt));
 }
 
 int wstr_endswith(const WCHAR *txt, const WCHAR *end)
Index: ext/freetype2/src/truetype/ttgxvar.c
===================================================================
--- ext/freetype2/src/truetype/ttgxvar.c	(révision 2827)
+++ ext/freetype2/src/truetype/ttgxvar.c	(copie de travail)
@@ -220,7 +220,7 @@
     FT_UNUSED( error );
 
 
-    if ( FT_NEW_ARRAY( deltas, delta_cnt ) )
+    if ( FT_NEW_ARRAY( deltas, (FT_Long) delta_cnt ) )
       return NULL;
 
     i = 0;
@@ -705,7 +705,7 @@
         fvar_head.instanceCount * fvar_head.axisCount * sizeof ( FT_Fixed ) +
         5 * fvar_head.axisCount;
 
-      if ( FT_ALLOC( mmvar, face->blend->mmvar_len ) )
+      if ( FT_ALLOC( mmvar, (FT_Long) face->blend->mmvar_len ) )
         goto Exit;
       face->blend->mmvar = mmvar;
 
@@ -784,7 +784,7 @@
       FT_UInt  n;
 
 
-      if ( FT_ALLOC( mmvar, face->blend->mmvar_len ) )
+      if ( FT_ALLOC( mmvar, (FT_Long) face->blend->mmvar_len ) )
         goto Exit;
       FT_MEM_COPY( mmvar, face->blend->mmvar, face->blend->mmvar_len );
 
@@ -1168,7 +1168,7 @@
       goto Exit;
     }
 
-    table_start = FT_Stream_FTell( stream );
+    table_start = (FT_ULong) FT_Stream_FTell( stream );
     if ( FT_GET_LONG() != 0x00010000L )
     {
       FT_TRACE2(( "bad table version\n" ));
@@ -1243,7 +1243,7 @@
         continue;
       }
 
-      here = FT_Stream_FTell( stream );
+      here = (FT_ULong) FT_Stream_FTell( stream );
 
       FT_Stream_SeekSet( stream, offsetToData );
 
@@ -1361,7 +1361,7 @@
                            blend->glyphoffsets[glyph_index] ) )
       goto Fail1;
 
-    glyph_start = FT_Stream_FTell( stream );
+    glyph_start = (FT_ULong) FT_Stream_FTell( stream );
 
     /* each set of glyph variation data is formatted similarly to `cvar' */
     /* (except we get shared points and global tuples)                   */
@@ -1376,12 +1376,12 @@
 
     if ( tupleCount & GX_TC_TUPLES_SHARE_POINT_NUMBERS )
     {
-      here = FT_Stream_FTell( stream );
+      here = (FT_ULong) FT_Stream_FTell( stream );
 
       FT_Stream_SeekSet( stream, offsetToData );
 
       sharedpoints = ft_var_readpackedpoints( stream, &spoint_count );
-      offsetToData = FT_Stream_FTell( stream );
+      offsetToData = (FT_ULong) FT_Stream_FTell( stream );
 
       FT_Stream_SeekSet( stream, here );
     }
@@ -1435,7 +1435,7 @@
         continue;
       }
 
-      here = FT_Stream_FTell( stream );
+      here = (FT_ULong) FT_Stream_FTell( stream );
 
       if ( tupleIndex & GX_TI_PRIVATE_POINT_NUMBERS )
       {
Index: ext/freetype2/src/pfr/pfrobjs.c
===================================================================
--- ext/freetype2/src/pfr/pfrobjs.c	(révision 2827)
+++ ext/freetype2/src/pfr/pfrobjs.c	(copie de travail)
@@ -503,7 +503,7 @@
       goto Exit;
 
     FoundPair: /* we found an item, now parse it and find the value if any */
-      if ( FT_STREAM_SEEK( item->offset )                       ||
+      if ( FT_STREAM_SEEK( (FT_ULong) item->offset )                       ||
            FT_FRAME_ENTER( item->pair_count * item->pair_size ) )
         goto Exit;
 
Index: ext/freetype2/src/pfr/pfrload.c
===================================================================
--- ext/freetype2/src/pfr/pfrload.c	(révision 2827)
+++ ext/freetype2/src/pfr/pfrload.c	(copie de travail)
@@ -457,7 +457,7 @@
     if ( phy_font->font_id != NULL )
       goto Exit;
 
-    if ( FT_ALLOC( phy_font->font_id, len + 1 ) )
+    if ( FT_ALLOC( phy_font->font_id, (FT_Long) (len + 1) ) )
       goto Exit;
 
     /* copy font ID name, and terminate it for safety */
Index: ext/freetype2/src/bdf/bdfdrivr.c
===================================================================
--- ext/freetype2/src/bdf/bdfdrivr.c	(révision 2827)
+++ ext/freetype2/src/bdf/bdfdrivr.c	(copie de travail)
@@ -266,7 +266,7 @@
       char*  s;
 
 
-      if ( FT_ALLOC( face->style_name, len ) )
+      if ( FT_ALLOC( face->style_name, (FT_Long) len ) )
         return error;
 
       s = face->style_name;
Index: ext/freetype2/src/bdf/bdflib.c
===================================================================
--- ext/freetype2/src/bdf/bdflib.c	(révision 2827)
+++ ext/freetype2/src/bdf/bdflib.c	(copie de travail)
@@ -719,12 +719,10 @@
       /* XXX: Use encoding independent value for 0x1a */
       if ( buf[start] != '#' && buf[start] != 0x1a && end > start )
       {
-        error = (*cb)( buf + start, end - start, lineno,
-                       (void*)&cb, client_data );
+        error = (*cb)( buf + start, (unsigned long) (end - start), lineno, (void*)&cb, client_data );
         /* Redo if we have encountered CHARS without properties. */
         if ( error == -1 )
-          error = (*cb)( buf + start, end - start, lineno,
-                         (void*)&cb, client_data );
+          error = (*cb)( buf + start, (unsigned long) (end - start), lineno, (void*)&cb, client_data );
         if ( error )
           break;
       }
@@ -1001,7 +999,7 @@
     if ( n > FT_ULONG_MAX )
       return BDF_Err_Invalid_Argument;
 
-    if ( FT_NEW_ARRAY( p->name, n ) )
+    if ( FT_NEW_ARRAY( p->name, (FT_Long) n ) )
       goto Exit;
 
     FT_MEM_COPY( (char *)p->name, name, n );
@@ -1168,7 +1166,7 @@
 
     FT_MEM_COPY( name, font->name, len );
 
-    error = _bdf_list_split( &list, (char *)"-", name, len );
+    error = _bdf_list_split( &list, (char *)"-", name, (unsigned long) len );
     if ( error )
       goto Fail;
 
Index: ext/freetype2/src/cff/cffobjs.c
===================================================================
--- ext/freetype2/src/cff/cffobjs.c	(révision 2827)
+++ ext/freetype2/src/cff/cffobjs.c	(copie de travail)
@@ -402,7 +402,7 @@
   remove_subset_prefix( FT_String*  name )
   {
     FT_Int32  idx             = 0;
-    FT_Int32  length          = strlen( name ) + 1;
+    FT_Int32  length          = (FT_Int32) strlen( name ) + 1;
     FT_Bool   continue_search = 1;
  
 
Index: ext/freetype2/src/cid/cidparse.c
===================================================================
--- ext/freetype2/src/cid/cidparse.c	(révision 2827)
+++ ext/freetype2/src/cid/cidparse.c	(copie de travail)
@@ -117,12 +117,12 @@
           if ( p[0] == 'S' && ft_strncmp( (char*)p, "StartData", 9 ) == 0 )
           {
             /* save offset of binary data after `StartData' */
-            offset += p - buffer + 10;
+            offset += (FT_ULong) (p - buffer + 10);
             goto Found;
           }
           else if ( p[1] == 's' && ft_strncmp( (char*)p, "/sfnts", 6 ) == 0 )
           {
-            offset += p - buffer + 7;
+            offset += (FT_ULong) (p - buffer + 7);
             goto Found;
           }
         }
Index: ext/freetype2/src/psaux/afmparse.c
===================================================================
--- ext/freetype2/src/psaux/afmparse.c	(révision 2827)
+++ ext/freetype2/src/psaux/afmparse.c	(copie de travail)
@@ -401,7 +401,7 @@
           FT_Error   error;
 
 
-          if ( !FT_QALLOC( val->u.s, len + 1 ) )
+          if ( !FT_QALLOC( val->u.s, (FT_Long) (len + 1) ) )
           {
             ft_memcpy( val->u.s, str, len );
             val->u.s[len] = '\0';
Index: ext/freetype2/src/psaux/psobjs.c
===================================================================
--- ext/freetype2/src/psaux/psobjs.c	(révision 2827)
+++ ext/freetype2/src/psaux/psobjs.c	(copie de travail)
@@ -203,7 +203,7 @@
         new_size  = FT_PAD_CEIL( new_size, 1024 );
       }
 
-      error = reallocate_t1_table( table, new_size );
+      error = reallocate_t1_table( table, (FT_Long) new_size );
       if ( error )
         return error;
 
@@ -249,7 +249,7 @@
     if ( !old_base )
       return;
 
-    if ( FT_ALLOC( table->block, table->cursor ) )
+    if ( FT_ALLOC( table->block, (FT_Long) table->cursor ) )
       return;
     FT_MEM_COPY( table->block, old_base, table->cursor );
     shift_elements( table, old_base );
Index: ext/freetype2/src/raster/ftraster.c
===================================================================
--- ext/freetype2/src/raster/ftraster.c	(révision 2827)
+++ ext/freetype2/src/raster/ftraster.c	(copie de travail)
@@ -3449,7 +3449,7 @@
 
 
         raster->buffer      = pool_base + ( ( sizeof ( *worker ) + 7 ) & ~7 );
-        raster->buffer_size = pool_base + pool_size - (char*)raster->buffer;
+        raster->buffer_size = (long) (pool_base + pool_size - (char*)raster->buffer);
         raster->worker      = worker;
       }
       else
Index: ext/freetype2/src/type1/t1parse.c
===================================================================
--- ext/freetype2/src/type1/t1parse.c	(révision 2827)
+++ ext/freetype2/src/type1/t1parse.c	(copie de travail)
@@ -117,7 +117,7 @@
     if ( tag != 0x8001U && FT_STREAM_SEEK( 0 ) )
       goto Exit;
 
-    if ( !FT_FRAME_ENTER( header_length ) )
+    if ( !FT_FRAME_ENTER( (FT_ULong) header_length ) )
     {
       error = T1_Err_Ok;
 
@@ -416,7 +416,7 @@
         goto Exit;
       }
 
-      size = parser->base_len - ( cur - parser->base_dict );
+      size = (FT_ULong) (parser->base_len - ( cur - parser->base_dict ));
 
       if ( parser->in_memory )
       {
Index: ext/freetype2/src/type1/t1load.c
===================================================================
--- ext/freetype2/src/type1/t1load.c	(révision 2827)
+++ ext/freetype2/src/type1/t1load.c	(copie de travail)
@@ -616,7 +616,7 @@
         goto Exit;
       }
 
-      if ( FT_ALLOC( blend->axis_names[n], len + 1 ) )
+      if ( FT_ALLOC( blend->axis_names[n], (FT_Long) len + 1 ) )
         goto Exit;
 
       name = (FT_Byte*)blend->axis_names[n];
Index: ext/freetype2/src/cache/ftcmru.c
===================================================================
--- ext/freetype2/src/cache/ftcmru.c	(révision 2827)
+++ ext/freetype2/src/cache/ftcmru.c	(copie de travail)
@@ -263,7 +263,7 @@
       if ( list->clazz.node_done )
         list->clazz.node_done( node, list->data );
     }
-    else if ( FT_ALLOC( node, list->clazz.node_size ) )
+    else if ( FT_ALLOC( node, (FT_Long) list->clazz.node_size ) )
         goto Exit;
 
     error = list->clazz.node_init( node, key, list->data );
Index: ext/freetype2/src/cache/ftccache.c
===================================================================
--- ext/freetype2/src/cache/ftccache.c	(révision 2827)
+++ ext/freetype2/src/cache/ftccache.c	(copie de travail)
@@ -291,7 +291,7 @@
     }
 #endif
 
-    manager->cur_weight -= cache->clazz.node_weight( node, cache );
+    manager->cur_weight -= (FT_ULong) cache->clazz.node_weight( node, cache );
 
     /* remove node from mru list */
     ftc_node_mru_unlink( node, manager );
@@ -369,7 +369,7 @@
           ftc_node_mru_unlink( node, manager );
 
           /* now finalize it */
-          manager->cur_weight -= cache->clazz.node_weight( node, cache );
+          manager->cur_weight -= (FT_ULong) cache->clazz.node_weight( node, cache );
 
           cache->clazz.node_free( node, cache );
           node = next;
@@ -424,7 +424,7 @@
       FTC_Manager  manager = cache->manager;
 
 
-      manager->cur_weight += cache->clazz.node_weight( node, cache );
+      manager->cur_weight += (FT_ULong) cache->clazz.node_weight( node, cache );
 
       if ( manager->cur_weight >= manager->max_weight )
       {
@@ -580,7 +580,7 @@
       node  = frees;
       frees = node->link;
 
-      manager->cur_weight -= cache->clazz.node_weight( node, cache );
+      manager->cur_weight -= (FT_ULong) cache->clazz.node_weight( node, cache );
       ftc_node_mru_unlink( node, manager );
 
       cache->clazz.node_free( node, cache );
Index: ext/freetype2/src/cache/ftcmanag.c
===================================================================
--- ext/freetype2/src/cache/ftcmanag.c	(révision 2827)
+++ ext/freetype2/src/cache/ftcmanag.c	(copie de travail)
@@ -592,7 +592,7 @@
         goto Exit;
       }
 
-      if ( !FT_ALLOC( cache, clazz->cache_size ) )
+      if ( !FT_ALLOC( cache, (FT_Long) clazz->cache_size ) )
       {
         cache->manager   = manager;
         cache->memory    = memory;
Index: ext/freetype2/src/winfonts/winfnt.c
===================================================================
--- ext/freetype2/src/winfonts/winfnt.c	(révision 2827)
+++ ext/freetype2/src/winfonts/winfnt.c	(copie de travail)
@@ -844,7 +844,7 @@
       /* NULL byte -- the frame is erroneously one byte too small.  */
       /* We thus allocate one more byte, setting it explicitly to   */
       /* zero.                                                      */
-      if ( FT_ALLOC( font->family_name, family_size + 1 ) )
+      if ( FT_ALLOC( font->family_name, (FT_Long) family_size + 1 ) )
         goto Fail;
 
       FT_MEM_COPY( font->family_name,
@@ -854,8 +854,8 @@
       font->family_name[family_size] = '\0';
 
       if ( FT_REALLOC( font->family_name,
-                       family_size,
-                       ft_strlen( font->family_name ) + 1 ) )
+                       (FT_Long) family_size,
+                       (FT_Long) ft_strlen( font->family_name ) + 1 ) )
         goto Fail;
 
       root->family_name = font->family_name;
Index: ext/freetype2/src/pcf/pcfdrivr.c
===================================================================
--- ext/freetype2/src/pcf/pcfdrivr.c	(révision 2827)
+++ ext/freetype2/src/pcf/pcfdrivr.c	(copie de travail)
@@ -513,12 +513,12 @@
     /* XXX: to do: are there cases that need repadding the bitmap? */
     bytes = bitmap->pitch * bitmap->rows;
 
-    error = ft_glyphslot_alloc_bitmap( slot, bytes );
+    error = ft_glyphslot_alloc_bitmap( slot, (FT_ULong) bytes );
     if ( error )
       goto Exit;
 
     if ( FT_STREAM_SEEK( metric->bits )          ||
-         FT_STREAM_READ( bitmap->buffer, bytes ) )
+         FT_STREAM_READ( bitmap->buffer, (FT_ULong) bytes ) )
       goto Exit;
 
     if ( PCF_BIT_ORDER( face->bitmapsFormat ) != MSBFirst )
Index: ext/freetype2/src/pcf/pcfread.c
===================================================================
--- ext/freetype2/src/pcf/pcfread.c	(révision 2827)
+++ ext/freetype2/src/pcf/pcfread.c	(copie de travail)
@@ -1059,7 +1059,7 @@
       char*  s;
 
 
-      if ( FT_ALLOC( face->style_name, len ) )
+      if ( FT_ALLOC( face->style_name, (FT_Long) len ) )
         return error;
 
       s = face->style_name;
Index: ext/freetype2/src/base/ftrfork.c
===================================================================
--- ext/freetype2/src/base/ftrfork.c	(révision 2827)
+++ ext/freetype2/src/base/ftrfork.c	(copie de travail)
@@ -529,7 +529,7 @@
     FT_Error   error;
     char*      newpath;
     FT_Memory  memory;
-    FT_Long    base_file_len = ft_strlen( base_file_name );
+    FT_Long    base_file_len = (FT_Long) ft_strlen( base_file_name );
 
     FT_UNUSED( stream );
 
@@ -565,7 +565,7 @@
     FT_Error   error;
     char*      newpath;
     FT_Memory  memory;
-    FT_Long    base_file_len = ft_strlen( base_file_name );
+    FT_Long    base_file_len = (FT_Long) ft_strlen( base_file_name );
 
     FT_UNUSED( stream );
 
@@ -811,7 +811,7 @@
 
 
     new_length = ft_strlen( original_name ) + ft_strlen( insertion );
-    if ( FT_ALLOC( new_name, new_length + 1 ) )
+    if ( FT_ALLOC( new_name, (FT_Long) new_length + 1 ) )
       return NULL;
 
     tmp = ft_strrchr( original_name, '/' );
Index: ext/freetype2/src/autofit/afglobal.c
===================================================================
--- ext/freetype2/src/autofit/afglobal.c	(révision 2827)
+++ ext/freetype2/src/autofit/afglobal.c	(copie de travail)
@@ -281,7 +281,7 @@
       FT_Memory  memory = globals->face->memory;
 
 
-      if ( FT_ALLOC( metrics, clazz->script_metrics_size ) )
+      if ( FT_ALLOC( metrics, (FT_Long) clazz->script_metrics_size ) )
         goto Exit;
 
       metrics->clazz = clazz;
Index: ext/libjpeg-turbo/jdatadst.c
===================================================================
--- ext/libjpeg-turbo/jdatadst.c	(révision 2827)
+++ ext/libjpeg-turbo/jdatadst.c	(copie de travail)
@@ -189,7 +189,7 @@
   my_mem_dest_ptr dest = (my_mem_dest_ptr) cinfo->dest;
 
   *dest->outbuffer = dest->buffer;
-  *dest->outsize = dest->bufsize - dest->pub.free_in_buffer;
+  *dest->outsize = (unsigned long) (dest->bufsize - dest->pub.free_in_buffer);
 }
 #endif
 
Index: ext/openjpeg/j2k.c
===================================================================
--- ext/openjpeg/j2k.c	(révision 2827)
+++ ext/openjpeg/j2k.c	(copie de travail)
@@ -1409,7 +1409,7 @@
 		j2k->cstr_info->packno = 0;
 	}
 	
-	len = int_min(j2k->eot - cio_getbp(cio), cio_numbytesleft(cio) + 1);
+	len = int_min((int) (j2k->eot - cio_getbp(cio)), (int) (cio_numbytesleft(cio) + 1));
 
 	if (len == cio_numbytesleft(cio) + 1) {
 		truncate = 1;		/* Case of a truncate codestream */
Index: ext/openjpeg/bio.c
===================================================================
--- ext/openjpeg/bio.c	(révision 2827)
+++ ext/openjpeg/bio.c	(copie de travail)
@@ -126,7 +126,7 @@
 }
 
 int bio_numbytes(opj_bio_t *bio) {
-	return (bio->bp - bio->start);
+	return ((int) (bio->bp - bio->start));
 }
 
 void bio_init_enc(opj_bio_t *bio, unsigned char *bp, int len) {
Index: ext/openjpeg/cio.c
===================================================================
--- ext/openjpeg/cio.c	(révision 2827)
+++ ext/openjpeg/cio.c	(copie de travail)
@@ -97,7 +97,7 @@
  * Get position in byte stream.
  */
 int OPJ_CALLCONV cio_tell(opj_cio_t *cio) {
-	return cio->bp - cio->start;
+	return (int) (cio->bp - cio->start);
 }
 
 /*
@@ -113,7 +113,7 @@
  * Number of bytes left before the end of the stream.
  */
 int cio_numbytesleft(opj_cio_t *cio) {
-	return cio->end - cio->bp;
+	return (int) (cio->end - cio->bp);
 }
 
 /*
Index: ext/openjpeg/mqc.c
===================================================================
--- ext/openjpeg/mqc.c	(révision 2827)
+++ ext/openjpeg/mqc.c	(copie de travail)
@@ -372,7 +372,7 @@
 }
 
 int mqc_numbytes(opj_mqc_t *mqc) {
-	return mqc->bp - mqc->start;
+	return (int) (mqc->bp - mqc->start);
 }
 
 void mqc_init_enc(opj_mqc_t *mqc, unsigned char *bp) {
Index: ext/openjpeg/event.c
===================================================================
--- ext/openjpeg/event.c	(révision 2827)
+++ ext/openjpeg/event.c	(copie de travail)
@@ -106,7 +106,7 @@
 		/* initialize the optional parameter list */
 		va_start(arg, fmt);
 		/* check the length of the format string */
-		str_length = (strlen(fmt) > MSG_SIZE) ? MSG_SIZE : strlen(fmt);
+		str_length = ((int) strlen(fmt) > MSG_SIZE) ? MSG_SIZE : (int) strlen(fmt);
 		/* parse the format string and put the result in 'message' */
 		vsprintf(message, fmt, arg); /* UniPG */
 		/* deinitialize the optional parameter list */
Index: ext/openjpeg/t2.c
===================================================================
--- ext/openjpeg/t2.c	(révision 2827)
+++ ext/openjpeg/t2.c	(copie de travail)
@@ -293,7 +293,7 @@
 		}
 	}
 	
-	return (c - dest);
+	return ((int) (c - dest));
 }
 
 static void t2_init_seg(opj_tcd_cblk_dec_t* cblk, int index, int cblksty, int first) {
@@ -382,7 +382,7 @@
 		bio_init_dec(bio, hd, tcp->ppt_len);
 	} else {			/* Normal Case */
 		hd = c;
-		bio_init_dec(bio, hd, src+len-hd);
+		bio_init_dec( bio, hd, (int) src + (int) len - (int) hd);
 	}
 	
 	present = bio_read(bio, 1);
@@ -411,17 +411,17 @@
 		/* INDEX >> */
 		
 		if (cp->ppm == 1) {		/* PPM case */
-			cp->ppm_len += cp->ppm_data-hd;
+			cp->ppm_len += (int) (cp->ppm_data-hd);
 			cp->ppm_data = hd;
-			return (c - src);
+			return ((int) (c - src));
 		}
 		if (tcp->ppt == 1) {	/* PPT case */
-			tcp->ppt_len+=tcp->ppt_data-hd;
+			tcp->ppt_len += (int) (tcp->ppt_data-hd);
 			tcp->ppt_data = hd;
-			return (c - src);
+			return ((int) (c - src));
 		}
 		
-		return (hd - src);
+		return ((int) (hd - src));
 	}
 	
 	for (bandno = 0; bandno < res->numbands; bandno++) {
@@ -511,10 +511,10 @@
 	/* INDEX >> */
 	
 	if (cp->ppm==1) {
-		cp->ppm_len+=cp->ppm_data-hd;
+		cp->ppm_len += (int) (cp->ppm_data-hd);
 		cp->ppm_data = hd;
 	} else if (tcp->ppt == 1) {
-		tcp->ppt_len+=tcp->ppt_data-hd;
+		tcp->ppt_len += (int) (tcp->ppt_data-hd);
 		tcp->ppt_data = hd;
 	} else {
 		c=hd;
@@ -587,7 +587,7 @@
 		}
 	}
 	
-	return (c - src);
+	return ((int) (c - src));
 }
 
 /* ----------------------------------------------------------------------- */
@@ -622,7 +622,7 @@
 				}
 				while (pi_next(&pi[poc])) {
 					if (pi[poc].layno < maxlayers) {
-						e = t2_encode_packet(tile, &cp->tcps[tileno], &pi[poc], c, dest + len - c, cstr_info, tileno);
+						e = t2_encode_packet(tile, &cp->tcps[tileno], &pi[poc], c, (int) (dest + len - c), cstr_info, tileno);
 						comp_len = comp_len + e;
 						if (e == -999) {
 							break;
@@ -645,7 +645,7 @@
 		pi_create_encode(pi, cp,tileno,pino,tpnum,tppos,t2_mode,cur_totnum_tp);
 		while (pi_next(&pi[pino])) {
 			if (pi[pino].layno < maxlayers) {
-				e = t2_encode_packet(tile, &cp->tcps[tileno], &pi[pino], c, dest + len - c, cstr_info, tileno);
+				e = t2_encode_packet(tile, &cp->tcps[tileno], &pi[pino], c, (int) (dest + len - c), cstr_info, tileno);
 				if (e == -999) {
 					break;
 				} else {
@@ -680,7 +680,7 @@
 		return e;
 	}
 	
-  return (c - dest);
+  return ((int) (c - dest));
 }
 
 int t2_decode_packets(opj_t2_t *t2, unsigned char *src, int len, int tileno, opj_tcd_tile_t *tile, opj_codestream_info_t *cstr_info) {
@@ -710,7 +710,7 @@
 					pack_info = &cstr_info->tile[tileno].packet[cstr_info->packno];
 				else
 					pack_info = NULL;
-				e = t2_decode_packet(t2, c, src + len - c, tile, &cp->tcps[tileno], &pi[pino], pack_info);
+				e = t2_decode_packet(t2, c, (int) (src + len - c), tile, &cp->tcps[tileno], &pi[pino], pack_info);
 			} else {
 				e = 0;
 			}
@@ -763,7 +763,7 @@
 		return e;
 	}
 	
-	return (c - src);
+	return ((int) (c - src));
 }
 
 /* ----------------------------------------------------------------------- */
Index: ext/openjpeg/raw.c
===================================================================
--- ext/openjpeg/raw.c	(révision 2827)
+++ ext/openjpeg/raw.c	(copie de travail)
@@ -54,7 +54,7 @@
 }
 
 int raw_numbytes(opj_raw_t *raw) {
-	return raw->bp - raw->start;
+	return (int) (raw->bp - raw->start);
 }
 
 void raw_init_dec(opj_raw_t *raw, unsigned char *bp, int len) {
Index: ext/jbig2dec/jbig2_page.c
===================================================================
--- ext/jbig2dec/jbig2_page.c	(révision 2827)
+++ ext/jbig2dec/jbig2_page.c	(copie de travail)
@@ -209,7 +209,7 @@
           " Trying to decode using the available data.");
         segment->data_length = ctx->buf_wr_ix - ctx->buf_rd_ix;
         code = jbig2_parse_segment(ctx, segment, ctx->buf + ctx->buf_rd_ix);
-        ctx->buf_rd_ix += segment->data_length;
+        ctx->buf_rd_ix += (unsigned int) segment->data_length;
         ctx->segment_index++;
       }
     }
Index: ext/jbig2dec/jbig2_huffman.c
===================================================================
--- ext/jbig2dec/jbig2_huffman.c	(révision 2827)
+++ ext/jbig2dec/jbig2_huffman.c	(copie de travail)
@@ -458,7 +458,7 @@
 jbig2_table_read_bits(const byte *data, size_t *bitoffset, const int bitlen)
 {
     uint32_t result = 0;
-    uint32_t byte_offset = *bitoffset / 8;
+    uint32_t byte_offset = (uint32_t) *bitoffset / 8;
     const int endbit = (*bitoffset & 7) + bitlen;
     const int n_proc_bytes = (endbit + 7) / 8;
     const int rshift = n_proc_bytes * 8 - endbit;
Index: ext/jbig2dec/jbig2.c
===================================================================
--- ext/jbig2dec/jbig2.c	(révision 2827)
+++ ext/jbig2dec/jbig2.c	(copie de travail)
@@ -230,7 +230,7 @@
       ctx->buf_rd_ix = 0;
     }
   memcpy(ctx->buf + ctx->buf_wr_ix, data, size);
-  ctx->buf_wr_ix += size;
+  ctx->buf_wr_ix += (unsigned int) size;
 
   /* data has now been added to buffer */
 
@@ -293,7 +293,7 @@
 					  &header_size);
 	  if (segment == NULL)
 	    return 0; /* need more data */
-	  ctx->buf_rd_ix += header_size;
+	  ctx->buf_rd_ix += (unsigned int) header_size;
 
 	  if (ctx->n_segments == ctx->n_segments_max)
 	    ctx->segments = (Jbig2Segment **)jbig2_realloc(ctx->allocator,
@@ -314,7 +314,7 @@
 	  if (segment->data_length > ctx->buf_wr_ix - ctx->buf_rd_ix)
 	    return 0; /* need more data */
 	  code = jbig2_parse_segment(ctx, segment, ctx->buf + ctx->buf_rd_ix);
-	  ctx->buf_rd_ix += segment->data_length;
+	  ctx->buf_rd_ix += (unsigned int) segment->data_length;
 	  ctx->segment_index++;
 	  if (ctx->state == JBIG2_FILE_RANDOM_BODIES)
 	    {
Index: ext/jbig2dec/jbig2_metadata.c
===================================================================
--- ext/jbig2dec/jbig2_metadata.c	(révision 2827)
+++ ext/jbig2dec/jbig2_metadata.c	(copie de travail)
@@ -124,10 +124,10 @@
     }
     /* loop over the segment data pulling out the key,value pairs */
     while(*s && s < end) {
-        key_length = strlen(s) + 1;
+        key_length = (int) strlen(s) + 1;
         key = s; s += key_length;
         if (s >= end) goto too_short;
-        value_length = strlen(s) + 1;
+        value_length = (int) strlen(s) + 1;
         value = s; s += value_length;
         if (s >= end) goto too_short;
         jbig2_metadata_add(ctx, comment, key, key_length, value, value_length);
Index: ext/synctex/synctex_parser.c
===================================================================
--- ext/synctex/synctex_parser.c	(révision 2827)
+++ ext/synctex/synctex_parser.c	(copie de travail)
@@ -1115,7 +1115,7 @@
 		}
 		SYNCTEX_CUR = SYNCTEX_START + available; /*  the next character after the move, will change. */
 		/*  Fill the buffer up to its end */
-		already_read = gzread(SYNCTEX_FILE,(void *)SYNCTEX_CUR,SYNCTEX_BUFFER_SIZE - available);
+		already_read = gzread(SYNCTEX_FILE,(void *)SYNCTEX_CUR,SYNCTEX_BUFFER_SIZE - (unsigned int) available);
 		if(already_read>0) {
 			/*  We assume that 0<already_read<=SYNCTEX_BUFFER_SIZE - available, such that
 			 *  SYNCTEX_CUR + already_read = SYNCTEX_START + available  + already_read <= SYNCTEX_START + SYNCTEX_BUFFER_SIZE */
@@ -1243,7 +1243,7 @@
 		SYNCTEX_CUR += available; /*  We validate the tested characters. */
 		if(0 == remaining_len) {
 			/*  Nothing left to test, we have found the given string, we return the length. */
-			return tested_len;
+			return (synctex_status_t)tested_len;
 		}
 		/*  We also have to record the current state of the file cursor because
 		 *  if the_string does not match, all this should be a totally blank operation,
@@ -1258,7 +1258,7 @@
 		 *  that match the head of the_string. If in fine the_string does not match, all these chars must be recovered
 		 *  because the buffer contents is completely replaced by _synctex_buffer_get_available_size.
 		 *  They were buffered from offset-len location in the file. */
-		offset -= available;
+		offset -= (long) available;
 more_characters:
 		/*  There is still some work to be done, so read another bunch of file.
 		 *  This is the second call to _synctex_buffer_get_available_size,
@@ -1411,7 +1411,7 @@
 				/*  But we have reached the limit: we do not have current_size+len+1>UINT_MAX.
 				 *  We return the missing amount of memory.
 				 *  This will never occur in practice. */
-				return UINT_MAX-len-1 - current_size;
+				return (synctex_status_t) (UINT_MAX-len-1 - current_size);
 			}
 			new_size = current_size+len;
 			/*  We have current_size+len+1<=UINT_MAX
@@ -3317,7 +3317,7 @@
 				SYNCTEX_END = (unsigned char *)start_ref;
 			}
 			SYNCTEX_CUR = NULL;
-			return (SYNCTEX_END-SYNCTEX_START)/sizeof(synctex_node_t);
+			return (SYNCTEX_END-SYNCTEX_START) / (int) sizeof(synctex_node_t);
 		}
 #       if defined(__SYNCTEX_STRONG_DISPLAY_QUERY__)
 		break;
@@ -3457,7 +3457,7 @@
 							}
 							SYNCTEX_END = SYNCTEX_START + 2*sizeof(synctex_node_t);
 							SYNCTEX_CUR = NULL;
-							return (SYNCTEX_END-SYNCTEX_START)/sizeof(synctex_node_t);
+							return (SYNCTEX_END-SYNCTEX_START) / (int) sizeof(synctex_node_t);
 						}
 						return SYNCTEX_STATUS_ERROR;
 					}
@@ -3476,7 +3476,7 @@
 					* (synctex_node_t *)SYNCTEX_START = bestNodes.left;
 					SYNCTEX_END = SYNCTEX_START + sizeof(synctex_node_t);
 					SYNCTEX_CUR = NULL;
-					return (SYNCTEX_END-SYNCTEX_START)/sizeof(synctex_node_t);
+					return (SYNCTEX_END-SYNCTEX_START) / (int) sizeof(synctex_node_t);
 				}
 				return SYNCTEX_STATUS_ERROR;
 			}
Index: mupdf/buildwin.bat
===================================================================
--- mupdf/buildwin.bat	(révision 2827)
+++ mupdf/buildwin.bat	(copie de travail)
@@ -2,7 +2,7 @@
 @rem call "%ProgramFiles%\Microsoft Visual Studio 8\Common7\Tools\vsvars32.bat"
 
 @rem this is for Visual Studio 2008 aka vs9
-call "%ProgramFiles%\Microsoft Visual Studio 9.0\Common7\Tools\vsvars32.bat"
+call "C:\Apps\Dev\Visual Studio 2010\Common7\Tools\vsvars32.bat"
 
 @rem add nasm.exe to the path and verify it exists
 @set PATH=%PATH%;..\src\bin
Index: mupdf/makefile.msvc
===================================================================
--- mupdf/makefile.msvc	(révision 2827)
+++ mupdf/makefile.msvc	(copie de travail)
@@ -64,7 +64,11 @@
 
 CFLAGS = $(CFLAGS) /nologo /c
 # standard windows defines
+!if "$(BUILDPLATFORM)"=="X64"
+CFLAGS = $(CFLAGS) /D "WIN64" /D "_WIN64"
+!else
 CFLAGS = $(CFLAGS) /D "WIN32" /D "_WIN32"
+!endif
 # suppress warning C4996: 'function': was declared deprecated
 CFLAGS = $(CFLAGS) /wd4996
 
@@ -113,8 +117,13 @@
 !else
 JPEG_TURBO_CFLAGS = $(CFLAGS) /I$(JPEG_TURBO_DIR) /I$(JPEG_TURBO_DIR)\simd
 JPEG_TURBO_CFLAGS = $(JPEG_TURBO_CFLAGS) /wd4101 /wd4018
-JPEG_TURBO_NASM_FLAGS = -I $(JPEG_TURBO_DIR)\simd\ -I $(JPEG_TURBO_DIR)\win\ -f win32
+!if "$(BUILDPLATFORM)"=="X64"
+JPEG_TURBO_NASM_FLAGS_PLATFORM = win64 -D__x86_64__ -DWIN64
+!else
+JPEG_TURBO_NASM_FLAGS_PLATFORM = win32
 !endif
+JPEG_TURBO_NASM_FLAGS = -I $(JPEG_TURBO_DIR)\simd\ -I $(JPEG_TURBO_DIR)\win\ -f $(JPEG_TURBO_NASM_FLAGS_PLATFORM) -DMSVC
+!endif
 
 MUPDF_CFLAGS = $(CFLAGS) /D "NEED_MATH" /D "NEED_GETTIMEOFDAY" /D "HAVE_JBIG2DEC" /D "USE_HINTING"
 
@@ -166,28 +175,42 @@
 	$(OJ)\jidctint.obj $(OJ)\jdsample.obj $(OJ)\jdcolor.obj $(OJ)\jquant1.obj $(OJ)\jquant2.obj \
 	$(OJ)\jdmerge.obj $(OJ)\jmemnobs.obj # should I use jmemansi.obj or jmemname.obj ?
 !else
+!if "$(BUILDPLATFORM)"=="X64"
 JPEG_TURBO_OBJS = \
-	$(OT)\jsimdcpu.obj $(OT)\jccolmmx.obj $(OT)\jdcolmmx.obj $(OT)\jcsammmx.obj \
-	$(OT)\jdsammmx.obj $(OT)\jdmermmx.obj $(OT)\jcqntmmx.obj $(OT)\jfmmxfst.obj $(OT)\jfmmxint.obj \
-	$(OT)\jimmxred.obj $(OT)\jimmxint.obj $(OT)\jimmxfst.obj $(OT)\jcqnt3dn.obj $(OT)\jf3dnflt.obj \
-	$(OT)\ji3dnflt.obj $(OT)\jcqntsse.obj $(OT)\jfsseflt.obj $(OT)\jisseflt.obj $(OT)\jccolss2.obj \
-	$(OT)\jdcolss2.obj $(OT)\jcsamss2.obj $(OT)\jdsamss2.obj $(OT)\jdmerss2.obj $(OT)\jcqnts2i.obj \
-	$(OT)\jfss2fst.obj $(OT)\jfss2int.obj $(OT)\jiss2red.obj $(OT)\jiss2int.obj $(OT)\jiss2fst.obj \
-	$(OT)\jcqnts2f.obj $(OT)\jiss2flt.obj \
-	$(OT)\jsimd_i386.obj $(OT)\jcapimin.obj $(OT)\jcapistd.obj $(OT)\jccoefct.obj $(OT)\jccolor.obj \
-	$(OT)\jcdctmgr.obj $(OT)\jchuff.obj $(OT)\jcinit.obj $(OT)\jcmainct.obj $(OT)\jcmarker.obj \
-	$(OT)\jcmaster.obj $(OT)\jcomapi.obj $(OT)\jcparam.obj \
-	$(OT)\jcprepct.obj $(OT)\jcsample.obj $(OT)\jctrans.obj $(OT)\jdapimin.obj $(OT)\jdapistd.obj \
-	$(OT)\jdatadst.obj $(OT)\jdatasrc.obj $(OT)\jdcoefct.obj $(OT)\jdcolor.obj $(OT)\jddctmgr.obj \
-	$(OT)\jdhuff.obj $(OT)\jdinput.obj $(OT)\jdmainct.obj $(OT)\jdmarker.obj $(OT)\jdmaster.obj \
-	$(OT)\jdmerge.obj $(OT)\jdpostct.obj $(OT)\jdsample.obj $(OT)\jdtrans.obj $(OT)\jerror.obj \
-	$(OT)\jfdctflt.obj $(OT)\jfdctint.obj $(OT)\jidctflt.obj $(OT)\jidctfst.obj $(OT)\jidctint.obj \
-	$(OT)\jquant1.obj $(OT)\jquant2.obj $(OT)\jutils.obj $(OT)\jmemmgr.obj $(OT)\jmemnobs.obj \
-	$(OT)\jaricom.obj $(OT)\jcarith.obj $(OT)\jdarith.obj $(OT)\jfdctfst.obj \
-	$(OT)\jidctred.obj $(OT)\jdphuff.obj $(OT)\jcphuff.obj
+	$(OT)\jfsseflt-64.obj $(OT)\jccolss2-64.obj $(OT)\jdcolss2-64.obj $(OT)\jcsamss2-64.obj $(OT)\jdsamss2-64.obj \
+	$(OT)\jdmerss2-64.obj $(OT)\jcqnts2i-64.obj $(OT)\jfss2fst-64.obj $(OT)\jfss2int-64.obj $(OT)\jiss2red-64.obj \
+	$(OT)\jiss2int-64.obj $(OT)\jiss2fst-64.obj $(OT)\jcqnts2f-64.obj $(OT)\jiss2flt-64.obj
+!else
+JPEG_TURBO_OBJS = \
+  $(OT)\jsimdcpu.obj $(OT)\jccolmmx.obj $(OT)\jdcolmmx.obj $(OT)\jcsammmx.obj $(OT)\jdsammmx.obj \
+  $(OT)\jdmermmx.obj $(OT)\jcqntmmx.obj $(OT)\jfmmxfst.obj $(OT)\jfmmxint.obj $(OT)\jimmxred.obj \
+  $(OT)\jimmxint.obj $(OT)\jimmxfst.obj $(OT)\jcqnt3dn.obj $(OT)\jf3dnflt.obj $(OT)\ji3dnflt.obj \
+  $(OT)\jcqntsse.obj $(OT)\jfsseflt.obj $(OT)\jisseflt.obj $(OT)\jccolss2.obj $(OT)\jdcolss2.obj \
+  $(OT)\jcsamss2.obj $(OT)\jdsamss2.obj $(OT)\jdmerss2.obj $(OT)\jcqnts2i.obj $(OT)\jfss2fst.obj \
+  $(OT)\jfss2int.obj $(OT)\jiss2red.obj $(OT)\jiss2int.obj $(OT)\jiss2fst.obj $(OT)\jcqnts2f.obj \
+  $(OT)\jiss2flt.obj
+!endif
 
+JPEG_TURBO_OBJS = $(JPEG_TURBO_OBJS) \
+  $(OT)\jcapimin.obj $(OT)\jcapistd.obj $(OT)\jccoefct.obj $(OT)\jccolor.obj $(OT)\jcdctmgr.obj \
+  $(OT)\jchuff.obj $(OT)\jcinit.obj $(OT)\jcmainct.obj $(OT)\jcmarker.obj $(OT)\jcmaster.obj \
+  $(OT)\jcomapi.obj $(OT)\jcparam.obj $(OT)\jcphuff.obj $(OT)\jcprepct.obj $(OT)\jcsample.obj \
+  $(OT)\jctrans.obj $(OT)\jdapimin.obj $(OT)\jdapistd.obj $(OT)\jdatadst.obj $(OT)\jdatasrc.obj \
+  $(OT)\jdcoefct.obj $(OT)\jdcolor.obj $(OT)\jddctmgr.obj $(OT)\jdhuff.obj $(OT)\jdinput.obj \
+  $(OT)\jdmainct.obj $(OT)\jdmarker.obj $(OT)\jdmaster.obj $(OT)\jdmerge.obj $(OT)\jdphuff.obj \
+  $(OT)\jdpostct.obj $(OT)\jdsample.obj $(OT)\jdtrans.obj $(OT)\jerror.obj $(OT)\jfdctflt.obj \
+  $(OT)\jfdctfst.obj $(OT)\jfdctint.obj $(OT)\jidctflt.obj $(OT)\jidctfst.obj $(OT)\jidctint.obj \
+  $(OT)\jidctred.obj $(OT)\jquant1.obj $(OT)\jquant2.obj $(OT)\jutils.obj $(OT)\jmemmgr.obj \
+  $(OT)\jmemnobs.obj $(OT)\jaricom.obj $(OT)\jcarith.obj $(OT)\jdarith.obj
+
+!if "$(BUILDPLATFORM)"=="X64"
+JPEG_TURBO_OBJS = $(JPEG_TURBO_OBJS) $(OT)\jsimd_x86_64.obj
+!else
+JPEG_TURBO_OBJS = $(JPEG_TURBO_OBJS) $(OT)\jsimd_i386.obj
 !endif
 
+!endif
+
 JBIG2_OBJS = \
 	$(OJB)\jbig2.obj $(OJB)\jbig2_arith.obj \
 	$(OJB)\jbig2_arith_iaid.obj $(OJB)\jbig2_arith_int.obj $(OJB)\jbig2_huffman.obj \
Index: mupdf/mupdf/pdf_fontfile.c
===================================================================
--- mupdf/mupdf/pdf_fontfile.c	(révision 2827)
+++ mupdf/mupdf/pdf_fontfile.c	(copie de travail)
@@ -216,8 +216,8 @@
 {
 	char *val1 = (char *)elem1;
 	char *val2 = (char *)elem2;
-	int len1 = strlen(val1);
-	int len2 = strlen(val2);
+	int len1 = (int) strlen(val1);
+	int len2 = (int) strlen(val2);
 
 	if (len1 != len2)
 	{
Index: mupdf/mupdf/pdf_lex.c
===================================================================
--- mupdf/mupdf/pdf_lex.c	(révision 2827)
+++ mupdf/mupdf/pdf_lex.c	(copie de travail)
@@ -1,4 +1,4 @@
-#include "fitz.h"
+#include "../fitz/fitz.h"
 #include "mupdf.h"
 
 #define ISNUMBER \
@@ -408,7 +408,7 @@
 			break;
 		case '/':
 			lexname(f, buf, n);
-			*sl = strlen(buf);
+			*sl = (int) strlen(buf);
 			*tok = PDF_TNAME;
 			return fz_okay;
 		case '(':
@@ -459,7 +459,7 @@
 		default: /* isregular: !isdelim && !iswhite && c != EOF */
 			fz_unreadbyte(f);
 			lexname(f, buf, n);
-			*sl = strlen(buf);
+			*sl = (int) strlen(buf);
 			*tok = pdf_tokenfromkeyword(buf);
 			return fz_okay;
 		}
Index: mupdf/mupdf/pdf_crypt.c
===================================================================
--- mupdf/mupdf/pdf_crypt.c	(révision 2827)
+++ mupdf/mupdf/pdf_crypt.c	(copie de travail)
@@ -533,9 +533,9 @@
 {
 	if (xref->crypt)
 	{
-		if (pdf_authenticateuserpassword(xref->crypt, (unsigned char *)password, strlen(password)))
+		if (pdf_authenticateuserpassword(xref->crypt, (unsigned char *)password, (int) strlen(password)))
 			return 1;
-		if (pdf_authenticateownerpassword(xref->crypt, (unsigned char *)password, strlen(password)))
+		if (pdf_authenticateownerpassword(xref->crypt, (unsigned char *)password, (int) strlen(password)))
 			return 1;
 		return 0;
 	}
Index: mupdf/fitz/base_string.c
===================================================================
--- mupdf/fitz/base_string.c	(révision 2827)
+++ mupdf/fitz/base_string.c	(copie de travail)
@@ -58,7 +58,7 @@
 	n = siz - dlen;
 
 	if (n == 0)
-		return dlen + strlen(s);
+		return dlen + (int) strlen(s);
 	while (*s != '\0') {
 		if (n != 1) {
 			*d++ = *s;
Index: mupdf/fitz/obj_simple.c
===================================================================
--- mupdf/fitz/obj_simple.c	(révision 2827)
+++ mupdf/fitz/obj_simple.c	(copie de travail)
@@ -1,5 +1,5 @@
 #include "fitz.h"
-#include "mupdf.h" /* for pdf_loadobject */
+#include "../mupdf/mupdf.h" /* for pdf_loadobject */
 
 extern void fz_freearray(fz_obj *array);
 extern void fz_freedict(fz_obj *dict);
@@ -7,7 +7,7 @@
 fz_obj *
 fz_newnull(void)
 {
-	fz_obj *o = fz_malloc(sizeof(fz_obj));
+	fz_obj *o = (fz_obj *) fz_malloc(sizeof(fz_obj));
 	o->refs = 1;
 	o->kind = FZ_NULL;
 	return o;
@@ -16,7 +16,7 @@
 fz_obj *
 fz_newbool(int b)
 {
-	fz_obj *o = fz_malloc(sizeof(fz_obj));
+	fz_obj *o = (fz_obj *) fz_malloc(sizeof(fz_obj));
 	o->refs = 1;
 	o->kind = FZ_BOOL;
 	o->u.b = b;
@@ -26,7 +26,7 @@
 fz_obj *
 fz_newint(int i)
 {
-	fz_obj *o = fz_malloc(sizeof(fz_obj));
+	fz_obj *o = (fz_obj *) fz_malloc(sizeof(fz_obj));
 	o->refs = 1;
 	o->kind = FZ_INT;
 	o->u.i = i;
@@ -36,7 +36,7 @@
 fz_obj *
 fz_newreal(float f)
 {
-	fz_obj *o = fz_malloc(sizeof(fz_obj));
+	fz_obj *o = (fz_obj *) fz_malloc(sizeof(fz_obj));
 	o->refs = 1;
 	o->kind = FZ_REAL;
 	o->u.f = f;
@@ -46,7 +46,7 @@
 fz_obj *
 fz_newstring(char *str, int len)
 {
-	fz_obj *o = fz_malloc(offsetof(fz_obj, u.s.buf) + len + 1);
+	fz_obj *o = (fz_obj *) fz_malloc(offsetof(fz_obj, u.s.buf) + len + 1);
 	o->refs = 1;
 	o->kind = FZ_STRING;
 	o->u.s.len = len;
@@ -58,7 +58,7 @@
 fz_obj *
 fz_newname(char *str)
 {
-	fz_obj *o = fz_malloc(offsetof(fz_obj, u.n) + strlen(str) + 1);
+	fz_obj *o = (fz_obj *) fz_malloc(offsetof(fz_obj, u.n) + (int) strlen(str) + 1);
 	o->refs = 1;
 	o->kind = FZ_NAME;
 	strcpy(o->u.n, str);
@@ -68,7 +68,7 @@
 fz_obj *
 fz_newindirect(int num, int gen, pdf_xref *xref)
 {
-	fz_obj *o = fz_malloc(sizeof(fz_obj));
+	fz_obj *o = (fz_obj *) fz_malloc(sizeof(fz_obj));
 	o->refs = 1;
 	o->kind = FZ_INDIRECT;
 	o->u.r.num = num;
Index: mupdf/fitz/filt_dctd.c
===================================================================
--- mupdf/fitz/filt_dctd.c	(révision 2827)
+++ mupdf/fitz/filt_dctd.c	(copie de travail)
@@ -1,6 +1,6 @@
 #include "fitz.h"
 
-#include <jpeglib.h>
+#include "../../ext/libjpeg-turbo/jpeglib.h"
 #include <setjmp.h>
 
 typedef struct fz_dctd_s fz_dctd;
@@ -22,7 +22,7 @@
 
 static void error_exit(j_common_ptr cinfo)
 {
-	fz_dctd *state = cinfo->client_data;
+	fz_dctd *state = (fz_dctd *) cinfo->client_data;
 	cinfo->err->format_message(cinfo, state->msg);
 	longjmp(state->jb, 1);
 }
@@ -40,7 +40,7 @@
 static boolean fill_input_buffer(j_decompress_ptr cinfo)
 {
 	struct jpeg_source_mgr *src = cinfo->src;
-	fz_dctd *state = cinfo->client_data;
+	fz_dctd *state = (fz_dctd *) cinfo->client_data;
 	fz_stream *chain = state->chain;
 
 	chain->rp = chain->wp;
@@ -66,7 +66,7 @@
 	{
 		while ((size_t)num_bytes > src->bytes_in_buffer)
 		{
-			num_bytes -= src->bytes_in_buffer;
+			num_bytes -= (long) src->bytes_in_buffer;
 			(void) src->fill_input_buffer(cinfo);
 		}
 		src->next_input_byte += num_bytes;
@@ -77,7 +77,7 @@
 static int
 readdctd(fz_stream *stm, unsigned char *buf, int len)
 {
-	fz_dctd *state = stm->state;
+	fz_dctd *state = (fz_dctd *) stm->state;
 	j_decompress_ptr cinfo = &state->cinfo;
 	unsigned char *p = buf;
 	unsigned char *ep = buf + len;
@@ -144,7 +144,7 @@
 		jpeg_start_decompress(cinfo);
 
 		state->stride = cinfo->output_width * cinfo->output_components;
-		state->scanline = fz_malloc(state->stride);
+		state->scanline = (unsigned char*) fz_malloc(state->stride);
 		state->rp = state->scanline;
 		state->wp = state->scanline;
 
Index: mupdf/fitz/base_memory.c
===================================================================
--- mupdf/fitz/base_memory.c	(révision 2827)
+++ mupdf/fitz/base_memory.c	(copie de travail)
@@ -70,8 +70,8 @@
 char *
 fz_strdup(char *s)
 {
-	int len = strlen(s) + 1;
-	char *ns = fz_malloc(len);
+	int len = (int) strlen(s) + 1;
+	char *ns = (char *) fz_malloc(len);
 	memcpy(ns, s, len);
 	return ns;
 }

