This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [New WinCE support] [patch 4/4] The bulk of the code.


> Date: Fri, 16 Mar 2007 02:08:51 +0000
> From: Pedro Alves <pedro_alves@portugalmail.pt>
> 
> This patch is the bulk of the new WinCE support.

Thanks.

I have a few comments.

> +static char *
> +strwinerror (DWORD error)
> +{
> +  static char buf[1024];
> +  wchar_t msgbuf[1024];
> +  DWORD chars = FormatMessageW (
> +		FORMAT_MESSAGE_FROM_SYSTEM,
> +                NULL,
> +                error,
> +                0, /* Default language */
> +                (LPVOID)&msgbuf,
> +                0,
> +                NULL);

Instead of using an arbitrary size 1024 (btw, you don't check whether
FormatMessageW indicated that it needed more than 1024), isn't it
better to use FORMAT_MESSAGE_ALLOCATE_BUFFER?  As a bonus, it would
avoid overwriting the static buffer on each call, which is not a nice
API, IMHO.

> +#ifdef __MINGW32CE__
> +  err = strwinerror (GetLastError ());
> +#else
>    err = strerror (errno);
> +#endif

Why not call strwinerror strerror and avoid the ifdef?

> doc/ChangeLog
> 
> 	* gdb.texinfo (WinCE): Delete subsection.

Why?  Is that subsection incorrect in some ways?


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]