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
fca9a92b
Commit
fca9a92b
authored
Jul 13, 2006
by
Avuton Olrich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
path.*: cleanups
utf8.c: add some static's git-svn-id:
https://svn.musicpd.org/mpd/trunk@4311
09075e82-0dd4-0310-85a5-a0d7c8717e4f
parent
db2f8439
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
19 deletions
+8
-19
path.c
src/path.c
+5
-14
path.h
src/path.h
+0
-2
utf8.c
src/utf8.c
+3
-3
No files found.
src/path.c
View file @
fca9a92b
...
...
@@ -42,23 +42,16 @@ char * playlistDir;
char
*
fsCharset
=
NULL
;
char
*
pathConvCharset
(
char
*
to
,
char
*
from
,
char
*
str
,
char
*
ret
)
{
if
(
ret
)
{
free
(
ret
);
ret
=
NULL
;
}
static
char
*
pathConvCharset
(
char
*
to
,
char
*
from
,
char
*
str
)
{
if
(
setCharSetConversion
(
to
,
from
)
==
0
)
{
ret
=
convStrDup
(
str
);
ret
urn
convStrDup
(
str
);
}
return
ret
;
return
NULL
;
}
char
*
fsCharsetToUtf8
(
char
*
str
)
{
static
char
*
ret
=
NULL
;
ret
=
pathConvCharset
(
"UTF-8"
,
fsCharset
,
str
,
ret
);
char
*
ret
=
pathConvCharset
(
"UTF-8"
,
fsCharset
,
str
);
if
(
ret
&&
!
validUtf8String
(
ret
))
{
free
(
ret
);
...
...
@@ -69,9 +62,7 @@ char * fsCharsetToUtf8(char * str) {
}
char
*
utf8ToFsCharset
(
char
*
str
)
{
static
char
*
ret
=
NULL
;
ret
=
pathConvCharset
(
fsCharset
,
"UTF-8"
,
str
,
ret
);
char
*
ret
=
pathConvCharset
(
fsCharset
,
"UTF-8"
,
str
);
if
(
!
ret
)
ret
=
strdup
(
str
);
...
...
src/path.h
View file @
fca9a92b
...
...
@@ -51,6 +51,4 @@ char * parentPath(char * path);
/* strips extra "///" and leading "/" and trailing "/" */
char
*
sanitizePathDup
(
char
*
path
);
char
*
prependCwdToPathDup
(
char
*
path
);
#endif
src/utf8.c
View file @
fca9a92b
...
...
@@ -22,7 +22,7 @@
#include <string.h>
#include <stdlib.h>
unsigned
char
*
latin1ToUtf8
(
unsigned
char
c
)
{
static
unsigned
char
*
latin1ToUtf8
(
unsigned
char
c
)
{
static
unsigned
char
utf8
[
3
];
memset
(
utf8
,
0
,
3
);
...
...
@@ -63,7 +63,7 @@ unsigned char * latin1StrToUtf8Dup(unsigned char * latin1) {
return
realloc
(
ret
,
len
+
1
);
}
unsigned
char
utf8ToLatin1
(
unsigned
char
*
utf8
)
{
static
unsigned
char
utf8ToLatin1
(
unsigned
char
*
utf8
)
{
unsigned
char
c
=
0
;
if
(
utf8
[
0
]
<
128
)
return
utf8
[
0
];
...
...
@@ -72,7 +72,7 @@ unsigned char utf8ToLatin1(unsigned char * utf8) {
return
c
+
utf8
[
1
];
}
int
validateUtf8Char
(
unsigned
char
*
utf8Char
)
{
static
int
validateUtf8Char
(
unsigned
char
*
utf8Char
)
{
if
(
utf8Char
[
0
]
<
0x80
)
return
1
;
if
(
utf8Char
[
0
]
>=
0xC0
&&
utf8Char
[
0
]
<=
0xFD
)
{
...
...
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