OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2000, 2001, 2002 Fabrice Bellard | 2 * Copyright (c) 2000, 2001, 2002 Fabrice Bellard |
3 * Copyright (c) 2007 Mans Rullgard | 3 * Copyright (c) 2007 Mans Rullgard |
4 * | 4 * |
5 * This file is part of FFmpeg. | 5 * This file is part of FFmpeg. |
6 * | 6 * |
7 * FFmpeg is free software; you can redistribute it and/or | 7 * FFmpeg is free software; you can redistribute it and/or |
8 * modify it under the terms of the GNU Lesser General Public | 8 * modify it under the terms of the GNU Lesser General Public |
9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
10 * version 2.1 of the License, or (at your option) any later version. | 10 * version 2.1 of the License, or (at your option) any later version. |
(...skipping 30 matching lines...) Expand all Loading... |
41 { | 41 { |
42 while (*pfx && toupper((unsigned)*pfx) == toupper((unsigned)*str)) { | 42 while (*pfx && toupper((unsigned)*pfx) == toupper((unsigned)*str)) { |
43 pfx++; | 43 pfx++; |
44 str++; | 44 str++; |
45 } | 45 } |
46 if (!*pfx && ptr) | 46 if (!*pfx && ptr) |
47 *ptr = str; | 47 *ptr = str; |
48 return !*pfx; | 48 return !*pfx; |
49 } | 49 } |
50 | 50 |
| 51 char *av_stristr(const char *s1, const char *s2) |
| 52 { |
| 53 if (!*s2) |
| 54 return s1; |
| 55 |
| 56 do { |
| 57 if (av_stristart(s1, s2, NULL)) |
| 58 return s1; |
| 59 } while (*s1++); |
| 60 |
| 61 return NULL; |
| 62 } |
| 63 |
51 size_t av_strlcpy(char *dst, const char *src, size_t size) | 64 size_t av_strlcpy(char *dst, const char *src, size_t size) |
52 { | 65 { |
53 size_t len = 0; | 66 size_t len = 0; |
54 while (++len < size && *src) | 67 while (++len < size && *src) |
55 *dst++ = *src++; | 68 *dst++ = *src++; |
56 if (len <= size) | 69 if (len <= size) |
57 *dst = 0; | 70 *dst = 0; |
58 return len + strlen(src) - 1; | 71 return len + strlen(src) - 1; |
59 } | 72 } |
60 | 73 |
(...skipping 16 matching lines...) Expand all Loading... |
77 | 90 |
78 return len; | 91 return len; |
79 } | 92 } |
80 | 93 |
81 char *av_d2str(double d) | 94 char *av_d2str(double d) |
82 { | 95 { |
83 char *str= av_malloc(16); | 96 char *str= av_malloc(16); |
84 if(str) snprintf(str, 16, "%f", d); | 97 if(str) snprintf(str, 16, "%f", d); |
85 return str; | 98 return str; |
86 } | 99 } |
OLD | NEW |