From: Andreas Schwab Date: Tue, 26 Mar 2013 09:11:04 +0000 (+0100) Subject: Fix misuses of memset X-Git-Tag: BASE-SuSE-Code-12_3-Branch~74^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4fdcd20f51b515107a285968f3b0c1f6c68801d5;p=thirdparty%2Flibsolv.git Fix misuses of memset src/md5.c: In function 'sat_MD5_Final': src/md5.c:269:23: error: argument to 'sizeof' in 'memset' call is the same expression as the destination; did you mean to dereference it? [-Werror=sizeof-pointer-memaccess] memset(ctx, 0, sizeof(ctx)); ^ examples/solv.c: In function 'read_repos': examples/solv.c:1616:27: error: argument to 'sizeof' in 'memset' call is the same expression as the destination; did you mean to remove the addressof? [-Werror=sizeof-pointer-memaccess] memset(&stb, 0, sizeof(&stb)); ^ --- diff --git a/examples/solv.c b/examples/solv.c index 235f3bc0..7d3b0684 100644 --- a/examples/solv.c +++ b/examples/solv.c @@ -1706,16 +1706,16 @@ read_repos(Pool *pool, struct repoinfo *repoinfos, int nrepoinfos) #if defined(ENABLE_RPMDB) && (defined(SUSE) || defined(FEDORA)) printf("rpm database:"); if (stat(pool_prepend_rootdir_tmp(pool, "/var/lib/rpm/Packages"), &stb)) - memset(&stb, 0, sizeof(&stb)); + memset(&stb, 0, sizeof(stb)); #endif #if defined(ENABLE_DEBIAN) && defined(DEBIAN) printf("dpgk database:"); if (stat(pool_prepend_rootdir_tmp(pool, "/var/lib/dpkg/status"), &stb)) - memset(&stb, 0, sizeof(&stb)); + memset(&stb, 0, sizeof(stb)); #endif #ifdef NOSYSTEM printf("no installed database:"); - memset(&stb, 0, sizeof(&stb)); + memset(&stb, 0, sizeof(stb)); #endif calc_checksum_stat(&stb, REPOKEY_TYPE_SHA256, 0, installedcookie); if (usecachedrepo(repo, 0, installedcookie, 0)) diff --git a/src/md5.c b/src/md5.c index 85bbd6ad..0431b50a 100644 --- a/src/md5.c +++ b/src/md5.c @@ -266,5 +266,5 @@ void solv_MD5_Final(unsigned char *result, MD5_CTX *ctx) result[14] = ctx->d >> 16; result[15] = ctx->d >> 24; - memset(ctx, 0, sizeof(ctx)); + memset(ctx, 0, sizeof(*ctx)); }