lib/icu/Converter: Create() throws exception on error
This commit is contained in:
@@ -40,19 +40,17 @@ static std::string fs_charset;
|
||||
|
||||
static IcuConverter *fs_converter;
|
||||
|
||||
bool
|
||||
SetFSCharset(const char *charset, Error &error)
|
||||
void
|
||||
SetFSCharset(const char *charset)
|
||||
{
|
||||
assert(charset != nullptr);
|
||||
assert(fs_converter == nullptr);
|
||||
|
||||
fs_converter = IcuConverter::Create(charset, error);
|
||||
if (fs_converter == nullptr)
|
||||
return false;
|
||||
fs_converter = IcuConverter::Create(charset);
|
||||
assert(fs_converter != nullptr);
|
||||
|
||||
FormatDebug(path_domain,
|
||||
"SetFSCharset: fs charset is: %s", fs_charset.c_str());
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@@ -37,8 +37,11 @@ gcc_const
|
||||
const char *
|
||||
GetFSCharset();
|
||||
|
||||
bool
|
||||
SetFSCharset(const char *charset, Error &error);
|
||||
/**
|
||||
* Throws std::runtime_error on error.
|
||||
*/
|
||||
void
|
||||
SetFSCharset(const char *charset);
|
||||
|
||||
void
|
||||
DeinitFSCharset();
|
||||
|
@@ -22,15 +22,13 @@
|
||||
#include "Charset.hxx"
|
||||
#include "config/ConfigGlobal.hxx"
|
||||
|
||||
bool
|
||||
ConfigureFS(Error &error)
|
||||
void
|
||||
ConfigureFS()
|
||||
{
|
||||
#ifdef HAVE_FS_CHARSET
|
||||
const char *charset = config_get_string(ConfigOption::FS_CHARSET);
|
||||
return charset == nullptr || SetFSCharset(charset, error);
|
||||
#else
|
||||
(void)error;
|
||||
return true;
|
||||
if (charset != nullptr)
|
||||
SetFSCharset(charset);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@@ -26,9 +26,11 @@ class Error;
|
||||
|
||||
/**
|
||||
* Performs global one-time initialization of this class.
|
||||
*
|
||||
* Throws std::runtime_error on error.
|
||||
*/
|
||||
bool
|
||||
ConfigureFS(Error &error);
|
||||
void
|
||||
ConfigureFS();
|
||||
|
||||
void
|
||||
DeinitFS();
|
||||
|
Reference in New Issue
Block a user