Revision: 990
http://www.exim.org/viewvc/pcre2?view=rev&revision=990
Author: ph10
Date: 2018-08-21 12:27:35 +0100 (Tue, 21 Aug 2018)
Log Message:
-----------
Minor code fix to get rid of Coverity warning (I hope).
Modified Paths:
--------------
code/trunk/src/pcre2_serialize.c
Modified: code/trunk/src/pcre2_serialize.c
===================================================================
--- code/trunk/src/pcre2_serialize.c 2018-08-19 16:54:41 UTC (rev 989)
+++ code/trunk/src/pcre2_serialize.c 2018-08-21 11:27:35 UTC (rev 990)
@@ -7,7 +7,7 @@
Written by Philip Hazel
Original API code Copyright (c) 1997-2012 University of Cambridge
- New API code Copyright (c) 2016-2017 University of Cambridge
+ New API code Copyright (c) 2016-2018 University of Cambridge
-----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
@@ -133,14 +133,18 @@
deserialization. In order to ensure that the serialized data stream is always
the same for the same pattern, set them to zero here. We can't assume the
copy of the pattern is correctly aligned for accessing the fields as part of
- a structure. */
+ a structure. Note the use of sizeof(void *) in the second of these, to
+ specify the size of a pointer. If sizeof(uint8_t *) is used (tables is a
+ pointer to uint8_t), gcc gives a warning because the first argument is also a
+ pointer to uint8_t. Casting the first argument to (void *) can stop this, but
+ it didn't stop Coverity giving the same complaint. */
- (void)memset((void *)(dst_bytes + offsetof(pcre2_real_code, memctl)), 0,
+ (void)memset(dst_bytes + offsetof(pcre2_real_code, memctl), 0,
sizeof(pcre2_memctl));
- (void)memset((void *)(dst_bytes + offsetof(pcre2_real_code, tables)), 0,
- sizeof(uint8_t *));
- (void)memset((void *)(dst_bytes + offsetof(pcre2_real_code, executable_jit)),
- 0, sizeof(void *));
+ (void)memset(dst_bytes + offsetof(pcre2_real_code, tables), 0,
+ sizeof(void *));
+ (void)memset(dst_bytes + offsetof(pcre2_real_code, executable_jit), 0,
+ sizeof(void *));
dst_bytes += re->blocksize;
}