Explorar o código

Silence clang warnings

enclink.c:127:6: warning: cast from 'char *' to 'uint32_t *' (aka 'unsigned int *') increases required alignment from 1 to 4 [-Wcast-align]
    *(uint32_t *) & key[0] = prand(&seed, 0xFFFFFFFF);
     ^~~~~~~~~~~~~~~~~~~~~
enclink.c:128:6: warning: cast from 'char *' to 'uint32_t *' (aka 'unsigned int *') increases required alignment from 1 to 4 [-Wcast-align]
    *(uint32_t *) & key[4] = prand(&seed, 0xFFFFFFFF);
     ^~~~~~~~~~~~~~~~~~~~~
enclink.c:129:6: warning: cast from 'char *' to 'uint32_t *' (aka 'unsigned int *') increases required alignment from 1 to 4 [-Wcast-align]
    *(uint32_t *) & key[8] = prand(&seed, 0xFFFFFFFF);
     ^~~~~~~~~~~~~~~~~~~~~
enclink.c:130:6: warning: cast from 'char *' to 'uint32_t *' (aka 'unsigned int *') increases required alignment from 1 to 4 [-Wcast-align]
    *(uint32_t *) & key[12] = prand(&seed, 0xFFFFFFFF);
     ^~~~~~~~~~~~~~~~~~~~~~
4 warnings generated.
Bryan Drewery %!s(int64=13) %!d(string=hai) anos
pai
achega
83ee695dc3
Modificáronse 1 ficheiros con 4 adicións e 4 borrados
  1. 4 4
      src/enclink.c

+ 4 - 4
src/enclink.c

@@ -124,10 +124,10 @@ static void
 rotate_key(char* key, int& seed)
 {
   if (seed) {
-    *(uint32_t *) & key[0] = prand(&seed, 0xFFFFFFFF);
-    *(uint32_t *) & key[4] = prand(&seed, 0xFFFFFFFF);
-    *(uint32_t *) & key[8] = prand(&seed, 0xFFFFFFFF);
-    *(uint32_t *) & key[12] = prand(&seed, 0xFFFFFFFF);
+    *(uint32_t *) (&key + 0)  = prand(&seed, 0xFFFFFFFF);
+    *(uint32_t *) (&key + 4)  = prand(&seed, 0xFFFFFFFF);
+    *(uint32_t *) (&key + 8)  = prand(&seed, 0xFFFFFFFF);
+    *(uint32_t *) (&key + 12) = prand(&seed, 0xFFFFFFFF);
 
     if (!seed)
       seed++;