Skip to content

Commit

Permalink
undid last commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Joshua Wise committed Mar 22, 2016
1 parent 2f27523 commit e0c7d4c
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 32 deletions.
31 changes: 0 additions & 31 deletions src/util/data.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,37 +134,6 @@ class Row {
}
}

// Given a v8 Array, fills the row with the values in that array.
// The array's length must never be less than 1.
// This must only be used on a row with no values in it.
// If the return value is -1, an error was thrown.
// If the return value is 1, an unrecognized type was given.
inline int Fill(v8::Local<v8::Array> arr) {
column_count = arr->Length();
values = new Data::Value* [column_count];
for (int i=0; i<column_count; i++) {
Nan::MaybeLocal<v8::Value> maybeItem = Nan::Get(arr, i);
if (maybeItem.IsEmpty()) {
for (; i<column_count; i++) {values[i] = NULL;}
return -1;
}
v8::Local<v8::Value> item = maybeItem.ToLocalChecked();
if (item->IsNumber()) {
values[i] = new Data::Float(v8::Local<v8::Number>::Cast(item));
} else if (item->IsString()) {
values[i] = new Data::String(v8::Local<v8::String>::Cast(item));
} else if (node::Buffer::HasInstance(item)) {
values[i] = new Data::Blob(v8::Local<v8::Object>::Cast(item));
} else if (item->IsNull() || item->IsUndefined()) {
values[i] = new Data::Null();
} else {
for (; i<column_count; i++) {values[i] = NULL;}
return 1;
}
}
return 0;
}

int column_count;
Data::Value** values;
};
Expand Down
2 changes: 1 addition & 1 deletion src/util/macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ inline char* C_STRING(v8::Local<v8::String> string) {
// Given a double, returns whether the number is non-negative, finite, and
// an integer.
inline bool IS_POSITIVE_INTEGER(double num) {
return std::isfinite(num) && num >= 0 && floor(num) == num;
return std::isfinite(num) && num >= 0 && num % 1 == 0;
}

// Creates a stack-allocated buffer of the concatenation of 2 well-formed
Expand Down

0 comments on commit e0c7d4c

Please sign in to comment.