From d50e9a46772651d03329f7d02f0e67d13c014c5d Mon Sep 17 00:00:00 2001 From: Pablo Barciela Date: Fri, 8 Mar 2019 23:14:25 +0100 Subject: caja-file-operations: add comment with false positive warning: False positive warning with Clang static analyzer: caja-file-operations.c:958:11: warning: Cast a region whose size is not a multiple of the destination type size common = g_malloc0 (job_size); ^~~~~~~~~~~~~~~~~~~~ --- libcaja-private/caja-file-operations.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/libcaja-private/caja-file-operations.c b/libcaja-private/caja-file-operations.c index a12d730c..c5223d0e 100644 --- a/libcaja-private/caja-file-operations.c +++ b/libcaja-private/caja-file-operations.c @@ -955,6 +955,14 @@ init_common (gsize job_size, CommonJob *common; GdkScreen *screen; + /* expected warning with Clang static analyzer: * + * "Cast a region whose size is not a multiple of the destination type size" * + * * + * It is expected for job_size to be larger than sizeof(CommonJob) no matter * + * what Clang analyzer reports: we're allocating the whole structure for a job * + * (e.g. a TrashJob), but only initializing the common part of it (CommonJob) * + * which is a subset of all "real" job structures, structures that all start * + * with a CommonJob, and that thus can be used as such. */ common = g_malloc0 (job_size); if (parent_window) { -- cgit v1.2.1