GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — src: use static_cast where appropriate · tcper/node@5664dd2

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • src
    • cares_wrap.cc
    • fs_event_wrap.cc
    • node_buffer.h
    • pipe_wrap.cc
    • v8_typed_array.cc
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎src/cares_wrap.cc‎

Copy file name to clipboardExpand all lines: src/cares_wrap.cc
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ class QueryWrap {
311311

312312
static void Callback(void *arg, int status, int timeouts,
313313
unsigned char* answer_buf, int answer_len) {
314-
QueryWrap* wrap = reinterpret_cast<QueryWrap*>(arg);
314+
QueryWrap* wrap = static_cast<QueryWrap*>(arg);
315315

316316
if (status != ARES_SUCCESS) {
317317
wrap->ParseError(status);
@@ -324,7 +324,7 @@ class QueryWrap {
324324

325325
static void Callback(void *arg, int status, int timeouts,
326326
struct hostent* host) {
327-
QueryWrap* wrap = reinterpret_cast<QueryWrap*>(arg);
327+
QueryWrap* wrap = static_cast<QueryWrap*>(arg);
328328

329329
if (status != ARES_SUCCESS) {
330330
wrap->ParseError(status);
Collapse file

‎src/fs_event_wrap.cc‎

Copy file name to clipboardExpand all lines: src/fs_event_wrap.cc
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class FSEventWrap: public HandleWrap {
5151

5252
FSEventWrap::FSEventWrap(Handle<Object> object): HandleWrap(object,
5353
(uv_handle_t*)&handle_) {
54-
handle_.data = reinterpret_cast<void*>(this);
54+
handle_.data = static_cast<void*>(this);
5555
initialized_ = false;
5656
}
5757

@@ -119,7 +119,7 @@ void FSEventWrap::OnEvent(uv_fs_event_t* handle, const char* filename,
119119
HandleScope scope;
120120
Local<String> eventStr;
121121

122-
FSEventWrap* wrap = reinterpret_cast<FSEventWrap*>(handle->data);
122+
FSEventWrap* wrap = static_cast<FSEventWrap*>(handle->data);
123123

124124
assert(wrap->object_.IsEmpty() == false);
125125

Collapse file

‎src/node_buffer.h‎

Copy file name to clipboardExpand all lines: src/node_buffer.h
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ class NODE_EXTERN Buffer: public ObjectWrap {
7575
static inline char* Data(v8::Handle<v8::Value> val) {
7676
assert(val->IsObject());
7777
void* data = val.As<v8::Object>()->GetIndexedPropertiesExternalArrayData();
78-
return reinterpret_cast<char*>(data);
78+
return static_cast<char*>(data);
7979
}
8080

8181
static inline char* Data(Buffer *b) {
Collapse file

‎src/pipe_wrap.cc‎

Copy file name to clipboardExpand all lines: src/pipe_wrap.cc
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ PipeWrap::PipeWrap(Handle<Object> object, bool ipc)
129129
int r = uv_pipe_init(uv_default_loop(), &handle_, ipc);
130130
assert(r == 0); // How do we proxy this error up to javascript?
131131
// Suggestion: uv_pipe_init() returns void.
132-
handle_.data = reinterpret_cast<void*>(this);
132+
handle_.data = static_cast<void*>(this);
133133
UpdateWriteQueueSize();
134134
}
135135

Collapse file

‎src/v8_typed_array.cc‎

Copy file name to clipboardExpand all lines: src/v8_typed_array.cc
+5-5Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ class TypedArray {
255255
}
256256

257257
void* buf = buffer->GetIndexedPropertiesExternalArrayData();
258-
char* begin = reinterpret_cast<char*>(buf) + byte_offset;
258+
char* begin = static_cast<char*>(buf) + byte_offset;
259259

260260
if (!checkAlignment(reinterpret_cast<uintptr_t>(begin), TBytes))
261261
return ThrowRangeError("Byte offset is not aligned.");
@@ -374,7 +374,7 @@ class TypedArray {
374374
// place as if all the data is first copied into a temporary buffer that
375375
// does not overlap either of the arrays, and then the data from the
376376
// 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,
378378
src_length * TBytes);
379379
} else { // type[]
380380
if (args[1]->Int32Value() < 0)
@@ -643,7 +643,7 @@ class DataView {
643643

644644
// Like ArrayBuffer, we violate the spec and add an operator[].
645645
args.This()->SetIndexedPropertiesToExternalArrayData(
646-
reinterpret_cast<char*>(buf) + byte_offset,
646+
static_cast<char*>(buf) + byte_offset,
647647
v8::kExternalUnsignedByteArray, byte_length);
648648

649649
args.This()->Set(v8::String::New("buffer"),
@@ -670,7 +670,7 @@ class DataView {
670670
template <typename T>
671671
static T getValue(void* ptr, unsigned int index, bool swiz) {
672672
char buf[sizeof(T)];
673-
memcpy(buf, reinterpret_cast<char*>(ptr) + index, sizeof(T));
673+
memcpy(buf, static_cast<char*>(ptr) + index, sizeof(T));
674674
if (swiz)
675675
swizzle(buf, sizeof(T));
676676
T val;
@@ -684,7 +684,7 @@ class DataView {
684684
memcpy(buf, &val, sizeof(T));
685685
if (swiz)
686686
swizzle(buf, sizeof(T));
687-
memcpy(reinterpret_cast<char*>(ptr) + index, buf, sizeof(T));
687+
memcpy(static_cast<char*>(ptr) + index, buf, sizeof(T));
688688
}
689689

690690
template <typename T>

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.