diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2024-02-15 11:18:34 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2024-02-15 11:18:34 -0300 |
commit | 7237eb3f1c480d6bc7fe2832ddd36f2137fb69d9 (patch) | |
tree | 618bb144df3f37b000fc12db0738a5d3ec3efbef /lauxlib.c | |
parent | 165389b27bc54e7c5214276db177e3ef75226f18 (diff) | |
download | lua-7237eb3f1c480d6bc7fe2832ddd36f2137fb69d9.tar.gz lua-7237eb3f1c480d6bc7fe2832ddd36f2137fb69d9.tar.bz2 lua-7237eb3f1c480d6bc7fe2832ddd36f2137fb69d9.zip |
Fixed warnings from different compilers
Diffstat (limited to 'lauxlib.c')
-rw-r--r-- | lauxlib.c | 9 |
1 files changed, 6 insertions, 3 deletions
@@ -1131,8 +1131,11 @@ static void warnfon (void *ud, const char *message, int tocont) { | |||
1131 | /* Size for the buffer in int's, rounded up */ | 1131 | /* Size for the buffer in int's, rounded up */ |
1132 | #define BUFSEED ((BUFSEEDB + sizeof(int) - 1) / sizeof(int)) | 1132 | #define BUFSEED ((BUFSEEDB + sizeof(int) - 1) / sizeof(int)) |
1133 | 1133 | ||
1134 | 1134 | /* | |
1135 | #define addbuff(b,v) (memcpy(b, &(v), sizeof(v)), b += sizeof(v)) | 1135 | ** Copy the contents of variable 'v' into the buffer pointed by 'b'. |
1136 | ** (The '&b[0]' disguises 'b' to fix an absurd warning from clang.) | ||
1137 | */ | ||
1138 | #define addbuff(b,v) (memcpy(&b[0], &(v), sizeof(v)), b += sizeof(v)) | ||
1136 | 1139 | ||
1137 | 1140 | ||
1138 | static unsigned int luai_makeseed (void) { | 1141 | static unsigned int luai_makeseed (void) { |
@@ -1146,7 +1149,7 @@ static unsigned int luai_makeseed (void) { | |||
1146 | /* fill (rare but possible) remain of the buffer with zeros */ | 1149 | /* fill (rare but possible) remain of the buffer with zeros */ |
1147 | memset(b, 0, sizeof(buff) - BUFSEEDB); | 1150 | memset(b, 0, sizeof(buff) - BUFSEEDB); |
1148 | res = buff[0]; | 1151 | res = buff[0]; |
1149 | for (i = 0; i < BUFSEED; i++) | 1152 | for (i = 1; i < BUFSEED; i++) |
1150 | res ^= (res >> 3) + (res << 7) + buff[i]; | 1153 | res ^= (res >> 3) + (res << 7) + buff[i]; |
1151 | return res; | 1154 | return res; |
1152 | } | 1155 | } |