Skip to content

Commit

Permalink
install script fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
christkv committed Jul 18, 2011
1 parent 5925000 commit c82f9b4
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 45 deletions.
26 changes: 10 additions & 16 deletions install.sh
Expand Up @@ -5,22 +5,16 @@ echo "= To install with C++ bson parser do <npm install mongodb --mongodb:nativ
echo "= the parser only works for node 0.4.X or lower ="
echo "= ="
echo "================================================================================"
echo "Not building native library for cygwin"
if [ x`which gmake` != "x" ]; then
echo "Using GNU make";

if [ $number = `uname -o` = "Cygwin" ]
then
echo "Not building native library for cygwin"
if [ $npm_package_config_native = "true" ]; then
gmake total
fi
else
echo "Not building native library for cygwin"
if [ x`which gmake` != "x" ]; then
echo "Using GNU make";

if [ $npm_package_config_native = "true" ]; then
gmake total
fi
else

if [ $npm_package_config_native = "true" ]; then
make total
fi

if [ $npm_package_config_native = "true" ]; then
make total
fi
fi
fi
58 changes: 29 additions & 29 deletions lib/mongodb/bson/bson.js
Expand Up @@ -1473,7 +1473,7 @@ BSON.deserialize = function(data) {
index = index + 1;

// Check if we have finished an object
if(object_end_index != 0 && index > object_end_index) {
if(object_end_index !== 0 && index > object_end_index) {
// Save the current Object for storing
var value = currentObject;

Expand All @@ -1493,10 +1493,10 @@ BSON.deserialize = function(data) {
}
}

if(type == BSON.BSON_DATA_STRING) {
if(type === BSON.BSON_DATA_STRING) {
// Read the null terminated string (indexof until first 0)
string_end_index = index;
while(data[string_end_index++] != 0);
while(data[string_end_index++] !== 0);
string_end_index = string_end_index - 1;

// Fetch the string name
Expand All @@ -1515,10 +1515,10 @@ BSON.deserialize = function(data) {

// Set object property
currentObject[Array.isArray(currentObject) ? parseInt(string_name, 10) : string_name] = value;
} else if(type == BSON.BSON_DATA_REGEXP) {
} else if(type === BSON.BSON_DATA_REGEXP) {
// Read the null terminated string (indexof until first 0)
string_end_index = index;
while(data[string_end_index++] != 0);
while(data[string_end_index++] !== 0);
string_end_index = string_end_index - 1;

// Fetch the string name
Expand All @@ -1531,7 +1531,7 @@ BSON.deserialize = function(data) {
var chr = 1;
var start_index = index;

while(data[index] != 0) {
while(data[index] !== 0) {
index = index + 1;
}

Expand All @@ -1542,7 +1542,7 @@ BSON.deserialize = function(data) {
// Read the options for the regular expression
var options_array = [];

while(data[index] != 0) {
while(data[index] !== 0) {
options_array.push(String.fromCharCode(data[index]));
index = index + 1;
}
Expand All @@ -1552,10 +1552,10 @@ BSON.deserialize = function(data) {

// Set object property
currentObject[Array.isArray(currentObject) ? parseInt(string_name, 10) : string_name] = value;
} else if(type == BSON.BSON_DATA_DATE) {
} else if(type === BSON.BSON_DATA_DATE) {
// Read the null terminated string (indexof until first 0)
string_end_index = index;
while(data[string_end_index++] != 0);
while(data[string_end_index++] !== 0);
string_end_index = string_end_index - 1;

// Fetch the string name
Expand All @@ -1580,10 +1580,10 @@ BSON.deserialize = function(data) {

// Set object property
currentObject[Array.isArray(currentObject) ? parseInt(string_name, 10) : string_name] = value;
} else if(type == BSON.BSON_DATA_BINARY) {
} else if(type === BSON.BSON_DATA_BINARY) {
// Read the null terminated string (indexof until first 0)
string_end_index = index;
while(data[string_end_index++] != 0);
while(data[string_end_index++] !== 0);
string_end_index = string_end_index - 1;

// Fetch the string name
Expand All @@ -1609,10 +1609,10 @@ BSON.deserialize = function(data) {

// Set object property
currentObject[Array.isArray(currentObject) ? parseInt(string_name, 10) : string_name] = value;
} else if(type == BSON.BSON_DATA_NUMBER) {
} else if(type === BSON.BSON_DATA_NUMBER) {
// Read the null terminated string (indexof until first 0)
string_end_index = index;
while(data[string_end_index++] != 0);
while(data[string_end_index++] !== 0);
string_end_index = string_end_index - 1;

// Fetch the string name
Expand All @@ -1627,10 +1627,10 @@ BSON.deserialize = function(data) {

// Set object property
currentObject[Array.isArray(currentObject) ? parseInt(string_name, 10) : string_name] = value;
} else if(type == BSON.BSON_DATA_OID) {
} else if(type === BSON.BSON_DATA_OID) {
// Read the null terminated string (indexof until first 0)
string_end_index = index;
while(data[string_end_index++] != 0);
while(data[string_end_index++] !== 0);
string_end_index = string_end_index - 1;

// Fetch the string name
Expand All @@ -1647,10 +1647,10 @@ BSON.deserialize = function(data) {

// Set object property
currentObject[Array.isArray(currentObject) ? parseInt(string_name, 10) : string_name] = value;
} else if(type == BSON.BSON_DATA_CODE_W_SCOPE) {
} else if(type === BSON.BSON_DATA_CODE_W_SCOPE) {
// Read the null terminated string (indexof until first 0)
string_end_index = index;
while(data[string_end_index++] != 0);
while(data[string_end_index++] !== 0);
string_end_index = string_end_index - 1;

// Fetch the string name
Expand All @@ -1677,10 +1677,10 @@ BSON.deserialize = function(data) {

// Set object property
currentObject[Array.isArray(currentObject) ? parseInt(string_name, 10) : string_name] = value;
} else if(type == BSON.BSON_DATA_LONG || type == BSON.BSON_DATA_TIMESTAMP) {
} else if(type === BSON.BSON_DATA_LONG || type === BSON.BSON_DATA_TIMESTAMP) {
// Read the null terminated string (indexof until first 0)
string_end_index = index;
while(data[string_end_index++] != 0);
while(data[string_end_index++] !== 0);
string_end_index = string_end_index - 1;

// Fetch the string name
Expand All @@ -1696,14 +1696,14 @@ BSON.deserialize = function(data) {
var high_bits = data[index] | data[index + 1] << 8 | data[index + 2] << 16 | data[index + 3] << 24;
// Adjust index
index = index + 4;
var value = type == BSON.BSON_DATA_LONG ? new Long(low_bits, high_bits) : new Timestamp(low_bits, high_bits);
var value = type === BSON.BSON_DATA_LONG ? new Long(low_bits, high_bits) : new Timestamp(low_bits, high_bits);

// Set object property
currentObject[Array.isArray(currentObject) ? parseInt(string_name, 10) : string_name] = value;
} else if(type == BSON.BSON_DATA_INT) {
} else if(type === BSON.BSON_DATA_INT) {
// Read the null terminated string (indexof until first 0)
string_end_index = index;
while(data[string_end_index++] != 0);
while(data[string_end_index++] !== 0);
string_end_index = string_end_index - 1;

// Fetch the string name
Expand All @@ -1718,10 +1718,10 @@ BSON.deserialize = function(data) {

// Set object property
currentObject[Array.isArray(currentObject) ? parseInt(string_name, 10) : string_name] = value;
} else if(type == BSON.BSON_DATA_NULL) {
} else if(type === BSON.BSON_DATA_NULL) {
// Read the null terminated string (indexof until first 0)
string_end_index = index;
while(data[string_end_index++] != 0);
while(data[string_end_index++] !== 0);
string_end_index = string_end_index - 1;

// Fetch the string name
Expand All @@ -1733,10 +1733,10 @@ BSON.deserialize = function(data) {

// Set object property
currentObject[Array.isArray(currentObject) ? parseInt(string_name, 10) : string_name] = value;
} else if(type == BSON.BSON_DATA_BOOLEAN) {
} else if(type === BSON.BSON_DATA_BOOLEAN) {
// Read the null terminated string (indexof until first 0)
string_end_index = index;
while(data[string_end_index++] != 0);
while(data[string_end_index++] !== 0);
string_end_index = string_end_index - 1;

// Fetch the string name
Expand All @@ -1752,10 +1752,10 @@ BSON.deserialize = function(data) {

// Set object property
currentObject[Array.isArray(currentObject) ? parseInt(string_name, 10) : string_name] = value;
} else if(type == BSON.BSON_DATA_OBJECT || type == BSON.BSON_DATA_ARRAY) {
} else if(type === BSON.BSON_DATA_OBJECT || type === BSON.BSON_DATA_ARRAY) {
// Read the null terminated string (indexof until first 0)
string_end_index = index;
while(data[string_end_index++] != 0);
while(data[string_end_index++] !== 0);
string_end_index = string_end_index - 1;

// Fetch the string name
Expand All @@ -1770,7 +1770,7 @@ BSON.deserialize = function(data) {
// Let's push the current object to the stack and work on this one
stack.push(stackObject);
// Set current pointer to empty object
currentObject = type == BSON.BSON_DATA_ARRAY ? [] : {};
currentObject = type === BSON.BSON_DATA_ARRAY ? [] : {};
// Set the end index for the new object so we know then to stop
object_end_index = index + object_size;
// Ajdust index
Expand Down

0 comments on commit c82f9b4

Please sign in to comment.