indent
This commit is contained in:
parent
96104e7d67
commit
eb58602b5d
@ -1,50 +1,50 @@
|
|||||||
/* Copyright (C) 2004-2019 J.F.Dockes
|
/* Copyright (C) 2004-2019 J.F.Dockes
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program; if not, write to the
|
* along with this program; if not, write to the
|
||||||
* Free Software Foundation, Inc.,
|
* Free Software Foundation, Inc.,
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "autoconfig.h"
|
#include "autoconfig.h"
|
||||||
|
|
||||||
#include "utf8fn.h"
|
#include "utf8fn.h"
|
||||||
#include "rclconfig.h"
|
#include "rclconfig.h"
|
||||||
#include "transcode.h"
|
#include "transcode.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
string compute_utf8fn(const RclConfig *config, const string& ifn, bool simple)
|
string compute_utf8fn(const RclConfig *config, const string& ifn, bool simple)
|
||||||
{
|
{
|
||||||
string lfn(simple ? path_getsimple(ifn) : ifn);
|
string lfn(simple ? path_getsimple(ifn) : ifn);
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
PRETEND_USE(config);
|
PRETEND_USE(config);
|
||||||
// On windows file names are read as UTF16 wchar_t and converted to UTF-8
|
// On windows file names are read as UTF16 wchar_t and converted to UTF-8
|
||||||
// while scanning directories
|
// while scanning directories
|
||||||
return lfn;
|
return lfn;
|
||||||
#else
|
#else
|
||||||
string charset = config->getDefCharset(true);
|
string charset = config->getDefCharset(true);
|
||||||
string utf8fn;
|
string utf8fn;
|
||||||
int ercnt;
|
int ercnt;
|
||||||
if (!transcode(lfn, utf8fn, charset, "UTF-8", &ercnt)) {
|
if (!transcode(lfn, utf8fn, charset, "UTF-8", &ercnt)) {
|
||||||
LOGERR("compute_utf8fn: fn transcode failure from [" << charset <<
|
LOGERR("compute_utf8fn: fn transcode failure from [" << charset <<
|
||||||
"] to UTF-8 for: [" << lfn << "]\n");
|
"] to UTF-8 for: [" << lfn << "]\n");
|
||||||
} else if (ercnt) {
|
} else if (ercnt) {
|
||||||
LOGDEB("compute_utf8fn: " << ercnt << " transcode errors from [" <<
|
LOGDEB("compute_utf8fn: " << ercnt << " transcode errors from [" <<
|
||||||
charset << "] to UTF-8 for: [" << lfn << "]\n");
|
charset << "] to UTF-8 for: [" << lfn << "]\n");
|
||||||
}
|
}
|
||||||
LOGDEB1("compute_utf8fn: transcoded from [" << lfn << "] to [" <<
|
LOGDEB1("compute_utf8fn: transcoded from [" << lfn << "] to [" <<
|
||||||
utf8fn << "] (" << charset << "->" << "UTF-8)\n");
|
utf8fn << "] (" << charset << "->" << "UTF-8)\n");
|
||||||
return utf8fn;
|
return utf8fn;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user