Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
3fa4dad4
Commit
3fa4dad4
authored
Jun 26, 2015
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lib/icu/Converter: remove GLib implementation
We don't need this anymore: Win32 doesn't use this library at all, and everything else has either iconv() or libicu.
parent
0756607e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
3 additions
and
53 deletions
+3
-53
Charset.hxx
src/fs/Charset.hxx
+1
-1
Converter.cxx
src/lib/icu/Converter.cxx
+2
-39
Converter.hxx
src/lib/icu/Converter.hxx
+0
-13
No files found.
src/fs/Charset.hxx
View file @
3fa4dad4
...
...
@@ -24,7 +24,7 @@
#include "Compiler.h"
#include "Traits.hxx"
#if (defined(HAVE_ICU) || defined(HAVE_ICONV)
|| defined(HAVE_GLIB)
) && !defined(WIN32)
#if (defined(HAVE_ICU) || defined(HAVE_ICONV)) && !defined(WIN32)
#define HAVE_FS_CHARSET
#endif
...
...
src/lib/icu/Converter.cxx
View file @
3fa4dad4
...
...
@@ -34,9 +34,6 @@
#elif defined(HAVE_ICONV)
#include "util/Domain.hxx"
static
constexpr
Domain
iconv_domain
(
"iconv"
);
#elif defined(HAVE_GLIB)
#include "util/Domain.hxx"
static
constexpr
Domain
g_iconv_domain
(
"g_iconv"
);
#endif
#ifdef HAVE_ICU
...
...
@@ -78,20 +75,6 @@ IcuConverter::Create(const char *charset, Error &error)
}
return
new
IcuConverter
(
to
,
from
);
#elif defined(HAVE_GLIB)
GIConv
to
=
g_iconv_open
(
"utf-8"
,
charset
);
GIConv
from
=
g_iconv_open
(
charset
,
"utf-8"
);
if
(
to
==
(
GIConv
)
-
1
||
from
==
(
GIConv
)
-
1
)
{
if
(
to
!=
(
GIConv
)
-
1
)
g_iconv_close
(
to
);
if
(
from
!=
(
GIConv
)
-
1
)
g_iconv_close
(
from
);
error
.
Format
(
g_iconv_domain
,
"Failed to initialize charset '%s'"
,
charset
);
return
nullptr
;
}
return
new
IcuConverter
(
to
,
from
);
#endif
}
...
...
@@ -116,26 +99,6 @@ DoConvert(iconv_t conv, const char *src)
return
AllocatedString
<>::
Duplicate
(
buffer
,
sizeof
(
buffer
)
-
out_left
);
}
#elif defined(HAVE_GLIB)
static
AllocatedString
<
char
>
DoConvert
(
GIConv
conv
,
const
char
*
src
)
{
// TODO: dynamic buffer?
char
buffer
[
4096
];
char
*
in
=
const_cast
<
char
*>
(
src
);
char
*
out
=
buffer
;
size_t
in_left
=
strlen
(
src
);
size_t
out_left
=
sizeof
(
buffer
);
size_t
n
=
g_iconv
(
conv
,
&
in
,
&
in_left
,
&
out
,
&
out_left
);
if
(
n
==
static_cast
<
size_t
>
(
-
1
)
||
in_left
>
0
)
return
nullptr
;
return
AllocatedString
<>::
Duplicate
(
buffer
,
sizeof
(
buffer
)
-
out_left
);
}
#endif
AllocatedString
<
char
>
...
...
@@ -160,7 +123,7 @@ IcuConverter::ToUTF8(const char *s) const
const
size_t
target_length
=
target
-
buffer
;
return
UCharToUTF8
({
buffer
,
target_length
});
#elif defined(HAVE_ICONV)
|| defined(HAVE_GLIB)
#elif defined(HAVE_ICONV)
return
DoConvert
(
to_utf8
,
s
);
#endif
}
...
...
@@ -192,7 +155,7 @@ IcuConverter::FromUTF8(const char *s) const
return
AllocatedString
<>::
Duplicate
(
buffer
,
target
);
#elif defined(HAVE_ICONV)
|| defined(HAVE_GLIB)
#elif defined(HAVE_ICONV)
return
DoConvert
(
from_utf8
,
s
);
#endif
}
...
...
src/lib/icu/Converter.hxx
View file @
3fa4dad4
...
...
@@ -29,9 +29,6 @@
#elif defined(HAVE_ICONV)
#include <iconv.h>
#define HAVE_ICU_CONVERTER
#elif defined(HAVE_GLIB)
#include <glib.h>
#define HAVE_ICU_CONVERTER
#endif
#ifdef HAVE_ICU_CONVERTER
...
...
@@ -64,11 +61,6 @@ class IcuConverter {
IcuConverter
(
iconv_t
_to
,
iconv_t
_from
)
:
to_utf8
(
_to
),
from_utf8
(
_from
)
{}
#elif defined(HAVE_GLIB)
const
GIConv
to_utf8
,
from_utf8
;
IcuConverter
(
GIConv
_to
,
GIConv
_from
)
:
to_utf8
(
_to
),
from_utf8
(
_from
)
{}
#endif
public
:
...
...
@@ -79,11 +71,6 @@ public:
iconv_close
(
to_utf8
);
iconv_close
(
from_utf8
);
}
#elif defined(HAVE_GLIB)
~
IcuConverter
()
{
g_iconv_close
(
to_utf8
);
g_iconv_close
(
from_utf8
);
}
#endif
static
IcuConverter
*
Create
(
const
char
*
charset
,
Error
&
error
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment