Ticket #471 (closed defect: fixed)

Opened 10 months ago

Last modified 10 months ago

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

Reported by: ragb Owned by: aleksey_s
Priority: major Milestone: 2009.1
Component: Core Version: development
Keywords: Cc:
Operating system: Windows XP Blocked by:
Blocking:

Description

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...

Attachments

diff.txt Download (0.8 KB) - added by aleksey_s 10 months ago.
Proposed patch
dateTimeFix.patch Download (2.0 KB) - added by pvagner 10 months ago.

Change History

Changed 10 months ago by aleksey_s

  • status changed from new to accepted
  • owner set to aleksey_s

Implemented the fix.

Changed 10 months ago by aleksey_s

Proposed patch

Changed 10 months ago by pvagner

  • owner changed from aleksey_s to pvagner
  • summary changed 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

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.

Changed 10 months ago by pvagner

Changed 10 months ago by pvagner

  • owner changed from pvagner to aleksey_s
  • status changed from accepted to assigned

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.

Changed 10 months ago by aleksey_s

  • status changed from assigned to closed
  • resolution set to fixed

Fixed in r3365

Note: See TracTickets for help on using tickets.