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
4e2f4e20
Commit
4e2f4e20
authored
Dec 04, 2014
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
util/StringUtil: add ToUpperASCII()
Replaces g_ascii_strup() and allows building the Vorbis encoder without GLib.
parent
e69bef3c
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
33 additions
and
7 deletions
+33
-7
configure.ac
configure.ac
+2
-3
VorbisEncoderPlugin.cxx
src/encoder/plugins/VorbisEncoderPlugin.cxx
+3
-4
StringUtil.cxx
src/util/StringUtil.cxx
+20
-0
StringUtil.hxx
src/util/StringUtil.hxx
+8
-0
No files found.
configure.ac
View file @
4e2f4e20
...
...
@@ -1145,9 +1145,8 @@ MPD_ENABLE_AUTO_PKG(shine_encoder, SHINE, [shine >= 3.1],
[shine encoder], [libshine not found])
dnl ---------------------------- Ogg Vorbis Encoder ---------------------------
MPD_ENABLE_AUTO_PKG_DEPENDS(vorbis_encoder, VORBISENC, [vorbisenc vorbis ogg],
[Ogg Vorbis encoder], [libvorbisenc not found], [],
[enable_glib], [Cannot use --enable-vorbis-encoder with --disable-glib])
MPD_ENABLE_AUTO_PKG(vorbis_encoder, VORBISENC, [vorbisenc vorbis ogg],
[Ogg Vorbis encoder], [libvorbisenc not found])
dnl ------------------------------- LAME Encoder ------------------------------
...
...
src/encoder/plugins/VorbisEncoderPlugin.cxx
View file @
4e2f4e20
...
...
@@ -25,14 +25,13 @@
#include "tag/Tag.hxx"
#include "AudioFormat.hxx"
#include "config/ConfigError.hxx"
#include "util/StringUtil.hxx"
#include "util/NumberParser.hxx"
#include "util/Error.hxx"
#include "util/Domain.hxx"
#include <vorbis/vorbisenc.h>
#include <glib.h>
struct
vorbis_encoder
{
/** the base class */
Encoder
encoder
;
...
...
@@ -273,9 +272,9 @@ static void
copy_tag_to_vorbis_comment
(
vorbis_comment
*
vc
,
const
Tag
&
tag
)
{
for
(
const
auto
&
item
:
tag
)
{
char
*
name
=
g_ascii_strup
(
tag_item_names
[
item
.
type
],
-
1
);
char
name
[
64
];
ToUpperASCII
(
name
,
tag_item_names
[
item
.
type
],
sizeof
(
name
));
vorbis_comment_add_tag
(
vc
,
name
,
item
.
value
);
g_free
(
name
);
}
}
...
...
src/util/StringUtil.cxx
View file @
4e2f4e20
...
...
@@ -120,3 +120,23 @@ string_array_contains(const char *const* haystack, const char *needle)
return
false
;
}
void
ToUpperASCII
(
char
*
dest
,
const
char
*
src
,
size_t
size
)
{
assert
(
dest
!=
nullptr
);
assert
(
src
!=
nullptr
);
assert
(
size
>
1
);
char
*
const
end
=
dest
+
size
-
1
;
do
{
char
ch
=
*
src
++
;
if
(
ch
==
0
)
break
;
*
dest
++
=
ToUpperASCII
(
ch
);
}
while
(
dest
<
end
);
*
dest
=
0
;
}
src/util/StringUtil.hxx
View file @
4e2f4e20
...
...
@@ -114,4 +114,12 @@ gcc_pure
bool
string_array_contains
(
const
char
*
const
*
haystack
,
const
char
*
needle
);
/**
* Convert the specified ASCII string (0x00..0x7f) to upper case.
*
* @param size the destination buffer size
*/
void
ToUpperASCII
(
char
*
dest
,
const
char
*
src
,
size_t
size
);
#endif
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