Re: [Freeciv-Dev] (PR#40057) strerror->mystrerror
http://bugs.freeciv.org/Ticket/Display.html?id=40057 > On Jan 31, 2008 8:35 AM, Marko Lindqvist <[EMAIL PROTECTED]> wrote: > > http://bugs.freeciv.org/Ticket/Display.html?id=40057 > > > On 27/01/2008, Jason Dorje Short <[EMAIL PROTECTED]> wrote: > > > > mystrerror is included in support.c. Two places don't use this but > > access strerror directly. This patch fixes it (for 2.1). > > That broke compilation. > mystrerror() takes no arguments, but just uses errno directly. I'll > fix compilation ASAP. > > > I'd vote for changing mystrerror() to take error number as argument, > so it is possibly for caller to store errno and postpone mystrerror() > call without risking errno overwrite. All this in a fashion compatible > with Windows version of mystrerror(), of course. Wow, quite a typo for a 2-line patch. My bad. And yes, I agree with you; mystrerror should be a drop-in for strerror. The drawback is as you can see in mystrerror that windows does not have the errno token IIRC. At best we'd be looking at something like myerrno and another poisoned token. -jason ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
Re: [Freeciv-Dev] (PR#40057) strerror->mystrerror
http://bugs.freeciv.org/Ticket/Display.html?id=40057 > On 27/01/2008, Jason Dorje Short <[EMAIL PROTECTED]> wrote: > > mystrerror is included in support.c. Two places don't use this but > access strerror directly. This patch fixes it (for 2.1). That broke compilation. mystrerror() takes no arguments, but just uses errno directly. I'll fix compilation ASAP. I'd vote for changing mystrerror() to take error number as argument, so it is possibly for caller to store errno and postpone mystrerror() call without risking errno overwrite. All this in a fashion compatible with Windows version of mystrerror(), of course. - ML ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] (PR#40057) strerror->mystrerror
http://bugs.freeciv.org/Ticket/Display.html?id=40057 > Committed. S2_1, 14357 S2_2, 14358 trunk, 14359 ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
Re: [Freeciv-Dev] (PR#40057) strerror->mystrerror
http://bugs.freeciv.org/Ticket/Display.html?id=40057 > Jason, the requisite time has passed -- are you committing this, or am I? ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
Re: [Freeciv-Dev] (PR#40057) strerror->mystrerror
http://bugs.freeciv.org/Ticket/Display.html?id=40057 > Jason Dorje Short wrote: > If you are asking about encodings, gui-sdl uses the call inside freelog > which expects the string in the internal encoding (utf-8). > OK. > Can we remove gui-mui? > Already done (2.2 and beyond). ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
Re: [Freeciv-Dev] (PR#40057) strerror->mystrerror
http://bugs.freeciv.org/Ticket/Display.html?id=40057 > William Allen Simpson wrote: > http://bugs.freeciv.org/Ticket/Display.html?id=40057 > > > Jason Dorje Short wrote: >> mystrerror is included in support.c. Two places don't use this but >> access strerror directly. This patch fixes it (for 2.1). >> > Yes, but gui-mui isn't used anymore, and gui-sdl has it in its local > version of iconv. Does this do the right thing? mystrerror is provided for portability; strerror presumably does not work as intended on windows. So it is mystrerror that should be used. If you are asking about encodings, gui-sdl uses the call inside freelog which expects the string in the internal encoding (utf-8). Can we remove gui-mui? -jason ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
Re: [Freeciv-Dev] (PR#40057) strerror->mystrerror
http://bugs.freeciv.org/Ticket/Display.html?id=40057 > Jason Dorje Short wrote: > mystrerror is included in support.c. Two places don't use this but > access strerror directly. This patch fixes it (for 2.1). > Yes, but gui-mui isn't used anymore, and gui-sdl has it in its local version of iconv. Does this do the right thing? ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] (PR#40057) strerror->mystrerror
http://bugs.freeciv.org/Ticket/Display.html?id=40057 > mystrerror is included in support.c. Two places don't use this but access strerror directly. This patch fixes it (for 2.1). -jason Index: client/gui-sdl/gui_iconv.c === --- client/gui-sdl/gui_iconv.c (revision 14336) +++ client/gui-sdl/gui_iconv.c (working copy) @@ -208,7 +208,7 @@ size_t Res = iconv(cd, (ICONV_CONST char **) &pInptr, &Insize, &pOutptr, &Outsize); if (Res == (size_t) (-1)) { -freelog(LOG_ERROR, "iconv() error: %s", strerror(errno)); +freelog(LOG_ERROR, "iconv() error: %s", mystrerror(errno)); if (errno == EINVAL) { break; } else { Index: client/gui-mui/gui_main.c === --- client/gui-mui/gui_main.c (revision 14336) +++ client/gui-mui/gui_main.c (working copy) @@ -1085,7 +1085,7 @@ } else if (sel < 0) { - printf("%s\n", strerror(errno)); + printf("%s\n", mystrerror(errno)); break; } } ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev