[Ffmpeg-devel] Network patch for MingW users
Måns Rullgård
mans
Wed Feb 21 16:36:57 CET 2007
Alex Beregszaszi said:
> Hi,
>
>> >> Actually, I don't like the neterrno macro at all. I'd prefer a macro
>> >> for retrieving the error code and some form of translation from E* codes
>> >> to WS* codes. The former of these would simply return errno on POSIX
>> >> systems and call WSAGetLastErrorUsingAnUglyFunctionName() on Windows. The
>> >> latter I don't know exactly what is required for.
>> >
>> > Actually neterrno() does the same what you say.
>>
>> Does not. In the patch you sent, it compares something to the supplied
>> argument, which I find confusing. That's not how things normally operate.
>
> ??
>
> av_neterrno(err) compares err to errno on unix
> av_neterrno(err) compares WSAerr to WSASomething() on windows
Yes, and I don't like it that way.
> In case the WSAerr part irritates you, how would you solve this? Adding
> a huge switch/case blob? After all you hate #ifdefs in other part of the
> code, including the errno handling, thus we need to pass only unix errno
> name, not windows ones.
I had something like this in mind:
#if SANE_SYSTEM
#define ff_network_errno() errno
#define FF_NETWORK_ERROR(err) err
#elif WINDOWS
#define ff_network_errno() WSAError()
#define FF_NETWORK_ERROR(err) WSA##err
#endif
/* ... */
if(ff_network_errno() == FF_NETWORK_ERROR(EFOO)){
deal_with_it();
}
It's slightly more code, but it makes the code easier to understand without
looking up the definitions of the macros.
--
M?ns Rullg?rd
mans at mansr.com
More information about the ffmpeg-devel
mailing list