From 7d52a84520f15355e363f1622a4fce0cf3170111 Mon Sep 17 00:00:00 2001 From: asfernandes Date: Wed, 2 Dec 2009 00:35:55 +0000 Subject: [PATCH] Misc --- src/jrd/intl.cpp | 5 ++++- src/jrd/jrd.cpp | 6 ++---- src/jrd/svc.cpp | 9 ++++++--- src/jrd/svc.h | 4 ++++ src/jrd/trace/TraceService.cpp | 2 +- src/utilities/ntrace/TracePluginImpl.cpp | 2 +- src/utilities/ntrace/TracePluginImpl.h | 2 +- src/utilities/ntrace/fbtrace.conf | 2 +- 8 files changed, 20 insertions(+), 12 deletions(-) diff --git a/src/jrd/intl.cpp b/src/jrd/intl.cpp index d991b9b455..c9367d0a7a 100644 --- a/src/jrd/intl.cpp +++ b/src/jrd/intl.cpp @@ -235,6 +235,8 @@ CharSetContainer* CharSetContainer::lookupCharset(thread_db* tdbb, USHORT ttype) return cs; } + +// Lookup a system character set without looking in the database. bool CharSetContainer::lookupInternalCharSet(USHORT id, SubtypeInfo* info) { if (id == CS_UTF16) @@ -260,7 +262,7 @@ bool CharSetContainer::lookupInternalCharSet(USHORT id, SubtypeInfo* info) if (colDef->charSetId == id && colDef->collationId == 0) { info->charsetName = csDef->name; - info->collationName = csDef->name; + info->collationName = colDef->name; info->attributes = colDef->attributes; info->ignoreAttributes = false; @@ -278,6 +280,7 @@ bool CharSetContainer::lookupInternalCharSet(USHORT id, SubtypeInfo* info) return false; } + Lock* CharSetContainer::createCollationLock(thread_db* tdbb, USHORT ttype) { /************************************** diff --git a/src/jrd/jrd.cpp b/src/jrd/jrd.cpp index b9292a20f6..a0cac8c008 100644 --- a/src/jrd/jrd.cpp +++ b/src/jrd/jrd.cpp @@ -223,10 +223,8 @@ namespace inline void validateHandle(Service* service) { - if (service && service->checkHandle()) - return; - - status_exception::raise(Arg::Gds(isc_bad_svc_handle)); + if (!service || !service->checkHandle()) + status_exception::raise(Arg::Gds(isc_bad_svc_handle)); } class AttachmentHolder diff --git a/src/jrd/svc.cpp b/src/jrd/svc.cpp index 2d7172fe8b..dc2ebd307a 100644 --- a/src/jrd/svc.cpp +++ b/src/jrd/svc.cpp @@ -129,16 +129,19 @@ namespace { class ThreadIdHolder { public: - explicit ThreadIdHolder(Jrd::Service::StatusStringsHelper& p) : strHelper(&p) + explicit ThreadIdHolder(Jrd::Service::StatusStringsHelper& p) + : strHelper(&p) { MutexLockGuard guard(strHelper->mtx); strHelper->workerThread = getThreadId(); } + ~ThreadIdHolder() { MutexLockGuard guard(strHelper->mtx); strHelper->workerThread = 0; } + private: Jrd::Service::StatusStringsHelper* strHelper; }; @@ -309,10 +312,10 @@ Service::ExistenceGuard::ExistenceGuard(Service* s) if (! svc->locateInAllServices()) { - // Service is so old that it's even missing in allSevrices array + // Service is so old that it's even missing in allServices array Arg::Gds(isc_bad_svc_handle).raise(); } - + if (svc->svc_flags & SVC_detached) { // Service was already detached diff --git a/src/jrd/svc.h b/src/jrd/svc.h index 5953a246ba..2b545c65c2 100644 --- a/src/jrd/svc.h +++ b/src/jrd/svc.h @@ -279,6 +279,7 @@ public: FB_THREAD_ID workerThread; Firebird::Mutex mtx; }; + private: StatusStringsHelper svc_thread_strings; @@ -289,11 +290,14 @@ private: ExistenceGuard(Service* svc); ~ExistenceGuard(); void release(); + private: Service* svc; bool locked; }; + friend class ExistenceGuard; + Firebird::Mutex svc_existence_lock; ExistenceGuard* svc_current_guard; }; diff --git a/src/jrd/trace/TraceService.cpp b/src/jrd/trace/TraceService.cpp index 65e0db3012..e4cec04ad5 100644 --- a/src/jrd/trace/TraceService.cpp +++ b/src/jrd/trace/TraceService.cpp @@ -88,7 +88,7 @@ void TraceSvcJrd::startSession(TraceSession& session, bool interactive) m_svc.printf("Can not start trace session. There are no trace plugins loaded\n"); return; } - + ConfigStorage* storage = TraceManager::getStorage(); { // scope diff --git a/src/utilities/ntrace/TracePluginImpl.cpp b/src/utilities/ntrace/TracePluginImpl.cpp index fd3577ab7c..fa052b910f 100644 --- a/src/utilities/ntrace/TracePluginImpl.cpp +++ b/src/utilities/ntrace/TracePluginImpl.cpp @@ -1636,7 +1636,7 @@ bool TracePluginImpl::checkServiceFilter(TraceService* service, bool started) { ReadLockGuard lock(servicesLock); - ServiceData *data = NULL; + ServiceData* data = NULL; ServicesTree::Accessor accessor(&services); if (accessor.locate(service->getServiceID())) data = &accessor.current(); diff --git a/src/utilities/ntrace/TracePluginImpl.h b/src/utilities/ntrace/TracePluginImpl.h index e875223ed5..e0fd2f1b46 100644 --- a/src/utilities/ntrace/TracePluginImpl.h +++ b/src/utilities/ntrace/TracePluginImpl.h @@ -186,7 +186,7 @@ private: void register_sql_statement(TraceSQLStatement* statement); void register_blr_statement(TraceBLRStatement* statement); void register_service(TraceService* service); - + bool checkServiceFilter(TraceService* service, bool started); // Write message to text log file diff --git a/src/utilities/ntrace/fbtrace.conf b/src/utilities/ntrace/fbtrace.conf index d282a562b8..4350ec3e50 100644 --- a/src/utilities/ntrace/fbtrace.conf +++ b/src/utilities/ntrace/fbtrace.conf @@ -124,7 +124,7 @@ # default services section # -# List of names of currently existing Firebirds services (to use with service +# List of names of currently existing Firebird services (to use with service # filters below) : # Backup Database # Restore Database