tag 672085 + fixed-upstream quit I've chosen to implement the anonymous union patch from http://sourceware.org/git/?p=glibc.git;a=patch;h=7dc6bd90c569c49807462b0740b18e32fab4d8b7 by Ulrich Drepper <[email protected]> in as far as that patch applies to the md5 code remaining in QOF.
(svn diff attached) I've got some more testing to do but this looks good, I expect to be able to make a new upstream release in a few days. -- Neil Williams ============= http://www.linux.codehelp.co.uk/
Index: qof/md5.c
===================================================================
--- qof/md5.c (revision 1327)
+++ qof/md5.c (working copy)
@@ -1,6 +1,6 @@
/* md5.c - Functions to compute MD5 message digest of files or memory blocks
according to the definition of MD5 in RFC 1321 from April 1992.
- Copyright (C) 1995, 1996 Free Software Foundation, Inc.
+ Copyright (C) 1995, 1996, 2011 Free Software Foundation, Inc.
NOTE: The canonical source of this file is maintained with the GNU C
Library. Bugs can be reported to [email protected].
@@ -116,9 +116,9 @@
memcpy (&ctx->buffer[bytes], fillbuf, pad);
/* Put the 64-bit file length in *bits* at the end of the buffer. */
- *(md5_uint32 *) & ctx->buffer[bytes + pad] = SWAP (ctx->total[0] << 3);
- *(md5_uint32 *) & ctx->buffer[bytes + pad + 4] =
- SWAP ((ctx->total[1] << 3) | (ctx->total[0] >> 29));
+ ctx->buffer32[(bytes + pad) / 4] = SWAP (ctx->total[0] << 3);
+ ctx->buffer32[(bytes + pad + 4) / 4] = SWAP ((ctx->total[1] << 3) |
+ (ctx->total[0] >> 29));
/* Process last bytes. */
md5_process_block (ctx->buffer, bytes + pad + 8, ctx);
Index: qof/md5.h
===================================================================
--- qof/md5.h (revision 1327)
+++ qof/md5.h (working copy)
@@ -1,6 +1,6 @@
/* md5.h - Declaration of functions and data types used for MD5 sum
computing library functions.
- Copyright (C) 1995, 1996 Free Software Foundation, Inc.
+ Copyright (C) 1995, 1996, 2011 Free Software Foundation, Inc.
NOTE: The canonical source of this file is maintained with the GNU C
Library. Bugs can be reported to [email protected].
@@ -86,7 +86,11 @@
md5_uint32 total[2];
md5_uint32 buflen;
- char buffer[128];
+ union
+ {
+ char buffer[128];
+ md5_uint32 buffer32[32];
+ };
};
/*
Index: ChangeLog
===================================================================
--- ChangeLog (revision 1330)
+++ ChangeLog (working copy)
@@ -1,3 +1,9 @@
+2012-05-29 Neil Williams <[email protected]>
+
+ * Apply patch by Ulrich Drepper <[email protected]>
+ to use anonymous union instead of type punning in
+ md5.c|h to avoid compiler error with strict aliasing.
+
2012-03-25 Neil Williams <[email protected]>
* Reimplement the deprecated GCache which is due for
pgplrqJhktgSW.pgp
Description: PGP signature

