Explicity cast to char*
authorKevin Klues <klueska@cs.berkeley.edu>
Sat, 18 Jul 2015 17:13:51 +0000 (10:13 -0700)
committerKevin Klues <klueska@cs.berkeley.edu>
Sat, 18 Jul 2015 17:16:20 +0000 (10:16 -0700)
When you subtract 2 pointers you end up with a long, so you need to
explicity cast back to the proper pointer type to avoid a warning.

tools/compilers/gcc-glibc/glibc-2.19-akaros/sysdeps/akaros/serialize.c

index d8c1fd0..7530da0 100644 (file)
@@ -58,12 +58,12 @@ struct serialized_data* serialize_argv_envp(char* const* argv,
        *sd_argc = argc;
        *sd_envc = envc;
        for (int i = 0; i < argc; i++) {
-               ppos[i] = vpos - vpos_base;
+               ppos[i] = (char*)(vpos - vpos_base);
                memcpy(vpos, argv[i], arglens[i]);
                vpos += arglens[i];
        }
        for(int i = 0; i < envc; i++) {
-               ppos[argc + i] = vpos - vpos_base;
+               ppos[argc + i] = (char*)(vpos - vpos_base);
                memcpy(vpos, envp[i], envlens[i]);
                vpos += envlens[i];
        }