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
801c71ed
Commit
801c71ed
authored
Aug 28, 2008
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
unsigned integers and size_t
Use "unsigned int" whenever negative values are not meaningful. Use size_t whenever we are going to describe buffer sizes.
parent
1560a70b
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
11 deletions
+11
-11
tag.c
src/tag.c
+3
-4
tag.h
src/tag.h
+2
-1
utf8.c
src/utf8.c
+6
-6
No files found.
src/tag.c
View file @
801c71ed
...
...
@@ -25,7 +25,6 @@
#include "charConv.h"
#include "tagTracker.h"
#include "song.h"
#include "os_compat.h"
#ifdef HAVE_ID3TAG
# define isId3v1(tag) (id3_tag_options(tag, 0, 0) & ID3_TAG_OPTION_ID3V1)
...
...
@@ -698,9 +697,9 @@ int mpdTagsAreEqual(MpdTag * tag1, MpdTag * tag2)
}
static
void
appendToTagItems
(
MpdTag
*
tag
,
enum
tag_type
type
,
char
*
value
,
in
t
len
)
char
*
value
,
size_
t
len
)
{
int
i
=
tag
->
numOfItems
;
unsigned
int
i
=
tag
->
numOfItems
;
char
*
duplicated
=
xmalloc
(
len
+
1
);
memcpy
(
duplicated
,
value
,
len
);
...
...
@@ -719,7 +718,7 @@ static void appendToTagItems(MpdTag * tag, enum tag_type type,
}
void
addItemToMpdTagWithLen
(
MpdTag
*
tag
,
enum
tag_type
itemType
,
char
*
value
,
in
t
len
)
char
*
value
,
size_
t
len
)
{
if
(
ignoreTagItems
[
itemType
])
{
...
...
src/tag.h
View file @
801c71ed
...
...
@@ -22,6 +22,7 @@
#include "../config.h"
#include "mpd_types.h"
#include "os_compat.h"
#ifdef HAVE_ID3TAG
#include <id3tag.h>
...
...
@@ -72,7 +73,7 @@ void clearItemsFromMpdTag(MpdTag * tag, enum tag_type itemType);
void
freeMpdTag
(
MpdTag
*
tag
);
void
addItemToMpdTagWithLen
(
MpdTag
*
tag
,
enum
tag_type
itemType
,
char
*
value
,
in
t
len
);
char
*
value
,
size_
t
len
);
#define addItemToMpdTag(tag, itemType, value) \
addItemToMpdTagWithLen(tag, itemType, value, strlen(value))
...
...
src/utf8.c
View file @
801c71ed
...
...
@@ -69,7 +69,7 @@ static char utf8_to_latin1_char(const char *inUtf8)
return
(
char
)(
c
+
utf8
[
1
]);
}
static
int
validateUtf8Char
(
const
char
*
inUtf8Char
)
static
unsigned
int
validateUtf8Char
(
const
char
*
inUtf8Char
)
{
const
unsigned
char
*
utf8Char
=
(
const
unsigned
char
*
)
inUtf8Char
;
...
...
@@ -77,9 +77,9 @@ static int validateUtf8Char(const char *inUtf8Char)
return
1
;
if
(
utf8Char
[
0
]
>=
0xC0
&&
utf8Char
[
0
]
<=
0xFD
)
{
int
count
=
1
;
unsigned
int
count
=
1
;
char
t
=
1
<<
5
;
int
i
;
unsigned
int
i
;
while
(
count
<
6
&&
(
t
&
utf8Char
[
0
]))
{
t
=
(
t
>>
1
);
count
++
;
...
...
@@ -97,7 +97,7 @@ static int validateUtf8Char(const char *inUtf8Char)
int
validUtf8String
(
const
char
*
string
)
{
int
ret
;
unsigned
int
ret
;
while
(
*
string
)
{
ret
=
validateUtf8Char
(
string
);
...
...
@@ -114,7 +114,7 @@ char *utf8StrToLatin1Dup(const char *utf8)
/* utf8 should have at most two char's per latin1 char */
char
*
ret
=
xmalloc
(
strlen
(
utf8
)
+
1
);
char
*
cp
=
ret
;
int
count
;
unsigned
int
count
;
size_t
len
=
0
;
while
(
*
utf8
)
{
...
...
@@ -136,7 +136,7 @@ char *utf8StrToLatin1Dup(const char *utf8)
char
*
utf8_to_latin1
(
char
*
dest
,
const
char
*
utf8
)
{
char
*
cp
=
dest
;
int
count
;
unsigned
int
count
;
size_t
len
=
0
;
while
(
*
utf8
)
{
...
...
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