Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(807)

Unified Diff: runtime/bin/socket.h

Issue 1526123002: VM: Const-correctness fixes. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/bin/dartutils.cc ('k') | runtime/include/dart_api.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/socket.h
diff --git a/runtime/bin/socket.h b/runtime/bin/socket.h
index 1910f863fd0ff7e4d8c5f74432675c6719cce72f..e7646dab21fcbba0ca4d78c607d15b59bdafcd1d 100644
--- a/runtime/bin/socket.h
+++ b/runtime/bin/socket.h
@@ -145,13 +145,13 @@ class SocketAddress {
Dart_Handle result = Dart_NewTypedData(Dart_TypedData_kUint8, len);
if (Dart_IsError(result)) Dart_PropagateError(result);
Dart_Handle err;
- RawAddr& raw = const_cast<RawAddr&>(addr);
if (addr.addr.sa_family == AF_INET6) {
err = Dart_ListSetAsBytes(
- result, 0, reinterpret_cast<uint8_t*>(&raw.in6.sin6_addr), len);
+ result, 0,
+ reinterpret_cast<const uint8_t*>(&addr.in6.sin6_addr), len);
} else {
err = Dart_ListSetAsBytes(
- result, 0, reinterpret_cast<uint8_t*>(&raw.in.sin_addr), len);
+ result, 0, reinterpret_cast<const uint8_t*>(&addr.in.sin_addr), len);
}
if (Dart_IsError(err)) Dart_PropagateError(err);
return result;
@@ -159,14 +159,13 @@ class SocketAddress {
static CObjectUint8Array* ToCObject(const RawAddr& addr) {
int in_addr_len = SocketAddress::GetInAddrLength(addr);
- void* in_addr;
- RawAddr& raw = const_cast<RawAddr&>(addr);
+ const void* in_addr;
CObjectUint8Array* data =
new CObjectUint8Array(CObject::NewUint8Array(in_addr_len));
if (addr.addr.sa_family == AF_INET6) {
- in_addr = reinterpret_cast<void*>(&raw.in6.sin6_addr);
+ in_addr = reinterpret_cast<const void*>(&addr.in6.sin6_addr);
} else {
- in_addr = reinterpret_cast<void*>(&raw.in.sin_addr);
+ in_addr = reinterpret_cast<const void*>(&addr.in.sin_addr);
}
memmove(data->Buffer(), in_addr, in_addr_len);
return data;
« no previous file with comments | « runtime/bin/dartutils.cc ('k') | runtime/include/dart_api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698