From 03b1b75bfbb36937dcd3618e75cb5f2715df6fed Mon Sep 17 00:00:00 2001 From: Tom Najdek Date: Sun, 16 Oct 2016 02:03:40 +0100 Subject: [PATCH] Fix non-strict syntax for octal number literals --- chrome/content/zotero/fileInterface.js | 2 +- chrome/content/zotero/recognizePDF.js | 2 +- chrome/content/zotero/test/modtime.js | 2 +- chrome/content/zotero/xpcom/attachments.js | 2 +- chrome/content/zotero/xpcom/file.js | 14 +++++++------- chrome/content/zotero/xpcom/ipc.js | 6 +++--- chrome/content/zotero/xpcom/itemTreeView.js | 6 +++--- chrome/content/zotero/xpcom/locateManager.js | 4 ++-- .../content/zotero/xpcom/storage/storageLocal.js | 4 ++-- .../zotero/xpcom/translation/translate_firefox.js | 4 ++-- .../zotero/xpcom/translation/translate_item.js | 4 ++-- chrome/content/zotero/xpcom/utilities_internal.js | 2 +- chrome/content/zotero/xpcom/zotero.js | 2 +- 13 files changed, 27 insertions(+), 27 deletions(-) diff --git a/chrome/content/zotero/fileInterface.js b/chrome/content/zotero/fileInterface.js index 57f91bef06..d8d5b615b6 100644 --- a/chrome/content/zotero/fileInterface.js +++ b/chrome/content/zotero/fileInterface.js @@ -611,7 +611,7 @@ var Zotero_File_Interface = new function() { // open file var fStream = Components.classes["@mozilla.org/network/file-output-stream;1"]. createInstance(Components.interfaces.nsIFileOutputStream); - fStream.init(fp.file, 0x02 | 0x08 | 0x20, 0664, 0); // write, create, truncate + fStream.init(fp.file, 0x02 | 0x08 | 0x20, 0o664, 0); // write, create, truncate return fStream; } else { return false; diff --git a/chrome/content/zotero/recognizePDF.js b/chrome/content/zotero/recognizePDF.js index 6042ca0ea8..8d8a71c7b4 100644 --- a/chrome/content/zotero/recognizePDF.js +++ b/chrome/content/zotero/recognizePDF.js @@ -160,7 +160,7 @@ var Zotero_RecognizePDF = new function() { try { var inputStream = Components.classes["@mozilla.org/network/file-input-stream;1"] .createInstance(Components.interfaces.nsIFileInputStream); - inputStream.init(cacheFile, 0x01, 0664, 0); + inputStream.init(cacheFile, 0x01, 0o664, 0); try { var intlStream = Components.classes["@mozilla.org/intl/converter-input-stream;1"] .createInstance(Components.interfaces.nsIConverterInputStream); diff --git a/chrome/content/zotero/test/modtime.js b/chrome/content/zotero/test/modtime.js index 94f3c532ee..d23e547e1a 100644 --- a/chrome/content/zotero/test/modtime.js +++ b/chrome/content/zotero/test/modtime.js @@ -1,6 +1,6 @@ var tmp = Zotero.getTempDirectory(); tmp.append(Zotero.randomString()); -tmp.create(Components.interfaces.nsIFile.FILE_TYPE, 0644); +tmp.create(Components.interfaces.nsIFile.FILE_TYPE, 0o644); var date = new Date(); var nowTS = Zotero.Date.toUnixTimestamp(date) * 1000; diff --git a/chrome/content/zotero/xpcom/attachments.js b/chrome/content/zotero/xpcom/attachments.js index d5f8ec6563..63c34f03b4 100644 --- a/chrome/content/zotero/xpcom/attachments.js +++ b/chrome/content/zotero/xpcom/attachments.js @@ -848,7 +848,7 @@ Zotero.Attachments = new function(){ var tmpDir = Zotero.getStorageDirectory(); tmpDir.append("tmp-" + Zotero.Utilities.randomString(6)); yield OS.File.makeDir(tmpDir.path, { - unixMode: 0755 + unixMode: 0o755 }); return tmpDir; }); diff --git a/chrome/content/zotero/xpcom/file.js b/chrome/content/zotero/xpcom/file.js index 27245a148a..c9af26f252 100644 --- a/chrome/content/zotero/xpcom/file.js +++ b/chrome/content/zotero/xpcom/file.js @@ -124,7 +124,7 @@ Zotero.File = new function(){ this.getBinaryContents = function(file) { var iStream = Components.classes["@mozilla.org/network/file-input-stream;1"] .createInstance(Components.interfaces.nsIFileInputStream); - iStream.init(file, 0x01, 0664, 0); + iStream.init(file, 0x01, 0o664, 0); var bStream = Components.classes["@mozilla.org/binaryinputstream;1"] .createInstance(Components.interfaces.nsIBinaryInputStream); bStream.setInputStream(iStream); @@ -154,7 +154,7 @@ Zotero.File = new function(){ } else if(file instanceof Components.interfaces.nsIFile) { fis = Components.classes["@mozilla.org/network/file-input-stream;1"]. createInstance(Components.interfaces.nsIFileInputStream); - fis.init(file, 0x01, 0664, 0); + fis.init(file, 0x01, 0o664, 0); } else { throw new Error("File is not an nsIInputStream or nsIFile"); } @@ -347,7 +347,7 @@ Zotero.File = new function(){ } var fos = Components.classes["@mozilla.org/network/file-output-stream;1"]. createInstance(Components.interfaces.nsIFileOutputStream); - fos.init(file, 0x02 | 0x08 | 0x20, 0664, 0); // write, create, truncate + fos.init(file, 0x02 | 0x08 | 0x20, 0o664, 0); // write, create, truncate var os = Components.classes["@mozilla.org/intl/converter-output-stream;1"] .createInstance(Components.interfaces.nsIConverterOutputStream); @@ -642,7 +642,7 @@ Zotero.File = new function(){ .getTypeFromFile(file); var inputStream = Components.classes["@mozilla.org/network/file-input-stream;1"] .createInstance(Components.interfaces.nsIFileInputStream); - inputStream.init(file, 0x01, 0600, 0); + inputStream.init(file, 0x01, 0o600, 0); var stream = Components.classes["@mozilla.org/binaryinputstream;1"] .createInstance(Components.interfaces.nsIBinaryInputStream); stream.setInputStream(inputStream); @@ -768,7 +768,7 @@ Zotero.File = new function(){ file = this.pathToFile(file); newFile = this.pathToFile(newFile); - newFile.createUnique(Components.interfaces.nsIFile.NORMAL_FILE_TYPE, 0644); + newFile.createUnique(Components.interfaces.nsIFile.NORMAL_FILE_TYPE, 0o644); var newName = newFile.leafName; newFile.remove(null); @@ -807,7 +807,7 @@ Zotero.File = new function(){ if (dir.exists() && !dir.isDirectory()) { dir.remove(null); } - dir.create(Components.interfaces.nsIFile.DIRECTORY_TYPE, 0755); + dir.create(Components.interfaces.nsIFile.DIRECTORY_TYPE, 0o755); } } @@ -818,7 +818,7 @@ Zotero.File = new function(){ path, { ignoreExisting: true, - unixMode: 0755 + unixMode: 0o755 } ) ); diff --git a/chrome/content/zotero/xpcom/ipc.js b/chrome/content/zotero/xpcom/ipc.js index fedb072068..81ffbca4d2 100755 --- a/chrome/content/zotero/xpcom/ipc.js +++ b/chrome/content/zotero/xpcom/ipc.js @@ -33,7 +33,7 @@ Zotero.IPC = new function() { if(!Zotero.isWin) { // no pipe support on Fx 3.6 _instancePipe = _getPipeDirectory(); if(!_instancePipe.exists()) { - _instancePipe.create(Ci.nsIFile.DIRECTORY_TYPE, 0700); + _instancePipe.create(Ci.nsIFile.DIRECTORY_TYPE, 0o700); } _instancePipe.append(Zotero.instanceID); @@ -126,7 +126,7 @@ Zotero.IPC = new function() { // On Linux, O_NONBLOCK = 00004000 // On both, O_WRONLY = 0x0001 var mode = 0x0001; - if(!block) mode = mode | (Zotero.isLinux ? 00004000 : 0x0004); + if(!block) mode = mode | (Zotero.isLinux ? 0o0004000 : 0x0004); var fd = open(pipe.path, mode); if(fd === -1) return false; @@ -387,7 +387,7 @@ Zotero.IPC.Pipe = new function() { } // make pipe - var ret = _mkfifo(file.path, 0600); + var ret = _mkfifo(file.path, 0o600); return file.exists(); } diff --git a/chrome/content/zotero/xpcom/itemTreeView.js b/chrome/content/zotero/xpcom/itemTreeView.js index 85843c5d38..10cf893f64 100644 --- a/chrome/content/zotero/xpcom/itemTreeView.js +++ b/chrome/content/zotero/xpcom/itemTreeView.js @@ -2673,7 +2673,7 @@ Zotero.ItemTreeView.fileDragDataProvider.prototype = { if (destDir.exists()) { destDir.remove(true); } - destDir.create(Components.interfaces.nsIFile.DIRECTORY_TYPE, 0755); + destDir.create(Components.interfaces.nsIFile.DIRECTORY_TYPE, 0o755); } var copiedFiles = []; @@ -2721,7 +2721,7 @@ Zotero.ItemTreeView.fileDragDataProvider.prototype = { // directory, it's a duplicate, so give this one // a different name else { - copiedFile.createUnique(Components.interfaces.nsIFile.NORMAL_FILE_TYPE, 0644); + copiedFile.createUnique(Components.interfaces.nsIFile.NORMAL_FILE_TYPE, 0o644); var newName = copiedFile.leafName; copiedFile.remove(null); } @@ -2762,7 +2762,7 @@ Zotero.ItemTreeView.fileDragDataProvider.prototype = { // it's a duplicate, so give this one a different // name else { - copiedFile.createUnique(Components.interfaces.nsIFile.NORMAL_FILE_TYPE, 0644); + copiedFile.createUnique(Components.interfaces.nsIFile.NORMAL_FILE_TYPE, 0o644); var newName = copiedFile.leafName; copiedFile.remove(null); } diff --git a/chrome/content/zotero/xpcom/locateManager.js b/chrome/content/zotero/xpcom/locateManager.js index 418502cc09..253a3c3e77 100644 --- a/chrome/content/zotero/xpcom/locateManager.js +++ b/chrome/content/zotero/xpcom/locateManager.js @@ -132,7 +132,7 @@ Zotero.LocateManager = new function() { if(locateDir.exists()) locateDir.remove(true); // create new locate dir - locateDir.create(Components.interfaces.nsIFile.DIRECTORY_TYPE, 0700); + locateDir.create(Components.interfaces.nsIFile.DIRECTORY_TYPE, 0o700); // copy default file to new locate dir Zotero.File.putContents(_jsonFile, @@ -233,7 +233,7 @@ Zotero.LocateManager = new function() { // write the icon to the file var fos = Components.classes["@mozilla.org/network/file-output-stream;1"]. createInstance(Components.interfaces.nsIFileOutputStream); - fos.init(iconFile, 0x02 | 0x08 | 0x20, 0664, 0); // write, create, truncate + fos.init(iconFile, 0x02 | 0x08 | 0x20, 0o664, 0); // write, create, truncate var bos = Components.classes["@mozilla.org/binaryoutputstream;1"]. createInstance(Components.interfaces.nsIBinaryOutputStream); bos.setOutputStream(fos); diff --git a/chrome/content/zotero/xpcom/storage/storageLocal.js b/chrome/content/zotero/xpcom/storage/storageLocal.js index 48b6d2032f..2208b8852e 100644 --- a/chrome/content/zotero/xpcom/storage/storageLocal.js +++ b/chrome/content/zotero/xpcom/storage/storageLocal.js @@ -655,7 +655,7 @@ Zotero.Sync.Storage.Local = { + " into attachment directory as '" + fileName + "'"); try { var finalFileName = Zotero.File.createShortened( - path, Components.interfaces.nsIFile.NORMAL_FILE_TYPE, 0644 + path, Components.interfaces.nsIFile.NORMAL_FILE_TYPE, 0o644 ); } catch (e) { @@ -822,7 +822,7 @@ Zotero.Sync.Storage.Local = { let shortened; try { shortened = Zotero.File.createShortened( - destPath, Components.interfaces.nsIFile.NORMAL_FILE_TYPE, 0644 + destPath, Components.interfaces.nsIFile.NORMAL_FILE_TYPE, 0o644 ); } catch (e) { diff --git a/chrome/content/zotero/xpcom/translation/translate_firefox.js b/chrome/content/zotero/xpcom/translation/translate_firefox.js index a310f19466..88a3b6ac46 100644 --- a/chrome/content/zotero/xpcom/translation/translate_firefox.js +++ b/chrome/content/zotero/xpcom/translation/translate_firefox.js @@ -786,7 +786,7 @@ Zotero.Translate.IO.Read.prototype = { if(this._rawStream) this._rawStream.close(); this._rawStream = Components.classes["@mozilla.org/network/file-input-stream;1"] .createInstance(Components.interfaces.nsIFileInputStream); - this._rawStream.init(this.file, 0x01, 0664, 0); + this._rawStream.init(this.file, 0x01, 0o664, 0); }, "_rewind":function() { @@ -921,7 +921,7 @@ Zotero.Translate.IO.Write = function(file) { Zotero.Translate.IO.maintainedInstances.push(this); this._rawStream = Components.classes["@mozilla.org/network/file-output-stream;1"] .createInstance(Components.interfaces.nsIFileOutputStream); - this._rawStream.init(file, 0x02 | 0x08 | 0x20, 0664, 0); // write, create, truncate + this._rawStream.init(file, 0x02 | 0x08 | 0x20, 0o664, 0); // write, create, truncate this._writtenToStream = false; } diff --git a/chrome/content/zotero/xpcom/translation/translate_item.js b/chrome/content/zotero/xpcom/translation/translate_item.js index 03c2559c59..968c2333f8 100644 --- a/chrome/content/zotero/xpcom/translation/translate_item.js +++ b/chrome/content/zotero/xpcom/translation/translate_item.js @@ -754,7 +754,7 @@ Zotero.Translate.ItemGetter.prototype = { this._exportFileDirectory.append(name); // create directory - this._exportFileDirectory.create(Components.interfaces.nsIFile.DIRECTORY_TYPE, 0700); + this._exportFileDirectory.create(Components.interfaces.nsIFile.DIRECTORY_TYPE, 0o700); // generate a new location for the exported file, with the appropriate // extension @@ -831,7 +831,7 @@ Zotero.Translate.ItemGetter.prototype = { // Create intermediate directories if they don't exist parent = targetFile; while((parent = parent.parent) && !parent.exists()) { - parent.create(Components.interfaces.nsIFile.DIRECTORY_TYPE, 0700); + parent.create(Components.interfaces.nsIFile.DIRECTORY_TYPE, 0o700); } // Delete any existing file if overwriteExisting is set, or throw an exception diff --git a/chrome/content/zotero/xpcom/utilities_internal.js b/chrome/content/zotero/xpcom/utilities_internal.js index 1c68b31d58..78cf28fd99 100644 --- a/chrome/content/zotero/xpcom/utilities_internal.js +++ b/chrome/content/zotero/xpcom/utilities_internal.js @@ -98,7 +98,7 @@ Zotero.Utilities.Internal = { var istream = Components.classes["@mozilla.org/network/file-input-stream;1"] .createInstance(Components.interfaces.nsIFileInputStream); // open for reading - istream.init(strOrFile, 0x01, 0444, 0); + istream.init(strOrFile, 0x01, 0o444, 0); var ch = Components.classes["@mozilla.org/security/hash;1"] .createInstance(Components.interfaces.nsICryptoHash); // we want to use the MD5 algorithm diff --git a/chrome/content/zotero/xpcom/zotero.js b/chrome/content/zotero/xpcom/zotero.js index ae00d5198f..f1a5cfe7a7 100644 --- a/chrome/content/zotero/xpcom/zotero.js +++ b/chrome/content/zotero/xpcom/zotero.js @@ -1413,7 +1413,7 @@ Components.utils.import("resource://gre/modules/PluralForm.jsm"); function moveToUnique(file, newFile){ - newFile.createUnique(Components.interfaces.nsIFile.NORMAL_FILE_TYPE, 0644); + newFile.createUnique(Components.interfaces.nsIFile.NORMAL_FILE_TYPE, 0o644); var newName = newFile.leafName; newFile.remove(null);