Tweaked the serialization progress dialog.
[gliv.git] / src / include / str_utils.h
blobef4dfbfd67df9af4e0921c42613faa6a41be3774
1 #ifndef STR_UTILS_H
2 #define STR_UTILS_H
4 #include "gliv.h"
6 /*
7 * The magic to find a '\0' in a long int is taken from the glibc.
8 * See sysdeps/generic/strlen.c in the glibc sources to have the
9 * explanation.
10 * Actually it also finds 0x80, that's why we double check when
11 * HAS_ZERO() finds something.
13 #define INIT_MAGIC() \
14 do { \
15 himagic = 0x80808080L; \
16 lomagic = 0x01010101L; \
18 if (sizeof(gulong) > 4) { \
19 /* 64-bit */ \
20 himagic = ((himagic << 16) << 16) | himagic; \
21 lomagic = ((lomagic << 16) << 16) | lomagic; \
22 magic_bits = ((0x7efefefeL << 16) << 16) | 0xfefefeffL; \
23 } else \
24 magic_bits = 0x7efefeffL; \
25 } while (0)
27 #define HAS_ZERO(longint) ((((longint) + magic_bits) ^ ~longint) & ~magic_bits)
29 const gchar *filename_to_utf8(const gchar * str);
30 gchar *clean_filename(const gchar * filename);
32 #endif