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
6a08f228
Commit
6a08f228
authored
Feb 17, 2014
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
TagString: disable UTF-8 validation if GLib is disabled
parent
91729437
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
3 deletions
+13
-3
TagString.cxx
src/tag/TagString.cxx
+13
-3
No files found.
src/tag/TagString.cxx
View file @
6a08f228
...
...
@@ -21,12 +21,16 @@
#include "TagString.hxx"
#include "util/Alloc.hxx"
#ifdef HAVE_GLIB
#include <glib.h>
#endif
#include <assert.h>
#include <string.h>
#include <stdlib.h>
#ifdef HAVE_GLIB
/**
* Replace invalid sequences with the question mark.
*/
...
...
@@ -72,6 +76,8 @@ fix_utf8(const char *str, size_t length)
return
patch_utf8
(
str
,
length
,
end
);
}
#endif
static
bool
char_is_non_printable
(
unsigned
char
ch
)
{
...
...
@@ -113,19 +119,23 @@ clear_non_printable(const char *p, size_t length)
char
*
FixTagString
(
const
char
*
p
,
size_t
length
)
{
char
*
utf8
,
*
cleared
;
#ifdef HAVE_GLIB
// TODO: implement without GLib
utf8
=
fix_utf8
(
p
,
length
);
char
*
utf8
=
fix_utf8
(
p
,
length
);
if
(
utf8
!=
nullptr
)
{
p
=
utf8
;
length
=
strlen
(
p
);
}
#endif
cleared
=
clear_non_printable
(
p
,
length
);
char
*
cleared
=
clear_non_printable
(
p
,
length
);
#ifdef HAVE_GLIB
if
(
cleared
==
nullptr
)
cleared
=
utf8
;
else
free
(
utf8
);
#endif
return
cleared
;
}
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