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/c-api/ssl_preaccept/ssl_preaccept.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@

namespace
{
typedef std::pair<IpAddr, IpAddr> IpRange;
using IpRange = std::pair<IpAddr, IpAddr>;
using IpRangeQueue = std::deque<IpRange>;
IpRangeQueue ClientBlindTunnelIp;

Expand Down
4 changes: 2 additions & 2 deletions iocore/cache/test/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ CacheWriteTest::start_test(int event, void *e)
}

SET_HANDLER(&CacheWriteTest::write_event);
cacheProcessor.open_write(this, 0, &key, (CacheHTTPHdr *)this->info.request_get(), old_info);
cacheProcessor.open_write(this, 0, &key, static_cast<CacheHTTPHdr *>(this->info.request_get()), old_info);
return 0;
}

Expand Down Expand Up @@ -271,7 +271,7 @@ CacheReadTest::start_test(int event, void *e)
key = generate_key(this->info);

SET_HANDLER(&CacheReadTest::read_event);
cacheProcessor.open_read(this, &key, (CacheHTTPHdr *)this->info.request_get(), &this->params);
cacheProcessor.open_read(this, &key, static_cast<CacheHTTPHdr *>(this->info.request_get()), &this->params);
return 0;
}

Expand Down
2 changes: 1 addition & 1 deletion plugins/background_fetch/background_fetch.cc
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ static const std::array<const std::string_view, 6> FILTER_HEADERS{
// Hold the global background fetch state. This is currently shared across all
// configurations, as a singleton. ToDo: Would it ever make sense to do this
// per remap rule? Maybe for per-remap logging ??
typedef std::unordered_map<std::string, bool> OutstandingRequests;
using OutstandingRequests = std::unordered_map<std::string, bool>;

class BgFetchState
{
Expand Down
4 changes: 2 additions & 2 deletions plugins/cache_range_requests/cache_range_requests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@

namespace
{
typedef enum parent_select_mode {
using parent_select_mode_t = enum parent_select_mode {
PS_DEFAULT, // Default ATS parent selection mode
PS_CACHEKEY_URL, // Set parent selection url to cache_key url
} parent_select_mode_t;
};

struct pluginconfig {
parent_select_mode_t ps_mode{PS_DEFAULT};
Expand Down
2 changes: 1 addition & 1 deletion plugins/escalate/escalate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ struct EscalationState {
std::string target;
};

typedef std::map<unsigned, RetryInfo> StatusMapType;
using StatusMapType = std::map<unsigned int, RetryInfo>;

EscalationState()
{
Expand Down
2 changes: 1 addition & 1 deletion plugins/esi/esi.cc
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,7 @@ cacheNodeList(ContData *cont_data)
string body("");
cont_data->esi_proc->packNodeList(body, false);
char buf[64];
snprintf(buf, 64, "%s: %d\r\n\r\n", TS_MIME_FIELD_CONTENT_LENGTH, (int)body.size());
snprintf(buf, 64, "%s: %d\r\n\r\n", TS_MIME_FIELD_CONTENT_LENGTH, static_cast<int>(body.size()));

post_request.append(buf);
post_request.append(body);
Expand Down
2 changes: 1 addition & 1 deletion plugins/esi/test/parser_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ main()
{
cout << endl << "==================== Test 6: Invalid Quoted URL test " << endl;
EsiParser parser("parser_test", &Debug, &Error);
string input_data = "<esi:include src=abc\"\"de\"f />";
string input_data = R"(<esi:include src=abc""de"f />)";

DocNodeList node_list;
assert(parser.parseChunk(input_data, node_list) == false);
Expand Down
6 changes: 3 additions & 3 deletions plugins/esi/test/utils_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ main()
const char *expected_strs4[] = {"pos", " SKY BAR ", "spaceid", "12123", nullptr};
checkAttributes("test4", attr_list, expected_strs4);

string str5("a=\"b & xyz\"&c=d&e=f&g=h\"");
string str5(R"(a="b & xyz"&c=d&e=f&g=h")");
Utils::parseAttributes(str5, attr_list, "&");
const char *expected_strs5[] = {"a", "b & xyz", "c", "d", "e", "f", nullptr};
checkAttributes("test5", attr_list, expected_strs5);
Expand All @@ -91,9 +91,9 @@ main()
checkAttributes("test7", attr_list, expected_strs7);

const char *escaped_sequence = R"({\"site-attribute\":\"content=no_expandable; ajax_cert_expandable\"})";
string str8("pos=\"FPM1\" spaceid=96584352 extra_mime=\"");
string str8(R"(pos="FPM1" spaceid=96584352 extra_mime=")");
str8.append(escaped_sequence);
str8.append("\" foo=bar a=\"b\"");
str8.append(R"(" foo=bar a="b")");
const char *expected_strs8[] = {"pos", "FPM1", "spaceid", "96584352", "extra_mime", escaped_sequence,
"foo", "bar", "a", "b", nullptr};
Utils::parseAttributes(str8, attr_list);
Expand Down
2 changes: 1 addition & 1 deletion plugins/experimental/access_control/utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ cryptoMessageDigestGet(const char *digestType, const char *data, size_t dataLen,
#else
ctx = HMAC_CTX_new();
#endif
if (!HMAC_Init_ex(ctx, key, keyLen, md, NULL)) {
if (!HMAC_Init_ex(ctx, key, keyLen, md, nullptr)) {
AccessControlError("failed to create EVP message digest context: %s", cryptoErrStr(buffer, sizeof(buffer)));
goto err;
}
Expand Down
2 changes: 1 addition & 1 deletion plugins/experimental/cache_fill/background_fetch.cc
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
#include "ts/ts.h"
#include "ts/remap.h"
#include "background_fetch.h"
typedef std::unordered_map<std::string, bool> OutstandingRequests;
using OutstandingRequests = std::unordered_map<std::string, bool>;

///////////////////////////////////////////////////////////////////////////
// Set a header to a specific value. This will avoid going to through a
Expand Down
5 changes: 3 additions & 2 deletions plugins/experimental/cache_fill/cache_fill.cc
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,12 @@ getCacheLookupResultName(TSCacheLookupResult result)
static bool
cont_check_cacheable(TSHttpTxn txnp)
{
if (TSHttpTxnIsInternal(txnp))
if (TSHttpTxnIsInternal(txnp)) {
return false;
}
int lookupStatus;
TSHttpTxnCacheLookupStatusGet(txnp, &lookupStatus);
TSDebug(PLUGIN_NAME, "lookup status: %s", getCacheLookupResultName((TSCacheLookupResult)lookupStatus));
TSDebug(PLUGIN_NAME, "lookup status: %s", getCacheLookupResultName(static_cast<TSCacheLookupResult>(lookupStatus)));
bool ret = false;
if (TS_CACHE_LOOKUP_MISS == lookupStatus || TS_CACHE_LOOKUP_HIT_STALE == lookupStatus) {
bool const nostore = TSHttpTxnServerRespNoStoreGet(txnp);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,11 @@ static int OPEN_WRITE_FAIL_REQ_DELAY_TIMEOUT = 500;

static bool global_init = false;

typedef struct _RequestData {
using RequestData = struct _RequestData {
TSHttpTxn txnp;
int wl_retry; // write lock failure retry count
std::string req_url;
} RequestData;
};

static int
add_redirect_header(TSMBuffer &bufp, TSMLoc &hdr_loc, const std::string &location)
Expand Down
4 changes: 2 additions & 2 deletions plugins/experimental/cookie_remap/cookie_remap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -811,8 +811,8 @@ class op
TSHttpStatus else_status = TS_HTTP_STATUS_NONE;
};

typedef std::pair<std::string, std::string> StringPair;
using OpMap = std::vector<StringPair>;
using StringPair = std::pair<std::string, std::string>;
using OpMap = std::vector<StringPair>;

//----------------------------------------------------------------------------
static bool
Expand Down
2 changes: 1 addition & 1 deletion plugins/experimental/magick/magick.cc
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ struct ImageTransform : TransformationPlugin {
{
TSDebug(PLUGIN_TAG, "handleInputComplete");

threadPool_.emplace_back([this](void) {
threadPool_.emplace_back([this]() {
magick::Image image;
magick::Exception exception;
magick::Wand wand;
Expand Down
32 changes: 16 additions & 16 deletions plugins/experimental/maxmind_acl/mmdb.cc
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,8 @@ Acl::loaddeny(const YAML::Node &denyNode)
YAML::Node country = denyNode["country"];
if (!country.IsNull()) {
if (country.IsSequence()) {
for (std::size_t i = 0; i < country.size(); i++) {
allow_country.insert_or_assign(country[i].as<std::string>(), false);
for (auto &&i : country) {
allow_country.insert_or_assign(i.as<std::string>(), false);
}
} else {
TSDebug(PLUGIN_NAME, "Invalid country code allow list yaml");
Expand All @@ -170,9 +170,9 @@ Acl::loaddeny(const YAML::Node &denyNode)
if (!ip.IsNull()) {
if (ip.IsSequence()) {
// Do IP Deny processing
for (std::size_t i = 0; i < ip.size(); i++) {
for (auto &&i : ip) {
IpAddr min, max;
ats_ip_range_parse(std::string_view{ip[i].as<std::string>()}, min, max);
ats_ip_range_parse(std::string_view{i.as<std::string>()}, min, max);
deny_ip_map.fill(min, max, nullptr);
TSDebug(PLUGIN_NAME, "loading ip: valid: %d, fam %d ", min.isValid(), min.family());
}
Expand Down Expand Up @@ -230,8 +230,8 @@ Acl::loadallow(const YAML::Node &allowNode)
YAML::Node country = allowNode["country"];
if (!country.IsNull()) {
if (country.IsSequence()) {
for (std::size_t i = 0; i < country.size(); i++) {
allow_country.insert_or_assign(country[i].as<std::string>(), true);
for (auto &&i : country) {
allow_country.insert_or_assign(i.as<std::string>(), true);
}

} else {
Expand All @@ -251,9 +251,9 @@ Acl::loadallow(const YAML::Node &allowNode)
if (!ip.IsNull()) {
if (ip.IsSequence()) {
// Do IP Allow processing
for (std::size_t i = 0; i < ip.size(); i++) {
for (auto &&i : ip) {
IpAddr min, max;
ats_ip_range_parse(std::string_view{ip[i].as<std::string>()}, min, max);
ats_ip_range_parse(std::string_view{i.as<std::string>()}, min, max);
allow_ip_map.fill(min, max, nullptr);
TSDebug(PLUGIN_NAME, "loading ip: valid: %d, fam %d ", min.isValid(), min.family());
}
Expand Down Expand Up @@ -290,9 +290,9 @@ Acl::parseregex(const YAML::Node &regex, bool allow)
if (!regex.IsNull()) {
if (regex.IsSequence()) {
// Parse each country-regex pair
for (std::size_t i = 0; i < regex.size(); i++) {
for (const auto &i : regex) {
plugin_regex temp;
auto temprule = regex[i].as<std::vector<std::string>>();
auto temprule = i.as<std::vector<std::string>>();
temp._regex_s = temprule.back();
const char *error;
int erroffset;
Expand All @@ -311,11 +311,11 @@ Acl::parseregex(const YAML::Node &regex, bool allow)
}

for (std::size_t y = 0; y < temprule.size() - 1; y++) {
TSDebug(PLUGIN_NAME, "Adding regex: %s, for country: %s", temp._regex_s.c_str(), regex[i][y].as<std::string>().c_str());
TSDebug(PLUGIN_NAME, "Adding regex: %s, for country: %s", temp._regex_s.c_str(), i[y].as<std::string>().c_str());
if (allow) {
allow_regex[regex[i][y].as<std::string>()].push_back(temp);
allow_regex[i[y].as<std::string>()].push_back(temp);
} else {
deny_regex[regex[i][y].as<std::string>()].push_back(temp);
deny_regex[i[y].as<std::string>()].push_back(temp);
}
}
}
Expand Down Expand Up @@ -423,7 +423,7 @@ Acl::eval(TSRemapRequestInfo *rri, TSHttpTxn txnp)
return ret;
}

if (NULL != entry_data_list) {
if (nullptr != entry_data_list) {
// This is useful to be able to dump out a full record of a
// mmdb entry for debug. Enabling can help if you want to figure
// out how to add new fields
Expand Down Expand Up @@ -481,7 +481,7 @@ Acl::eval(TSRemapRequestInfo *rri, TSHttpTxn txnp)
break;
}

if (NULL != entry_data_list) {
if (nullptr != entry_data_list) {
MMDB_free_entry_data_list(entry_data_list);
}

Expand All @@ -498,7 +498,7 @@ Acl::eval_country(MMDB_entry_data_s *entry_data, const char *path, int path_len)
bool ret = false;
bool allow = default_allow;
char *output = nullptr;
output = (char *)malloc((sizeof(char) * entry_data->data_size));
output = static_cast<char *>(malloc((sizeof(char) * entry_data->data_size)));
strncpy(output, entry_data->utf8_string, entry_data->data_size);
TSDebug(PLUGIN_NAME, "This IP Country Code: %s", output);
auto exists = allow_country.count(output);
Expand Down
2 changes: 1 addition & 1 deletion plugins/experimental/memcache/tsmemcache.cc
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ MCAccept::main_event(int event, void *data)
}
return EVENT_CONT;
} else {
Fatal("tsmemcache accept received fatal error: errno = %d", -((int)(intptr_t)data));
Fatal("tsmemcache accept received fatal error: errno = %d", -(static_cast<int>((intptr_t)data)));
return EVENT_CONT;
}
}
Expand Down
4 changes: 2 additions & 2 deletions plugins/experimental/mysql_remap/mysql_remap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@

MYSQL mysql;

typedef struct {
using my_data = struct {
char *query;
} my_data;
};

bool
do_mysql_remap(TSCont contp, TSHttpTxn txnp)
Expand Down
2 changes: 1 addition & 1 deletion plugins/experimental/rate_limit/rate_limit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
*/
#include <unistd.h>
#include <getopt.h>
#include <stdlib.h>
#include <cstdlib>
#include <ts/ts.h>
#include <ts/remap.h>

Expand Down
12 changes: 6 additions & 6 deletions plugins/experimental/statichit/statichit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ StaticHitTxnHook(TSCont contp, TSEvent event, void *edata)
}

method = TSHttpHdrMethodGet(bufp, hdr_loc, &method_length);
if (NULL == method) {
if (nullptr == method) {
VERROR("Couldn't retrieve client request method");
goto done;
}
Expand Down Expand Up @@ -601,9 +601,9 @@ TSReturnCode
TSRemapNewInstance(int argc, char *argv[], void **ih, char * /* errbuf ATS_UNUSED */, int /* errbuf_size ATS_UNUSED */)
{
static const struct option longopt[] = {
{"file-path", required_argument, NULL, 'f'}, {"mime-type", required_argument, NULL, 'm'},
{"max-age", required_argument, NULL, 'a'}, {"failure-code", required_argument, NULL, 'c'},
{"success-code", required_argument, NULL, 's'}, {NULL, no_argument, NULL, '\0'}};
{"file-path", required_argument, nullptr, 'f'}, {"mime-type", required_argument, nullptr, 'm'},
{"max-age", required_argument, nullptr, 'a'}, {"failure-code", required_argument, nullptr, 'c'},
{"success-code", required_argument, nullptr, 's'}, {nullptr, no_argument, nullptr, '\0'}};

std::string filePath;
std::string mimeType = "text/plain";
Expand All @@ -616,7 +616,7 @@ TSRemapNewInstance(int argc, char *argv[], void **ih, char * /* errbuf ATS_UNUSE
optind = 0;

while (true) {
int opt = getopt_long(argc, (char *const *)argv, "f:m:a:c:s:", longopt, NULL);
int opt = getopt_long(argc, (char *const *)argv, "f:m:a:c:s:", longopt, nullptr);

switch (opt) {
case 'f': {
Expand Down Expand Up @@ -646,7 +646,7 @@ TSRemapNewInstance(int argc, char *argv[], void **ih, char * /* errbuf ATS_UNUSE
return TS_ERROR;
}

if (filePath.find("/") != 0) {
if (filePath.find('/') != 0) {
filePath = std::string(TSConfigDirGet()) + '/' + filePath;
}

Expand Down
4 changes: 2 additions & 2 deletions plugins/experimental/stream_editor/stream_editor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ class rule_t
using ruleset_t = std::vector<rule_t>;
using rule_p = ruleset_t::const_iterator;

typedef struct contdata_t {
using contdata_t = struct contdata_t {
TSCont cont = nullptr;
TSIOBuffer out_buf = nullptr;
TSIOBufferReader out_rd = nullptr;
Expand Down Expand Up @@ -582,7 +582,7 @@ typedef struct contdata_t {
contbuf_sz = 2 * sz - 1;
}
}
} contdata_t;
};

static int64_t
process_block(contdata_t *contdata, TSIOBufferReader reader)
Expand Down
4 changes: 2 additions & 2 deletions plugins/header_rewrite/conditions_geo_maxmind.cc
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ MMConditionGeo::get_geo_string(const sockaddr *addr) const
}
ret = std::string(entry_data.utf8_string, entry_data.data_size);

if (NULL != entry_data_list) {
if (nullptr != entry_data_list) {
MMDB_free_entry_data_list(entry_data_list);
}

Expand Down Expand Up @@ -176,7 +176,7 @@ MMConditionGeo::get_geo_int(const sockaddr *addr) const
}
ret = entry_data.uint32;

if (NULL != entry_data_list) {
if (nullptr != entry_data_list) {
MMDB_free_entry_data_list(entry_data_list);
}

Expand Down
Loading