From 8bf009e2162ec1a8fd7a6756c10f85e1236cfc15 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Wed, 22 Feb 2012 13:28:44 +0100 Subject: [PATCH] Silence coverity warning about sizeof(Node*) vs sizeof(Node) in QList Coverity was complaining about QList::node_copy using sizeof(Node *) instead of sizeof(Node). The complete message from Coverity is: "Passing argument "from" of type "struct QList::Node *" and argument "(to - from) * sizeof (struct QList::Node *) /*4*/" to function "memcpy" is suspicious. Did you intend to use "sizeof(struct QList::Node)" instead of "sizeof (struct QList::Node *)" ? In this particular case sizeof(struct QList::Node *) happens to be equal to sizeof(struct QList::Node), but this is not a portable assumption." Task-number: QTBUG-24443 Change-Id: I583887a8b4177a224664065e14f8780a9586c9a3 Reviewed-by: Thiago Macieira --- src/corelib/tools/qlist.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/tools/qlist.h b/src/corelib/tools/qlist.h index 8f36e5c2ae2..bf6933732c0 100644 --- a/src/corelib/tools/qlist.h +++ b/src/corelib/tools/qlist.h @@ -402,7 +402,7 @@ Q_INLINE_TEMPLATE void QList::node_copy(Node *from, Node *to, Node *src) } } else { if (src != from && to - from > 0) - memcpy(from, src, (to - from) * sizeof(Node *)); + memcpy(from, src, (to - from) * sizeof(Node)); } }