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
8c96c2d3
Commit
8c96c2d3
authored
Apr 13, 2004
by
Warren Dukes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rename all ascii/utf8 stuff to latin1/utf8
git-svn-id:
https://svn.musicpd.org/mpd/trunk@718
09075e82-0dd4-0310-85a5-a0d7c8717e4f
parent
4920ee71
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
27 additions
and
31 deletions
+27
-31
charConv.c
src/charConv.c
+11
-11
path.c
src/path.c
+0
-4
tag.c
src/tag.c
+1
-1
utf8.c
src/utf8.c
+11
-11
utf8.h
src/utf8.h
+4
-4
No files found.
src/charConv.c
View file @
8c96c2d3
...
...
@@ -34,10 +34,10 @@ char * char_conv_from = NULL;
mpd_sint8
char_conv_same
=
0
;
mpd_sint8
char_conv_use_iconv
=
0
;
/* 1 is to use
ascii
ToUtf8
0 is not to use
ascii
/utf8 converter
-1 is to use utf8To
Ascii
*/
mpd_sint8
char_conv_
ascii
ToUtf8
=
0
;
/* 1 is to use
latin1
ToUtf8
0 is not to use
latin1
/utf8 converter
-1 is to use utf8To
Latin1
*/
mpd_sint8
char_conv_
latin1
ToUtf8
=
0
;
#define BUFFER_SIZE 1024
...
...
@@ -58,13 +58,13 @@ int setCharSetConversion(char * to, char * from) {
}
if
(
strcmp
(
to
,
"UTF-8"
)
==
0
&&
strcmp
(
from
,
"ISO-8859-1"
)
==
0
)
{
char_conv_
ascii
ToUtf8
=
1
;
char_conv_
latin1
ToUtf8
=
1
;
}
else
if
(
strcmp
(
to
,
"ISO-8859-1"
)
==
0
&&
strcmp
(
from
,
"UTF-8"
)
==
0
)
{
char_conv_
ascii
ToUtf8
=
-
1
;
char_conv_
latin1
ToUtf8
=
-
1
;
}
if
(
char_conv_
ascii
ToUtf8
!=
0
)
{
if
(
char_conv_
latin1
ToUtf8
!=
0
)
{
char_conv_to
=
strdup
(
to
);
char_conv_from
=
strdup
(
from
);
return
0
;
...
...
@@ -121,12 +121,12 @@ char * convStrDup(char * string) {
}
#endif
switch
(
char_conv_
ascii
ToUtf8
)
{
switch
(
char_conv_
latin1
ToUtf8
)
{
case
1
:
return
ascii
StrToUtf8Dup
(
string
);
return
latin1
StrToUtf8Dup
(
string
);
break
;
case
-
1
:
return
utf8StrTo
Ascii
Dup
(
string
);
return
utf8StrTo
Latin1
Dup
(
string
);
break
;
}
...
...
@@ -143,7 +143,7 @@ void closeCharSetConversion() {
char_conv_to
=
NULL
;
char_conv_from
=
NULL
;
char_conv_same
=
0
;
char_conv_
ascii
ToUtf8
=
0
;
char_conv_
latin1
ToUtf8
=
0
;
char_conv_use_iconv
=
0
;
}
}
src/path.c
View file @
8c96c2d3
...
...
@@ -20,7 +20,6 @@
#include "log.h"
#include "charConv.h"
#include "conf.h"
#include "utf8.h"
#include <stdlib.h>
#include <string.h>
...
...
@@ -59,9 +58,6 @@ char * fsCharsetToUtf8(char * str) {
free
(
ret
);
ret
=
NULL
;
}
/*if(!ret) ret = asciiStrToUtf8Dup(str);*/
/* if all else fails, just strdup */
return
ret
;
}
...
...
src/tag.c
View file @
8c96c2d3
...
...
@@ -63,7 +63,7 @@ void printMpdTag(FILE * fp, MpdTag * tag) {
if(str && !validUtf8String(str)) { \
char * temp; \
DEBUG("not valid utf8 in tag: %s\n",str); \
temp =
ascii
StrToUtf8Dup(str); \
temp =
latin1
StrToUtf8Dup(str); \
free(str); \
str = temp; \
} \
...
...
src/utf8.c
View file @
8c96c2d3
...
...
@@ -4,7 +4,7 @@
#include <string.h>
#include <stdlib.h>
unsigned
char
*
ascii
ToUtf8
(
unsigned
char
c
)
{
unsigned
char
*
latin1
ToUtf8
(
unsigned
char
c
)
{
static
unsigned
char
utf8
[
3
];
memset
(
utf8
,
0
,
3
);
...
...
@@ -22,9 +22,9 @@ unsigned char * asciiToUtf8(unsigned char c) {
return
utf8
;
}
unsigned
char
*
asciiStrToUtf8Dup
(
unsigned
char
*
ascii
)
{
/* utf8 should have at most two char's per
ascii
char */
int
len
=
strlen
(
ascii
)
*
2
+
1
;
unsigned
char
*
latin1StrToUtf8Dup
(
unsigned
char
*
latin1
)
{
/* utf8 should have at most two char's per
latin1
char */
int
len
=
strlen
(
latin1
)
*
2
+
1
;
unsigned
char
*
ret
=
malloc
(
len
);
unsigned
char
*
cp
=
ret
;
unsigned
char
*
utf8
;
...
...
@@ -33,19 +33,19 @@ unsigned char * asciiStrToUtf8Dup(unsigned char * ascii) {
len
=
0
;
while
(
*
ascii
)
{
utf8
=
asciiToUtf8
(
*
ascii
);
while
(
*
latin1
)
{
utf8
=
latin1ToUtf8
(
*
latin1
);
while
(
*
utf8
)
{
*
(
cp
++
)
=
*
(
utf8
++
);
len
++
;
}
ascii
++
;
latin1
++
;
}
return
realloc
(
ret
,
len
+
1
);
}
unsigned
char
utf8To
Ascii
(
unsigned
char
*
utf8
)
{
unsigned
char
utf8To
Latin1
(
unsigned
char
*
utf8
)
{
unsigned
char
c
=
0
;
if
(
utf8
[
0
]
<
128
)
return
utf8
[
0
];
...
...
@@ -86,8 +86,8 @@ int validUtf8String(unsigned char * string) {
return
1
;
}
unsigned
char
*
utf8StrTo
Ascii
Dup
(
unsigned
char
*
utf8
)
{
/* utf8 should have at most two char's per
ascii
char */
unsigned
char
*
utf8StrTo
Latin1
Dup
(
unsigned
char
*
utf8
)
{
/* utf8 should have at most two char's per
latin1
char */
int
len
=
strlen
(
utf8
)
+
1
;
unsigned
char
*
ret
=
malloc
(
len
);
unsigned
char
*
cp
=
ret
;
...
...
@@ -103,7 +103,7 @@ unsigned char * utf8StrToAsciiDup(unsigned char * utf8) {
free
(
ret
);
return
NULL
;
}
*
(
cp
++
)
=
utf8To
Ascii
(
utf8
);
*
(
cp
++
)
=
utf8To
Latin1
(
utf8
);
utf8
+=
count
;
len
++
;
}
...
...
src/utf8.h
View file @
8c96c2d3
#ifndef UTF_8_H
#define UTF_8_H
unsigned
char
*
ascii
ToUtf8
(
unsigned
char
c
);
unsigned
char
*
latin1
ToUtf8
(
unsigned
char
c
);
unsigned
char
*
asciiStrToUtf8Dup
(
unsigned
char
*
ascii
);
unsigned
char
*
latin1StrToUtf8Dup
(
unsigned
char
*
latin1
);
unsigned
char
*
utf8StrTo
Ascii
Dup
(
unsigned
char
*
utf8
);
unsigned
char
*
utf8StrTo
Latin1
Dup
(
unsigned
char
*
utf8
);
unsigned
char
utf8To
Ascii
(
unsigned
char
*
utf8
);
unsigned
char
utf8To
Latin1
(
unsigned
char
*
utf8
);
int
validateUtf8Char
(
unsigned
char
*
utf8Char
);
...
...
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