New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Date and time information is not spoken correctly in some languages because of small buffer size in winKernel.GetDateFormat and GetTimeFormat #471

Closed
nvaccessAuto opened this Issue Jan 1, 2010 · 6 comments

Comments

Projects
None yet
1 participant
@nvaccessAuto

nvaccessAuto commented Jan 1, 2010

Reported by ragb on 2009-11-10 15:09
In winkernel.GetDateFormat (line 76 of current trunk winkernel.py) the created unicode buffer that will have the date string is sized to 32 characteres. At least in Portuguese (and some other languages I think) there are situations when Windows returns a 33, 34 or more characters string. The GetTimeFormat may also suffer from the same bug.

There are to solutions to this problem. The Obvious one is to increase to buffer size to 64 or 128 chars, it must work for every language out there.
The other solution is partialy described here:
[http://msdn.microsoft.com/en-us/library/dd318086%28VS.85%29.aspx]
and requires to calls to the kernel32.GetDateFormat. One with the output buffer set to NULL and size to 0 to get the string size on the return value, and other to get the string itself for a allocated buffer with the previously got size value.

I've no way to compile NVDA from source right now so if someone could do something before 2009.1 it would be fine... If not I will try to write a patch but don't know when...

@nvaccessAuto

This comment has been minimized.

nvaccessAuto commented Jan 1, 2010

Attachment diff.txt added by aleksey_s on 2009-11-10 16:10
Description:
Proposed patch

@nvaccessAuto

This comment has been minimized.

nvaccessAuto commented Jan 1, 2010

Attachment dateTimeFix.patch added by pvagner on 2009-11-10 19:35
Description:

@nvaccessAuto

This comment has been minimized.

nvaccessAuto commented Jan 1, 2010

Comment 1 by aleksey_s on 2009-11-10 16:09
Implemented the fix.

@nvaccessAuto

This comment has been minimized.

nvaccessAuto commented Jan 1, 2010

Comment 2 by pvagner on 2009-11-10 19:31
Thanks Aleksey for the patch.
Also I have found out in the script_dateTime the call to the getThreadLocale function is redundant and we should just use the constant LOCALE_USER_DEFAULT.
Changes:
Changed title from "Date and time information are not spoken corrently in some languages because of small buffer size in winkernel.GetDateFrmat and GetTimeFormat" to "Date and time information is not spoken correctly in some languages because of small buffer size in winKernel.GetDateFormat and GetTimeFormat"

@nvaccessAuto

This comment has been minimized.

nvaccessAuto commented Jan 1, 2010

Comment 3 by pvagner on 2009-11-10 19:41
oops Sorry Aleksey, I've taken over the issue after you've accepted it. So I'am now returning it back to you and adding a patch with the little improvement I was tallking about.
Feel free to commit if you like.

@nvaccessAuto

This comment has been minimized.

nvaccessAuto commented Jan 1, 2010

Comment 4 by aleksey_s on 2009-11-10 20:58
Fixed in r3365
Changes:
State: closed

@nvaccessAuto nvaccessAuto added the bug label Nov 10, 2015

@nvaccessAuto nvaccessAuto added this to the 2009.1 milestone Nov 10, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment