Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion example/plugins/cpp-api/websocket/WSBuffer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ WSBuffer::read_buffered_message(std::string &message, int &code)
if (avail < 4 + mask_len) { // 2 + 2 + length bytes + mask.
return false;
}
msg_len = ntohs(*(uint16_t *)(ws_buf_.data() + 2));
msg_len = ntohs(*reinterpret_cast<uint16_t *>(ws_buf_.data() + 2));
pos = 4;
} else if (msg_len == WS_64BIT_LEN) {
if (avail < 10 + mask_len) { // 2 + 8 length bytes + mask.
Expand Down
2 changes: 1 addition & 1 deletion iocore/cache/Cache.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2774,7 +2774,7 @@ cplist_reconfigure()
int64_t space_in_blks = 0;
if (0 == tot_forced_space_in_blks) {
// Calculate the space as percentage of total space in blocks.
space_in_blks = static_cast<int64_t>(((double)(config_vol->percent / percent_remaining)) * tot_space_in_blks);
space_in_blks = static_cast<int64_t>(((config_vol->percent / percent_remaining)) * tot_space_in_blks);
} else {
// Forced volumes take all disk space, so no percentage calculations here.
space_in_blks = tot_forced_space_in_blks;
Expand Down
2 changes: 1 addition & 1 deletion iocore/cache/CacheLink.cc
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Cache::link(Continuation *cont, const CacheKey *from, const CacheKey *to, CacheF

c->buf = new_IOBufferData(BUFFER_SIZE_INDEX_512);
#ifdef DEBUG
Doc *doc = (Doc *)c->buf->data();
Doc *doc = reinterpret_cast<Doc *>(c->buf->data());
memcpy(doc->data(), to, sizeof(*to)); // doublecheck
#endif

Expand Down
2 changes: 1 addition & 1 deletion iocore/eventsystem/UnixEventProcessor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ ThreadAffinityInitializer::set_affinity(int, Event *)
hwloc_obj_t obj = hwloc_get_obj_by_type(ink_get_topology(), obj_type, t->id % obj_count);
#if HWLOC_API_VERSION >= 0x00010100
int cpu_mask_len = hwloc_bitmap_snprintf(nullptr, 0, obj->cpuset) + 1;
char *cpu_mask = (char *)alloca(cpu_mask_len);
char *cpu_mask = static_cast<char *>(alloca(cpu_mask_len));
hwloc_bitmap_snprintf(cpu_mask, cpu_mask_len, obj->cpuset);
Debug("iocore_thread", "EThread: %p %s: %d CPU Mask: %s\n", t, obj_name, obj->logical_index, cpu_mask);
#else
Expand Down
4 changes: 2 additions & 2 deletions iocore/net/P_QUICNetVConnection.h
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ class QUICNetVConnection : public UnixNetVConnection,
QUICPacketUPtr _packetize_frames(uint8_t *packet_buf, QUICEncryptionLevel level, uint64_t max_packet_size,
std::vector<QUICFrameInfo> &frames);
void _packetize_closing_frame();
QUICPacketUPtr _build_packet(uint8_t *packet_buf, QUICEncryptionLevel level, Ptr<IOBufferBlock> parent_block,
QUICPacketUPtr _build_packet(uint8_t *packet_buf, QUICEncryptionLevel level, const Ptr<IOBufferBlock> &parent_block,
bool retransmittable, bool probing, bool crypto);

QUICConnectionErrorUPtr _recv_and_ack(const QUICPacketR &packet, bool *has_non_probing_frame = nullptr);
Expand Down Expand Up @@ -357,7 +357,7 @@ class QUICNetVConnection : public UnixNetVConnection,
void _update_local_cid(const QUICConnectionId &new_cid);
void _rerandomize_original_cid();

QUICHandshakeProtocol *_setup_handshake_protocol(shared_SSL_CTX ctx);
QUICHandshakeProtocol *_setup_handshake_protocol(const shared_SSL_CTX &ctx);

QUICPacketUPtr _the_final_packet = QUICPacketFactory::create_null_packet();
uint8_t _final_packet_buf[QUICPacket::MAX_INSTANCE_SIZE];
Expand Down
2 changes: 1 addition & 1 deletion iocore/net/P_QUICPacketHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class QUICPacketHandler
~QUICPacketHandler();

void send_packet(const QUICPacket &packet, QUICNetVConnection *vc, const QUICPacketHeaderProtector &pn_protector);
void send_packet(QUICNetVConnection *vc, Ptr<IOBufferBlock> udp_payload);
void send_packet(QUICNetVConnection *vc, const Ptr<IOBufferBlock> &udp_payload);

void close_connection(QUICNetVConnection *conn);

Expand Down
4 changes: 2 additions & 2 deletions iocore/net/P_SSLUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,12 @@ class SSLMultiCertConfigLoader
protected:
const SSLConfigParams *_params;

bool _store_single_ssl_ctx(SSLCertLookup *lookup, shared_SSLMultiCertConfigParams sslMultCertSettings, shared_SSL_CTX ctx,
bool _store_single_ssl_ctx(SSLCertLookup *lookup, const shared_SSLMultiCertConfigParams &sslMultCertSettings, shared_SSL_CTX ctx,
std::set<std::string> &names);

private:
virtual const char *_debug_tag() const;
bool _store_ssl_ctx(SSLCertLookup *lookup, shared_SSLMultiCertConfigParams ssl_multi_cert_params);
bool _store_ssl_ctx(SSLCertLookup *lookup, const shared_SSLMultiCertConfigParams &ssl_multi_cert_params);
virtual void _set_handshake_callbacks(SSL_CTX *ctx);
};

Expand Down
6 changes: 3 additions & 3 deletions iocore/net/QUICNet.cc
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ QUICPollCont::_process_long_header_packet(QUICPollEvent *e, NetHandler *nh)
UDPPacketInternal *p = e->packet;
// FIXME: VC is nullptr ?
QUICNetVConnection *vc = static_cast<QUICNetVConnection *>(e->con);
uint8_t *buf = (uint8_t *)p->getIOBlockChain()->buf();
uint8_t *buf = reinterpret_cast<uint8_t *>(p->getIOBlockChain()->buf());

QUICPacketType ptype;
QUICLongHeaderPacketR::type(ptype, buf, 1);
Expand Down Expand Up @@ -147,7 +147,7 @@ QUICPollCont::pollEvent(int, Event *)
}

while ((e = result.pop())) {
buf = (uint8_t *)e->packet->getIOBlockChain()->buf();
buf = reinterpret_cast<uint8_t *>(e->packet->getIOBlockChain()->buf());
if (QUICInvariants::is_long_header(buf)) {
// Long Header Packet with Connection ID, has a valid type value.
this->_process_long_header_packet(e, nh);
Expand All @@ -166,7 +166,7 @@ initialize_thread_for_quic_net(EThread *thread)
NetHandler *nh = get_NetHandler(thread);
QUICPollCont *quicpc = get_QUICPollCont(thread);

new ((ink_dummy_for_new *)quicpc) QUICPollCont(thread->mutex, nh);
new (reinterpret_cast<ink_dummy_for_new *>(quicpc)) QUICPollCont(thread->mutex, nh);

thread->schedule_every(quicpc, -HRTIME_MSECONDS(UDP_PERIOD));
}
6 changes: 3 additions & 3 deletions iocore/net/QUICNetVConnection.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1046,7 +1046,7 @@ QUICNetVConnection::select_next_protocol(SSL *ssl, const unsigned char **out, un
if (this->getNPN(&npnptr, &npnsize)) {
// SSL_select_next_proto chooses the first server-offered protocol that appears in the clients protocol set, ie. the
// server selects the protocol. This is a n^2 search, so it's preferable to keep the protocol set short.
if (SSL_select_next_proto((unsigned char **)out, outlen, npnptr, npnsize, in, inlen) == OPENSSL_NPN_NEGOTIATED) {
if (SSL_select_next_proto(const_cast<unsigned char **>(out), outlen, npnptr, npnsize, in, inlen) == OPENSSL_NPN_NEGOTIATED) {
Debug("ssl", "selected ALPN protocol %.*s", (int)(*outlen), *out);
return SSL_TLSEXT_ERR_OK;
}
Expand Down Expand Up @@ -1740,7 +1740,7 @@ QUICNetVConnection::_recv_and_ack(const QUICPacketR &packet, bool *has_non_probi
}

QUICPacketUPtr
QUICNetVConnection::_build_packet(uint8_t *packet_buf, QUICEncryptionLevel level, Ptr<IOBufferBlock> parent_block,
QUICNetVConnection::_build_packet(uint8_t *packet_buf, QUICEncryptionLevel level, const Ptr<IOBufferBlock> &parent_block,
bool ack_eliciting, bool probing, bool crypto)
{
QUICPacketType type = QUICTypeUtil::packet_type(level);
Expand Down Expand Up @@ -2230,7 +2230,7 @@ QUICNetVConnection::_rerandomize_original_cid()
}

QUICHandshakeProtocol *
QUICNetVConnection::_setup_handshake_protocol(shared_SSL_CTX ctx)
QUICNetVConnection::_setup_handshake_protocol(const shared_SSL_CTX &ctx)
{
// Initialize handshake protocol specific stuff
// For QUICv1 TLS is the only option
Expand Down
10 changes: 5 additions & 5 deletions iocore/net/QUICPacketHandler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ QUICPacketHandlerIn::acceptEvent(int event, void *data)
this->_collector_event = this_ethread()->schedule_every(this->_closed_con_collector, HRTIME_MSECONDS(100));
}

Queue<UDPPacket> *queue = (Queue<UDPPacket> *)data;
Queue<UDPPacket> *queue = static_cast<Queue<UDPPacket> *>(data);
UDPPacket *packet_r;
while ((packet_r = queue->dequeue())) {
this->_recv_packet(event, packet_r);
Expand All @@ -191,7 +191,7 @@ QUICPacketHandlerIn::acceptEvent(int event, void *data)
if (((long)data) == -ECONNABORTED) {
}

ink_abort("QUIC accept received fatal error: errno = %d", -((int)(intptr_t)data));
ink_abort("QUIC accept received fatal error: errno = %d", -(static_cast<int>((intptr_t)data)));
return EVENT_CONT;
return 0;
}
Expand Down Expand Up @@ -386,7 +386,7 @@ QUICPacketHandler::send_packet(const QUICPacket &packet, QUICNetVConnection *vc,
}

void
QUICPacketHandler::send_packet(QUICNetVConnection *vc, Ptr<IOBufferBlock> udp_payload)
QUICPacketHandler::send_packet(QUICNetVConnection *vc, const Ptr<IOBufferBlock> &udp_payload)
{
this->_send_packet(vc->get_udp_con(), vc->con.addr, udp_payload);
}
Expand Down Expand Up @@ -493,7 +493,7 @@ QUICPacketHandlerIn::_send_invalid_token_error(const uint8_t *initial_packet, ui
QUICConnectionId scid;
scid.randomize();
uint8_t packet_buf[QUICPacket::MAX_INSTANCE_SIZE];
QUICPacketUPtr cc_packet = pf.create_initial_packet(packet_buf, scid_in_initial, scid, 0, block, block_len, 0, 0, 1);
QUICPacketUPtr cc_packet = pf.create_initial_packet(packet_buf, scid_in_initial, scid, 0, block, block_len, false, false, true);

this->_send_packet(*cc_packet, connection, from, 0, &php, scid_in_initial);
}
Expand Down Expand Up @@ -521,7 +521,7 @@ QUICPacketHandlerOut::event_handler(int event, Event *data)
return EVENT_CONT;
}
case NET_EVENT_DATAGRAM_READ_READY: {
Queue<UDPPacket> *queue = (Queue<UDPPacket> *)data;
Queue<UDPPacket> *queue = reinterpret_cast<Queue<UDPPacket> *>(data);
UDPPacket *packet_r;
while ((packet_r = queue->dequeue())) {
this->_recv_packet(event, packet_r);
Expand Down
4 changes: 2 additions & 2 deletions iocore/net/SSLUtils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1393,7 +1393,7 @@ SSLCreateServerContext(const SSLConfigParams *params, const SSLMultiCertConfigPa
Do NOT call SSL_CTX_set_* functions from here. SSL_CTX should be set up by SSLMultiCertConfigLoader::init_server_ssl_ctx().
*/
bool
SSLMultiCertConfigLoader::_store_ssl_ctx(SSLCertLookup *lookup, const shared_SSLMultiCertConfigParams sslMultCertSettings)
SSLMultiCertConfigLoader::_store_ssl_ctx(SSLCertLookup *lookup, const shared_SSLMultiCertConfigParams &sslMultCertSettings)
{
bool retval = true;
std::vector<X509 *> cert_list;
Expand Down Expand Up @@ -1454,7 +1454,7 @@ SSLMultiCertConfigLoader::_store_ssl_ctx(SSLCertLookup *lookup, const shared_SSL
}

bool
SSLMultiCertConfigLoader::_store_single_ssl_ctx(SSLCertLookup *lookup, const shared_SSLMultiCertConfigParams sslMultCertSettings,
SSLMultiCertConfigLoader::_store_single_ssl_ctx(SSLCertLookup *lookup, const shared_SSLMultiCertConfigParams &sslMultCertSettings,
shared_SSL_CTX ctx, std::set<std::string> &names)
{
bool inserted = false;
Expand Down
3 changes: 2 additions & 1 deletion iocore/net/UnixNetVConnection.cc
Original file line number Diff line number Diff line change
Expand Up @@ -290,8 +290,9 @@ read_from_net(NetHandler *nh, UnixNetVConnection *vc, EThread *thread)
// Add data to buffer and signal continuation.
buf.writer()->fill(r);
#ifdef DEBUG
if (buf.writer()->write_avail() <= 0)
if (buf.writer()->write_avail() <= 0) {
Debug("iocore_net", "read_from_net, read buffer full");
}
#endif
s->vio.ndone += r;
net_activity(vc, thread);
Expand Down
6 changes: 3 additions & 3 deletions plugins/cache_promote/lru_policy.cc
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,9 @@ LRUPolicy::stats_add(const char *remap_id)
return false;
}

for (int ii = 0; ii < 8; ii++) {
std::string_view name = std::get<0>(stats[ii]);
int *id = std::get<1>(stats[ii]);
for (const auto &stat : stats) {
std::string_view name = std::get<0>(stat);
int *id = std::get<1>(stat);
if ((*(id) = create_stat(name, remap_identifier)) == TS_ERROR) {
return false;
}
Expand Down
3 changes: 2 additions & 1 deletion plugins/experimental/memcache/tsmemcache.cc
Original file line number Diff line number Diff line change
Expand Up @@ -375,8 +375,9 @@ MC::write_binary_response(const void *d, int hlen, int keylen, int dlen)
if (dlen) {
MCDebug("tsmemcache", "response dlen %d\n", dlen);
wbuf->write(d, dlen);
} else
} else {
MCDebug("tsmemcache", "no response\n");
}
}
return writer->read_avail();
}
Expand Down
15 changes: 6 additions & 9 deletions plugins/experimental/metalink/metalink.cc
Original file line number Diff line number Diff line change
Expand Up @@ -44,19 +44,18 @@
/* TSCacheWrite() and TSVConnWrite() data: Write the digest to the
* cache and store the request URL at that key */

typedef struct {
struct WriteData {
TSHttpTxn txnp;

TSCacheKey key;

TSVConn connp;
TSIOBuffer cache_bufp;

} WriteData;
};

/* TSTransformCreate() data: Compute the SHA-256 digest of the content */

typedef struct {
struct TransformData {
TSHttpTxn txnp;

/* Null transformation */
Expand All @@ -65,13 +64,12 @@ typedef struct {

/* Message digest handle */
SHA256_CTX c;

} TransformData;
};

/* TSCacheRead() and TSVConnRead() data: Check the Location and Digest
* headers */

typedef struct {
struct SendData {
TSHttpTxn txnp;

TSMBuffer resp_bufp;
Expand All @@ -95,8 +93,7 @@ typedef struct {

const char *value;
int64_t length;

} SendData;
};

/* Implement TS_HTTP_READ_RESPONSE_HDR_HOOK to implement a null
* transformation */
Expand Down
2 changes: 1 addition & 1 deletion plugins/experimental/remap_stats/remap_stats.cc
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ get_effective_host(TSHttpTxn txn)
int
handle_read_req_hdr(TSCont cont, TSEvent event ATS_UNUSED, void *edata)
{
TSHttpTxn txn = (TSHttpTxn)edata;
TSHttpTxn txn = static_cast<TSHttpTxn>(edata);
config_t *config;
void *txnd;

Expand Down
8 changes: 4 additions & 4 deletions plugins/experimental/slice/Config.cc
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ Config::fromArgs(int const argc, char const *const argv[])
const char *errptr;
int erroffset;
m_regexstr = optarg;
m_regex = pcre_compile(m_regexstr.c_str(), 0, &errptr, &erroffset, NULL);
m_regex = pcre_compile(m_regexstr.c_str(), 0, &errptr, &erroffset, nullptr);
if (nullptr == m_regex) {
ERROR_LOG("Invalid regex: '%s'", m_regexstr.c_str());
} else {
Expand All @@ -168,7 +168,7 @@ Config::fromArgs(int const argc, char const *const argv[])
const char *errptr;
int erroffset;
m_regexstr = optarg;
m_regex = pcre_compile(m_regexstr.c_str(), 0, &errptr, &erroffset, NULL);
m_regex = pcre_compile(m_regexstr.c_str(), 0, &errptr, &erroffset, nullptr);
if (nullptr == m_regex) {
ERROR_LOG("Invalid regex: '%s'", m_regexstr.c_str());
} else {
Expand Down Expand Up @@ -264,12 +264,12 @@ Config::matchesRegex(char const *const url, int const urllen) const

switch (m_regex_type) {
case Exclude: {
if (0 <= pcre_exec(m_regex, m_regex_extra, url, urllen, 0, 0, NULL, 0)) {
if (0 <= pcre_exec(m_regex, m_regex_extra, url, urllen, 0, 0, nullptr, 0)) {
matches = false;
}
} break;
case Include: {
if (pcre_exec(m_regex, m_regex_extra, url, urllen, 0, 0, NULL, 0) < 0) {
if (pcre_exec(m_regex, m_regex_extra, url, urllen, 0, 0, nullptr, 0) < 0) {
matches = false;
}
} break;
Expand Down
2 changes: 1 addition & 1 deletion plugins/experimental/slice/Range.cc
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ int64_t
Range::lastBlockFor(int64_t const blocksize) const
{
if (0 < blocksize && isValid()) {
return std::max((int64_t)0, (m_end - 1) / blocksize);
return std::max(static_cast<int64_t>(0), (m_end - 1) / blocksize);
} else {
return -1;
}
Expand Down
2 changes: 1 addition & 1 deletion plugins/experimental/slice/slice.cc
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ read_request(TSHttpTxn txnp, Config *const config)
if (!header.hasKey(SLICER_MIME_FIELD_INFO, SLICER_MIME_LEN_INFO)) {
// check if any previous plugin has monkeyed with the transaction status
TSHttpStatus const txnstat = TSHttpTxnStatusGet(txnp);
if (0 != (int)txnstat) {
if (0 != static_cast<int>(txnstat)) {
DEBUG_LOG("txn status change detected (%d), skipping plugin\n", (int)txnstat);
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion plugins/experimental/slice/util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ request_block(TSCont contp, Data *const data)
}

// create virtual connection back into ATS
TSVConn const upvc = TSHttpConnectWithPluginId((sockaddr *)&data->m_client_ip, PLUGIN_NAME, 0);
TSVConn const upvc = TSHttpConnectWithPluginId(reinterpret_cast<sockaddr *>(&data->m_client_ip), PLUGIN_NAME, 0);

int const hlen = TSHttpHdrLengthGet(header.m_buffer, header.m_lochdr);

Expand Down
Loading