diff --git a/src/dsql/DdlNodes.epp b/src/dsql/DdlNodes.epp index 38b916f89b..19436020f8 100644 --- a/src/dsql/DdlNodes.epp +++ b/src/dsql/DdlNodes.epp @@ -3164,9 +3164,8 @@ bool CreateAlterTriggerNode::checkPermission(thread_db* tdbb, jrd_tra* transacti SCL_check_relation(tdbb, &dscName, SCL_alter); } else - { SCL_check_database(tdbb, SCL_alter); - } + return true; } @@ -3355,9 +3354,7 @@ bool DropTriggerNode::checkPermission(thread_db* tdbb, jrd_tra* transaction) END_FOR if (relationName.isEmpty()) - { SCL_check_database(tdbb, SCL_alter); - } else { dsc dscName; diff --git a/src/dsql/parse.y b/src/dsql/parse.y index ae98038a48..14c46fc559 100644 --- a/src/dsql/parse.y +++ b/src/dsql/parse.y @@ -936,7 +936,7 @@ ddl_privileges($privilegeArray) ; privileges_opt - : + : // nothing | PRIVILEGES ; diff --git a/src/gpre/std/gpre_meta.epp b/src/gpre/std/gpre_meta.epp index 2031dcb63e..cfa41f22fd 100644 --- a/src/gpre/std/gpre_meta.epp +++ b/src/gpre/std/gpre_meta.epp @@ -1409,7 +1409,8 @@ void MET_load_hash_table(gpre_dbb* database) p = FUN.RDB$QUERY_NAME; p[length] = 0; } - gpre_sym* symbol = an_udf->udf_symbol = MSC_symbol(SYM_udf, p, static_cast(strlen(p)), (gpre_ctx*) an_udf); + gpre_sym* symbol = an_udf->udf_symbol = MSC_symbol(SYM_udf, + p, static_cast(strlen(p)), (gpre_ctx*) an_udf); HSH_insert(symbol); an_udf->udf_length = ARG.RDB$FIELD_LENGTH; @@ -1637,7 +1638,8 @@ gpre_fld* MET_make_field(const SCHAR* name, SSHORT dtype, SSHORT length, bool in gpre_index* MET_make_index(const SCHAR* name) { gpre_index* index = (gpre_index*) MSC_alloc(IND_LEN); - index->ind_symbol = MSC_symbol(SYM_index, name, static_cast(strlen(name)), (gpre_ctx*) index); + index->ind_symbol = MSC_symbol(SYM_index, + name, static_cast(strlen(name)), (gpre_ctx*) index); return index; } @@ -1651,7 +1653,8 @@ gpre_index* MET_make_index(const SCHAR* name) gpre_rel* MET_make_relation(const SCHAR* name) { gpre_rel* relation = (gpre_rel*) MSC_alloc(REL_LEN); - relation->rel_symbol = MSC_symbol(SYM_relation, name, static_cast(strlen(name)), (gpre_ctx*) relation); + relation->rel_symbol = MSC_symbol(SYM_relation, + name, static_cast(strlen(name)), (gpre_ctx*) relation); return relation; } @@ -1697,7 +1700,8 @@ bool MET_type(gpre_fld* field, const TEXT* string, SSHORT* ptr) field_type* type = (field_type*) MSC_alloc(TYP_LEN); type->typ_field = field; *ptr = type->typ_value = X.RDB$TYPE; - type->typ_symbol = symbol = MSC_symbol(SYM_type, string, static_cast(strlen(string)), (gpre_ctx*) type); + type->typ_symbol = symbol = MSC_symbol(SYM_type, + string, static_cast(strlen(string)), (gpre_ctx*) type); HSH_insert(symbol); return true; END_FOR diff --git a/src/isql/isql.epp b/src/isql/isql.epp index 9e95f6b1c0..065116a8c7 100644 --- a/src/isql/isql.epp +++ b/src/isql/isql.epp @@ -7418,7 +7418,8 @@ static unsigned print_item(TEXT** s, const IsqlVar* var, const unsigned length) else { IcuUtil::pad(p, var->charSet, - static_cast(strnlen(var->value.asChar, var->length)), var->value.asChar, length, false); + static_cast(strnlen(var->value.asChar, var->length)), + var->value.asChar, length, false); strcat(p, " "); } break; @@ -7939,7 +7940,8 @@ static void process_header(Firebird::IMessageMetadata* msg, const unsigned pad[] p += strlen(p); // Separators need not go on forever no more than a line - unsigned limit = IcuUtil::charLength(isqlGlob.att_charset, static_cast(strlen(var.alias)), var.alias); + unsigned limit = IcuUtil::charLength( + isqlGlob.att_charset, static_cast(strlen(var.alias)), var.alias); limit = MAX(limit, pad[i]) + 1; for (unsigned j = 1; j < limit && j < 80; j++) @@ -8133,7 +8135,8 @@ static unsigned process_message_display(Firebird::IMessageMetadata* message, uns unsigned data_length, disp_length, alignment; data_length = disp_length = alignment = var.length; - unsigned namelength = IcuUtil::charLength(isqlGlob.att_charset, static_cast(strlen(var.alias)), var.alias); + unsigned namelength = IcuUtil::charLength(isqlGlob.att_charset, + static_cast(strlen(var.alias)), var.alias); // Minimum display length should not be less than that needed // for displaying null diff --git a/src/jrd/Attachment.cpp b/src/jrd/Attachment.cpp index d3a32a4f93..0d62b8fa5e 100644 --- a/src/jrd/Attachment.cpp +++ b/src/jrd/Attachment.cpp @@ -283,8 +283,11 @@ string Jrd::Attachment::stringToMetaCharSet(thread_db* tdbb, const string& str, if (charSet) { - if (!MET_get_char_coll_subtype(tdbb, &charSetId, (const UCHAR*) charSet, static_cast(strlen(charSet)))) + if (!MET_get_char_coll_subtype(tdbb, &charSetId, (const UCHAR*) charSet, + static_cast(strlen(charSet)))) + { (Arg::Gds(isc_charset_not_found) << Arg::Str(charSet)).raise(); + } } if (charSetId == CS_METADATA || charSetId == CS_NONE) diff --git a/src/jrd/Mapping.cpp b/src/jrd/Mapping.cpp index 9878cd71e4..d1f269a24d 100644 --- a/src/jrd/Mapping.cpp +++ b/src/jrd/Mapping.cpp @@ -1095,7 +1095,8 @@ void mapUser(string& name, string& trusted_role, Firebird::string* auth_method, { newAuthBlock->shrink(0); newAuthBlock->push(newBlock.getBuffer(), newBlock.getBufferLength()); - MAP_DEBUG(fprintf(stderr, "Saved to newAuthBlock %u bytes\n", static_cast(newAuthBlock->getCount()))); + MAP_DEBUG(fprintf(stderr, "Saved to newAuthBlock %u bytes\n", + static_cast(newAuthBlock->getCount()))); } } diff --git a/src/jrd/RecordSourceNodes.h b/src/jrd/RecordSourceNodes.h index 97edfc1bc6..55d3db9e7e 100644 --- a/src/jrd/RecordSourceNodes.h +++ b/src/jrd/RecordSourceNodes.h @@ -491,8 +491,8 @@ public: virtual RecordSource* compile(thread_db* tdbb, OptimizerBlk* opt, bool innerSubStream); private: - RecordSource* generate(thread_db* tdbb, OptimizerBlk* opt, const StreamType* streams, FB_SIZE_T nstreams, - BoolExprNodeStack* parentStack, StreamType shellStream); + RecordSource* generate(thread_db* tdbb, OptimizerBlk* opt, const StreamType* streams, + FB_SIZE_T nstreams, BoolExprNodeStack* parentStack, StreamType shellStream); public: bool dsqlAll; // UNION ALL diff --git a/src/jrd/SysFunction.cpp b/src/jrd/SysFunction.cpp index 551660cd39..5e8eab860a 100644 --- a/src/jrd/SysFunction.cpp +++ b/src/jrd/SysFunction.cpp @@ -776,8 +776,8 @@ void makeLeftRight(DataTypeUtilBase* dataTypeUtil, const SysFunction* function, result->setTextType(value->getTextType()); result->setNullable(value->isNullable() || length->isNullable()); - result->dsc_length = - dataTypeUtil->fixLength(result, dataTypeUtil->convertLength(value, result)) + static_cast(sizeof(USHORT)); + result->dsc_length = dataTypeUtil->fixLength(result, + dataTypeUtil->convertLength(value, result)) + static_cast(sizeof(USHORT)); } } @@ -890,7 +890,10 @@ void makePad(DataTypeUtilBase* dataTypeUtil, const SysFunction* function, dsc* r dataTypeUtil->maxBytesPerChar(result->getCharSet())); } else - result->dsc_length = static_cast(sizeof(USHORT)) + dataTypeUtil->fixLength(result, MAX_COLUMN_SIZE); + { + result->dsc_length = static_cast(sizeof(USHORT)) + + dataTypeUtil->fixLength(result, MAX_COLUMN_SIZE); + } } result->setNullable(isNullable); @@ -948,8 +951,9 @@ void makeReplace(DataTypeUtilBase* dataTypeUtil, const SysFunction* function, ds result->dsc_length = dataTypeUtil->fixLength(result, searchedLen) + static_cast(sizeof(USHORT)); else { - result->dsc_length = dataTypeUtil->fixLength(result, MAX(searchedLen, - searchedLen + (searchedLen / findLen) * (replacementLen - findLen))) + static_cast(sizeof(USHORT)); + result->dsc_length = dataTypeUtil->fixLength(result, + MAX(searchedLen, searchedLen + (searchedLen / findLen) * (replacementLen - findLen))) + + static_cast(sizeof(USHORT)); } } diff --git a/src/jrd/blb.h b/src/jrd/blb.h index 8cabbcb86f..b4cf9df420 100644 --- a/src/jrd/blb.h +++ b/src/jrd/blb.h @@ -129,7 +129,7 @@ private: void insert_page(thread_db*); void destroy(const bool purge_flag); - FB_SIZE_T blb_temp_size; // size stored in transaction temp space + FB_SIZE_T blb_temp_size; // size stored in transaction temp space offset_t blb_temp_offset; // offset in transaction temp space Attachment* blb_attachment; // database attachment jrd_tra* blb_transaction; // Parent transaction block diff --git a/src/jrd/cch.cpp b/src/jrd/cch.cpp index a231e3f1f8..62d6303052 100644 --- a/src/jrd/cch.cpp +++ b/src/jrd/cch.cpp @@ -198,7 +198,7 @@ const ULONG MIN_BUFFER_SEGMENT = 65536; // Given pointer a field in the block, find the block -#define BLOCK(fld_ptr, type, fld) (type*)((SCHAR*) fld_ptr - offsetof (type, fld)) +#define BLOCK(fld_ptr, type, fld) (type*)((SCHAR*) fld_ptr - offsetof(type, fld)) const PageNumber FREE_PAGE(DB_PAGE_SPACE, -1); @@ -4329,9 +4329,12 @@ static ULONG memory_init(thread_db* tdbb, BufferControl* bcb, SLONG number) QUE_INIT(tail->bcb_page_mod); - try { + try + { tail->bcb_bdb = alloc_bdb(tdbb, bcb, &memory); - } catch (Firebird::BadAlloc&) { + } + catch (Firebird::BadAlloc&) + { // Whoops! Time to reset our expectations. Release the buffer memory // but use that memory size to calculate a new number that takes into account // the page buffer overhead. Reduce this number by a 25% fudge factor to diff --git a/src/jrd/dfw.epp b/src/jrd/dfw.epp index dd8248af19..898a0954b5 100644 --- a/src/jrd/dfw.epp +++ b/src/jrd/dfw.epp @@ -5228,8 +5228,8 @@ static bool make_version(thread_db* tdbb, SSHORT phase, DeferredWork* work, jrd_ if (notNull) { dsc desc; - desc.makeText(static_cast(strlen(REL.RDB$RELATION_NAME)), CS_METADATA, - (UCHAR*) REL.RDB$RELATION_NAME); + desc.makeText(static_cast(strlen(REL.RDB$RELATION_NAME)), + CS_METADATA, (UCHAR*) REL.RDB$RELATION_NAME); DeferredWork* work = DFW_post_work(transaction, dfw_check_not_null, &desc, 0); diff --git a/src/jrd/dyn_util.epp b/src/jrd/dyn_util.epp index a9d35708b7..56d98d4b09 100644 --- a/src/jrd/dyn_util.epp +++ b/src/jrd/dyn_util.epp @@ -207,7 +207,8 @@ SINT64 DYN_UTIL_gen_unique_id(thread_db* tdbb, SSHORT id, const char* generator_ { const FB_SIZE_T name_length = fb_strlen(generator_name); fb_assert(name_length < MAX_SQL_IDENTIFIER_SIZE); - const FB_SIZE_T blr_size = static_cast(sizeof(gen_id_blr1) + sizeof(gen_id_blr2)) + 1 + name_length; + const FB_SIZE_T blr_size = static_cast( + sizeof(gen_id_blr1) + sizeof(gen_id_blr2)) + 1 + name_length; Firebird::UCharBuffer blr; UCHAR* p = blr.getBuffer(blr_size); diff --git a/src/jrd/evl_string.h b/src/jrd/evl_string.h index bcb3a149c7..cedb61bc22 100644 --- a/src/jrd/evl_string.h +++ b/src/jrd/evl_string.h @@ -487,9 +487,9 @@ bool LikeEvaluator::processNextChunk(const CharType* data, SLONG data_ SLONG data_pos = 0; SLONG finishCandidate = -1; + while (data_pos < data_len) { - FB_SIZE_T branch_number = 0; while (branch_number < branches.getCount()) { diff --git a/src/jrd/ods.cpp b/src/jrd/ods.cpp index f293d87b72..3c02a266e5 100644 --- a/src/jrd/ods.cpp +++ b/src/jrd/ods.cpp @@ -112,8 +112,8 @@ ULONG maxRecsPerDP(ULONG page_size) // size of the record index (dpb_repeat) and a record header. This // gives an artificially high number, reducing the density of db_keys. - ULONG max_records = - static_cast((page_size - sizeof(data_page)) / (sizeof(data_page::dpg_repeat) + offsetof(rhd, rhd_data[0]))); + ULONG max_records = static_cast( + (page_size - sizeof(data_page)) / (sizeof(data_page::dpg_repeat) + offsetof(rhd, rhd_data[0]))); // Artificially reduce density of records to test high bits of record number // max_records = 32000; diff --git a/src/jrd/par_proto.h b/src/jrd/par_proto.h index 97a471bf13..bf903c0efb 100644 --- a/src/jrd/par_proto.h +++ b/src/jrd/par_proto.h @@ -62,7 +62,7 @@ Jrd::ValueExprNode* PAR_gen_field(Jrd::thread_db* tdbb, StreamType stream, USHOR Jrd::ValueExprNode* PAR_make_field(Jrd::thread_db*, Jrd::CompilerScratch*, USHORT, const Firebird::MetaName&); Jrd::CompoundStmtNode* PAR_make_list(Jrd::thread_db*, Jrd::StmtNodeStack&); USHORT PAR_name(Jrd::CompilerScratch*, Firebird::MetaName&); -FB_SIZE_T PAR_name(Jrd::CompilerScratch* csb, Firebird::string& name); +FB_SIZE_T PAR_name(Jrd::CompilerScratch* csb, Firebird::string& name); Jrd::CompilerScratch* PAR_parse(Jrd::thread_db*, const UCHAR* blr, ULONG blr_length, bool internal_flag, ULONG = 0, const UCHAR* = NULL); diff --git a/src/jrd/status.cpp b/src/jrd/status.cpp index b1d4e9fbf6..8262014f59 100644 --- a/src/jrd/status.cpp +++ b/src/jrd/status.cpp @@ -44,7 +44,7 @@ * type. So check for 17 or less */ -void PARSE_STATUS(const ISC_STATUS* status_vector, FB_SIZE_T&length, FB_SIZE_T& warning) +void PARSE_STATUS(const ISC_STATUS* status_vector, FB_SIZE_T& length, FB_SIZE_T& warning) { warning = 0; length = 0;