فهرست منبع

Use strict in javascript

Caleb James DeLisle 3 سال پیش
والد
کامیت
0899f770c6

+ 1 - 1
exception/Er.js

@@ -12,7 +12,7 @@
  * You should have received a copy of the GNU General Public License
  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
  */
-
+'use strict';
 const trim = (x) => {
     if (x[0] !== ' ' || x[x.length-1] !== ' ') {
         throw new Error("INTERNAL: Er input must begin " +

+ 1 - 0
node_build/CanCompile.js

@@ -12,6 +12,7 @@
  * You should have received a copy of the GNU General Public License
  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
  */
+'use strict';
 var nThen = require("nthen");
 var Fs = require("fs");
 

+ 1 - 1
node_build/Codestyle.js

@@ -12,7 +12,7 @@
  * You should have received a copy of the GNU General Public License
  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
  */
-
+'use strict';
 var Fs = require('fs');
 var nThen = require('nthen');
 var Semaphore = require('../tools/lib/Semaphore');

+ 1 - 0
node_build/Cp.js

@@ -1,3 +1,4 @@
+'use strict';
 var Fs = require("fs");
 var Semaphore = require('../tools/lib/Semaphore');
 var nThen = require('nthen');

+ 1 - 0
node_build/FindPython.js

@@ -12,6 +12,7 @@
  * You should have received a copy of the GNU General Public License
  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
  */
+'use strict';
 var nThen = require('nthen');
 var Spawn = require('child_process').spawn;
 var Fs = require('fs');

+ 1 - 0
node_build/GetVersion.js

@@ -1,3 +1,4 @@
+'use strict';
 var nThen = require('nthen');
 var Exec = require('child_process').exec;
 

+ 1 - 0
node_build/HasFunction.js

@@ -1,3 +1,4 @@
+'use strict';
 var nThen = require("nthen");
 var Fs = require("fs");
 

+ 1 - 1
node_build/JSHintReporter.js

@@ -12,7 +12,7 @@
  * You should have received a copy of the GNU General Public License
  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
  */
-
+'use strict';
 module.exports = {
     reporter: function(res) {
         var len = res.length;

+ 1 - 0
node_build/TestRunner.js

@@ -11,6 +11,7 @@
  * You should have received a copy of the GNU General Public License
  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
  */
+'use strict';
 var Spawn = require('child_process').spawn;
 var Http = require("http");
 var Fs = require("fs");

+ 10 - 11
util/Constant.js

@@ -12,7 +12,7 @@
  * You should have received a copy of the GNU General Public License
  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
  */
-
+'use strict';
 var Crypto = require('crypto');
 var seed = process.env.SOURCE_DATE_EPOCH || Crypto.randomBytes(32).toString('hex');
 
@@ -67,24 +67,23 @@ var base2 = module.exports.base2 = function (numStr) {
     return '((' + type + ') 0x' + base2ToHex(numStr) + ((type === 'uint64_t') ? 'ull' : 'ul') + ')';
 };
 
-var randomHex = function (bytes, file) {
-    if (!file) { throw new Error('file unspecified'); }
-    var nonce = file.Constant_JS_nonce = (file.Constant_JS_nonce || 0) + 1;
-    var material = new Crypto.Hash('sha512').update(seed).update(file.name).update(String(nonce)).digest();
+var randomHex = function (bytes, self, fileName) {
+    var nonce = self.Constant_JS_nonce = (self.Constant_JS_nonce || 0) + 1;
+    var material = new Crypto.Hash('sha512').update(seed).update(fileName).update(String(nonce)).digest();
     if (bytes > 64) { throw new Error("meh, randomHex of over 64 bytes is unimplemented"); }
     return material.slice(0, bytes).toString('hex');
 };
 
-var rand64 = module.exports.rand64 = function (file) {
-    return '((uint64_t) 0x' + randomHex(64 / 8, file) + 'ull)';
+var rand64 = module.exports.rand64 = function (self, fileName) {
+    return '((uint64_t) 0x' + randomHex(64 / 8, self, fileName) + 'ull)';
 };
 
-var rand32 = module.exports.rand32 = function (file) {
-    return '((uint32_t) 0x' + randomHex(32 / 8, file) + 'ul)';
+var rand32 = module.exports.rand32 = function (self, fileName) {
+    return '((uint32_t) 0x' + randomHex(32 / 8, self, fileName) + 'ul)';
 };
 
-var randHexString = module.exports.randHexString = function (lenStr, file) {
-    return '"' + randomHex(lenStr / 2, file) + '"';
+var randHexString = module.exports.randHexString = function (lenStr, self, fileName) {
+    return '"' + randomHex(lenStr / 2, self, fileName) + '"';
 };
 
 var log2 = module.exports.log2 = function (val) {

+ 1 - 0
util/Seccomp.js

@@ -12,6 +12,7 @@
  * You should have received a copy of the GNU General Public License
  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
  */
+'use strict';
 var Os = require('os');
 
 var TEST_PROGRAM = [