Skip to content

Commit

Permalink
typed arrays: fix signed/unsigned compiler warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
bnoordhuis committed Aug 12, 2011
1 parent 4726504 commit cbea40e
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/v8_typed_array.cc
Original file line number Diff line number Diff line change
Expand Up @@ -357,11 +357,11 @@ class TypedArray {

if (begin < 0) begin = length + begin;
if (begin < 0) begin = 0;
if (begin > length) begin = length;
if ((unsigned)begin > length) begin = length;

if (end < 0) end = length + end;
if (end < 0) end = 0;
if (end > length) end = length;
if ((unsigned)end > length) end = length;

if (begin > end) begin = end;

Expand Down Expand Up @@ -585,7 +585,7 @@ class DataView {

// TODO(deanm): This isn't beautiful or optimal.
static void swizzle(char* buf, size_t len) {
for (int i = 0; i < len / 2; ++i) {
for (size_t i = 0; i < len / 2; ++i) {
char t = buf[i];
buf[i] = buf[len - i - 1];
buf[len - i - 1] = t;
Expand Down Expand Up @@ -625,7 +625,7 @@ class DataView {
int size = args.This()->GetIndexedPropertiesExternalArrayDataLength() *
element_size;

if (index + sizeof(T) > size) // TODO(deanm): integer overflow.
if (index + sizeof(T) > (unsigned)size) // TODO(deanm): integer overflow.
return ThrowError("Index out of range.");

void* ptr = args.This()->GetIndexedPropertiesExternalArrayData();
Expand All @@ -645,7 +645,7 @@ class DataView {
int size = args.This()->GetIndexedPropertiesExternalArrayDataLength() *
element_size;

if (index + sizeof(T) > size) // TODO(deanm): integer overflow.
if (index + sizeof(T) > (unsigned)size) // TODO(deanm): integer overflow.
return ThrowError("Index out of range.");

void* ptr = args.This()->GetIndexedPropertiesExternalArrayData();
Expand Down

0 comments on commit cbea40e

Please sign in to comment.