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 F3E5E4922D for ; Tue, 7 May 2024 13:41:37 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 049CA68D705; Tue, 7 May 2024 16:41:35 +0300 (EEST) Received: from b-painless.mh.aa.net.uk (b-painless.mh.aa.net.uk [81.187.30.52]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id A470F68D624 for ; Tue, 7 May 2024 16:41:28 +0300 (EEST) Received: from 4.b.1.2.5.3.2.f.2.f.3.9.e.5.e.4.0.5.8.0.9.1.8.0.0.b.8.0.1.0.0.2.ip6.arpa ([2001:8b0:819:850:4e5e:93f2:f235:21b4] helo=andrews-2024-laptop.sayers) by painless-b.tch.aa.net.uk with smtp (Exim 4.96) (envelope-from ) id 1s4L4R-001Fc0-34 for ffmpeg-devel@ffmpeg.org; Tue, 07 May 2024 14:41:28 +0100 Date: Tue, 7 May 2024 14:41:21 +0100 From: Andrew Sayers To: FFmpeg development discussions and patches Message-ID: References: <819f684d-8a72-465d-ab22-3eef5bc3468b@gmail.com> <20240419190801.169291-1-ffmpeg-devel@pileofstuff.org> <458a73af-a0a3-a2f2-d881-e747fa2ea29a@passwd.hu> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <458a73af-a0a3-a2f2-d881-e747fa2ea29a@passwd.hu> Subject: Re: [FFmpeg-devel] [PATCH v3 1/3] avformat/network: add ff_neterrno2() for cases where we already have an errno 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: On Sun, May 05, 2024 at 09:59:28PM +0200, Marton Balint wrote: > > > On Fri, 19 Apr 2024, Andrew Sayers wrote: > > > For example, WSAStartup()'s documentation says: > > > > "A call to the WSAGetLastError function is not needed and should not be used" > > --- > > libavformat/network.c | 7 ++++++- > > 1 file changed, 6 insertions(+), 1 deletion(-) > > > > diff --git a/libavformat/network.c b/libavformat/network.c > > index f752efc411..fb70f9cafc 100644 > > --- a/libavformat/network.c > > +++ b/libavformat/network.c > > @@ -121,9 +121,14 @@ void ff_network_close(void) > > } > > > > #if HAVE_WINSOCK2_H > > + > > +} > > int ff_neterrno(void) > > { > > - int err = WSAGetLastError(); > > + return ff_neterrno2(WSAGetLastError()); > > +} > > +int ff_neterrno2(int err) > > ff_neterror(int err) would be a better name, since it has nothing to do with > errno. > > Regards. > Marton Not sure which one you're proposing to rename, but if the original ff_neterrno() was documented, I think it would say something like: /* * @brief AVERROR for the latest network function * @return AVERROR based on `WSAGetLastError()` (Windows) or `errno` (otherwise) */ ... and neterrno2 would be something like: /* * @brief ff_neterrno()-style AVERROR * @param err error code (usually an errno or Windows Sockets Error Code) * @return AVERROR equivalent to err */ So neither necessarily have anything to do with errno. How about adding the above documentation then doing s/ff_neterrno(2?)/ff_neterror\1/g ? Note: this was supposed to be a quick patch documenting the existing behaviour of a single function, and has now scope-crept up to a fairly sizeable refactor of a barely-related function. I don't mind working on this sort of thing in principle, but would like to land this particular patch before things get too much further out of hand. _______________________________________________ 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".