From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 825E145201 for ; Thu, 13 Apr 2023 02:11:41 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id C4201689FE5; Thu, 13 Apr 2023 05:11:37 +0300 (EEST) Received: from mail-oa1-f50.google.com (mail-oa1-f50.google.com [209.85.160.50]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E4D95680303 for ; Thu, 13 Apr 2023 05:11:31 +0300 (EEST) Received: by mail-oa1-f50.google.com with SMTP id 586e51a60fabf-1879502e2afso4730fac.5 for ; Wed, 12 Apr 2023 19:11:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681351889; x=1683943889; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=uVuPO0yC+c/i8v04VSms1LPCONLiAOC6uKRyn1RIEjU=; b=bxpWmnNX3ak2ZrzQtFHLiiWRrfJYfUaCoesPJJDJBun/iRb8TOKFtIKSJMYSwda4Eu cIkAfR5qYpXuT/A8oquFxQWb8TV2pTsK/I1hztDgTvuprvf5MczqtPwyuWZiAHQQezEr Rk84VBoSYiJz0gb67a8T85oDVyc8T9teFz5rYdY8J+cLYoh0xGMLAGOP4njq2pe3Zixb Dpaos9l/p2pgzGFpJ2gXHr/E4vkPYR3NM5/7nz8zdMruSnifUoVnjoIftvK/2Q5g+skG vveLL6nfZasISeK8zCyT33cqNh/jto/3p8vHHY0j+TUEoBbP219BOGAywWMs3vb98fL7 DP+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681351889; x=1683943889; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=uVuPO0yC+c/i8v04VSms1LPCONLiAOC6uKRyn1RIEjU=; b=i6HsEPkYvS8iQ8fZwPbp6X/Qivz04zlTtra4o9JhhTJ2Kuyiu9tZWeiguooiy0z85u 3b8TPI77//d41B2u2OENPSyn45Ge4BrC4pEWsABiwbxolb6mnfUcbGYDb3dQ9iVwkEXx 7S8FgLJ/LqFvWgTHrw9NPmNIj/uIzoXatuL0McgLr1FUM/hPq/k3eCBQ/kxxaqBWdeIP cx8Ko3jd3xF4kPul/M9QL6ZGjXhjy2Echzlrri7iJrboRJMohCPE6j5Ja+doziw//jHO nAO3BXmkVGFThZaG/mzF/FGVa+aTkhO3UP3Jb5Zqt4CLajeDmBkvyqCY6ajELNWHFRYc hz/g== X-Gm-Message-State: AAQBX9dF5ikLOwWzttbezsvcciCbDrzPqPijE2vWIxDWiui7zu8ZHc/Z +gUfWq1DmUS4boE8SYgApa8kxIFm95c= X-Google-Smtp-Source: AKy350ZngdBqAngjwPftiZg2CxlTGx+0Ig5WArWqoCyd5Im+wbpyB5QRLm1GXrPutWI/0u5jAJpt5A== X-Received: by 2002:a05:6870:9598:b0:186:906d:5b26 with SMTP id k24-20020a056870959800b00186906d5b26mr558817oao.14.1681351889700; Wed, 12 Apr 2023 19:11:29 -0700 (PDT) Received: from localhost.localdomain (host197.190-225-105.telecom.net.ar. [190.225.105.197]) by smtp.gmail.com with ESMTPSA id dy16-20020a056870c79000b0017197629658sm253660oab.56.2023.04.12.19.11.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Apr 2023 19:11:29 -0700 (PDT) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Wed, 12 Apr 2023 23:11:06 -0300 Message-Id: <20230413021106.44992-1-jamrial@gmail.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230413015356.44961-2-jamrial@gmail.com> References: <20230413015356.44961-2-jamrial@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/2 v2] avutil/wchar_filename: propagate MultiByteToWideChar() and WideCharToMultiByte() failures 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 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: Don't return success if the string could not be converted. Signed-off-by: James Almer --- libavutil/wchar_filename.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libavutil/wchar_filename.h b/libavutil/wchar_filename.h index 9a04a069f1..fbc0a55146 100644 --- a/libavutil/wchar_filename.h +++ b/libavutil/wchar_filename.h @@ -32,7 +32,8 @@ static inline int utf8towchar(const char *filename_utf8, wchar_t **filename_w) num_chars = MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, filename_utf8, -1, NULL, 0); if (num_chars <= 0) { *filename_w = NULL; - return 0; + errno = EINVAL; + return -1; } *filename_w = (wchar_t *)av_calloc(num_chars, sizeof(wchar_t)); if (!*filename_w) { @@ -52,7 +53,8 @@ static inline int wchartocp(unsigned int code_page, const wchar_t *filename_w, NULL, 0, NULL, NULL); if (num_chars <= 0) { *filename = NULL; - return 0; + errno = EINVAL; + return -1; } *filename = (char*)av_malloc_array(num_chars, sizeof *filename); if (!*filename) { -- 2.40.0 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".