Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

TypedArrays: Update a few c casts to C++ static_casts.

  • Loading branch information...
commit e703b0c7b914c451685fb68517ba2499e9c71fa5 1 parent 254907b
Dean McNamee authored
Showing with 6 additions and 4 deletions.
  1. +6 −4 src/v8_typed_array.cc
10 src/v8_typed_array.cc
View
@@ -424,11 +424,11 @@ class TypedArray {
if (begin < 0) begin = length + begin;
if (begin < 0) begin = 0;
- if ((unsigned)begin > length) begin = length;
+ if (static_cast<unsigned int>(begin) > length) begin = length;
if (end < 0) end = length + end;
if (end < 0) end = 0;
- if ((unsigned)end > length) end = length;
+ if (static_cast<unsigned int>(end) > length) end = length;
if (begin > end) begin = end;
@@ -664,7 +664,8 @@ class DataView {
int size = args.This()->GetIndexedPropertiesExternalArrayDataLength() *
element_size;
- if (index + sizeof(T) > (unsigned)size) // TODO(deanm): integer overflow.
+ // TODO(deanm): integer overflow.
+ if (index + sizeof(T) > static_cast<unsigned int>(size))
return ThrowError("Index out of range.");
void* ptr = reinterpret_cast<char*>(
@@ -696,7 +697,8 @@ class DataView {
int size = args.This()->GetIndexedPropertiesExternalArrayDataLength() *
element_size;
- if (index + sizeof(T) > (unsigned)size) // TODO(deanm): integer overflow.
+ // TODO(deanm): integer overflow.
+ if (index + sizeof(T) > static_cast<unsigned int>(size))
return ThrowError("Index out of range.");
void* ptr = reinterpret_cast<char*>(
Please sign in to comment.
Something went wrong with that request. Please try again.