fixed c89 compatibility

This commit is contained in:
Tim Ruehsen 2014-06-18 16:27:29 +02:00
parent 58bdb22546
commit a1a5b5e5d7
2 changed files with 6 additions and 4 deletions

View File

@ -877,6 +877,7 @@ int psl_str_to_utf8lower(const char *str, const char *encoding, const char *loca
} }
#ifdef WITH_LIBICU #ifdef WITH_LIBICU
do {
size_t str_length = strlen(str); size_t str_length = strlen(str);
UErrorCode status = 0; UErrorCode status = 0;
UChar *utf16_dst, *utf16_lower; UChar *utf16_dst, *utf16_lower;
@ -918,6 +919,7 @@ int psl_str_to_utf8lower(const char *str, const char *encoding, const char *loca
ret = -2; ret = -2;
/* fprintf(stderr, "Failed to open converter for '%s' (status %d)\n", encoding, status); */ /* fprintf(stderr, "Failed to open converter for '%s' (status %d)\n", encoding, status); */
} }
} while (0);
#endif #endif
return ret; return ret;

View File

@ -151,11 +151,11 @@ int main(int argc, const char *const *argv)
size_t len; size_t len;
int rc; int rc;
// read URLs from STDIN /* read URLs from STDIN */
while (fgets(buf, sizeof(buf), stdin)) { while (fgets(buf, sizeof(buf), stdin)) {
for (domain = buf; isspace(*domain); domain++); // skip leading spaces for (domain = buf; isspace(*domain); domain++); /* skip leading spaces */
if (*domain == '#' || !*domain) continue; // skip empty lines and comments if (*domain == '#' || !*domain) continue; /* skip empty lines and comments */
for (len = strlen(domain); len && isspace(domain[len - 1]); len--); // skip trailing spaces for (len = strlen(domain); len && isspace(domain[len - 1]); len--); /* skip trailing spaces */
domain[len] = 0; domain[len] = 0;
if ((rc = psl_str_to_utf8lower(domain, NULL, NULL, &lower)) != 0) if ((rc = psl_str_to_utf8lower(domain, NULL, NULL, &lower)) != 0)