00001
00021 #ifndef _LIGHTMEDIASCANNER_UTILS_H_
00022 #define _LIGHTMEDIASCANNER_UTILS_H_ 1
00023
00024 #ifdef API
00025 #undef API
00026 #endif
00027
00028 #ifdef __GNUC__
00029 # if __GNUC__ >= 4
00030 # define API __attribute__ ((visibility("default")))
00031 # else
00032 # define API
00033 # endif
00034 # if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
00035 # define GNUC_NON_NULL(...) __attribute__((nonnull(__VA_ARGS__)))
00036 # else
00037 # define GNUC_NON_NULL(...)
00038 # endif
00039 #else
00040 # define API
00041 # define GNUC_NON_NULL(...)
00042 #endif
00043
00044 #ifdef __cplusplus
00045 extern "C" {
00046 #endif
00047
00048
00049 struct lms_string_size {
00050 char *str;
00051 unsigned int len;
00052 };
00053
00054 #define LMS_STATIC_STRING_SIZE(s) {s, sizeof(s) - 1}
00055 #define LMS_ARRAY_SIZE(a) (sizeof(a) / sizeof(*a))
00056
00057
00058 API void lms_strstrip(char *str, unsigned int *p_len) GNUC_NON_NULL(1, 2);
00059 API void lms_strstrip_and_free(char **p_str, unsigned int *p_len) GNUC_NON_NULL(1, 2);
00060 API void lms_string_size_strip_and_free(struct lms_string_size *p) GNUC_NON_NULL(1);
00061 API int lms_which_extension(const char *name, unsigned int name_len, const struct lms_string_size *exts, unsigned int exts_len) GNUC_NON_NULL(1, 3);
00062
00063
00064
00065 #ifdef __cplusplus
00066 }
00067 #endif
00068 #endif