From 03d928b40ceccab4aa2cedbacb40e642ab24a8c1 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Wed, 21 Mar 2007 15:43:07 +0000 Subject: [PATCH] Fix File.getContents() (including PDF cache file indexing) on Windows (I think) --- chrome/content/zotero/xpcom/file.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/chrome/content/zotero/xpcom/file.js b/chrome/content/zotero/xpcom/file.js index 206603b00..8b8b800a3 100644 --- a/chrome/content/zotero/xpcom/file.js +++ b/chrome/content/zotero/xpcom/file.js @@ -59,7 +59,7 @@ Zotero.File = new function(){ function getSample(file){ var fis = Components.classes["@mozilla.org/network/file-input-stream;1"]. createInstance(Components.interfaces.nsIFileInputStream); - fis.init(file, false, false, false); + fis.init(file, 0x01, 0664, 0); const replacementChar = Components.interfaces.nsIConverterInputStream.DEFAULT_REPLACEMENT_CHARACTER; @@ -67,7 +67,7 @@ Zotero.File = new function(){ .createInstance(Components.interfaces.nsIConverterInputStream); is.init(fis, "UTF-8", 128, replacementChar); var str = {}; - var numChars = is.readString(512, str); + var numChars = is.readString(128, str); is.close(); return str.value; @@ -77,7 +77,7 @@ Zotero.File = new function(){ function getContents(file, charset, maxLength){ var fis = Components.classes["@mozilla.org/network/file-input-stream;1"]. createInstance(Components.interfaces.nsIFileInputStream); - fis.init(file, false, false, false); + fis.init(file, 0x01, 0664, 0); if (charset){ charset = Zotero.CharacterSets.getName(charset); @@ -91,8 +91,8 @@ Zotero.File = new function(){ = Components.interfaces.nsIConverterInputStream.DEFAULT_REPLACEMENT_CHARACTER; var is = Components.classes["@mozilla.org/intl/converter-input-stream;1"] .createInstance(Components.interfaces.nsIConverterInputStream); - is.init(fis, charset, 1024, replacementChar); - var chars = 1024; + is.init(fis, charset, 4096, replacementChar); + var chars = 4096; var contents = [], str = {}; while (is.readString(4096, str) != 0) {