| 47 | } |
| 48 | |
| 49 | int memicmp(const void* buf1, const void* buf2, size_t len) |
| 50 | { |
| 51 | auto p1 = static_cast<const unsigned char*>(buf1); |
| 52 | auto p2 = static_cast<const unsigned char*>(buf2); |
| 53 | |
| 54 | if(p1 == p2) { |
| 55 | return 0; |
| 56 | } |
| 57 | |
| 58 | int result = 0; |
| 59 | while(len-- && (result = tolower(*p1++) - tolower(*p2++)) == 0) { |
| 60 | } |
| 61 | |
| 62 | return result; |
| 63 | } |
| 64 | |
| 65 | char hexchar(unsigned char c) |
| 66 | { |