On Wed, Jul 9, 2014 at 10:36 AM, Alexandre Julliard <julliard@winehq.org> wrote:
Nikolay Sivov <nsivov@codeweavers.com> writes:

> +    ptr = &geoinfodata[geoid];
> +    if (!*ptr->iso2W) {
> +        SetLastError(ERROR_INVALID_PARAMETER);
> +        return 0;
> +    }
> +
> +    len = get_geoinfo_len(geoid, geotype);
> +    if (!data || !data_len)
> +        return len;

You could check this at the end before copying the string instead of
having a duplicate function for the length.
 
Ok, I think I understand what you mean.


> +INT WINAPI GetGeoInfoA(GEOID geoid, GEOTYPE geotype, LPSTR data, int data_len, LANGID lang)
> +{
> +    WCHAR buffW[12];
> +    INT len = 0;
> +
> +    TRACE("%d %d %p %d %d\n", geoid, geotype, data, data_len, lang);
> +
> +    if (!data || !data_len)
> +        return GetGeoInfoW(geoid, geotype, NULL, 0, lang);

You can't just return the W length.
 
That's true. Length is identical for all types except country names (potentially, I didn't check that) as it's a character length. But yeah, this is dirty. I'll need to W -> A + length check for resulting A string I think.

Thanks for commenting.

--
Alexandre Julliard
julliard@winehq.org