diff --git a/src/common/config/config.cpp b/src/common/config/config.cpp index 6014473522..33cdb8f863 100644 --- a/src/common/config/config.cpp +++ b/src/common/config/config.cpp @@ -32,9 +32,6 @@ #include #endif -// config_file works with OS case-sensitivity -typedef Firebird::PathName String; - namespace { /****************************************************************************** @@ -222,7 +219,7 @@ void Config::loadValues(const ConfigFile& file) for (int i = 0; i < MAX_CONFIG_KEY; i++) { const ConfigEntry& entry = entries[i]; - const String value = getValue(file, entry.key); + const ConfigFile::String value = getValue(file, entry.key); if (value.length()) { @@ -274,23 +271,23 @@ Config::~Config() } } -String Config::getValue(const ConfigFile& file, ConfigName key) +ConfigFile::String Config::getValue(const ConfigFile& file, ConfigName key) { const ConfigFile::Parameter* p = file.findParameter(key); return p ? p->value : ""; } -int Config::asInteger(const String &value) +int Config::asInteger(const ConfigFile::String &value) { return atoi(value.data()); } -bool Config::asBoolean(const String &value) +bool Config::asBoolean(const ConfigFile::String &value) { return (atoi(value.data()) != 0); } -const char* Config::asString(const String &value) +const char* Config::asString(const ConfigFile::String &value) { return value.c_str(); } diff --git a/src/common/config/config.h b/src/common/config/config.h index 9eb4ee71f4..c7a2f1e951 100644 --- a/src/common/config/config.h +++ b/src/common/config/config.h @@ -26,6 +26,7 @@ #include "../common/classes/alloc.h" #include "../common/classes/fb_string.h" #include "../common/classes/RefCounted.h" +#include "../common/config/config_file.h" /** Since the original (isc.cpp) code wasn't able to provide powerful and @@ -74,8 +75,6 @@ extern const char* AmMixed; enum AmCache {AM_UNKNOWN, AM_DISABLED, AM_ENABLED}; -class ConfigFile; - class Config : public Firebird::RefCounted, public Firebird::GlobalStorage { public: @@ -150,11 +149,11 @@ private: ConfigValue default_value; }; - static Firebird::PathName getValue(const ConfigFile&, ConfigName); + static ConfigFile::String getValue(const ConfigFile&, ConfigName); - static int asInteger(const Firebird::PathName&); - static bool asBoolean(const Firebird::PathName&); - static const char* asString(const Firebird::PathName&); + static int asInteger(const ConfigFile::String&); + static bool asBoolean(const ConfigFile::String&); + static const char* asString(const ConfigFile::String&); void loadValues(const ConfigFile& file); diff --git a/src/common/config/config_file.cpp b/src/common/config/config_file.cpp index 06136ca1a0..9a01a458db 100644 --- a/src/common/config/config_file.cpp +++ b/src/common/config/config_file.cpp @@ -166,7 +166,7 @@ private: } // anonymous namespace -ConfigFile::ConfigFile(const ConfigFile::String& file, USHORT fl) +ConfigFile::ConfigFile(const Firebird::PathName& file, USHORT fl) : AutoStorage(), configFile(getPool(), file), parameters(getPool()), flags(fl) { MainStream s(configFile.c_str(), flags & EXCEPTION_ON_ERROR); @@ -334,8 +334,9 @@ bool ConfigFile::translate(const String& from, String& to) { return false; } - PathName file; - PathUtils::splitLastComponent(to, file, configFile); + PathName path, file; + PathUtils::splitLastComponent(path, file, configFile.ToPathName()); + to = path.ToString(); } /* else if (!substituteOneOfStandardFirebirdDirs(from, to)) { diff --git a/src/common/config/config_file.h b/src/common/config/config_file.h index 8d09d92fb4..b733bb3916 100644 --- a/src/common/config/config_file.h +++ b/src/common/config/config_file.h @@ -57,8 +57,8 @@ public: // enum to distinguish ctors enum UseText {USE_TEXT}; - // config_file works with OS case-sensitivity - typedef Firebird::PathName String; + // config_file is always OS case sensitive + typedef Firebird::string String; class Stream { @@ -91,7 +91,7 @@ public: typedef Firebird::SortedObjectsArray, String, Parameter> Parameters; - ConfigFile(const String& file, USHORT fl); + ConfigFile(const Firebird::PathName& file, USHORT fl); ConfigFile(const char* file, USHORT fl); ConfigFile(UseText, const char* configText, USHORT fl); diff --git a/src/jrd/ExtEngineManager.cpp b/src/jrd/ExtEngineManager.cpp index 6df02e8a11..841eb74a3d 100644 --- a/src/jrd/ExtEngineManager.cpp +++ b/src/jrd/ExtEngineManager.cpp @@ -363,7 +363,7 @@ void* FB_CALL ExtEngineManager::ExternalContextImpl::setInfo(int code, void* val //--------------------- -static InitInstance > > > enginesModules; +static InitInstance > > > enginesModules; //--------------------- @@ -888,7 +888,7 @@ ExternalEngine* ExtEngineManager::getEngine(thread_db* tdbb, const MetaName& nam if (!engines.get(name, engine)) { - PathName pluginName; + ConfigFile::String pluginName; if (enginesModules().get(name, pluginName)) { PluginImpl* plugin = PluginManager::getPlugin(pluginName); diff --git a/src/jrd/IntlManager.cpp b/src/jrd/IntlManager.cpp index faf798e6af..55912f8982 100644 --- a/src/jrd/IntlManager.cpp +++ b/src/jrd/IntlManager.cpp @@ -468,7 +468,7 @@ bool IntlManager::initialize() { fatal_exception::raiseFmt("Missing parameter 'filename' for intl_module %s\n", module->value.c_str()); } - filename = fname->value; + filename = fname->value.ToPathName(); configInfo = getConfigInfo(objModule); if (!modules->exist(filename)) diff --git a/src/jrd/PluginManager.cpp b/src/jrd/PluginManager.cpp index 2afd2bce0f..791d64d8c4 100644 --- a/src/jrd/PluginManager.cpp +++ b/src/jrd/PluginManager.cpp @@ -43,11 +43,11 @@ namespace Jrd { namespace { - class PluginsMap : public GenericMap > > + class PluginsMap : public GenericMap > > { public: explicit PluginsMap(MemoryPool& p) - : GenericMap > >(p) + : GenericMap > >(p) { } @@ -127,7 +127,7 @@ void PluginManager::initialize() plugin->name.c_str()); } - plugin->filename = par->value; + plugin->filename = par->value.ToPathName(); par = pm->sub->findParameter("plugin_config"); if (par) @@ -172,7 +172,7 @@ PathName PluginManager::getPluginsDirectory() } -PluginImpl* PluginManager::getPlugin(const PathName& name) +PluginImpl* PluginManager::getPlugin(const ConfigFile::String& name) { PluginImpl* plugin; diff --git a/src/jrd/PluginManager.h b/src/jrd/PluginManager.h index 10fa099430..bc4640b4d8 100644 --- a/src/jrd/PluginManager.h +++ b/src/jrd/PluginManager.h @@ -33,11 +33,12 @@ #include "../common/classes/MetaName.h" #include "../common/classes/objects_array.h" #include "../common/classes/rwlock.h" +#include "../common/config/config_file.h" namespace Jrd { -typedef Firebird::Pair > ConfigEntry; +typedef Firebird::Pair > ConfigEntry; class PluginImpl : public Firebird::Plugin, public Firebird::GlobalStorage { @@ -66,12 +67,12 @@ public: Firebird::ExternalEngineFactory* getExternalEngineFactory(); private: - Firebird::PathName name; + ConfigFile::String name; Firebird::PathName filename; Firebird::SortedObjectsArray< ConfigEntry, Firebird::EmptyStorage, - Firebird::PathName, Firebird::FirstPointerKey + ConfigFile::String, Firebird::FirstPointerKey > configInfo; Firebird::AutoPtr module; Firebird::ExternalEngineFactory* externalEngineFactory; @@ -83,7 +84,7 @@ class PluginManager public: static void initialize(); static Firebird::PathName getPluginsDirectory(); - static PluginImpl* getPlugin(const Firebird::PathName& name); + static PluginImpl* getPlugin(const ConfigFile::String& name); }; diff --git a/src/jrd/db_alias.cpp b/src/jrd/db_alias.cpp index dd3a6cf578..3ccfe20ffa 100644 --- a/src/jrd/db_alias.cpp +++ b/src/jrd/db_alias.cpp @@ -84,7 +84,8 @@ namespace static void upcpy(size_t* toPar, const char* from, size_t length) { - char* to = reinterpret_cast(toPar); + memcpy(toPar, from, length); +/* char* to = reinterpret_cast(toPar); while (length--) { if (CASE_SENSITIVITY) @@ -96,6 +97,7 @@ namespace *to++ = toupper(*from++); } } + */ } static size_t hash(const char* value, size_t length, size_t hashSize) @@ -205,7 +207,7 @@ namespace { const ConfigFile::Parameter* par = ¶ms[n]; - PathName file(par->value); + PathName file(par->value.ToPathName()); replace_dir_sep(file); if (PathUtils::isRelative(file)) { @@ -236,7 +238,7 @@ namespace db->config = new Config(*par->sub, *Config::getDefaultConfig()); } - PathName correctedAlias(par->name); + PathName correctedAlias(par->name.ToPathName()); AliasName* alias = aliasHash.lookup(correctedAlias); if (alias) { diff --git a/src/utilities/ntrace/TraceConfiguration.cpp b/src/utilities/ntrace/TraceConfiguration.cpp index edd5952f86..17e18f646c 100644 --- a/src/utilities/ntrace/TraceConfiguration.cpp +++ b/src/utilities/ntrace/TraceConfiguration.cpp @@ -47,7 +47,7 @@ void TraceCfgReader::readTraceConfiguration(const char* text, #define PATH_PARAMETER(NAME, VALUE) \ if (!found && el->name == #NAME) { \ - ConfigFile::String temp; \ + Firebird::PathName temp; \ expandPattern(el, temp); \ m_config.NAME = temp.c_str(); \ found = true; \ @@ -273,10 +273,10 @@ ULONG TraceCfgReader::parseUInteger(const ConfigFile::Parameter* el) const return result; } -void TraceCfgReader::expandPattern(const ConfigFile::Parameter* el, ConfigFile::String& valueToExpand) +void TraceCfgReader::expandPattern(const ConfigFile::Parameter* el, PathName& valueToExpand) { - valueToExpand = el->value; - string::size_type pos = 0; + valueToExpand = el->value.ToPathName(); + PathName::size_type pos = 0; while (pos < valueToExpand.length()) { string::char_type c = valueToExpand[pos]; diff --git a/src/utilities/ntrace/TracePluginConfig.h b/src/utilities/ntrace/TracePluginConfig.h index bf9d89b56b..761f94c607 100644 --- a/src/utilities/ntrace/TracePluginConfig.h +++ b/src/utilities/ntrace/TracePluginConfig.h @@ -28,7 +28,8 @@ #ifndef TRACEPLUGINCONFIG_H #define TRACEPLUGINCONFIG_H -#include "../../common/classes/fb_string.h" +#include "../common/classes/fb_string.h" +#include "../common/config/config_file.h" //enum LogFormat { lfText = 0, lfBinary = 1 }; @@ -38,7 +39,7 @@ struct TracePluginConfig #define SERVICE_PARAMS #define PATH_PARAMETER(NAME, VALUE) Firebird::PathName NAME; -#define STR_PARAMETER(NAME, VALUE) Firebird::PathName NAME; +#define STR_PARAMETER(NAME, VALUE) ConfigFile::String NAME; #define BOOL_PARAMETER(NAME, VALUE) bool NAME; #define UINT_PARAMETER(NAME, VALUE) ULONG NAME; #include "paramtable.h"