diff --git a/doc/sql.extensions/README.merge.txt b/doc/sql.extensions/README.merge.txt index 10b066b270..18e0b976fb 100644 --- a/doc/sql.extensions/README.merge.txt +++ b/doc/sql.extensions/README.merge.txt @@ -32,7 +32,7 @@ MERGE statement VALUES Syntax rules: - 1. At least one of and should be specified. + 1. At least one of or should be specified. Scope: DSQL, PSQL diff --git a/src/auth/AuthDbg.cpp b/src/auth/AuthDbg.cpp index 58b9ece69c..0f62d0aa7d 100644 --- a/src/auth/AuthDbg.cpp +++ b/src/auth/AuthDbg.cpp @@ -65,21 +65,21 @@ Result FB_CARG DebugServer::startAuthentication(Firebird::IStatus* status, const str.erase(); #ifdef AUTH_VERBOSE - fprintf(stderr, "DebugServerInstance::startAuthentication: tA-tag=%d dpb=%p\n", tags->trustedAuth, dpb); + fprintf(stderr, "DebugServer::startAuthentication: tA-tag=%d dpb=%p\n", tags->trustedAuth, dpb); #endif if (tags->trustedAuth && dpb && dpb->find(tags->trustedAuth)) { unsigned int len; const UCHAR* s = dpb->get(&len); #ifdef AUTH_VERBOSE - fprintf(stderr, "DebugServerInstance::startAuthentication: get()=%.*s\n", len, s); + fprintf(stderr, "DebugServer::startAuthentication: get()=%.*s\n", len, s); #endif str.assign(s, len); } str += '_'; #ifdef AUTH_VERBOSE - fprintf(stderr, "DebugServerInstance::startAuthentication: %s\n", str.c_str()); + fprintf(stderr, "DebugServer::startAuthentication: %s\n", str.c_str()); #endif return AUTH_MORE_DATA; } @@ -96,7 +96,7 @@ Result FB_CARG DebugServer::contAuthentication(Firebird::IStatus* status, const try { #ifdef AUTH_VERBOSE - fprintf(stderr, "DebugServerInstance::contAuthentication: %.*s\n", size, data); + fprintf(stderr, "DebugServer::contAuthentication: %.*s\n", size, data); #endif Firebird::MasterInterfacePtr()->upgradeInterface(writerInterface, FB_AUTH_WRITER_VERSION, upInfo); writerInterface->add(Firebird::string((const char*) data, size).c_str()); @@ -114,7 +114,7 @@ void FB_CARG DebugServer::getData(const unsigned char** data, unsigned short* da *data = reinterpret_cast(str.c_str()); *dataSize = str.length(); #ifdef AUTH_VERBOSE - fprintf(stderr, "DebugServerInstance::getData: %.*s\n", *dataSize, *data); + fprintf(stderr, "DebugServer::getData: %.*s\n", *dataSize, *data); #endif } @@ -139,14 +139,14 @@ Result FB_CARG DebugClient::startAuthentication(Firebird::IStatus* status, const { str = "HAND"; #ifdef AUTH_VERBOSE - fprintf(stderr, "DebugClientInstance::startAuthentication: %s\n", str.c_str()); + fprintf(stderr, "DebugClient::startAuthentication: %s\n", str.c_str()); #endif if (dpb && tags->trustedAuth) { Firebird::MasterInterfacePtr()->upgradeInterface(dpb, FB_AUTH_CLUMPLETS_VERSION, upInfo); dpb->add(tags->trustedAuth, str.c_str(), str.length()); #ifdef AUTH_VERBOSE - fprintf(stderr, "DebugClientInstance::startAuthentication: DPB filled\n"); + fprintf(stderr, "DebugClient::startAuthentication: DPB filled\n"); #endif return AUTH_SUCCESS; } @@ -164,7 +164,7 @@ Result FB_CARG DebugClient::contAuthentication(Firebird::IStatus* status, const try { #ifdef AUTH_VERBOSE - fprintf(stderr, "DebugClientInstance::contAuthentication: %.*s\n", size, data); + fprintf(stderr, "DebugClient::contAuthentication: %.*s\n", size, data); #endif str.assign(data, size); const char* env = getenv("ISC_DEBUG_AUTH"); @@ -186,7 +186,7 @@ void FB_CARG DebugClient::getData(const unsigned char** data, unsigned short* da *data = reinterpret_cast(str.c_str()); *dataSize = str.length(); #ifdef AUTH_VERBOSE - fprintf(stderr, "DebugClientInstance::getData: %.*s\n", *dataSize, *data); + fprintf(stderr, "DebugClient::getData: %.*s\n", *dataSize, *data); #endif } diff --git a/src/common/cvt.cpp b/src/common/cvt.cpp index 46dd965a38..bddd0dac12 100644 --- a/src/common/cvt.cpp +++ b/src/common/cvt.cpp @@ -1741,7 +1741,7 @@ void CVT_conversion_error(const dsc* desc, ErrorFunction err) * A data conversion error occurred. Complain. * **************************************/ - Firebird::string message; + string message; if (desc->dsc_dtype == dtype_blob) message = "BLOB"; diff --git a/src/common/isc_sync.cpp b/src/common/isc_sync.cpp index 6b27587e68..3566ed920b 100644 --- a/src/common/isc_sync.cpp +++ b/src/common/isc_sync.cpp @@ -534,30 +534,35 @@ namespace { #ifdef DEB_EVNT struct AbsPtr { - SLONG offset; - int fn; - bool bad() - { - return offset < 0 || fn < 0; - } AbsPtr() : offset(-1), fn(-1) { } + bool operator==(const AbsPtr& sec) const { return offset == sec.offset && fn == sec.fn; } + + bool bad() + { + return offset < 0 || fn < 0; + } + + SLONG offset; + int fn; }; static AbsPtr absPtr(const void* s) { const int n = getByAddress((UCHAR*) s); AbsPtr rc; + if (n >= 0) { - rc.offset = (IPTR)s - (IPTR)(sharedFiles[n].from); + rc.offset = (IPTR) s - (IPTR) (sharedFiles[n].from); rc.fn = sharedFiles[n].fileNum; } + return rc; } #endif // DEB_EVNT @@ -726,6 +731,7 @@ namespace { } state; int code; }; + GlobalPtr > dump; GlobalPtr dMutex; diff --git a/src/common/os/posix/isc_ipc.cpp b/src/common/os/posix/isc_ipc.cpp index 3a9a55ca9d..330654a69d 100644 --- a/src/common/os/posix/isc_ipc.cpp +++ b/src/common/os/posix/isc_ipc.cpp @@ -149,7 +149,7 @@ extern "C" { #endif #ifdef SA_SIGINFO -static void CLIB_ROUTINE signal_action(int number, siginfo_t *siginfo, void *context); +static void CLIB_ROUTINE signal_action(int number, siginfo_t* siginfo, void* context); #else static void CLIB_ROUTINE signal_action(int number); #endif @@ -346,7 +346,7 @@ static SIG que_signal(int signal_number, #ifdef SA_SIGINFO -static void CLIB_ROUTINE signal_action(int number, siginfo_t *siginfo, void *context) +static void CLIB_ROUTINE signal_action(int number, siginfo_t* siginfo, void* context) #else static void CLIB_ROUTINE signal_action(int number) #endif diff --git a/src/common/unicode_util.cpp b/src/common/unicode_util.cpp index c7ae50e0c1..1abf0a642c 100644 --- a/src/common/unicode_util.cpp +++ b/src/common/unicode_util.cpp @@ -1031,6 +1031,7 @@ UnicodeUtil::ConversionICU& UnicodeUtil::getConversionICU() LocalStatus lastError; string version; const int majorArray[] = {4, 3, 5, 6, 0}; + for (const int* major = majorArray; *major; ++major) { for (int minor = 20; minor--; ) // from 19 down to 0 @@ -1054,9 +1055,7 @@ UnicodeUtil::ConversionICU& UnicodeUtil::getConversionICU() << Arg::StatusVector(lastError.get())).raise(); } else - { (Arg::Gds(isc_random) << "Could not find acceptable ICU library").raise(); - } // compiler warning silencer return *convIcu; diff --git a/src/dbs/metadata.sql b/src/dbs/metadata.sql index 0464af0b7b..15d08a1468 100644 --- a/src/dbs/metadata.sql +++ b/src/dbs/metadata.sql @@ -32,4 +32,3 @@ CREATE TABLE QLI$PROCEDURES (QLI$PROCEDURE_NAME QLI$PROCEDURE_NAME, /* Index definitions for all user tables */ CREATE UNIQUE INDEX QLI$PROCEDURES_IDX1 ON QLI$PROCEDURES(QLI$PROCEDURE_NAME); - diff --git a/src/dsql/StmtNodes.cpp b/src/dsql/StmtNodes.cpp index 3eb55fb375..48826a1689 100644 --- a/src/dsql/StmtNodes.cpp +++ b/src/dsql/StmtNodes.cpp @@ -218,7 +218,6 @@ namespace dsql_ctx* oldContext; string oldAlias, oldInternalAlias; AutoSetRestore autoFlags; - bool hasModContext; }; } // namespace diff --git a/src/jrd/btr.cpp b/src/jrd/btr.cpp index 57a7e863f3..db9f037b92 100644 --- a/src/jrd/btr.cpp +++ b/src/jrd/btr.cpp @@ -2376,9 +2376,9 @@ static void compress(thread_db* tdbb, UCHAR* ptr; size_t length; - if (isNull) { + + if (isNull) length = 0; - } else if (itype >= idx_first_intl_string || itype == idx_metadata) { DSC to; @@ -2394,24 +2394,23 @@ static void compress(thread_db* tdbb, length = INTL_string_to_key(tdbb, itype, desc, &to, key_type); } else - { length = MOV_get_string(desc, &ptr, &buffer, MAX_KEY); - } if (length) { // clear key_empty flag, because length is >= 1 key->key_flags &= ~key_empty; - if (length > sizeof(key->key_data)) { + + if (length > sizeof(key->key_data)) length = sizeof(key->key_data); - } + if (descending && ((*ptr == desc_end_value_prefix) || (*ptr == desc_end_value_check))) { *p++ = desc_end_value_prefix; - if ((length + 1) > sizeof(key->key_data)) { + if ((length + 1) > sizeof(key->key_data)) length = sizeof(key->key_data) - 1; - } } + memcpy(p, ptr, length); p += length; } @@ -2419,19 +2418,18 @@ static void compress(thread_db* tdbb, { // Leave key_empty flag, because the string is an empty string if (descending && ((pad == desc_end_value_prefix) || (pad == desc_end_value_check))) - { *p++ = desc_end_value_prefix; - } + *p++ = pad; } + while (p > key->key_data) { - if (*--p != pad) { + if (*--p != pad) break; - } } - key->key_length = p + 1 - key->key_data; + key->key_length = p + 1 - key->key_data; return; } diff --git a/src/jrd/shut.cpp b/src/jrd/shut.cpp index 6c2a73aadc..3142a4d4f2 100644 --- a/src/jrd/shut.cpp +++ b/src/jrd/shut.cpp @@ -244,7 +244,8 @@ void SHUT_database(thread_db* tdbb, SSHORT flag, SSHORT delay) } } - if (!exclusive && !successful && (timeout > 0 || flag & (isc_dpb_shut_attachment | isc_dpb_shut_transaction))) + if (!exclusive && !successful && + (timeout > 0 || flag & (isc_dpb_shut_attachment | isc_dpb_shut_transaction))) { notify_shutdown(tdbb, 0, -1); // Tell everyone we're giving up attachment->att_flags &= ~ATT_shutdown_manager; diff --git a/src/jrd/trace/TraceConfigStorage.cpp b/src/jrd/trace/TraceConfigStorage.cpp index 2a82bb99ac..2cb7532139 100644 --- a/src/jrd/trace/TraceConfigStorage.cpp +++ b/src/jrd/trace/TraceConfigStorage.cpp @@ -306,9 +306,7 @@ void ConfigStorage::acquire() void ConfigStorage::release() { fb_assert(m_recursive > 0); - - const FB_THREAD_ID currTID = getThreadId(); - fb_assert(m_mutexTID == currTID); + fb_assert(m_mutexTID == getThreadId()); if (--m_recursive == 0) { diff --git a/src/jrd/trace/TraceConfigStorage.h b/src/jrd/trace/TraceConfigStorage.h index e4427fc16c..95a4ea16fe 100644 --- a/src/jrd/trace/TraceConfigStorage.h +++ b/src/jrd/trace/TraceConfigStorage.h @@ -116,9 +116,9 @@ private: void putItem(ITEM tag, ULONG len, const void* data); bool getItemLength(ITEM& tag, ULONG& len); - int m_recursive; + int m_recursive; FB_THREAD_ID m_mutexTID; - int m_cfg_file; + int m_cfg_file; bool m_dirty; }; diff --git a/src/jrd/vio.cpp b/src/jrd/vio.cpp index 1799a147b5..288d84f182 100644 --- a/src/jrd/vio.cpp +++ b/src/jrd/vio.cpp @@ -4264,7 +4264,8 @@ static THREAD_ENTRY_DECLARE garbage_collector(THREAD_ENTRY_PARAM arg) jrd_rel* relation = NULL; jrd_tra* transaction = NULL; - AutoPtr gc(FB_NEW(*attachment->att_pool) GarbageCollector(*attachment->att_pool, dbb)); + AutoPtr gc(FB_NEW(*attachment->att_pool) GarbageCollector( + *attachment->att_pool, dbb)); try { diff --git a/src/lock/lock.cpp b/src/lock/lock.cpp index 02190e9ae7..4971e80803 100644 --- a/src/lock/lock.cpp +++ b/src/lock/lock.cpp @@ -2307,7 +2307,8 @@ SRQ_PTR LockManager::grant_or_que(Attachment* attachment, lrq* request, lbl* loc } -bool LockManager::init_owner_block(Arg::StatusVector& statusVector, own* owner, UCHAR owner_type, LOCK_OWNER_T owner_id) +bool LockManager::init_owner_block(Arg::StatusVector& statusVector, own* owner, UCHAR owner_type, + LOCK_OWNER_T owner_id) { /************************************** * diff --git a/src/remote/client/interface.cpp b/src/remote/client/interface.cpp index e7a5ef3170..35053186fc 100644 --- a/src/remote/client/interface.cpp +++ b/src/remote/client/interface.cpp @@ -592,8 +592,7 @@ static Rvnt* find_event(rem_port*, SLONG); static bool get_new_dpb(ClumpletWriter&, const ParametersSet&); static void handle_error(ISC_STATUS); static void info(IStatus*, Rdb*, P_OP, USHORT, USHORT, USHORT, - const UCHAR*, USHORT, const UCHAR*, ULONG, UCHAR*, - AuthClientPlugins* authItr = NULL); + const UCHAR*, USHORT, const UCHAR*, ULONG, UCHAR*, AuthClientPlugins* authItr = NULL); static void init(IStatus*, rem_port*, P_OP, PathName&, ClumpletWriter&); static Rtr* make_transaction(Rdb*, USHORT); static void mov_dsql_message(const UCHAR*, const rem_fmt*, UCHAR*, const rem_fmt*); @@ -620,16 +619,10 @@ static void svcstart(IStatus*, Rdb*, P_OP, USHORT, USHORT, USHORT, const UCHAR*) static void unsupported(); static void zap_packet(PACKET *); -static void authFillParametersBlock(AuthClientPlugins& authItr, - ClumpletWriter& dpb, - const Auth::AuthTags* tags, - rem_port* port); -static void authReceiveResponse(AuthClientPlugins& authItr, - rem_port* port, - Rdb* rdb, - const Auth::AuthTags* tags, - IStatus* status, - PACKET* packet); +static void authFillParametersBlock(AuthClientPlugins& authItr, ClumpletWriter& dpb, + const Auth::AuthTags* tags, rem_port* port); +static void authReceiveResponse(AuthClientPlugins& authItr, rem_port* port, Rdb* rdb, + const Auth::AuthTags* tags, IStatus* status, PACKET* packet); static AtomicCounter remote_event_id; @@ -5843,10 +5836,8 @@ static void info(IStatus* status, } // Let plugins try to add data to DPB in order to avoid extra network roundtrip -static void authFillParametersBlock(AuthClientPlugins& authItr, - ClumpletWriter& dpb, - const Auth::AuthTags* tags, - rem_port* port) +static void authFillParametersBlock(AuthClientPlugins& authItr, ClumpletWriter& dpb, + const Auth::AuthTags* tags, rem_port* port) { LocalStatus s; Auth::DpbImplementation di(dpb); @@ -5879,12 +5870,8 @@ static void authFillParametersBlock(AuthClientPlugins& authItr, } } -static void authReceiveResponse(AuthClientPlugins& authItr, - rem_port* port, - Rdb* rdb, - const Auth::AuthTags* tags, - IStatus* status, - PACKET* packet) +static void authReceiveResponse(AuthClientPlugins& authItr, rem_port* port, Rdb* rdb, + const Auth::AuthTags* tags, IStatus* status, PACKET* packet) { LocalStatus s; @@ -5985,11 +5972,8 @@ static void authReceiveResponse(AuthClientPlugins& authItr, (Arg::Gds(isc_login) << Arg::StatusVector(s.get())).raise(); } -static void init(IStatus* status, - rem_port* port, - P_OP op, - PathName& file_name, - ClumpletWriter& dpb) +static void init(IStatus* status, rem_port* port, P_OP op, PathName& file_name, + ClumpletWriter& dpb) { /************************************** * @@ -6012,8 +5996,8 @@ static void init(IStatus* status, AuthClientPlugins authItr(PluginType::AuthClient, FB_AUTH_CLIENT_VERSION, upInfo); authFillParametersBlock(authItr, dpb, - op == op_service_attach ? &Auth::SVC_ATTACH_LIST : &Auth::DB_ATTACH_LIST, - port); + op == op_service_attach ? &Auth::SVC_ATTACH_LIST : &Auth::DB_ATTACH_LIST, + port); if (port->port_protocol < PROTOCOL_VERSION12) { @@ -6061,8 +6045,8 @@ static void init(IStatus* status, send_packet(port, packet); authReceiveResponse(authItr, port, rdb, - op == op_service_attach ? &Auth::SVC_ATTACH_LIST : &Auth::DB_ATTACH_LIST, - status, packet); + op == op_service_attach ? &Auth::SVC_ATTACH_LIST : &Auth::DB_ATTACH_LIST, + status, packet); } catch (const Exception&) { diff --git a/src/yvalve/why.cpp b/src/yvalve/why.cpp index b829e05708..5ec42a8e5e 100644 --- a/src/yvalve/why.cpp +++ b/src/yvalve/why.cpp @@ -4754,15 +4754,13 @@ void YService::query(IStatus* status, unsigned int sendLength, const unsigned ch { ClumpletWriter spb(ClumpletReader::SpbSendItems, MAX_DPB_SIZE, sendItems, sendLength); if (!regular.next) - { populateSpb(spb, isc_info_svc_auth_block); - } checkSpbLen = receiveLength; checkSpbPresent = receiveItems; YEntry entry(status, this, SERV_QUERY); - entry.next()->query(status, spb.getBufferLength(), spb.getBuffer(), receiveLength, receiveItems, - bufferLength, buffer); + entry.next()->query(status, spb.getBufferLength(), spb.getBuffer(), + receiveLength, receiveItems, bufferLength, buffer); checkSpbLen = 0; checkSpbPresent = NULL; } @@ -4780,9 +4778,7 @@ void YService::start(IStatus* status, unsigned int spbLength, const unsigned cha { ClumpletWriter spb(ClumpletReader::SpbStart, MAX_DPB_SIZE, spbItems, spbLength); if (!regular.next) - { populateSpb(spb, isc_spb_auth_block); - } YEntry entry(status, this, SERV_START); entry.next()->start(status, spb.getBufferLength(), spb.getBuffer()); @@ -5081,7 +5077,8 @@ YService* Dispatcher::attachServiceManager(IStatus* status, const char* serviceN svcName.trim(); ClumpletReader spbReader(ClumpletReader::SpbAttach, spb, spbLength); - if ((spbReader.find(isc_spb_auth_block) && spbReader.getClumpLength() > 0) || ISC_check_if_remote(svcName, false)) + if ((spbReader.find(isc_spb_auth_block) && spbReader.getClumpLength() > 0) || + ISC_check_if_remote(svcName, false)) { IProvider* provider = NULL; service = getServiceManagerByName(&provider, status, svcName.c_str(), spbLength, spb);