History

avstring: Add locale independent implementations of strcasecmp/strncasecmp

Reimar Döffinger committed 15 years ago

Commit ba04ecf1 parent 07b172f4 files · +37 −1Browse files

Unified · Split

4 files
  1. doc/APIchanges +3 −0
  2. libavutil/avstring.c +21 −0
  3. libavutil/avstring.h +12 −0
  4. libavutil/avutil.h +1 −1
doc/APIchanges+3−0
@@ -13,6 +13,9 @@ libavutil: 2011-04-18 · 12 unmodified lines
13 13
14API changes, most recent first:14API changes, most recent first:
15 15
162011-11-xx - xxxxxxx - lavu 51.14.0
17 Add av_strcasecmp() and av_strncasecmp() to avstring.h.
18
162011-11-xx - xxxxxxx - lavu 51.13.0192011-11-xx - xxxxxxx - lavu 51.13.0
17 Add av_toupper()/av_tolower()20 Add av_toupper()/av_tolower()
18 21
libavutil/avstring.c+21−0
@@ -134,6 +134,27 @@ char *av_get_token(const char **buf, const char *term) · 133 unmodified lines
134 return ret;134 return ret;
135}135}
136 136
137int av_strcasecmp(const char *a, const char *b)
138{
139 uint8_t c1, c2;
140 do {
141 c1 = av_tolower(*a++);
142 c2 = av_tolower(*b++);
143 } while (c1 && c1 == c2);
144 return c1 - c2;
145}
146
147int av_strncasecmp(const char *a, const char *b, size_t n)
148{
149 const char *end = a + n;
150 uint8_t c1, c2;
151 do {
152 c1 = av_tolower(*a++);
153 c2 = av_tolower(*b++);
154 } while (a < end && c1 && c1 == c2);
155 return c1 - c2;
156}
157
137#ifdef TEST158#ifdef TEST
138 159
139#undef printf160#undef printf
libavutil/avstring.h+12−0
@@ -151,4 +151,16 @@ static inline int av_tolower(int c) · 150 unmodified lines
151 return c;151 return c;
152}152}
153 153
154/*
155 * Locale independent case-insensitive compare.
156 * Note: This means only ASCII-range characters are case-insensitive
157 */
158int av_strcasecmp(const char *a, const char *b);
159
160/**
161 * Locale independent case-insensitive compare.
162 * Note: This means only ASCII-range characters are case-insensitive
163 */
164int av_strncasecmp(const char *a, const char *b, size_t n);
165
154#endif /* AVUTIL_AVSTRING_H */166#endif /* AVUTIL_AVSTRING_H */
libavutil/avutil.h+1−1
@@ -40,7 +40,7 @@ · 39 unmodified lines
40#define AV_VERSION(a, b, c) AV_VERSION_DOT(a, b, c)40#define AV_VERSION(a, b, c) AV_VERSION_DOT(a, b, c)
41 41
42#define LIBAVUTIL_VERSION_MAJOR 5142#define LIBAVUTIL_VERSION_MAJOR 51
43#define LIBAVUTIL_VERSION_MINOR 1343#define LIBAVUTIL_VERSION_MINOR 14
44#define LIBAVUTIL_VERSION_MICRO 044#define LIBAVUTIL_VERSION_MICRO 0
45 45
46#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \46#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t