::chdir(working_directory);
err.SetError(::posix_spawnp(&pid, path, &file_actions, &attr,
- (char *const *)argv, (char *const *)envp),
+ const_cast<char *const *>(argv),
+ const_cast<char *const *>(envp)),
DNBError::POSIX);
if (err.Fail() || DNBLogCheckLogBit(LOG_PROCESS))
err.LogThreaded("::posix_spawnp ( pid => %i, path = '%s', file_actions = "
if (working_directory)
::chdir(working_directory);
- err.SetError(::posix_spawnp(&pid, path, NULL, &attr, (char *const *)argv,
- (char *const *)envp),
+ err.SetError(::posix_spawnp(&pid, path, NULL, &attr,
+ const_cast<char *const *>(argv),
+ const_cast<char *const *>(envp)),
DNBError::POSIX);
if (err.Fail() || DNBLogCheckLogBit(LOG_PROCESS))
err.LogThreaded("::posix_spawnp ( pid => %i, path = '%s', file_actions = "
::sleep(1);
// Turn this process into
- ::execv(path, (char *const *)argv);
+ ::execv(path, const_cast<char *const *>(argv));
}
// Exit with error code. Child process should have taken
// over in above exec call and if the exec fails it will
(uint64_t)addr, (uint64_t)size, buf, (uint64_t)n);
if (DNBLogCheckLogBit(LOG_MEMORY_DATA_LONG) ||
(DNBLogCheckLogBit(LOG_MEMORY_DATA_SHORT) && size <= 8)) {
- DNBDataRef data((uint8_t *)buf, n, false);
+ DNBDataRef data((const uint8_t *)buf, n, false);
data.Dump(0, static_cast<DNBDataRef::offset_t>(n), addr,
DNBDataRef::TypeUInt8, 16);
}
if (size > buf_len)
size = buf_len;
- uint8_t *p = (uint8_t *)buf;
+ const uint8_t *p = (const uint8_t *)buf;
// Copy the GPR registers
memcpy(&m_state.context.gpr, p, sizeof(GPR));
p += sizeof(GPR);
p += sizeof(EXC);
// make sure we end up with exactly what we think we should have
- size_t bytes_written = p - (uint8_t *)buf;
+ size_t bytes_written = p - (const uint8_t *)buf;
UNUSED_IF_ASSERT_DISABLED(bytes_written);
assert(bytes_written == size);
kern_return_t kret;
if (size > buf_len)
size = static_cast<uint32_t>(buf_len);
- uint8_t *p = (uint8_t *)buf;
+ const uint8_t *p = (const uint8_t *)buf;
// Copy the GPR registers
memcpy(&m_state.context.gpr, p, sizeof(GPR));
p += sizeof(GPR);
p += sizeof(EXC);
// make sure we end up with exactly what we think we should have
- size_t bytes_written = p - (uint8_t *)buf;
+ size_t bytes_written = p - (const uint8_t *)buf;
UNUSED_IF_ASSERT_DISABLED(bytes_written);
assert(bytes_written == size);
#if defined(HAVE_LIBCOMPRESSION)
if (compression_type == compression_types::lz4) {
compressed_size = compression_encode_buffer(
- encoded_data.data(), encoded_data_buf_size, (uint8_t *)orig.c_str(),
- orig.size(), nullptr, COMPRESSION_LZ4_RAW);
+ encoded_data.data(), encoded_data_buf_size,
+ (const uint8_t *)orig.c_str(), orig.size(), nullptr,
+ COMPRESSION_LZ4_RAW);
}
if (compression_type == compression_types::zlib_deflate) {
compressed_size = compression_encode_buffer(
- encoded_data.data(), encoded_data_buf_size, (uint8_t *)orig.c_str(),
- orig.size(), nullptr, COMPRESSION_ZLIB);
+ encoded_data.data(), encoded_data_buf_size,
+ (const uint8_t *)orig.c_str(), orig.size(), nullptr,
+ COMPRESSION_ZLIB);
}
if (compression_type == compression_types::lzma) {
compressed_size = compression_encode_buffer(
- encoded_data.data(), encoded_data_buf_size, (uint8_t *)orig.c_str(),
- orig.size(), nullptr, COMPRESSION_LZMA);
+ encoded_data.data(), encoded_data_buf_size,
+ (const uint8_t *)orig.c_str(), orig.size(), nullptr,
+ COMPRESSION_LZMA);
}
if (compression_type == compression_types::lzfse) {
compressed_size = compression_encode_buffer(
- encoded_data.data(), encoded_data_buf_size, (uint8_t *)orig.c_str(),
- orig.size(), nullptr, COMPRESSION_LZFSE);
+ encoded_data.data(), encoded_data_buf_size,
+ (const uint8_t *)orig.c_str(), orig.size(), nullptr,
+ COMPRESSION_LZFSE);
}
#endif
else {
// the thread name contains special chars, send as hex bytes
ostrm << std::hex << "hexname:";
- uint8_t *u_thread_name = (uint8_t *)thread_name;
+ const uint8_t *u_thread_name = (const uint8_t *)thread_name;
for (size_t i = 0; i < thread_name_len; i++)
ostrm << RAWHEX8(u_thread_name[i]);
ostrm << ';';
return RNBRemote::HandlePacket_s("s");
} else if (strstr(p, "vCont") == p) {
DNBThreadResumeActions thread_actions;
- char *c = (char *)(p += strlen("vCont"));
+ char *c = const_cast<char *>(p += strlen("vCont"));
char *c_end = c + strlen(c);
if (*c == '?')
return SendPacket("vCont;c;C;s;S");
CFIndex size = ::CFDataGetLength(plistData.get());
const UInt8 *bytes = ::CFDataGetBytePtr(plistData.get());
if (bytes != NULL && size > 0) {
- plist.assign((char *)bytes, size);
+ plist.assign((const char *)bytes, size);
return 0; // Success
} else {
DNBLogError("empty application property list.");
DNBLogThreadedIf(
LOG_RNB_PACKETS, "putpkt: %*s", (int)length,
- (char *)
+ (const char *)
buffer); // All data is string based in debugserver, so this is safe
- DNBLogThreadedIf(LOG_RNB_COMM, "sent: %*s", (int)length, (char *)buffer);
+ DNBLogThreadedIf(LOG_RNB_COMM, "sent: %*s", (int)length,
+ (const char *)buffer);
return rnb_success;
}