mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-05 22:20:24 -08:00
Remove assumption of uint64_t etc. in portable code
C11 doesn’t guarantee the existence of types like uint64_t, so avoid these types in portable code, as it’s easy to do so. There’s no need to avoid the types in w32-specific code, since w32 is guaranteed to have them. * lib-src/make-fingerprint.c (main): * src/fingerprint-dummy.c: * src/fingerprint.h: * src/pdumper.c (dump_fingerprint, struct dump_header): Prefer unsigned char to uint8_t in portable code, as either will do. Put an "#include <config.h>" in fingerprint.c files, so that the corresponding .o file is rebuilt after ./configure is run. * lib-src/make-fingerprint.c (main): Simplify loop. * src/Makefile.in (fingerprint.c): Update atomically. * src/pdumper.c: Omit unnecessary check that off_t is the same size as int32_t or int64_t, as the code does not rely on this assumption. (dump_off): Use int_least32_t, not int32_t. (struct dump_reloc): Use unsigned int, not uint32_t. (dump_anonymous_allocate_w32, dump_anonymous_allocate_posix) (dump_anonymous_allocate, dump_map_file_w32, dump_map_file_posix) (dump_map_file: Do the sanity checks at compile time, not at run-time, to avoid usage of uint64_t etc. on non-w32 platforms.
This commit is contained in:
parent
44a39e3e76
commit
e44ff2de81
5 changed files with 47 additions and 70 deletions
|
|
@ -89,7 +89,7 @@ main (int argc, char **argv)
|
|||
fclose (f);
|
||||
}
|
||||
|
||||
uint8_t digest[32];
|
||||
unsigned char digest[32];
|
||||
sha256_finish_ctx (&ctx, digest);
|
||||
|
||||
if (raw)
|
||||
|
|
@ -99,12 +99,12 @@ main (int argc, char **argv)
|
|||
}
|
||||
else
|
||||
{
|
||||
printf ("#include \"fingerprint.h\"\n");
|
||||
printf ("\n");
|
||||
printf ("const uint8_t fingerprint[32] = { ");
|
||||
puts ("#include <config.h>\n"
|
||||
"#include \"fingerprint.h\"\n"
|
||||
"unsigned char const fingerprint[] = {");
|
||||
for (int i = 0; i < 32; ++i)
|
||||
printf ("%s0x%02X", i ? ", " : "", digest[i]);
|
||||
printf (" };\n");
|
||||
printf ("\t0x%02X,\n", digest[i]);
|
||||
puts ("};");
|
||||
}
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue