X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Ftool%2Ftool.c;h=3b9cc255aed18141c38d6548804798bf396ff125;hb=61d1c864c55291c1f5f81f284e984b044fe2722f;hp=eb6c131e428462e81d3aad67075c721b429edd00;hpb=74be9040183c113d5cb62ad25782099479a5c450;p=ngircd-alex.git diff --git a/src/tool/tool.c b/src/tool/tool.c index eb6c131e..3b9cc255 100644 --- a/src/tool/tool.c +++ b/src/tool/tool.c @@ -84,7 +84,7 @@ ngt_UpperStr(char *String) ptr = String; while(*ptr) { - *ptr = toupper(*ptr); + *ptr = toupper((int)*ptr); ptr++; } return String; @@ -103,7 +103,7 @@ ngt_LowerStr(char *String) ptr = String; while(*ptr) { - *ptr = tolower(*ptr); + *ptr = tolower((int)*ptr); ptr++; } return String; @@ -144,11 +144,16 @@ ngt_RandomStr(char *String, const size_t len) assert(String != NULL); gettimeofday(&t, NULL); +#ifndef HAVE_ARC4RANDOM srand((unsigned)(t.tv_usec * t.tv_sec)); for (i = 0; i < len; ++i) { String[i] = chars[rand() % (sizeof(chars) - 1)]; } +#else + for (i = 0; i < len; ++i) + String[i] = chars[arc4random() % (sizeof(chars) - 1)]; +#endif String[len] = '\0'; return String;