diff --git a/server/modules/filter/cache/cache.hh b/server/modules/filter/cache/cache.hh index 03e9c422b..4e932fb6b 100644 --- a/server/modules/filter/cache/cache.hh +++ b/server/modules/filter/cache/cache.hh @@ -42,7 +42,10 @@ public: void show(DCB* pDcb) const; - const CACHE_CONFIG& config() const { return m_config; } + const CACHE_CONFIG& config() const + { + return m_config; + } virtual json_t* get_info(uint32_t what = INFO_ALL) const = 0; diff --git a/server/modules/filter/cache/cachefilter.cc b/server/modules/filter/cache/cachefilter.cc index 6817b0184..212b372f5 100644 --- a/server/modules/filter/cache/cachefilter.cc +++ b/server/modules/filter/cache/cachefilter.cc @@ -142,9 +142,9 @@ extern "C" MXS_MODULE* MXS_CREATE_MODULE() { { "storage", - MXS_MODULE_PARAM_STRING, - NULL, - MXS_MODULE_OPT_REQUIRED + MXS_MODULE_PARAM_STRING, + NULL, + MXS_MODULE_OPT_REQUIRED }, { "storage_options", @@ -157,44 +157,44 @@ extern "C" MXS_MODULE* MXS_CREATE_MODULE() }, { "soft_ttl", - MXS_MODULE_PARAM_COUNT, - CACHE_DEFAULT_SOFT_TTL + MXS_MODULE_PARAM_COUNT, + CACHE_DEFAULT_SOFT_TTL }, { "max_resultset_rows", - MXS_MODULE_PARAM_COUNT, - CACHE_DEFAULT_MAX_RESULTSET_ROWS + MXS_MODULE_PARAM_COUNT, + CACHE_DEFAULT_MAX_RESULTSET_ROWS }, { "max_resultset_size", - MXS_MODULE_PARAM_COUNT, - CACHE_DEFAULT_MAX_RESULTSET_SIZE + MXS_MODULE_PARAM_COUNT, + CACHE_DEFAULT_MAX_RESULTSET_SIZE }, { "max_count", - MXS_MODULE_PARAM_COUNT, - CACHE_DEFAULT_MAX_COUNT + MXS_MODULE_PARAM_COUNT, + CACHE_DEFAULT_MAX_COUNT }, { "max_size", - MXS_MODULE_PARAM_COUNT, - CACHE_DEFAULT_THREAD_MODEL + MXS_MODULE_PARAM_COUNT, + CACHE_DEFAULT_THREAD_MODEL }, { "rules", - MXS_MODULE_PARAM_PATH + MXS_MODULE_PARAM_PATH }, { "debug", - MXS_MODULE_PARAM_COUNT, - CACHE_DEFAULT_DEBUG + MXS_MODULE_PARAM_COUNT, + CACHE_DEFAULT_DEBUG }, { "cached_data", - MXS_MODULE_PARAM_ENUM, - CACHE_DEFAULT_THREAD_MODEL, - MXS_MODULE_OPT_NONE, - cached_data_values + MXS_MODULE_PARAM_ENUM, + CACHE_DEFAULT_THREAD_MODEL, + MXS_MODULE_OPT_NONE, + cached_data_values }, {MXS_END_MODULE_PARAMS} } diff --git a/server/modules/filter/cache/cachefilter.h b/server/modules/filter/cache/cachefilter.h index 2a1e6d5b1..00ff72146 100644 --- a/server/modules/filter/cache/cachefilter.h +++ b/server/modules/filter/cache/cachefilter.h @@ -31,11 +31,11 @@ #define CACHE_DEBUG_MAX (CACHE_DEBUG_RULES | CACHE_DEBUG_USAGE | CACHE_DEBUG_DECISIONS) #if !defined(UINT32_MAX) -#define UINT32_MAX (4294967295U) +#define UINT32_MAX (4294967295U) #endif #if !defined(UINT64_MAX) -#define UINT64_MAX (18446744073709551615UL) +#define UINT64_MAX (18446744073709551615UL) #endif // Count diff --git a/server/modules/filter/cache/cachefilter.hh b/server/modules/filter/cache/cachefilter.hh index 64ee496fc..6dd8201bb 100644 --- a/server/modules/filter/cache/cachefilter.hh +++ b/server/modules/filter/cache/cachefilter.hh @@ -24,8 +24,16 @@ public: static CacheFilter* create(const char* zName, char** pzOptions, CONFIG_PARAMETER* ppParams); - Cache& cache() { ss_dassert(m_sCache.get()); return *m_sCache.get(); } - const Cache& cache() const { ss_dassert(m_sCache.get()); return *m_sCache.get(); } + Cache& cache() + { + ss_dassert(m_sCache.get()); + return *m_sCache.get(); + } + const Cache& cache() const + { + ss_dassert(m_sCache.get()); + return *m_sCache.get(); + } CacheFilterSession* newSession(SESSION* pSession); diff --git a/server/modules/filter/cache/lrustorage.hh b/server/modules/filter/cache/lrustorage.hh index e3393d9eb..b1685b22a 100644 --- a/server/modules/filter/cache/lrustorage.hh +++ b/server/modules/filter/cache/lrustorage.hh @@ -122,10 +122,22 @@ private: remove(); } - const CACHE_KEY* key() const { return pkey_; } - size_t size() const { return size_; } - Node* next() const { return pnext_; } - Node* prev() const { return pprev_; } + const CACHE_KEY* key() const + { + return pkey_; + } + size_t size() const + { + return size_; + } + Node* next() const + { + return pnext_; + } + Node* prev() const + { + return pprev_; + } /** * Move the node before the node provided as argument. diff --git a/server/modules/filter/cache/storage/storage_inmemory/inmemorystorage.hh b/server/modules/filter/cache/storage/storage_inmemory/inmemorystorage.hh index 2eb3613f9..6d1a826ff 100644 --- a/server/modules/filter/cache/storage/storage_inmemory/inmemorystorage.hh +++ b/server/modules/filter/cache/storage/storage_inmemory/inmemorystorage.hh @@ -62,7 +62,7 @@ private: struct Entry { Entry() - : time(0) + : time(0) {} uint32_t time; diff --git a/server/modules/filter/cache/storage/storage_inmemory/storage_inmemory.cc b/server/modules/filter/cache/storage/storage_inmemory/storage_inmemory.cc index 6099e11c8..d3325b4e0 100644 --- a/server/modules/filter/cache/storage/storage_inmemory/storage_inmemory.cc +++ b/server/modules/filter/cache/storage/storage_inmemory/storage_inmemory.cc @@ -20,9 +20,9 @@ extern "C" { -CACHE_STORAGE_API* CacheGetStorageAPI() -{ - return &StorageModule::s_api; -} + CACHE_STORAGE_API* CacheGetStorageAPI() + { + return &StorageModule::s_api; + } } diff --git a/server/modules/filter/cache/storage/storage_rocksdb/rocksdbinternals.cc b/server/modules/filter/cache/storage/storage_rocksdb/rocksdbinternals.cc index dcb326fe4..e1b267bcf 100644 --- a/server/modules/filter/cache/storage/storage_rocksdb/rocksdbinternals.cc +++ b/server/modules/filter/cache/storage/storage_rocksdb/rocksdbinternals.cc @@ -25,7 +25,8 @@ bool RocksDBInternals::is_stale(const rocksdb::Slice& value, int32_t ttl, rocksdb::Env* pEnv) { if (ttl <= 0) - { // Data is fresh if TTL is non-positive + { + // Data is fresh if TTL is non-positive return false; } diff --git a/server/modules/filter/cache/storage/storage_rocksdb/rocksdbinternals.hh b/server/modules/filter/cache/storage/storage_rocksdb/rocksdbinternals.hh index b6ed95914..b883a0181 100644 --- a/server/modules/filter/cache/storage/storage_rocksdb/rocksdbinternals.hh +++ b/server/modules/filter/cache/storage/storage_rocksdb/rocksdbinternals.hh @@ -19,7 +19,7 @@ #if (ROCKSDB_MAJOR != 4) || (ROCKSDB_MINOR != 9) #error RocksDBStorage was created with knowledge of RocksDB 4.9 internals.\ - The version used is something else. Ensure the knowledge is still applicable. +The version used is something else. Ensure the knowledge is still applicable. #endif namespace RocksDBInternals diff --git a/server/modules/filter/cache/storage/storage_rocksdb/rocksdbstorage.cc b/server/modules/filter/cache/storage/storage_rocksdb/rocksdbstorage.cc index 4ed43b211..843350433 100644 --- a/server/modules/filter/cache/storage/storage_rocksdb/rocksdbstorage.cc +++ b/server/modules/filter/cache/storage/storage_rocksdb/rocksdbstorage.cc @@ -122,7 +122,8 @@ bool deletePath(const string& path) // FTS_XDEV - Don't cross filesystem boundaries FTS *pFts = fts_open(files, FTS_NOCHDIR | FTS_PHYSICAL | FTS_XDEV, NULL); - if (pFts) { + if (pFts) + { FTSENT* pCurrent; while ((pCurrent = fts_read(pFts))) { @@ -178,7 +179,8 @@ bool deletePath(const string& path) MXS_NOTICE("Deleted cache storage at '%s'.", path.c_str()); } - if (pFts) { + if (pFts) + { fts_close(pFts); } } @@ -393,7 +395,10 @@ cache_result_t RocksDBStorage::Get_key(const char* zDefault_db, const GWBUF& que // dbs now contain each accessed database in sorted order. Now copy them to a single string. string tag; - for_each(dbs.begin(), dbs.end(), [&tag](const string& db) { tag.append(db); }); + for_each(dbs.begin(), dbs.end(), [&tag](const string & db) + { + tag.append(db); + }); memset(pKey->data, 0, CACHE_KEY_MAXLEN); @@ -432,15 +437,16 @@ cache_result_t RocksDBStorage::get_info(uint32_t what, json_t** ppInfo) const auto sStatistics = m_sDb->GetOptions().statistics; for_each(rocksdb::TickersNameMap.begin(), rocksdb::TickersNameMap.end(), - [pInfo, sStatistics](const std::pair& tickerName) { - json_t* pValue = json_integer(sStatistics->getTickerCount(tickerName.first)); + [pInfo, sStatistics](const std::pair& tickerName) + { + json_t* pValue = json_integer(sStatistics->getTickerCount(tickerName.first)); - if (pValue) - { - json_object_set(pInfo, tickerName.second.c_str(), pValue); - json_decref(pValue); - } - }); + if (pValue) + { + json_object_set(pInfo, tickerName.second.c_str(), pValue); + json_decref(pValue); + } + }); *ppInfo = pInfo; } diff --git a/server/modules/filter/cache/storage/storage_rocksdb/storage_rocksdb.cc b/server/modules/filter/cache/storage/storage_rocksdb/storage_rocksdb.cc index 52f95589d..7f94edecf 100644 --- a/server/modules/filter/cache/storage/storage_rocksdb/storage_rocksdb.cc +++ b/server/modules/filter/cache/storage/storage_rocksdb/storage_rocksdb.cc @@ -21,9 +21,9 @@ extern "C" { -CACHE_STORAGE_API* CacheGetStorageAPI() -{ - return &StorageModule::s_api; -} + CACHE_STORAGE_API* CacheGetStorageAPI() + { + return &StorageModule::s_api; + } } diff --git a/server/modules/filter/cache/storagefactory.hh b/server/modules/filter/cache/storagefactory.hh index e82c2fa06..9a43a1117 100644 --- a/server/modules/filter/cache/storagefactory.hh +++ b/server/modules/filter/cache/storagefactory.hh @@ -31,7 +31,10 @@ public: * * @return Bitmask of @c cache_storage_capabilities_t values. */ - uint32_t capabilities() const { return m_caps; } + uint32_t capabilities() const + { + return m_caps; + } /** * The capabilities of storages loaded via this factory. These @@ -39,7 +42,10 @@ public: * * @return Bitmask of @c cache_storage_capabilities_t values. */ - uint32_t storage_capabilities() const { return m_storage_caps; } + uint32_t storage_capabilities() const + { + return m_storage_caps; + } /** * Create storage instance. diff --git a/server/modules/filter/cache/test/tester.cc b/server/modules/filter/cache/test/tester.cc index f1f776133..c97605c54 100644 --- a/server/modules/filter/cache/test/tester.cc +++ b/server/modules/filter/cache/test/tester.cc @@ -46,7 +46,10 @@ public: return Thread(pTask); } - Tester::Task* task() { return m_pTask; } + Tester::Task* task() + { + return m_pTask; + } void start() { diff --git a/server/modules/filter/cache/test/tester.hh b/server/modules/filter/cache/test/tester.hh index 05e814662..2f3211e06 100644 --- a/server/modules/filter/cache/test/tester.hh +++ b/server/modules/filter/cache/test/tester.hh @@ -52,12 +52,18 @@ public: * * @return True, if the task should terminate, i.e., return from @c run. */ - bool should_terminate() const { return m_terminate; } + bool should_terminate() const + { + return m_terminate; + } /** * Tell the task to terminate. */ - void terminate() { m_terminate = true; } + void terminate() + { + m_terminate = true; + } /** * Calls terminate on the provided task. For use in algorithms. @@ -98,14 +104,20 @@ public: * * @return The value returned by @run. */ - int rv() const { return m_rv; } + int rv() const + { + return m_rv; + } /** * The stream to be used for user output. * * @return The output stream to be used. */ - std::ostream& out() const { return m_out; } + std::ostream& out() const + { + return m_out; + } protected: /** @@ -118,7 +130,10 @@ public: private: friend class Thread; - void set_rv(int rv) { m_rv = rv; } + void set_rv(int rv) + { + m_rv = rv; + } private: Task(const Task&); @@ -249,7 +264,10 @@ protected: * * @return A stream. */ - std::ostream& out() const { return m_out; } + std::ostream& out() const + { + return m_out; + } /** * Execute a specific number of tasks in as many threads. diff --git a/server/modules/filter/cache/test/testerlrustorage.cc b/server/modules/filter/cache/test/testerlrustorage.cc index 030d09335..47fa99489 100644 --- a/server/modules/filter/cache/test/testerlrustorage.cc +++ b/server/modules/filter/cache/test/testerlrustorage.cc @@ -243,7 +243,7 @@ int TesterLRUStorage::test_max_count_and_size(size_t n_threads, size_t n_seconds ss_debug(cache_result_t result); uint64_t items; - ss_debug(result =) pStorage->get_items(&items); + ss_debug(result = ) pStorage->get_items(&items); ss_dassert(result == CACHE_RESULT_OK); out() << "Max count: " << max_count << ", count: " << items << "." << endl; @@ -254,7 +254,7 @@ int TesterLRUStorage::test_max_count_and_size(size_t n_threads, size_t n_seconds } uint64_t size; - ss_debug(result =) pStorage->get_size(&size); + ss_debug(result = ) pStorage->get_size(&size); ss_dassert(result == CACHE_RESULT_OK); out() << "Max size: " << max_size << ", size: " << size << "." << endl; diff --git a/server/modules/filter/cache/test/teststorage.hh b/server/modules/filter/cache/test/teststorage.hh index a7985f243..ef57f5d19 100644 --- a/server/modules/filter/cache/test/teststorage.hh +++ b/server/modules/filter/cache/test/teststorage.hh @@ -49,7 +49,10 @@ protected: virtual void print_usage(const char* zProgram); - std::ostream& out() const { return m_out; } + std::ostream& out() const + { + return m_out; + } private: TestStorage(const TestStorage&); diff --git a/server/modules/filter/dbfwfilter/dbfwfilter.c b/server/modules/filter/dbfwfilter/dbfwfilter.c index 9d27c483d..a62b73702 100644 --- a/server/modules/filter/dbfwfilter/dbfwfilter.c +++ b/server/modules/filter/dbfwfilter/dbfwfilter.c @@ -836,26 +836,26 @@ MXS_MODULE* MXS_CREATE_MODULE() { { "rules", - MXS_MODULE_PARAM_PATH, - NULL, - MXS_MODULE_OPT_REQUIRED | MXS_MODULE_OPT_PATH_R_OK + MXS_MODULE_PARAM_PATH, + NULL, + MXS_MODULE_OPT_REQUIRED | MXS_MODULE_OPT_PATH_R_OK }, { "log_match", - MXS_MODULE_PARAM_BOOL, - "false" + MXS_MODULE_PARAM_BOOL, + "false" }, { "log_no_match", - MXS_MODULE_PARAM_BOOL, - "false" + MXS_MODULE_PARAM_BOOL, + "false" }, { "action", - MXS_MODULE_PARAM_ENUM, - "block", - MXS_MODULE_OPT_ENUM_UNIQUE, - action_values + MXS_MODULE_PARAM_ENUM, + "block", + MXS_MODULE_OPT_ENUM_UNIQUE, + action_values }, {MXS_END_MODULE_PARAMS} } @@ -901,29 +901,29 @@ char* get_regex_string(char** saved) { switch (*ptr) { - case '\'': - case '"': - if (quoted) + case '\'': + case '"': + if (quoted) + { + if (*ptr == delimiter) { - if (*ptr == delimiter) - { - *ptr = '\0'; - *saved = ptr + 1; - return start; - } + *ptr = '\0'; + *saved = ptr + 1; + return start; } - else - { - delimiter = *ptr; - start = ptr + 1; - quoted = true; - } - break; - case '\\': - escaped = true; - break; - default: - break; + } + else + { + delimiter = *ptr; + start = ptr + 1; + quoted = true; + } + break; + case '\\': + escaped = true; + break; + default: + break; } } } @@ -1045,21 +1045,21 @@ static void rule_free_all(RULE* rule) switch (rule->type) { - case RT_COLUMN: - case RT_FUNCTION: - strlink_free((STRLINK*) rule->data); - break; + case RT_COLUMN: + case RT_FUNCTION: + strlink_free((STRLINK*) rule->data); + break; - case RT_THROTTLE: - MXS_FREE(rule->data); - break; + case RT_THROTTLE: + MXS_FREE(rule->data); + break; - case RT_REGEX: - pcre2_code_free((pcre2_code*) rule->data); - break; + case RT_REGEX: + pcre2_code_free((pcre2_code*) rule->data); + break; - default: - break; + default: + break; } MXS_FREE(rule->name); @@ -1402,20 +1402,20 @@ static bool process_user_templates(HASHTABLE *users, user_template_t *templates, switch (templates->type) { - case FWTOK_MATCH_ANY: - tail->next = user->rules_or; - user->rules_or = foundrules; - break; + case FWTOK_MATCH_ANY: + tail->next = user->rules_or; + user->rules_or = foundrules; + break; - case FWTOK_MATCH_ALL: - tail->next = user->rules_and; - user->rules_and = foundrules; - break; + case FWTOK_MATCH_ALL: + tail->next = user->rules_and; + user->rules_and = foundrules; + break; - case FWTOK_MATCH_STRICT_ALL: - tail->next = user->rules_strict_and; - user->rules_strict_and = foundrules; - break; + case FWTOK_MATCH_STRICT_ALL: + tail->next = user->rules_strict_and; + user->rules_strict_and = foundrules; + break; } } else @@ -2027,17 +2027,17 @@ bool rule_matches(FW_INSTANCE* my_instance, { switch (optype) { - case QUERY_OP_SELECT: - case QUERY_OP_UPDATE: - case QUERY_OP_INSERT: - case QUERY_OP_DELETE: - // In these cases, we have to be able to trust what qc_get_field_info - // returns. Unless the query was parsed completely, we cannot do that. - msg = create_parse_error(my_instance, "parsed completely", query, &matches); - goto queryresolved; + case QUERY_OP_SELECT: + case QUERY_OP_UPDATE: + case QUERY_OP_INSERT: + case QUERY_OP_DELETE: + // In these cases, we have to be able to trust what qc_get_field_info + // returns. Unless the query was parsed completely, we cannot do that. + msg = create_parse_error(my_instance, "parsed completely", query, &matches); + goto queryresolved; - default: - break; + default: + break; } } } @@ -2051,58 +2051,58 @@ bool rule_matches(FW_INSTANCE* my_instance, { switch (rulebook->rule->type) { - case RT_UNDEFINED: - ss_dassert(false); - MXS_ERROR("Undefined rule type found."); - break; + case RT_UNDEFINED: + ss_dassert(false); + MXS_ERROR("Undefined rule type found."); + break; - case RT_REGEX: - match_regex(rulebook, query, &matches, &msg); - break; + case RT_REGEX: + match_regex(rulebook, query, &matches, &msg); + break; - case RT_PERMISSION: + case RT_PERMISSION: + matches = true; + msg = MXS_STRDUP_A("Permission denied at this time."); + MXS_NOTICE("rule '%s': query denied at this time.", rulebook->rule->name); + break; + + case RT_COLUMN: + if (is_sql) + { + match_column(rulebook, queue, &matches, &msg); + } + break; + + case RT_FUNCTION: + if (is_sql) + { + match_function(rulebook, queue, &matches, &msg); + } + break; + + case RT_WILDCARD: + if (is_sql) + { + match_wildcard(rulebook, queue, &matches, &msg); + } + break; + + case RT_THROTTLE: + matches = match_throttle(my_session, rulebook, &msg); + break; + + case RT_CLAUSE: + if (is_sql && !qc_query_has_clause(queue)) + { matches = true; - msg = MXS_STRDUP_A("Permission denied at this time."); - MXS_NOTICE("rule '%s': query denied at this time.", rulebook->rule->name); - break; + msg = MXS_STRDUP_A("Required WHERE/HAVING clause is missing."); + MXS_NOTICE("rule '%s': query has no where/having " + "clause, query is denied.", rulebook->rule->name); + } + break; - case RT_COLUMN: - if (is_sql) - { - match_column(rulebook, queue, &matches, &msg); - } - break; - - case RT_FUNCTION: - if (is_sql) - { - match_function(rulebook, queue, &matches, &msg); - } - break; - - case RT_WILDCARD: - if (is_sql) - { - match_wildcard(rulebook, queue, &matches, &msg); - } - break; - - case RT_THROTTLE: - matches = match_throttle(my_session, rulebook, &msg); - break; - - case RT_CLAUSE: - if (is_sql && !qc_query_has_clause(queue)) - { - matches = true; - msg = MXS_STRDUP_A("Required WHERE/HAVING clause is missing."); - MXS_NOTICE("rule '%s': query has no where/having " - "clause, query is denied.", rulebook->rule->name); - } - break; - - default: - break; + default: + break; } } @@ -2374,28 +2374,28 @@ routeQuery(MXS_FILTER *instance, MXS_FILTER_SESSION *session, GWBUF *queue) switch (my_instance->action) { - case FW_ACTION_ALLOW: - if (match) - { - query_ok = true; - } - break; - - case FW_ACTION_BLOCK: - if (!match) - { - query_ok = true; - } - break; - - case FW_ACTION_IGNORE: + case FW_ACTION_ALLOW: + if (match) + { query_ok = true; - break; + } + break; - default: - MXS_ERROR("Unknown dbfwfilter action: %d", my_instance->action); - ss_dassert(false); - break; + case FW_ACTION_BLOCK: + if (!match) + { + query_ok = true; + } + break; + + case FW_ACTION_IGNORE: + query_ok = true; + break; + + default: + MXS_ERROR("Unknown dbfwfilter action: %d", my_instance->action); + ss_dassert(false); + break; } if (my_instance->log_match != FW_LOG_NONE) diff --git a/server/modules/filter/hintfilter/hintparser.c b/server/modules/filter/hintfilter/hintparser.c index 3d0b2700c..e293e337d 100644 --- a/server/modules/filter/hintfilter/hintparser.c +++ b/server/modules/filter/hintfilter/hintparser.c @@ -96,15 +96,15 @@ static const char* token_get_keyword( { switch (token->token) { - case TOK_EOL: - return "End of line"; - break; + case TOK_EOL: + return "End of line"; + break; - case TOK_STRING: - return token->value; - break; + case TOK_STRING: + return token->value; + break; - default: + default: { int i = 0; while (i < TOK_EOL && keywords[i].token != token->token) @@ -276,144 +276,144 @@ hint_parser(HINT_SESSION *session, GWBUF *request) { switch (state) { - case HS_INIT: - switch (tok->token) - { - case TOK_ROUTE: - state = HS_ROUTE; - break; - case TOK_STRING: - state = HS_NAME; - lvalue = MXS_STRDUP_A(tok->value); - break; - case TOK_STOP: - /* Action: pop active hint */ - hint_pop(session); - state = HS_INIT; - break; - case TOK_START: - hintname = NULL; - mode = HM_START; - state = HS_INIT; - break; - default: - /* Error: expected hint, name or STOP */ - MXS_ERROR("Syntax error in hint. Expected " - "'route', 'stop' or hint name instead of " - "'%s'. Hint ignored.", - token_get_keyword(tok)); - token_free(tok); - goto retblock; - } + case HS_INIT: + switch (tok->token) + { + case TOK_ROUTE: + state = HS_ROUTE; break; - case HS_ROUTE: - if (tok->token != TOK_TO) - { - /* Error, expect TO */; - MXS_ERROR("Syntax error in hint. Expected " - "'to' instead of '%s'. Hint ignored.", - token_get_keyword(tok)); - token_free(tok); - goto retblock; - } - state = HS_ROUTE1; + case TOK_STRING: + state = HS_NAME; + lvalue = MXS_STRDUP_A(tok->value); break; - case HS_ROUTE1: - switch (tok->token) - { - case TOK_MASTER: - rval = hint_create_route(rval, - HINT_ROUTE_TO_MASTER, NULL); - break; - case TOK_SLAVE: - rval = hint_create_route(rval, - HINT_ROUTE_TO_SLAVE, NULL); - break; - case TOK_SERVER: - state = HS_ROUTE_SERVER; - break; - default: - /* Error expected MASTER, SLAVE or SERVER */ - MXS_ERROR("Syntax error in hint. Expected " - "'master', 'slave', or 'server' instead " - "of '%s'. Hint ignored.", - token_get_keyword(tok)); - - token_free(tok); - goto retblock; - } - break; - case HS_ROUTE_SERVER: - if (tok->token == TOK_STRING) - { - rval = hint_create_route(rval, - HINT_ROUTE_TO_NAMED_SERVER, tok->value); - } - else - { - /* Error: Expected server name */ - MXS_ERROR("Syntax error in hint. Expected " - "server name instead of '%s'. Hint " - "ignored.", - token_get_keyword(tok)); - token_free(tok); - goto retblock; - } - break; - case HS_NAME: - switch (tok->token) - { - case TOK_EQUAL: - pname = lvalue; - state = HS_PVALUE; - break; - case TOK_PREPARE: - pname = lvalue; - state = HS_PREPARE; - break; - case TOK_START: - /* Action start(lvalue) */ - hintname = lvalue; - mode = HM_START; - state = HS_INIT; - break; - default: - /* Error, token tok->value not expected */ - MXS_ERROR("Syntax error in hint. Expected " - "'=', 'prepare', or 'start' instead of " - "'%s'. Hint ignored.", - token_get_keyword(tok)); - token_free(tok); - goto retblock; - } - break; - case HS_PVALUE: - /* Action: pname = tok->value */ - rval = hint_create_parameter(rval, pname, tok->value); + case TOK_STOP: + /* Action: pop active hint */ + hint_pop(session); state = HS_INIT; break; - case HS_PREPARE: - mode = HM_PREPARE; - hintname = lvalue; - switch (tok->token) - { - case TOK_ROUTE: - state = HS_ROUTE; - break; - case TOK_STRING: - state = HS_NAME; - lvalue = tok->value; - break; - default: - /* Error, token tok->value not expected */ - MXS_ERROR("Syntax error in hint. Expected " - "'route' or hint name instead of " - "'%s'. Hint ignored.", - token_get_keyword(tok)); - token_free(tok); - goto retblock; - } + case TOK_START: + hintname = NULL; + mode = HM_START; + state = HS_INIT; break; + default: + /* Error: expected hint, name or STOP */ + MXS_ERROR("Syntax error in hint. Expected " + "'route', 'stop' or hint name instead of " + "'%s'. Hint ignored.", + token_get_keyword(tok)); + token_free(tok); + goto retblock; + } + break; + case HS_ROUTE: + if (tok->token != TOK_TO) + { + /* Error, expect TO */; + MXS_ERROR("Syntax error in hint. Expected " + "'to' instead of '%s'. Hint ignored.", + token_get_keyword(tok)); + token_free(tok); + goto retblock; + } + state = HS_ROUTE1; + break; + case HS_ROUTE1: + switch (tok->token) + { + case TOK_MASTER: + rval = hint_create_route(rval, + HINT_ROUTE_TO_MASTER, NULL); + break; + case TOK_SLAVE: + rval = hint_create_route(rval, + HINT_ROUTE_TO_SLAVE, NULL); + break; + case TOK_SERVER: + state = HS_ROUTE_SERVER; + break; + default: + /* Error expected MASTER, SLAVE or SERVER */ + MXS_ERROR("Syntax error in hint. Expected " + "'master', 'slave', or 'server' instead " + "of '%s'. Hint ignored.", + token_get_keyword(tok)); + + token_free(tok); + goto retblock; + } + break; + case HS_ROUTE_SERVER: + if (tok->token == TOK_STRING) + { + rval = hint_create_route(rval, + HINT_ROUTE_TO_NAMED_SERVER, tok->value); + } + else + { + /* Error: Expected server name */ + MXS_ERROR("Syntax error in hint. Expected " + "server name instead of '%s'. Hint " + "ignored.", + token_get_keyword(tok)); + token_free(tok); + goto retblock; + } + break; + case HS_NAME: + switch (tok->token) + { + case TOK_EQUAL: + pname = lvalue; + state = HS_PVALUE; + break; + case TOK_PREPARE: + pname = lvalue; + state = HS_PREPARE; + break; + case TOK_START: + /* Action start(lvalue) */ + hintname = lvalue; + mode = HM_START; + state = HS_INIT; + break; + default: + /* Error, token tok->value not expected */ + MXS_ERROR("Syntax error in hint. Expected " + "'=', 'prepare', or 'start' instead of " + "'%s'. Hint ignored.", + token_get_keyword(tok)); + token_free(tok); + goto retblock; + } + break; + case HS_PVALUE: + /* Action: pname = tok->value */ + rval = hint_create_parameter(rval, pname, tok->value); + state = HS_INIT; + break; + case HS_PREPARE: + mode = HM_PREPARE; + hintname = lvalue; + switch (tok->token) + { + case TOK_ROUTE: + state = HS_ROUTE; + break; + case TOK_STRING: + state = HS_NAME; + lvalue = tok->value; + break; + default: + /* Error, token tok->value not expected */ + MXS_ERROR("Syntax error in hint. Expected " + "'route' or hint name instead of " + "'%s'. Hint ignored.", + token_get_keyword(tok)); + token_free(tok); + goto retblock; + } + break; } token_free(tok); } /*< while */ @@ -425,68 +425,68 @@ hint_parser(HINT_SESSION *session, GWBUF *request) switch (mode) { - case HM_START: - /* - * We are starting either a predefined set of hints, - * creating a new set of hints and starting in a single - * operation or starting an anonymous block of hints. - */ - if (hintname == NULL && rval != NULL) + case HM_START: + /* + * We are starting either a predefined set of hints, + * creating a new set of hints and starting in a single + * operation or starting an anonymous block of hints. + */ + if (hintname == NULL && rval != NULL) + { + /* We are starting an anonymous block of hints */ + hint_push(session, rval); + rval = NULL; + } + else if (hintname && rval) + { + /* We are creating and starting a block of hints */ + if (lookup_named_hint(session, hintname) != NULL) { - /* We are starting an anonymous block of hints */ - hint_push(session, rval); - rval = NULL; - } - else if (hintname && rval) - { - /* We are creating and starting a block of hints */ - if (lookup_named_hint(session, hintname) != NULL) - { - /* Error hint with this name already exists */ - } - else - { - create_named_hint(session, hintname, rval); - hint_push(session, hint_dup(rval)); - } - } - else if (hintname && rval == NULL) - { - /* We starting an already define set of named hints */ - rval = lookup_named_hint(session, hintname); - hint_push(session, hint_dup(rval)); - MXS_FREE(hintname); - rval = NULL; - } - else if (hintname == NULL && rval == NULL) - { - /* Error case */ - } - break; - case HM_PREPARE: - /* - * We are preparing a named set of hints. Note this does - * not trigger the usage of these hints currently. - */ - if (hintname == NULL || rval == NULL) - { - /* Error case, name and hints must be defined */ + /* Error hint with this name already exists */ } else { create_named_hint(session, hintname, rval); + hint_push(session, hint_dup(rval)); } - /* We are not starting the hints now, so return an empty - * hint set. - */ + } + else if (hintname && rval == NULL) + { + /* We starting an already define set of named hints */ + rval = lookup_named_hint(session, hintname); + hint_push(session, hint_dup(rval)); + MXS_FREE(hintname); rval = NULL; - break; - case HM_EXECUTE: - /* - * We have a one-off hint for the statement we are - * currently forwarding. - */ - break; + } + else if (hintname == NULL && rval == NULL) + { + /* Error case */ + } + break; + case HM_PREPARE: + /* + * We are preparing a named set of hints. Note this does + * not trigger the usage of these hints currently. + */ + if (hintname == NULL || rval == NULL) + { + /* Error case, name and hints must be defined */ + } + else + { + create_named_hint(session, hintname, rval); + } + /* We are not starting the hints now, so return an empty + * hint set. + */ + rval = NULL; + break; + case HM_EXECUTE: + /* + * We have a one-off hint for the statement we are + * currently forwarding. + */ + break; } retblock: diff --git a/server/modules/filter/insertstream/insertstream.c b/server/modules/filter/insertstream/insertstream.c index 07beeeffb..ad4dab012 100644 --- a/server/modules/filter/insertstream/insertstream.c +++ b/server/modules/filter/insertstream/insertstream.c @@ -280,46 +280,46 @@ static int32_t routeQuery(MXS_FILTER *instance, MXS_FILTER_SESSION *session, GWB { switch (my_session->state) { - case DS_STREAM_CLOSED: - /** We're opening a new stream */ - strcpy(my_session->target, target); - my_session->queue = queue; - my_session->state = DS_REQUEST_SENT; - my_session->packet_num = 0; - queue = create_load_data_command(target); - break; + case DS_STREAM_CLOSED: + /** We're opening a new stream */ + strcpy(my_session->target, target); + my_session->queue = queue; + my_session->state = DS_REQUEST_SENT; + my_session->packet_num = 0; + queue = create_load_data_command(target); + break; - case DS_REQUEST_ACCEPTED: - my_session->state = DS_STREAM_OPEN; - /** Fallthrough */ + case DS_REQUEST_ACCEPTED: + my_session->state = DS_STREAM_OPEN; + /** Fallthrough */ - case DS_STREAM_OPEN: - if (strcmp(target, my_session->target) == 0) - { - /** - * Stream is open and targets match, convert the insert into - * a data stream - */ - uint8_t packet_num = ++my_session->packet_num; - send_ok = true; - queue = convert_to_stream(queue, packet_num); - } - else - { - /** - * Target mismatch - * - * TODO: Instead of sending an error, we could just open a new stream - */ - gwbuf_free(queue); - send_error = true; - } - break; + case DS_STREAM_OPEN: + if (strcmp(target, my_session->target) == 0) + { + /** + * Stream is open and targets match, convert the insert into + * a data stream + */ + uint8_t packet_num = ++my_session->packet_num; + send_ok = true; + queue = convert_to_stream(queue, packet_num); + } + else + { + /** + * Target mismatch + * + * TODO: Instead of sending an error, we could just open a new stream + */ + gwbuf_free(queue); + send_error = true; + } + break; - default: - MXS_ERROR("Unexpected state: %d", my_session->state); - ss_dassert(false); - break; + default: + MXS_ERROR("Unexpected state: %d", my_session->state); + ss_dassert(false); + break; } } else @@ -331,22 +331,22 @@ static int32_t routeQuery(MXS_FILTER *instance, MXS_FILTER_SESSION *session, GWB switch (my_session->state) { - case DS_STREAM_OPEN: - /** Stream is open, we need to close it */ - my_session->state = DS_CLOSING_STREAM; - send_empty = true; - packet_num = ++my_session->packet_num; - my_session->queue = queue; - break; + case DS_STREAM_OPEN: + /** Stream is open, we need to close it */ + my_session->state = DS_CLOSING_STREAM; + send_empty = true; + packet_num = ++my_session->packet_num; + my_session->queue = queue; + break; - case DS_REQUEST_ACCEPTED: - my_session->state = DS_STREAM_OPEN; - send_ok = true; - break; + case DS_REQUEST_ACCEPTED: + my_session->state = DS_STREAM_OPEN; + send_ok = true; + break; - default: - ss_dassert(my_session->state == DS_STREAM_CLOSED); - break; + default: + ss_dassert(my_session->state == DS_STREAM_CLOSED); + break; } if (send_empty) diff --git a/server/modules/filter/luafilter/luafilter.c b/server/modules/filter/luafilter/luafilter.c index a67313127..67a8fed86 100644 --- a/server/modules/filter/luafilter/luafilter.c +++ b/server/modules/filter/luafilter/luafilter.c @@ -186,8 +186,8 @@ typedef struct lua_State* lua_state; GWBUF* current_query; SPINLOCK lock; - MXS_DOWNSTREAM down; - MXS_UPSTREAM up; + MXS_DOWNSTREAM down; + MXS_UPSTREAM up; } LUA_SESSION; /** diff --git a/server/modules/filter/masking/maskingfilter.cc b/server/modules/filter/masking/maskingfilter.cc index 42a8aa4d5..03d1a16ab 100644 --- a/server/modules/filter/masking/maskingfilter.cc +++ b/server/modules/filter/masking/maskingfilter.cc @@ -85,9 +85,11 @@ extern "C" MXS_MODULE* MXS_CREATE_MODULE() NULL, /* Thread finish. */ { { Config::rules_file_name, MXS_MODULE_PARAM_STRING, NULL, MXS_MODULE_OPT_REQUIRED }, - { Config::warn_type_mismatch_name, - MXS_MODULE_PARAM_ENUM, Config::warn_type_mismatch_default, - MXS_MODULE_OPT_NONE, Config::warn_type_mismatch_values }, + { + Config::warn_type_mismatch_name, + MXS_MODULE_PARAM_ENUM, Config::warn_type_mismatch_default, + MXS_MODULE_OPT_NONE, Config::warn_type_mismatch_values + }, { MXS_END_MODULE_PARAMS } } }; diff --git a/server/modules/filter/masking/maskingfilter.hh b/server/modules/filter/masking/maskingfilter.hh index b3543e44c..0d83f9385 100644 --- a/server/modules/filter/masking/maskingfilter.hh +++ b/server/modules/filter/masking/maskingfilter.hh @@ -39,7 +39,10 @@ public: void reload(DCB* pOut); - const Config& config() const { return m_config; } + const Config& config() const + { + return m_config; + } SMaskingRules rules() const; private: diff --git a/server/modules/filter/masking/maskingfilterconfig.hh b/server/modules/filter/masking/maskingfilterconfig.hh index fe0999ce0..dc97ee192 100644 --- a/server/modules/filter/masking/maskingfilterconfig.hh +++ b/server/modules/filter/masking/maskingfilterconfig.hh @@ -38,12 +38,27 @@ public: {} ~MaskingFilterConfig() {} - const std::string& name() const { return m_name; } - const std::string& rules_file() const { return m_rules_file; } - warn_type_mismatch_t warn_type_mismatch() const { return m_warn_type_mismatch; } + const std::string& name() const + { + return m_name; + } + const std::string& rules_file() const + { + return m_rules_file; + } + warn_type_mismatch_t warn_type_mismatch() const + { + return m_warn_type_mismatch; + } - void set_rules_file(const std::string& s) { m_rules_file = s; } - void set_warn_type_mismatch(warn_type_mismatch_t w) { m_warn_type_mismatch = w; } + void set_rules_file(const std::string& s) + { + m_rules_file = s; + } + void set_warn_type_mismatch(warn_type_mismatch_t w) + { + m_warn_type_mismatch = w; + } static warn_type_mismatch_t get_warn_type_mismatch(const CONFIG_PARAMETER* pParams); diff --git a/server/modules/filter/masking/maskingfiltersession.cc b/server/modules/filter/masking/maskingfiltersession.cc index 45b5195a6..662d8e322 100644 --- a/server/modules/filter/masking/maskingfiltersession.cc +++ b/server/modules/filter/masking/maskingfiltersession.cc @@ -111,7 +111,7 @@ void MaskingFilterSession::handle_response(GWBUF* pPacket) switch (response.type()) { case ComPacket::OK_PACKET: // OK - // We'll end up here also in the case of a multi-result. + // We'll end up here also in the case of a multi-result. case 0xfb: // GET_MORE_CLIENT_DATA/SEND_MORE_CLIENT_DATA m_state = EXPECTING_NOTHING; break; diff --git a/server/modules/filter/masking/maskingfiltersession.hh b/server/modules/filter/masking/maskingfiltersession.hh index 710dcc048..6e953c1ff 100644 --- a/server/modules/filter/masking/maskingfiltersession.hh +++ b/server/modules/filter/masking/maskingfiltersession.hh @@ -97,11 +97,20 @@ private: return m_sRules; } - bool is_multi_result() const { return m_multi_result; } + bool is_multi_result() const + { + return m_multi_result; + } - uint32_t total_fields() const { return m_nTotal_fields; } + uint32_t total_fields() const + { + return m_nTotal_fields; + } - void set_total_fields(uint32_t n) { m_nTotal_fields = n; } + void set_total_fields(uint32_t n) + { + m_nTotal_fields = n; + } bool append_type_and_rule(enum_field_types type, const MaskingRules::Rule* pRule) { diff --git a/server/modules/filter/masking/maskingrules.hh b/server/modules/filter/masking/maskingrules.hh index 80e695718..870f39310 100644 --- a/server/modules/filter/masking/maskingrules.hh +++ b/server/modules/filter/masking/maskingrules.hh @@ -90,13 +90,34 @@ public: std::string match() const; - const std::string& column() const { return m_column; } - const std::string& table() const { return m_table; } - const std::string& database() const { return m_database; } - const std::string& value() const { return m_value; } - const std::string& fill() const { return m_fill; } - const std::vector& applies_to() const { return m_applies_to; } - const std::vector& exempted() const { return m_exempted; } + const std::string& column() const + { + return m_column; + } + const std::string& table() const + { + return m_table; + } + const std::string& database() const + { + return m_database; + } + const std::string& value() const + { + return m_value; + } + const std::string& fill() const + { + return m_fill; + } + const std::vector& applies_to() const + { + return m_applies_to; + } + const std::vector& exempted() const + { + return m_exempted; + } /** * Create a Rule instance diff --git a/server/modules/filter/masking/mysql.hh b/server/modules/filter/masking/mysql.hh index e6131bab1..72c9b7340 100644 --- a/server/modules/filter/masking/mysql.hh +++ b/server/modules/filter/masking/mysql.hh @@ -116,10 +116,10 @@ public: * A _random access iterator_ to a @c LEncString. */ class iterator : public std::iterator + char, + std::ptrdiff_t, + char*, + char&> { public: iterator(char* pS) @@ -488,8 +488,14 @@ public: ERR_PACKET = 0xff, }; - uint32_t packet_len() const { return m_packet_len; } - uint8_t packet_no() const { return m_packet_no; } + uint32_t packet_len() const + { + return m_packet_len; + } + uint8_t packet_no() const + { + return m_packet_no; + } protected: ComPacket(GWBUF* pPacket) @@ -624,7 +630,10 @@ public: ++m_pData; } - uint8_t command() const { return m_command; } + uint8_t command() const + { + return m_command; + } protected: uint8_t m_command; @@ -667,13 +676,34 @@ public: m_pData += 1; } - const LEncString& catalog() const { return m_catalog; } - const LEncString& schema() const { return m_schema; } - const LEncString& table() const { return m_table; } - const LEncString& org_table() const { return m_org_table; } - const LEncString& name() const { return m_name; } - const LEncString& org_name() const { return m_org_name; } - enum_field_types type() const { return m_type; } + const LEncString& catalog() const + { + return m_catalog; + } + const LEncString& schema() const + { + return m_schema; + } + const LEncString& table() const + { + return m_table; + } + const LEncString& org_table() const + { + return m_org_table; + } + const LEncString& name() const + { + return m_name; + } + const LEncString& org_name() const + { + return m_org_name; + } + enum_field_types type() const + { + return m_type; + } std::string to_string() const { @@ -763,9 +793,9 @@ public: case MYSQL_TYPE_VAR_STRING: return true; - // These, although returned as length-encoded strings, also in the case of - // a binary resultset row, are not are not considered to be strings from the - // perspective of masking. + // These, although returned as length-encoded strings, also in the case of + // a binary resultset row, are not are not considered to be strings from the + // perspective of masking. case MYSQL_TYPE_BIT: case MYSQL_TYPE_DECIMAL: case MYSQL_TYPE_ENUM: @@ -826,10 +856,10 @@ typedef CQRResultsetValue CQRBinaryResultsetValue; * typedef @c ComQueryResponse::TextResultset::iterator. */ class CQRTextResultsetRowIterator : public std::iterator + CQRTextResultsetValue, + std::ptrdiff_t, + CQRTextResultsetValue*, + CQRTextResultsetValue> { public: typedef CQRTextResultsetValue Value; @@ -887,10 +917,10 @@ private: * typedef @c ComQueryResponse::BinaryResultset::iterator. */ class CQRBinaryResultsetRowIterator : public std::iterator + CQRBinaryResultsetValue, + std::ptrdiff_t, + CQRBinaryResultsetValue*, + CQRBinaryResultsetValue> { public: typedef CQRBinaryResultsetValue Value; @@ -1162,7 +1192,10 @@ public: { } - uint64_t nFields() const { return m_nFields; } + uint64_t nFields() const + { + return m_nFields; + } private: LEncInt m_nFields; diff --git a/server/modules/filter/masking/test/testrules.cc b/server/modules/filter/masking/test/testrules.cc index aa2f34600..4670330e1 100644 --- a/server/modules/filter/masking/test/testrules.cc +++ b/server/modules/filter/masking/test/testrules.cc @@ -170,7 +170,7 @@ struct expected_account } }; -const size_t nExpected_accounts = (sizeof(expected_accounts)/sizeof(expected_accounts[0])); +const size_t nExpected_accounts = (sizeof(expected_accounts) / sizeof(expected_accounts[0])); class MaskingRulesTester { diff --git a/server/modules/filter/maxrows/maxrows.c b/server/modules/filter/maxrows/maxrows.c index 2f549c696..713983bff 100644 --- a/server/modules/filter/maxrows/maxrows.c +++ b/server/modules/filter/maxrows/maxrows.c @@ -96,18 +96,18 @@ MXS_MODULE* MXS_CREATE_MODULE() { { "max_resultset_rows", - MXS_MODULE_PARAM_COUNT, - MAXROWS_DEFAULT_MAX_RESULTSET_ROWS + MXS_MODULE_PARAM_COUNT, + MAXROWS_DEFAULT_MAX_RESULTSET_ROWS }, { "max_resultset_size", - MXS_MODULE_PARAM_COUNT, - MAXROWS_DEFAULT_MAX_RESULTSET_SIZE + MXS_MODULE_PARAM_COUNT, + MAXROWS_DEFAULT_MAX_RESULTSET_SIZE }, { "debug", - MXS_MODULE_PARAM_COUNT, - MAXROWS_DEFAULT_DEBUG + MXS_MODULE_PARAM_COUNT, + MAXROWS_DEFAULT_DEBUG }, {MXS_END_MODULE_PARAMS} } @@ -701,11 +701,11 @@ static int handle_rows(MAXROWS_SESSION_DATA *csdata) break; } - /* - * Check packet size against MYSQL_PACKET_LENGTH_MAX - * If true then break as received could be not complete - * EOF or OK packet could be seen after receiving the full large packet - */ + /* + * Check packet size against MYSQL_PACKET_LENGTH_MAX + * If true then break as received could be not complete + * EOF or OK packet could be seen after receiving the full large packet + */ if (packetlen == (MYSQL_PACKET_LENGTH_MAX + MYSQL_HEADER_LEN)) { // Mark the beginning of a large packet receiving @@ -906,7 +906,7 @@ static int send_upstream(MAXROWS_SESSION_DATA *csdata) static int send_ok_upstream(MAXROWS_SESSION_DATA *csdata) { /* Note: sequence id is always 01 (4th byte) */ - uint8_t ok[MAXROWS_OK_PACKET_LEN] = {07,00,00,01,00,00,00,02,00,00,00}; + uint8_t ok[MAXROWS_OK_PACKET_LEN] = {07, 00, 00, 01, 00, 00, 00, 02, 00, 00, 00}; GWBUF *packet = gwbuf_alloc(MAXROWS_OK_PACKET_LEN); uint8_t *ptr = GWBUF_DATA(packet); memcpy(ptr, &ok, MAXROWS_OK_PACKET_LEN); diff --git a/server/modules/filter/tee/tee.c b/server/modules/filter/tee/tee.c index 7babcdcd0..1495d6b61 100644 --- a/server/modules/filter/tee/tee.c +++ b/server/modules/filter/tee/tee.c @@ -340,10 +340,10 @@ MXS_MODULE* MXS_CREATE_MODULE() {"user", MXS_MODULE_PARAM_STRING}, { "options", - MXS_MODULE_PARAM_ENUM, - "ignorecase", - MXS_MODULE_OPT_NONE, - option_values + MXS_MODULE_PARAM_ENUM, + "ignorecase", + MXS_MODULE_OPT_NONE, + option_values }, {MXS_END_MODULE_PARAMS} } @@ -925,20 +925,20 @@ int reset_session_state(TEE_SESSION* my_session, GWBUF* buffer) switch (command) { - case 0x1b: - my_session->client_multistatement = *((unsigned char*) buffer->start + 5); - MXS_INFO("client %s multistatements", - my_session->client_multistatement ? "enabled" : "disabled"); - case 0x03: - case 0x16: - case 0x17: - case 0x04: - case 0x0a: - memset(my_session->multipacket, (char) true, 2 * sizeof(bool)); - break; - default: - memset(my_session->multipacket, (char) false, 2 * sizeof(bool)); - break; + case 0x1b: + my_session->client_multistatement = *((unsigned char*) buffer->start + 5); + MXS_INFO("client %s multistatements", + my_session->client_multistatement ? "enabled" : "disabled"); + case 0x03: + case 0x16: + case 0x17: + case 0x04: + case 0x0a: + memset(my_session->multipacket, (char) true, 2 * sizeof(bool)); + break; + default: + memset(my_session->multipacket, (char) false, 2 * sizeof(bool)); + break; } memset(my_session->replies, 0, 2 * sizeof(int)); diff --git a/server/modules/filter/testfilter/testfilter.c b/server/modules/filter/testfilter/testfilter.c index dc4f43c03..ff028ac30 100644 --- a/server/modules/filter/testfilter/testfilter.c +++ b/server/modules/filter/testfilter/testfilter.c @@ -173,7 +173,6 @@ static void freeSession(MXS_FILTER *instance, MXS_FILTER_SESSION *session) { MXS_FREE(session); - return; } /** diff --git a/server/modules/filter/topfilter/topfilter.c b/server/modules/filter/topfilter/topfilter.c index e618cf3e4..1c74310d3 100644 --- a/server/modules/filter/topfilter/topfilter.c +++ b/server/modules/filter/topfilter/topfilter.c @@ -171,10 +171,10 @@ MXS_MODULE* MXS_CREATE_MODULE() {"user", MXS_MODULE_PARAM_STRING}, { "options", - MXS_MODULE_PARAM_ENUM, - "ignorecase", - MXS_MODULE_OPT_NONE, - option_values + MXS_MODULE_PARAM_ENUM, + "ignorecase", + MXS_MODULE_OPT_NONE, + option_values }, {MXS_END_MODULE_PARAMS} } diff --git a/server/modules/filter/tpmfilter/tpmfilter.c b/server/modules/filter/tpmfilter/tpmfilter.c index 223982f6e..958611654 100644 --- a/server/modules/filter/tpmfilter/tpmfilter.c +++ b/server/modules/filter/tpmfilter/tpmfilter.c @@ -283,7 +283,7 @@ createInstance(const char *name, char **options, CONFIG_PARAMETER *params) } } - return(MXS_FILTER *)my_instance; + return (MXS_FILTER *)my_instance; } /**