bits: Fix warnings

This commit is contained in:
Nicolas Williams
2022-01-03 16:05:01 -06:00
parent 581ca3d44f
commit ee2a92c547

View File

@@ -46,21 +46,21 @@ RCSID("$Id$");
#include <ws2tcpip.h> #include <ws2tcpip.h>
#endif #endif
#define BITSIZE(TYPE) \ #define BITSIZE(TYPE) \
{ \ { \
int b = 0; TYPE x = 1, zero = 0; const char *pre = "u"; \ int b = 0; TYPE x = 1, zero = 0; const char *pre = "u"; \
char tmp[128], tmp2[128]; \ char tmp[128]; \
while(x){ x <<= 1; b++; if(x < zero) pre=""; } \ while(x){ x <<= 1; b++; if(x < zero) pre=""; } \
if(b >= len){ \ if(b >= len){ \
size_t tabs; \ size_t tabs; \
sprintf(tmp, "%sint%d_t" , pre, len); \ snprintf(tmp, sizeof(tmp), "typedef %s %sint%d_t;", #TYPE, \
sprintf(tmp2, "typedef %s %s;", #TYPE, tmp); \ pre, len); \
tabs = 5 - strlen(tmp2) / 8; \ tabs = 5 - strlen(tmp) / 8; \
fprintf(f, "%s", tmp2); \ fprintf(f, "%s", tmp); \
while(tabs-- > 0) fprintf(f, "\t"); \ while(tabs-- > 0) fprintf(f, "\t"); \
fprintf(f, "/* %2d bits */\n", b); \ fprintf(f, "/* %2d bits */\n", b); \
return; \ return; \
} \ } \
} }
#ifndef HAVE___ATTRIBUTE__ #ifndef HAVE___ATTRIBUTE__