Fix non-strict syntax for octal number literals

This commit is contained in:
Tom Najdek 2016-10-16 02:03:40 +01:00 committed by Dan Stillman
parent 269e2f8bff
commit 03b1b75bfb
13 changed files with 27 additions and 27 deletions

View file

@ -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;

View file

@ -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);

View file

@ -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;

View file

@ -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;
});

View file

@ -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
}
)
);

View file

@ -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();
}

View file

@ -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);
}

View file

@ -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);

View file

@ -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) {

View file

@ -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;
}

View file

@ -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

View file

@ -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

View file

@ -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);