From patchwork Sat Nov 20 16:32:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 31515 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:d206:0:0:0:0:0 with SMTP id q6csp4226561iob; Sat, 20 Nov 2021 08:33:20 -0800 (PST) X-Google-Smtp-Source: ABdhPJwN0vMfARwVcZfMlPXLlTGOXwwdZ4YO28UCv7IAJfxMRnV3JT7/detAZuj7/wRMds6eeH6M X-Received: by 2002:a05:6402:3551:: with SMTP id f17mr34897703edd.129.1637426000316; Sat, 20 Nov 2021 08:33:20 -0800 (PST) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id hu16si5732674ejc.408.2021.11.20.08.33.19; Sat, 20 Nov 2021 08:33:20 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@outlook.com header.s=selector1 header.b=O3gvrTTn; arc=fail (body hash mismatch); spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=outlook.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 2BF6868A255; Sat, 20 Nov 2021 18:33:14 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-oln040092069072.outbound.protection.outlook.com [40.92.69.72]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 3690F6802C1 for ; Sat, 20 Nov 2021 18:33:07 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=m15ETAIn6HQ8xKi6q1EwrPEdDg+czEdsLVBxClo2DZFlA92O22i30dlsWsRVdl+3y4TDESAVh3DrK8l3MkYHU6oLfBFMLq8y8fjubag90N8vDjHLJnQUhx656yAPaKZLjTOFocXud9zE03oLGULV4AWeqXxscK4M7+JrLXzMkg5CCKcgnioIggV9etAF7X5RCiqaJPFsnrGuie8BZURylASQ9zI5xfe5YrFKAIl3flJE3q6PaFbhpfItiSy2eKJTm0j9cs6L19rWW7FKVojT+NhM4mWoBAKaYY5LmHdwiDhQmMVWnNz6Hx4LK5I19IxQVRdUrgKuZXfgewy1t7204g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=+qemubXDQHSZZMphK7Arpmaf2zM6Tp1a/o4sR6Gp1+g=; b=YmHnPfzN8uDjZn31Q8PIX0F7v/F4c8x+YCHIprpS91kyZ23aUrxl+orYrJzkhLCXHlL4Qln2jAK5fhlWs0eVndvIA8ijF+BTKCZBhFdrxzJhxG4zHbpvAPTrBldQxko2NfMJZsK5nlPwJ69Kg4F2KNtjYNUqguJxmqlEP8bKaNjqEoBOeDQmSqwC5eKcmKJWqlQm7mnB1AahZSRxCIKEubylxOEYTVNUbLv3e3vNwVcFLxvO7e87vz5tZwkrN+Vl5fj3KMsJeBuMgYCC+8lafh0VQNB+bSQ1TVJ5EVIVAfA7w0sfxT+GdQPSKCEB0kwcCQBa9sIGOKGb5l62CqOSnA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=+qemubXDQHSZZMphK7Arpmaf2zM6Tp1a/o4sR6Gp1+g=; b=O3gvrTTnq/b0ZrqHCTZZHQLHxD2G7DQoy2ykEUfi5tjo75K/i85RUoy2OEPYgdZKb1TPvJcmzW/KgIvp3eAE4vh2QZvArVgYpuI7+kdyrpEZshU8C3d22a1mpSpLkPtj0w+UvO2gFDWalLbyeK2eRHOiirBwCPTSeUVjh00Deod+OO5f0GcJdVop7U78NMmsBOaUypK7hTICVZ6mLJvRBEIvGzrlkiruS4MSP/QA7Gqr0ozdW6GWwXAGTWFP5ZYMDih43Jlrs9FPDZ4ZDrQBILDRKM0BuhgihpzZFw9M2lM5RjMucsoeaW2OJtnvqiUxAuPYijRMjvQDovP6logeGw== Received: from AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) by AM6PR03MB3687.eurprd03.prod.outlook.com (2603:10a6:209:30::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4690.22; Sat, 20 Nov 2021 16:33:05 +0000 Received: from AM7PR03MB6660.eurprd03.prod.outlook.com ([fe80::700f:d70b:3bb8:4d51]) by AM7PR03MB6660.eurprd03.prod.outlook.com ([fe80::700f:d70b:3bb8:4d51%9]) with mapi id 15.20.4713.024; Sat, 20 Nov 2021 16:33:05 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Sat, 20 Nov 2021 17:32:56 +0100 Message-ID: X-Mailer: git-send-email 2.30.2 X-TMN: [erwOCkXyE7nKRNrSfmkabZtzeZ+LaJgq] X-ClientProxiedBy: AM0PR02CA0140.eurprd02.prod.outlook.com (2603:10a6:20b:28d::7) To AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) X-Microsoft-Original-Message-ID: <20211120163257.1417652-1-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from sblaptop.fritz.box (188.192.137.12) by AM0PR02CA0140.eurprd02.prod.outlook.com (2603:10a6:20b:28d::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.22 via Frontend Transport; Sat, 20 Nov 2021 16:33:04 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7bf00c63-c97b-485c-d432-08d9ac436d93 X-MS-Exchange-SLBlob-MailProps: EpEO96k6Wol9fKQIkSXRM6aCPlv/tY+rFa6DwWNvV42YIha2tMmejo+iXCxFRdmWNZ7/cFt3on/fdUIis/A0/sgBiyTwcyMvzSmzxl1ywEVi1Dl7QbvMPY0irsoIhCOosPYFHeZE0DubTFtwDQ9ezg70bVW2yw7DWEbdXcuKIB1leSy/mRfp3fd7hWZmrsPKCop3gUGsjoxZpGLubX57X/WuBydkw8QkIM8EpMaIt5MYYXUKURTvzAdxlQwn5UUj+ZjosOYSO4qv8t+9VJRSgZCnLbyJt8U2+mBbBtCNvpztO5dV/PeUpI5fGZFm0Fvryk0qZTIL3p4nY9TtBMnG4UZeOY1y3RMHOliMCXGtSMWIKbqMxqQZv/8ysjyghTnrU4D20ebhjSczdTVgpVL22RWPrle1TPFDOMX+E+EddXHRdc/goq+Wc9yC5mjfumUWzuanj8K5qY2L8PEyGMFpDvRVjXup23Zqq8GtugovmSYcnX+Sn0lKRvEw+PbAOpQjbOcNWypUec1ffkBVFrUzZeiCzUO/hSNDP0tI830eYBy0glWV1oCwuuE3UQ35nIpd5pymofSivsddRhbVZHuPK3+foAK8YBceTKpJVtsqPYAQ473omw1J2ib9IxYH4i7QBadpXiu5kFfcKU9dhWjYvN3sp8y2fukWjT/OSByGldTDohX/5Q8lP5nKMZ+rtRMlM0pC3s8OzTlv0vR0s2df3Wt//vyX2OBZnWhFTAVU38lxkKq3tZ5Ur0tXJO3x09w4ShiU16OLqzc= X-MS-TrafficTypeDiag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yqUVHDLSLpRSnbVP0URTQvuBXdRopeIxzHGpBz/67oYrb1NnfZEBbLsgMxFvoIpZRzd0fAcsYYuwherHxSmk0x1QZovhdnWJF/zZPmKrp7YMbGfo5XPml7GZA/BmgWVNPuKKBfZq3DH8TgEeEdlylRUz7Q1VojEG2FJAkB1L1RVEwrsO+5+BofFeRgtp93o4CF6H5pO/LHSpGbu6VAGpRlJ85JyFC2IPSVrcNwv1QXIIzaaf//ME8hxWNzcSZZmOm6WVwc/p/WeeYcD1uJo+NeVnCCIrL1GFUFWX0dvPL/mjyEA5PRXiOeqDbg3+edk2INS3cSdUDqQct8fsDfamXfX6XmOh13v9aFa2Fj0yPi0KAR4Yl5+JYLAQ== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7bf00c63-c97b-485c-d432-08d9ac436d93 X-MS-Exchange-CrossTenant-AuthSource: AM7PR03MB6660.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Nov 2021 16:33:05.4938 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR03MB3687 Subject: [FFmpeg-devel] [PATCH 1/2] av(codec|device): Don't cast pointers to int X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: 5yKwnVlEMuwb C99/C11 6.3.2.3 5: "Any pointer type may be converted to an integer type. [...] If the result cannot be represented in the integer type, the behavior is undefined." So stop casting pointers to int; use uintptr_t instead. Signed-off-by: Andreas Rheinhardt --- When did these asserts actually help the last time? libavcodec/dvdec.c | 4 ++-- libavcodec/x86/h264_qpel.c | 8 ++++---- libavcodec/x86/me_cmp_init.c | 6 +++--- libavcodec/x86/mpegvideoenc_template.c | 2 +- libavdevice/xcbgrab.c | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/libavcodec/dvdec.c b/libavcodec/dvdec.c index a7424fd1d4..b72a67d01c 100644 --- a/libavcodec/dvdec.c +++ b/libavcodec/dvdec.c @@ -399,8 +399,8 @@ static int dv_decode_video_segment(AVCodecContext *avctx, void *arg) int retried = 0; int sta; - av_assert1((((int) mb_bit_buffer) & 7) == 0); - av_assert1((((int) vs_bit_buffer) & 7) == 0); + av_assert1((((uintptr_t) mb_bit_buffer) & 7) == 0); + av_assert1((((uintptr_t) vs_bit_buffer) & 7) == 0); retry: diff --git a/libavcodec/x86/h264_qpel.c b/libavcodec/x86/h264_qpel.c index a2d8a64976..320d98933a 100644 --- a/libavcodec/x86/h264_qpel.c +++ b/libavcodec/x86/h264_qpel.c @@ -338,7 +338,7 @@ static void OPNAME ## h264_qpel ## SIZE ## _mc21_ ## MMX(uint8_t *dst, const uin LOCAL_ALIGNED(ALIGN, uint8_t, temp, [SIZE*(SIZE<8?12:24)*2 + SIZE*SIZE]);\ uint8_t * const halfHV= temp;\ int16_t * const halfV= (int16_t*)(temp + SIZE*SIZE);\ - av_assert2(((int)temp & 7) == 0);\ + av_assert2(((uintptr_t)temp & 7) == 0);\ ff_put_h264_qpel ## SIZE ## _hv_lowpass_ ## MMX(halfHV, halfV, src, SIZE, SIZE, stride);\ ff_ ## OPNAME ## h264_qpel ## SIZE ## _h_lowpass_l2_ ## MMX(dst, src, halfHV, stride, SIZE);\ }\ @@ -348,7 +348,7 @@ static void OPNAME ## h264_qpel ## SIZE ## _mc23_ ## MMX(uint8_t *dst, const uin LOCAL_ALIGNED(ALIGN, uint8_t, temp, [SIZE*(SIZE<8?12:24)*2 + SIZE*SIZE]);\ uint8_t * const halfHV= temp;\ int16_t * const halfV= (int16_t*)(temp + SIZE*SIZE);\ - av_assert2(((int)temp & 7) == 0);\ + av_assert2(((uintptr_t)temp & 7) == 0);\ ff_put_h264_qpel ## SIZE ## _hv_lowpass_ ## MMX(halfHV, halfV, src, SIZE, SIZE, stride);\ ff_ ## OPNAME ## h264_qpel ## SIZE ## _h_lowpass_l2_ ## MMX(dst, src+stride, halfHV, stride, SIZE);\ }\ @@ -358,7 +358,7 @@ static void OPNAME ## h264_qpel ## SIZE ## _mc12_ ## MMX(uint8_t *dst, const uin LOCAL_ALIGNED(ALIGN, uint8_t, temp, [SIZE*(SIZE<8?12:24)*2 + SIZE*SIZE]);\ uint8_t * const halfHV= temp;\ int16_t * const halfV= (int16_t*)(temp + SIZE*SIZE);\ - av_assert2(((int)temp & 7) == 0);\ + av_assert2(((uintptr_t)temp & 7) == 0);\ ff_put_h264_qpel ## SIZE ## _hv_lowpass_ ## MMX(halfHV, halfV, src, SIZE, SIZE, stride);\ ff_ ## OPNAME ## pixels ## SIZE ## _l2_shift5_mmxext(dst, halfV+2, halfHV, stride, SIZE, SIZE);\ }\ @@ -368,7 +368,7 @@ static void OPNAME ## h264_qpel ## SIZE ## _mc32_ ## MMX(uint8_t *dst, const uin LOCAL_ALIGNED(ALIGN, uint8_t, temp, [SIZE*(SIZE<8?12:24)*2 + SIZE*SIZE]);\ uint8_t * const halfHV= temp;\ int16_t * const halfV= (int16_t*)(temp + SIZE*SIZE);\ - av_assert2(((int)temp & 7) == 0);\ + av_assert2(((uintptr_t)temp & 7) == 0);\ ff_put_h264_qpel ## SIZE ## _hv_lowpass_ ## MMX(halfHV, halfV, src, SIZE, SIZE, stride);\ ff_ ## OPNAME ## pixels ## SIZE ## _l2_shift5_mmxext(dst, halfV+3, halfHV, stride, SIZE, SIZE);\ }\ diff --git a/libavcodec/x86/me_cmp_init.c b/libavcodec/x86/me_cmp_init.c index 701eb1ab25..9af911bb88 100644 --- a/libavcodec/x86/me_cmp_init.c +++ b/libavcodec/x86/me_cmp_init.c @@ -131,7 +131,7 @@ static int vsad_intra16_mmx(MpegEncContext *v, uint8_t *pix, uint8_t *dummy, { int tmp; - av_assert2((((int) pix) & 7) == 0); + av_assert2(((uintptr_t) pix & 7) == 0); av_assert2((stride & 7) == 0); #define SUM(in0, in1, out0, out1) \ @@ -195,8 +195,8 @@ static int vsad16_mmx(MpegEncContext *v, uint8_t *pix1, uint8_t *pix2, { int tmp; - av_assert2((((int) pix1) & 7) == 0); - av_assert2((((int) pix2) & 7) == 0); + av_assert2(((uintptr_t)pix1 & 7) == 0); + av_assert2(((uintptr_t)pix2 & 7) == 0); av_assert2((stride & 7) == 0); #define SUM(in0, in1, out0, out1) \ diff --git a/libavcodec/x86/mpegvideoenc_template.c b/libavcodec/x86/mpegvideoenc_template.c index b32b1b0350..30c06a6b2c 100644 --- a/libavcodec/x86/mpegvideoenc_template.c +++ b/libavcodec/x86/mpegvideoenc_template.c @@ -109,7 +109,7 @@ static int RENAME(dct_quantize)(MpegEncContext *s, const uint16_t *qmat, *bias; LOCAL_ALIGNED_16(int16_t, temp_block, [64]); - av_assert2((7&(int)(&temp_block[0])) == 0); //did gcc align it correctly? + av_assert2((7&(uintptr_t)(&temp_block[0])) == 0); //did gcc align it correctly? //s->fdct (block); RENAME_FDCT(ff_fdct)(block); // cannot be anything else ... diff --git a/libavdevice/xcbgrab.c b/libavdevice/xcbgrab.c index 8164101c5e..64a68ba497 100644 --- a/libavdevice/xcbgrab.c +++ b/libavdevice/xcbgrab.c @@ -277,7 +277,7 @@ static int xcbgrab_frame_shm(AVFormatContext *s, AVPacket *pkt) av_log(s, AV_LOG_ERROR, "Could not get shared memory buffer.\n"); return AVERROR(ENOMEM); } - segment = (xcb_shm_seg_t)av_buffer_pool_buffer_get_opaque(buf); + segment = (xcb_shm_seg_t)(uintptr_t)av_buffer_pool_buffer_get_opaque(buf); iq = xcb_shm_get_image(c->conn, drawable, c->x, c->y, c->width, c->height, ~0,