summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPablo Barciela <[email protected]>2019-03-08 23:14:25 +0100
committerZenWalker <[email protected]>2019-03-22 13:10:25 +0100
commitd50e9a46772651d03329f7d02f0e67d13c014c5d (patch)
treed8ff714ca35a5fa02c50cf585d0dcdaaaa1e189c
parentbdceb0f13d5b70ea8d5b4208031884e64b4753d4 (diff)
downloadcaja-d50e9a46772651d03329f7d02f0e67d13c014c5d.tar.bz2
caja-d50e9a46772651d03329f7d02f0e67d13c014c5d.tar.xz
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); ^~~~~~~~~~~~~~~~~~~~
-rw-r--r--libcaja-private/caja-file-operations.c8
1 files changed, 8 insertions, 0 deletions
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) {