Lines Matching defs:str
44 safe_atoi32(const char *str, int32_t *val)
50 intval = strtol(str, &end, 10);
55 DPRINTF(E_DBG, L_MISC, "Invalid integer in string (%s): %s\n", str, strerror(errno));
60 if (end == str)
62 DPRINTF(E_DBG, L_MISC, "No integer found in string (%s)\n", str);
69 DPRINTF(E_DBG, L_MISC, "Integer value too large (%s)\n", str);
80 safe_atou32(const char *str, uint32_t *val)
86 intval = strtoul(str, &end, 10);
91 DPRINTF(E_DBG, L_MISC, "Invalid integer in string (%s): %s\n", str, strerror(errno));
96 if (end == str)
98 DPRINTF(E_DBG, L_MISC, "No integer found in string (%s)\n", str);
105 DPRINTF(E_DBG, L_MISC, "Integer value too large (%s)\n", str);
116 safe_hextou32(const char *str, uint32_t *val)
122 if (strncmp(str, "0x", 2) != 0)
123 return safe_atou32(str, val);
126 intval = strtoul(str, &end, 16);
131 DPRINTF(E_DBG, L_MISC, "Invalid integer in string (%s): %s\n", str, strerror(errno));
136 if (end == str)
138 DPRINTF(E_DBG, L_MISC, "No integer found in string (%s)\n", str);
145 DPRINTF(E_DBG, L_MISC, "Integer value too large (%s)\n", str);
156 safe_atoi64(const char *str, int64_t *val)
162 intval = strtoll(str, &end, 10);
167 DPRINTF(E_DBG, L_MISC, "Invalid integer in string (%s): %s\n", str, strerror(errno));
172 if (end == str)
174 DPRINTF(E_DBG, L_MISC, "No integer found in string (%s)\n", str);
181 DPRINTF(E_DBG, L_MISC, "Integer value too large (%s)\n", str);
192 safe_atou64(const char *str, uint64_t *val)
198 intval = strtoull(str, &end, 10);
203 DPRINTF(E_DBG, L_MISC, "Invalid integer in string (%s): %s\n", str, strerror(errno));
208 if (end == str)
210 DPRINTF(E_DBG, L_MISC, "No integer found in string (%s)\n", str);
217 DPRINTF(E_DBG, L_MISC, "Integer value too large (%s)\n", str);
228 safe_hextou64(const char *str, uint64_t *val)
234 intval = strtoull(str, &end, 16);
239 DPRINTF(E_DBG, L_MISC, "Invalid integer in string (%s): %s\n", str, strerror(errno));
244 if (end == str)
246 DPRINTF(E_DBG, L_MISC, "No integer found in string (%s)\n", str);
253 DPRINTF(E_DBG, L_MISC, "Integer value too large (%s)\n", str);
418 unicode_fixup_string(char *str)
423 if (!str)
426 len = strlen(str);
429 if (!u8_check((uint8_t *)str, len))
434 if (memcmp("\xef\xbb\xbf", str, 3) == 0)
435 memmove(str, str + 3, len - 3 + 1);
438 return str;
441 ret = u8_conv_from_encoding("ascii", iconveh_question_mark, str, len, NULL, NULL, &len);
444 DPRINTF(E_LOG, L_MISC, "Could not convert string '%s' to UTF-8: %s\n", str, strerror(errno));
473 char *str;
503 str = (char *)malloc(len);
504 if (!str)
507 memset(str, 0, len);
510 optr = (unsigned char *)str;
555 return str;