GeezerVison is showing github.com — src: use static_cast where appropriate · tcper/node@5664dd2
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: src/cares_wrap.cc +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -311,7 +311,7 @@ class QueryWrap { | 311 | 311 |
| 312 | 312 | static void Callback(void *arg, int status, int timeouts, | 313 | 313 | unsigned char* answer_buf, int answer_len) { | 314 | | - QueryWrap* wrap = reinterpret_cast<QueryWrap*>(arg); | | 314 | + QueryWrap* wrap = static_cast<QueryWrap*>(arg); | 315 | 315 |
| 316 | 316 | if (status != ARES_SUCCESS) { | 317 | 317 | wrap->ParseError(status); | @@ -324,7 +324,7 @@ class QueryWrap { | 324 | 324 |
| 325 | 325 | static void Callback(void *arg, int status, int timeouts, | 326 | 326 | struct hostent* host) { | 327 | | - QueryWrap* wrap = reinterpret_cast<QueryWrap*>(arg); | | 327 | + QueryWrap* wrap = static_cast<QueryWrap*>(arg); | 328 | 328 |
| 329 | 329 | if (status != ARES_SUCCESS) { | 330 | 330 | wrap->ParseError(status); | |
Collapse file Copy file name to clipboardExpand all lines: src/fs_event_wrap.cc +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -51,7 +51,7 @@ class FSEventWrap: public HandleWrap { | 51 | 51 |
| 52 | 52 | FSEventWrap::FSEventWrap(Handle<Object> object): HandleWrap(object, | 53 | 53 | (uv_handle_t*)&handle_) { | 54 | | - handle_.data = reinterpret_cast<void*>(this); | | 54 | + handle_.data = static_cast<void*>(this); | 55 | 55 | initialized_ = false; | 56 | 56 | } | 57 | 57 |
| @@ -119,7 +119,7 @@ void FSEventWrap::OnEvent(uv_fs_event_t* handle, const char* filename, | 119 | 119 | HandleScope scope; | 120 | 120 | Local<String> eventStr; | 121 | 121 |
| 122 | | - FSEventWrap* wrap = reinterpret_cast<FSEventWrap*>(handle->data); | | 122 | + FSEventWrap* wrap = static_cast<FSEventWrap*>(handle->data); | 123 | 123 |
| 124 | 124 | assert(wrap->object_.IsEmpty() == false); | 125 | 125 |
| |
Collapse file Copy file name to clipboardExpand all lines: src/node_buffer.h +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -75,7 +75,7 @@ class NODE_EXTERN Buffer: public ObjectWrap { | 75 | 75 | static inline char* Data(v8::Handle<v8::Value> val) { | 76 | 76 | assert(val->IsObject()); | 77 | 77 | void* data = val.As<v8::Object>()->GetIndexedPropertiesExternalArrayData(); | 78 | | - return reinterpret_cast<char*>(data); | | 78 | + return static_cast<char*>(data); | 79 | 79 | } | 80 | 80 |
| 81 | 81 | static inline char* Data(Buffer *b) { | |
Collapse file Copy file name to clipboardExpand all lines: src/pipe_wrap.cc +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -129,7 +129,7 @@ PipeWrap::PipeWrap(Handle<Object> object, bool ipc) | 129 | 129 | int r = uv_pipe_init(uv_default_loop(), &handle_, ipc); | 130 | 130 | assert(r == 0); // How do we proxy this error up to javascript? | 131 | 131 | // Suggestion: uv_pipe_init() returns void. | 132 | | - handle_.data = reinterpret_cast<void*>(this); | | 132 | + handle_.data = static_cast<void*>(this); | 133 | 133 | UpdateWriteQueueSize(); | 134 | 134 | } | 135 | 135 |
| |
Collapse file Copy file name to clipboardExpand all lines: src/v8_typed_array.cc +5-5Lines changed: 5 additions & 5 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -255,7 +255,7 @@ class TypedArray { | 255 | 255 | } | 256 | 256 |
| 257 | 257 | void* buf = buffer->GetIndexedPropertiesExternalArrayData(); | 258 | | - char* begin = reinterpret_cast<char*>(buf) + byte_offset; | | 258 | + char* begin = static_cast<char*>(buf) + byte_offset; | 259 | 259 |
| 260 | 260 | if (!checkAlignment(reinterpret_cast<uintptr_t>(begin), TBytes)) | 261 | 261 | return ThrowRangeError("Byte offset is not aligned."); | @@ -374,7 +374,7 @@ class TypedArray { | 374 | 374 | // place as if all the data is first copied into a temporary buffer that | 375 | 375 | // does not overlap either of the arrays, and then the data from the | 376 | 376 | // temporary buffer is copied into the current array. | 377 | | - memmove(reinterpret_cast<char*>(dst_ptr) + offset * TBytes, src_ptr, | | 377 | + memmove(static_cast<char*>(dst_ptr) + offset * TBytes, src_ptr, | 378 | 378 | src_length * TBytes); | 379 | 379 | } else { // type[] | 380 | 380 | if (args[1]->Int32Value() < 0) | @@ -643,7 +643,7 @@ class DataView { | 643 | 643 |
| 644 | 644 | // Like ArrayBuffer, we violate the spec and add an operator[]. | 645 | 645 | args.This()->SetIndexedPropertiesToExternalArrayData( | 646 | | - reinterpret_cast<char*>(buf) + byte_offset, | | 646 | + static_cast<char*>(buf) + byte_offset, | 647 | 647 | v8::kExternalUnsignedByteArray, byte_length); | 648 | 648 |
| 649 | 649 | args.This()->Set(v8::String::New("buffer"), | @@ -670,7 +670,7 @@ class DataView { | 670 | 670 | template <typename T> | 671 | 671 | static T getValue(void* ptr, unsigned int index, bool swiz) { | 672 | 672 | char buf[sizeof(T)]; | 673 | | - memcpy(buf, reinterpret_cast<char*>(ptr) + index, sizeof(T)); | | 673 | + memcpy(buf, static_cast<char*>(ptr) + index, sizeof(T)); | 674 | 674 | if (swiz) | 675 | 675 | swizzle(buf, sizeof(T)); | 676 | 676 | T val; | @@ -684,7 +684,7 @@ class DataView { | 684 | 684 | memcpy(buf, &val, sizeof(T)); | 685 | 685 | if (swiz) | 686 | 686 | swizzle(buf, sizeof(T)); | 687 | | - memcpy(reinterpret_cast<char*>(ptr) + index, buf, sizeof(T)); | | 687 | + memcpy(static_cast<char*>(ptr) + index, buf, sizeof(T)); | 688 | 688 | } | 689 | 689 |
| 690 | 690 | template <typename T> | |
|