Skip to content

Commit

Permalink
add radix in parseInt
Browse files Browse the repository at this point in the history
  • Loading branch information
erossignon committed Feb 23, 2014
1 parent a4e828e commit bd27b8c
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 27 deletions.
4 changes: 2 additions & 2 deletions bin/opcua_interceptor.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ var s = require("../lib/structures");

require("colors");

var remote_port = parseInt(argv.port) || 4841;
var remote_port = parseInt(argv.port,10) || 4841;
hostname = argv.hostname || "localhost" ;

var my_port = parseInt(argv.portServer) || remote_port + 1;
var my_port = parseInt(argv.portServer,10) || remote_port + 1;


var TrafficAnalyser = function(id)
Expand Down
2 changes: 1 addition & 1 deletion code_gen/fetch.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ function wget(url) {
// handle the response
var res_data = '';
// console.log(response);
var fileBytes = parseInt(response.headers['content-length']);
var fileBytes = parseInt(response.headers['content-length'],10);
var bar = new ProgressBar(' downloading ' + url + '[:bar] :percent :etas', {
complete: '='
, incomplete: ' '
Expand Down
4 changes: 2 additions & 2 deletions code_gen/generate_node_ids.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ csv().from.stream(fs.createReadStream(__dirname+'/NodeIds.csv')).to.array(functi
if (codeMap.hasOwnProperty(name)) {
e = codeMap[name];
var name = e[0];
var id = parseInt(e[1]);
var id = parseInt(e[1],10);
var typeName = e[2];

outFile.write(sprintf(" %40s: { name: %40s , value: %6d }, \n",name,"'"+name+"'",id));
Expand All @@ -59,7 +59,7 @@ csv().from.stream(fs.createReadStream(__dirname+'/NodeIds.csv')).to.array(functi
if (typeMap.hasOwnProperty(name)) {
e = typeMap[name];
var name = e[0];
var id = parseInt(e[1]);
var id = parseInt(e[1],10);
var type = e[2];
outFile.write(sprintf(" %80s: %6d , \n",name,id));
}
Expand Down
2 changes: 1 addition & 1 deletion code_gen/generate_status_code.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ var codeMap = {};
csv().from.stream(fs.createReadStream(__dirname + '/StatusCodes.csv')).to.array(function (data) {
data.forEach(function (e) {
var codeName = e[0];
codeMap[codeName] = parseInt(e[1]);
codeMap[codeName] = parseInt(e[1],10);
});
//xx console.log(data);

Expand Down
26 changes: 13 additions & 13 deletions lib/encode_decode.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ function bn_dateToHundredNanoSecondFrom1601(date) {
var high = bn_value.div(0xFFFFFFFF).floor();
var low = bn_value.mod(0xFFFFFFFF);
//xx console.log(" high =",high,"low = ",low);
return [ parseInt(high.toS()),parseInt(low.toS())];
return [ parseInt(high.toS()),parseInt(low.toS(),10)];
}
exports.bn_dateToHundredNanoSecondFrom1601 = bn_dateToHundredNanoSecondFrom1601;

Expand All @@ -185,7 +185,7 @@ function bn_hundredNanoSecondFrom1601ToDate(high,low) {
var factor = offset_factor_1601[1];

var value = BigNumber(high).times(0xFFFFFFFF).plus(low).div(factor).minus(offset);
value = parseInt(value);
value = parseInt(value,10);
return new Date(value);
}

Expand Down Expand Up @@ -230,21 +230,21 @@ exports.encodeGUID = function (guid, stream) {
// 0123456789012345678901234567890123456
// | | | | |
// “72962B91-FA75-4AE6-8D28-B404DC7DAF63”
stream.writeUInt32(parseInt("0x" + guid.substr(0, 8)));
stream.writeUInt32(parseInt(guid.substr(0, 8),16));

stream.writeUInt16(parseInt("0x" + guid.substr(9, 4)));
stream.writeUInt16(parseInt(guid.substr(9, 4),16));

stream.writeUInt16(parseInt("0x" + guid.substr(14, 4)));
stream.writeUInt16(parseInt(guid.substr(14, 4),16));

stream.writeUInt8(parseInt("0x" + guid.substr(19, 2)));
stream.writeUInt8(parseInt("0x" + guid.substr(21, 2)));
stream.writeUInt8(parseInt(guid.substr(19, 2),16));
stream.writeUInt8(parseInt(guid.substr(21, 2),16));

stream.writeUInt8(parseInt("0x" + guid.substr(24, 2)));
stream.writeUInt8(parseInt("0x" + guid.substr(26, 2)));
stream.writeUInt8(parseInt("0x" + guid.substr(28, 2)));
stream.writeUInt8(parseInt("0x" + guid.substr(30, 2)));
stream.writeUInt8(parseInt("0x" + guid.substr(32, 2)));
stream.writeUInt8(parseInt("0x" + guid.substr(34, 2)));
stream.writeUInt8(parseInt(guid.substr(24, 2),16));
stream.writeUInt8(parseInt(guid.substr(26, 2),16));
stream.writeUInt8(parseInt(guid.substr(28, 2),16));
stream.writeUInt8(parseInt(guid.substr(30, 2),16));
stream.writeUInt8(parseInt(guid.substr(32, 2),16));
stream.writeUInt8(parseInt(guid.substr(34, 2),16));

};

Expand Down
10 changes: 5 additions & 5 deletions lib/nodeid.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ function coerceNodeId(value,namespace){
if ( value.substr(0,2) === "i=" ) {

identifierType = NodeIdType.NUMERIC;
value = parseInt(value.substr(2));
value = parseInt(value.substr(2),10);

} else if ( value.substr(0,2) === "s=" ) {

Expand All @@ -84,12 +84,12 @@ function coerceNodeId(value,namespace){

} else if ( (matches = rege_ns_i.exec(value)) !== null) {
identifierType = NodeIdType.NUMERIC;
namespace = parseInt(matches[1]);
value = parseInt(matches[2]);
namespace = parseInt(matches[1],10);
value = parseInt(matches[2],10);

} else if ( (matches = rege_ns_s.exec(value)) !== null) {
identifierType = NodeIdType.STRING;
namespace = parseInt(matches[1]);
namespace = parseInt(matches[1],10);
value = matches[2];
}

Expand Down Expand Up @@ -174,7 +174,7 @@ ExpandedNodeId.prototype.toString = function() {
//
exports.makeExpandedNodeId = function makeExpandedNodeId(value,namespace) {

value = parseInt(value) || 0;
value = parseInt(value,10) || 0;
namespace = namespace || 0;
serverIndex = 0;
namespaceUri = null;
Expand Down
2 changes: 1 addition & 1 deletion lib/nodeopcua.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ function parseEndpointUrl(endpoint_url)
return {
protocol: matches[1],
hostname: matches[2],
port: parseInt(matches[3]),
port: parseInt(matches[3],10),
address: matches[4] || ""
}

Expand Down
2 changes: 1 addition & 1 deletion lib/server/server_endpoint.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ function OPCUAServerEndPoint(server, port,options) {

options = options || {};
var self = this;
self.port = parseInt(port);
self.port = parseInt(port,10);

self.server = server;
self._channels = [];
Expand Down
2 changes: 1 addition & 1 deletion lib/variant.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ function coerceVariantType(dataType, value)
}
break;
case DataType.UInt32:
value = parseInt(value);
value = parseInt(value,10);
break;

default:
Expand Down

0 comments on commit bd27b8c

Please sign in to comment.