winehq.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
February
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
January
2003
December
November
October
September
August
July
June
May
April
March
February
January
2002
December
November
October
September
August
July
June
May
April
March
February
January
2001
December
November
October
September
August
July
June
May
April
March
February
List overview
wine-commits
October 2010
----- 2025 -----
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
----- 2003 -----
December 2003
November 2003
October 2003
September 2003
August 2003
July 2003
June 2003
May 2003
April 2003
March 2003
February 2003
January 2003
----- 2002 -----
December 2002
November 2002
October 2002
September 2002
August 2002
July 2002
June 2002
May 2002
April 2002
March 2002
February 2002
January 2002
----- 2001 -----
December 2001
November 2001
October 2001
September 2001
August 2001
July 2001
June 2001
May 2001
April 2001
March 2001
February 2001
wine-commits@winehq.org
2 participants
1174 discussions
Start a n
N
ew thread
David Adam : ddraw/test: Add more combination tests for SetCooperativeLevels.
by Alexandre Julliard
12 Oct '10
12 Oct '10
Module: wine Branch: master Commit: a8740a46678fd1b044eae22396eea01f93f39af2 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=a8740a46678fd1b044eae2239…
Author: David Adam <david.adam.cnrs(a)gmail.com> Date: Mon Oct 11 11:50:35 2010 +0200 ddraw/test: Add more combination tests for SetCooperativeLevels. --- dlls/ddraw/tests/ddrawmodes.c | 31 ++++++++++++++++++++++++++++++- 1 files changed, 30 insertions(+), 1 deletions(-) diff --git a/dlls/ddraw/tests/ddrawmodes.c b/dlls/ddraw/tests/ddrawmodes.c index 8235d86..709ea5d 100644 --- a/dlls/ddraw/tests/ddrawmodes.c +++ b/dlls/ddraw/tests/ddrawmodes.c @@ -558,7 +558,36 @@ static void testcooperativelevels_normal(void) surfacedesc.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE | DDSCAPS_COMPLEX | DDSCAPS_FLIP; /* Do some tests with DDSCL_NORMAL mode */ - + /* Fullscreen mode + normal mode + exclusive mode */ + rc = IDirectDraw_SetCooperativeLevel(lpDD, hwnd, DDSCL_FULLSCREEN | DDSCL_EXCLUSIVE | DDSCL_NORMAL); + todo_wine ok(rc==DD_OK,"SetCooperativeLevel(DDSCL_FULLSCREEN | DDSCL_EXCLUSIVE | DDSCL_NORMAL) returned: %x\n",rc); + /* Try creating a double buffered primary in fullscreen + exclusive + normal mode */ + rc = IDirectDraw_CreateSurface(lpDD, &surfacedesc, &surface, NULL); + if (rc == DDERR_UNSUPPORTEDMODE) + skip("Unsupported mode\n"); + else + { + todo_wine ok(rc == DD_OK, "IDirectDraw_CreateSurface returned %08x\n", rc); + todo_wine ok(surface!=NULL, "Returned NULL surface pointer \n"); + } + if(surface && surface != (IDirectDrawSurface *)0xdeadbeef) IDirectDrawSurface_Release(surface); + /* Exclusive mode + normal mode */ + rc = IDirectDraw_SetCooperativeLevel(lpDD, hwnd, DDSCL_EXCLUSIVE | DDSCL_NORMAL); + ok(rc==DDERR_INVALIDPARAMS,"SetCooperativeLevel(DDSCL_EXCLUSIVE | DDSCL_NORMAL) returned: %x\n",rc); + /* Fullscreen mode + normal mode */ + rc = IDirectDraw_SetCooperativeLevel(lpDD, hwnd, DDSCL_FULLSCREEN | DDSCL_NORMAL); + todo_wine ok(rc==DD_OK,"SetCooperativeLevel(DDSCL_FULLSCREEN | DDSCL_NORMAL) returned: %x\n",rc); + /* Try creating a double buffered primary in fullscreen + normal mode */ + rc = IDirectDraw_CreateSurface(lpDD, &surfacedesc, &surface, NULL); + if (rc == DDERR_UNSUPPORTEDMODE) + skip("Unsupported mode\n"); + else + { + ok(rc == DDERR_NOEXCLUSIVEMODE, "IDirectDraw_CreateSurface returned %08x\n", rc); + ok(surface == NULL, "Returned surface pointer is %p\n", surface); + } + if(surface && surface != (IDirectDrawSurface *)0xdeadbeef) IDirectDrawSurface_Release(surface); + /* Normal mode */ rc = IDirectDraw_SetCooperativeLevel(lpDD, hwnd, DDSCL_NORMAL); ok(rc==DD_OK,"SetCooperativeLevel(DDSCL_NORMAL) returned: %x\n",rc);
1
0
0
0
Alexandre Julliard : user32: Correctly handle mouse events on a size grip scrollbar.
by Alexandre Julliard
12 Oct '10
12 Oct '10
Module: wine Branch: master Commit: 90ba8ceb07645632318cd11e9ba03d9603056fa1 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=90ba8ceb07645632318cd11e9…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Tue Oct 12 11:43:21 2010 +0200 user32: Correctly handle mouse events on a size grip scrollbar. --- dlls/user32/scroll.c | 15 +++++++++++++++ 1 files changed, 15 insertions(+), 0 deletions(-) diff --git a/dlls/user32/scroll.c b/dlls/user32/scroll.c index 7e02a42..fd73bf4 100644 --- a/dlls/user32/scroll.c +++ b/dlls/user32/scroll.c @@ -1426,6 +1426,13 @@ LRESULT ScrollBarWndProc_common( HWND hwnd, UINT message, WPARAM wParam, LPARAM case WM_LBUTTONDBLCLK: case WM_LBUTTONDOWN: + if (GetWindowLongW( hwnd, GWL_STYLE ) & SBS_SIZEGRIP) + { + SendMessageW( GetParent(hwnd), WM_SYSCOMMAND, + SC_SIZE + ((GetWindowLongW( hwnd, GWL_EXSTYLE ) & WS_EX_LAYOUTRTL) ? + WMSZ_BOTTOMLEFT : WMSZ_BOTTOMRIGHT), lParam ); + } + else { POINT pt; pt.x = (short)LOWORD(lParam); @@ -1519,6 +1526,14 @@ LRESULT ScrollBarWndProc_common( HWND hwnd, UINT message, WPARAM wParam, LPARAM } break; + case WM_SETCURSOR: + if (GetWindowLongW( hwnd, GWL_STYLE ) & SBS_SIZEGRIP) + { + ULONG_PTR cursor = (GetWindowLongW( hwnd, GWL_EXSTYLE ) & WS_EX_LAYOUTRTL) ? IDC_SIZENESW : IDC_SIZENWSE; + return (LRESULT)SetCursor( LoadCursorA( 0, (LPSTR)cursor )); + } + return DefWindowProcW( hwnd, message, wParam, lParam ); + case SBM_SETPOS: return SetScrollPos( hwnd, SB_CTL, wParam, (BOOL)lParam );
1
0
0
0
Alexandre Julliard : user32: Make sure AdjustWindowRect and WM_NCCALCSIZE yield the same result for WS_EX_DLGMODALFRAME windows .
by Alexandre Julliard
12 Oct '10
12 Oct '10
Module: wine Branch: master Commit: 299f2b354eeb8909535cb966e22b46d3d7c0463f URL:
http://source.winehq.org/git/wine.git/?a=commit;h=299f2b354eeb8909535cb966e…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Tue Oct 12 11:28:51 2010 +0200 user32: Make sure AdjustWindowRect and WM_NCCALCSIZE yield the same result for WS_EX_DLGMODALFRAME windows. --- dlls/user32/nonclient.c | 14 ++++---------- 1 files changed, 4 insertions(+), 10 deletions(-) diff --git a/dlls/user32/nonclient.c b/dlls/user32/nonclient.c index 64c1186..d2bcdcb 100644 --- a/dlls/user32/nonclient.c +++ b/dlls/user32/nonclient.c @@ -86,7 +86,6 @@ static void NC_AdjustRectOuter (LPRECT rect, DWORD style, BOOL menu, DWORD exStyle) { int adjust; - if(style & WS_ICONIC) return; if ((exStyle & (WS_EX_STATICEDGE|WS_EX_DLGMODALFRAME)) == WS_EX_STATICEDGE) @@ -99,7 +98,7 @@ NC_AdjustRectOuter (LPRECT rect, DWORD style, BOOL menu, DWORD exStyle) if ((exStyle & WS_EX_DLGMODALFRAME) || (style & (WS_THICKFRAME|WS_DLGFRAME))) adjust = 2; /* outer */ } - if (style & WS_THICKFRAME) + if ((style & WS_THICKFRAME) && !(exStyle & WS_EX_DLGMODALFRAME)) adjust += ( GetSystemMetrics (SM_CXFRAME) - GetSystemMetrics (SM_CXDLGFRAME)); /* The resize border */ if ((style & (WS_BORDER|WS_DLGFRAME)) || @@ -140,8 +139,6 @@ NC_AdjustRectOuter (LPRECT rect, DWORD style, BOOL menu, DWORD exStyle) static void NC_AdjustRectInner (LPRECT rect, DWORD style, DWORD exStyle) { - if(style & WS_ICONIC) return; - if (exStyle & WS_EX_CLIENTEDGE) InflateRect(rect, GetSystemMetrics(SM_CXEDGE), GetSystemMetrics(SM_CYEDGE)); @@ -390,11 +387,8 @@ BOOL WINAPI AdjustWindowRect( LPRECT rect, DWORD style, BOOL menu ) */ BOOL WINAPI AdjustWindowRectEx( LPRECT rect, DWORD style, BOOL menu, DWORD exStyle ) { - /* Correct the window style */ - style &= (WS_DLGFRAME | WS_BORDER | WS_THICKFRAME | WS_CHILD); - exStyle &= (WS_EX_DLGMODALFRAME | WS_EX_CLIENTEDGE | - WS_EX_STATICEDGE | WS_EX_TOOLWINDOW); - if (exStyle & WS_EX_DLGMODALFRAME) style &= ~WS_THICKFRAME; + if (style & WS_ICONIC) return TRUE; + style &= ~(WS_HSCROLL | WS_VSCROLL); TRACE("(%s) %08x %d %08x\n", wine_dbgstr_rect(rect), style, menu, exStyle ); @@ -424,7 +418,7 @@ LRESULT NC_HandleNCCalcSize( HWND hwnd, WPARAM wparam, RECT *winRect ) if (cls_style & CS_VREDRAW) result |= WVR_VREDRAW; if (cls_style & CS_HREDRAW) result |= WVR_HREDRAW; - if (!IsIconic(hwnd)) + if (!(style & WS_ICONIC)) { NC_AdjustRectOuter( &tmpRect, style, FALSE, exStyle );
1
0
0
0
Paul Vriens : transl: Deal with WS_EX_LAYOUTRTL for RTL languages.
by Alexandre Julliard
12 Oct '10
12 Oct '10
Module: tools Branch: master Commit: 849ef228f2979805b9c4e8897def7730a857aa6d URL:
http://source.winehq.org/git/tools.git/?a=commit;h=849ef228f2979805b9c4e889…
Author: Paul Vriens <Paul.Vriens.Wine(a)gmail.com> Date: Tue Oct 12 11:01:43 2010 +0200 transl: Deal with WS_EX_LAYOUTRTL for RTL languages. --- transl/lib_res.php | 16 ++++++++++++++++ 1 files changed, 16 insertions(+), 0 deletions(-) diff --git a/transl/lib_res.php b/transl/lib_res.php index efeefe5..caa87b4 100644 --- a/transl/lib_res.php +++ b/transl/lib_res.php @@ -911,6 +911,22 @@ class DialogResource extends Resource function is_hex_different(&$other, $lparam) { $field = $lparam[0]; + + if ($lparam[1] == "EXSTYLE") + { + if ((($this->header['language'] & 0xff) == 0x01 /* LANG_ARABIC */) || + (($this->header['language'] & 0xff) == 0x0d /* LANG_HEBREW */) || + (($this->header['language'] & 0xff) == 0x29 /* LANG_PERSIAN */)) + { + /* WS_EX_LAYOUTRTL (0x400000) should be present */ + if (($this->$field & 0x400000) == 0) + return TRUE; + + /* We can ignore WS_EX_LAYOUTRTL for RTL languages */ + return (($this->$field & ~0x400000) != $other->$field); + } + } + return ($this->$field != $other->$field); }
1
0
0
0
Luca Bennati : taskkill: Update Italian translation.
by Alexandre Julliard
11 Oct '10
11 Oct '10
Module: wine Branch: master Commit: 9d18f10a0d1f2d39f6f47fd4b0f439e9fffd20b2 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=9d18f10a0d1f2d39f6f47fd4b…
Author: Luca Bennati <lucak3(a)gmail.com> Date: Mon Oct 11 15:00:22 2010 +0200 taskkill: Update Italian translation. --- programs/taskkill/It.rc | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/programs/taskkill/It.rc b/programs/taskkill/It.rc index 05bf2d8..87f7b86 100644 --- a/programs/taskkill/It.rc +++ b/programs/taskkill/It.rc @@ -41,4 +41,5 @@ STRINGTABLE STRING_SEARCH_FAILED, "Errore: processo non trovato \"%s\".\n" STRING_ENUM_FAILED, "Errore: impossibile elencare la lista dei processi.\n" STRING_TERMINATE_FAILED, "Errore: impossibile terminare il processo \"%s\".\n" + STRING_SELF_TERMINATION, "Errore: l'auto-terminazione del processo non è permessa.\n" }
1
0
0
0
Nikolay Sivov : msxml3: Implement ::get_responseXML().
by Alexandre Julliard
11 Oct '10
11 Oct '10
Module: wine Branch: master Commit: 45db1d137670c88b712ad96c1ef639a830713871 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=45db1d137670c88b712ad96c1…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Sat Oct 9 01:42:44 2010 +0400 msxml3: Implement ::get_responseXML(). --- dlls/msxml3/httprequest.c | 27 ++++++++++++++++++++++++--- 1 files changed, 24 insertions(+), 3 deletions(-) diff --git a/dlls/msxml3/httprequest.c b/dlls/msxml3/httprequest.c index 3c2c049..504da92 100644 --- a/dlls/msxml3/httprequest.c +++ b/dlls/msxml3/httprequest.c @@ -766,13 +766,34 @@ static HRESULT WINAPI httprequest_get_statusText(IXMLHTTPRequest *iface, BSTR *p return E_NOTIMPL; } -static HRESULT WINAPI httprequest_get_responseXML(IXMLHTTPRequest *iface, IDispatch **ppBody) +static HRESULT WINAPI httprequest_get_responseXML(IXMLHTTPRequest *iface, IDispatch **body) { httprequest *This = impl_from_IXMLHTTPRequest( iface ); + IXMLDOMDocument3 *doc; + HRESULT hr; + BSTR str; - FIXME("stub %p %p\n", This, ppBody); + TRACE("(%p)->(%p)\n", This, body); - return E_NOTIMPL; + if (!body) return E_INVALIDARG; + if (This->state != READYSTATE_COMPLETE) return E_FAIL; + + hr = DOMDocument_create(&CLSID_DOMDocument, NULL, (void**)&doc); + if (hr != S_OK) return hr; + + hr = IXMLHTTPRequest_get_responseText(iface, &str); + if (hr == S_OK) + { + VARIANT_BOOL ok; + + hr = IXMLDOMDocument3_loadXML(doc, str, &ok); + SysFreeString(str); + } + + IXMLDOMDocument3_QueryInterface(doc, &IID_IDispatch, (void**)body); + IXMLDOMDocument3_Release(doc); + + return hr; } static HRESULT WINAPI httprequest_get_responseText(IXMLHTTPRequest *iface, BSTR *body)
1
0
0
0
Andrew Nguyen : msvcrt: Implement _strlwr_s.
by Alexandre Julliard
11 Oct '10
11 Oct '10
Module: wine Branch: master Commit: 41ab8251266299e2d22551f9d333bcaa5cb1b85e URL:
http://source.winehq.org/git/wine.git/?a=commit;h=41ab8251266299e2d22551f9d…
Author: Andrew Nguyen <anguyen(a)codeweavers.com> Date: Mon Oct 11 05:25:23 2010 -0500 msvcrt: Implement _strlwr_s. --- dlls/msvcr100/msvcr100.spec | 2 +- dlls/msvcr80/msvcr80.spec | 2 +- dlls/msvcr90/msvcr90.spec | 2 +- dlls/msvcrt/msvcrt.spec | 2 +- dlls/msvcrt/string.c | 35 +++++++++++++++++++++++++ dlls/msvcrt/tests/string.c | 60 +++++++++++++++++++++++++++++++++++++++++++ include/msvcrt/string.h | 1 + 7 files changed, 100 insertions(+), 4 deletions(-) diff --git a/dlls/msvcr100/msvcr100.spec b/dlls/msvcr100/msvcr100.spec index eb8028d..60211ab 100644 --- a/dlls/msvcr100/msvcr100.spec +++ b/dlls/msvcr100/msvcr100.spec @@ -1142,7 +1142,7 @@ @ stub _stricoll_l @ cdecl _strlwr(str) msvcrt._strlwr @ stub _strlwr_l -@ stub _strlwr_s +@ cdecl _strlwr_s(ptr long) msvcrt._strlwr_s @ stub _strlwr_s_l @ stub _strncoll @ stub _strncoll_l diff --git a/dlls/msvcr80/msvcr80.spec b/dlls/msvcr80/msvcr80.spec index b5be55f..4b0363f 100644 --- a/dlls/msvcr80/msvcr80.spec +++ b/dlls/msvcr80/msvcr80.spec @@ -996,7 +996,7 @@ @ stub _stricoll_l @ cdecl _strlwr(str) msvcrt._strlwr @ stub _strlwr_l -@ stub _strlwr_s +@ cdecl _strlwr_s(ptr long) msvcrt._strlwr_s @ stub _strlwr_s_l @ stub _strncoll @ stub _strncoll_l diff --git a/dlls/msvcr90/msvcr90.spec b/dlls/msvcr90/msvcr90.spec index 5647b13..967db82 100644 --- a/dlls/msvcr90/msvcr90.spec +++ b/dlls/msvcr90/msvcr90.spec @@ -982,7 +982,7 @@ @ stub _stricoll_l @ cdecl _strlwr(str) msvcrt._strlwr @ stub _strlwr_l -@ stub _strlwr_s +@ cdecl _strlwr_s(ptr long) msvcrt._strlwr_s @ stub _strlwr_s_l @ stub _strncoll @ stub _strncoll_l diff --git a/dlls/msvcrt/msvcrt.spec b/dlls/msvcrt/msvcrt.spec index b964724..e6a8670 100644 --- a/dlls/msvcrt/msvcrt.spec +++ b/dlls/msvcrt/msvcrt.spec @@ -917,7 +917,7 @@ # stub _stricoll_l @ cdecl _strlwr(str) ntdll._strlwr # stub _strlwr_l -# stub _strlwr_s +@ cdecl _strlwr_s(ptr long) # stub _strlwr_s_l @ stub _strncoll #(str str long) # stub _strncoll_l diff --git a/dlls/msvcrt/string.c b/dlls/msvcrt/string.c index 0b1beae..02bd0a5 100644 --- a/dlls/msvcrt/string.c +++ b/dlls/msvcrt/string.c @@ -51,6 +51,41 @@ char* CDECL _strdup(const char* str) } /********************************************************************* + * _strlwr_s (MSVCRT.@) + */ +int CDECL _strlwr_s(char *str, MSVCRT_size_t len) +{ + char *ptr = str; + + if (!str || !len) + { + *MSVCRT__errno() = MSVCRT_EINVAL; + return MSVCRT_EINVAL; + } + + while (len && *ptr) + { + len--; + ptr++; + } + + if (!len) + { + str[0] = '\0'; + *MSVCRT__errno() = MSVCRT_EINVAL; + return MSVCRT_EINVAL; + } + + while (*str) + { + *str = tolower(*str); + str++; + } + + return 0; +} + +/********************************************************************* * _strnset (MSVCRT.@) */ char* CDECL MSVCRT__strnset(char* str, int value, MSVCRT_size_t len) diff --git a/dlls/msvcrt/tests/string.c b/dlls/msvcrt/tests/string.c index 4955f75..a7d033a 100644 --- a/dlls/msvcrt/tests/string.c +++ b/dlls/msvcrt/tests/string.c @@ -60,6 +60,7 @@ static int (__cdecl *pwcstombs_s)(size_t*,char*,size_t,const wchar_t*,size_t); static int (__cdecl *pmbstowcs_s)(size_t*,wchar_t*,size_t,const char*,size_t); static errno_t (__cdecl *p_gcvt_s)(char*,size_t,double,int); static errno_t (__cdecl *p_itoa_s)(int,char*,size_t,int); +static errno_t (__cdecl *p_strlwr_s)(char*,size_t); static int *p__mb_cur_max; static unsigned char *p_mbctype; @@ -1370,6 +1371,63 @@ static void test__itoa_s(void) buffer); } +static void test__strlwr_s(void) +{ + errno_t ret; + char buffer[20]; + + if (!p_strlwr_s) + { + win_skip("Skipping _strlwr_s tests\n"); + return; + } + + errno = EBADF; + ret = p_strlwr_s(NULL, 0); + ok(ret == EINVAL, "Expected _strlwr_s to return EINVAL, got %d\n", ret); + ok(errno == EINVAL, "Expected errno to be EINVAL, got %d\n", errno); + + errno = EBADF; + ret = p_strlwr_s(NULL, sizeof(buffer)); + ok(ret == EINVAL, "Expected _strlwr_s to return EINVAL, got %d\n", ret); + ok(errno == EINVAL, "Expected errno to be EINVAL, got %d\n", errno); + + errno = EBADF; + ret = p_strlwr_s(buffer, 0); + ok(ret == EINVAL, "Expected _strlwr_s to return EINVAL, got %d\n", ret); + ok(errno == EINVAL, "Expected errno to be EINVAL, got %d\n", errno); + + strcpy(buffer, "GoRrIsTeR"); + errno = EBADF; + ret = p_strlwr_s(buffer, 5); + ok(ret == EINVAL, "Expected _strlwr_s to return EINVAL, got %d\n", ret); + ok(errno == EINVAL, "Expected errno to be EINVAL, got %d\n", errno); + ok(!memcmp(buffer, "\0oRrIsTeR", sizeof("\0oRrIsTeR")), + "Expected the output buffer to be \"gorrIsTeR\"\n"); + + strcpy(buffer, "GoRrIsTeR"); + errno = EBADF; + ret = p_strlwr_s(buffer, sizeof("GoRrIsTeR") - 1); + ok(ret == EINVAL, "Expected _strlwr_s to return EINVAL, got %d\n", ret); + ok(errno == EINVAL, "Expected errno to be EINVAL, got %d\n", errno); + ok(!memcmp(buffer, "\0oRrIsTeR", sizeof("\0oRrIsTeR")), + "Expected the output buffer to be \"gorrIsTeR\"\n"); + + strcpy(buffer, "GoRrIsTeR"); + ret = p_strlwr_s(buffer, sizeof("GoRrIsTeR")); + ok(ret == 0, "Expected _strlwr_s to return 0, got %d\n", ret); + ok(!strcmp(buffer, "gorrister"), + "Expected the output buffer to be \"gorrister\", got \"%s\"\n", + buffer); + + memcpy(buffer, "GoRrIsTeR\0ELLEN", sizeof("GoRrIsTeR\0ELLEN")); + ret = p_strlwr_s(buffer, sizeof(buffer)); + ok(ret == 0, "Expected _strlwr_s to return 0, got %d\n", ret); + ok(!memcmp(buffer, "gorrister\0ELLEN", sizeof("gorrister\0ELLEN")), + "Expected the output buffer to be \"gorrister\\0ELLEN\", got \"%s\"\n", + buffer); +} + START_TEST(string) { char mem[100]; @@ -1396,6 +1454,7 @@ START_TEST(string) pwcstombs_s = (void *)GetProcAddress(hMsvcrt, "wcstombs_s"); p_gcvt_s = (void *)GetProcAddress(hMsvcrt, "_gcvt_s"); p_itoa_s = (void *)GetProcAddress(hMsvcrt, "_itoa_s"); + p_strlwr_s = (void *)GetProcAddress(hMsvcrt, "_strlwr_s"); /* MSVCRT memcpy behaves like memmove for overlapping moves, MFC42 CString::Insert seems to rely on that behaviour */ @@ -1431,4 +1490,5 @@ START_TEST(string) test_mbstowcs(); test_gcvt(); test__itoa_s(); + test__strlwr_s(); } diff --git a/include/msvcrt/string.h b/include/msvcrt/string.h index 614fa85..8ab459b 100644 --- a/include/msvcrt/string.h +++ b/include/msvcrt/string.h @@ -48,6 +48,7 @@ errno_t __cdecl strerror_s(char*,size_t,int); int __cdecl _stricmp(const char*,const char*); int __cdecl _stricoll(const char*,const char*); char* __cdecl _strlwr(char*); +errno_t __cdecl _strlwr_s(char*,size_t); int __cdecl _strnicmp(const char*,const char*,size_t); char* __cdecl _strnset(char*,int,size_t); char* __cdecl _strrev(char*);
1
0
0
0
Andrew Nguyen : msvcrt: Implement _itoa_s.
by Alexandre Julliard
11 Oct '10
11 Oct '10
Module: wine Branch: master Commit: bcfaf467b590e6b1b1edf6e8311f0ee975bb356c URL:
http://source.winehq.org/git/wine.git/?a=commit;h=bcfaf467b590e6b1b1edf6e83…
Author: Andrew Nguyen <anguyen(a)codeweavers.com> Date: Mon Oct 11 05:25:15 2010 -0500 msvcrt: Implement _itoa_s. --- dlls/msvcr100/msvcr100.spec | 2 +- dlls/msvcr80/msvcr80.spec | 2 +- dlls/msvcr90/msvcr90.spec | 2 +- dlls/msvcrt/msvcrt.spec | 2 +- dlls/msvcrt/string.c | 75 ++++++++++++++++++++++++++++++++++ dlls/msvcrt/tests/string.c | 95 +++++++++++++++++++++++++++++++++++++++++++ include/msvcrt/stdlib.h | 1 + 7 files changed, 175 insertions(+), 4 deletions(-) diff --git a/dlls/msvcr100/msvcr100.spec b/dlls/msvcr100/msvcr100.spec index 042437e..eb8028d 100644 --- a/dlls/msvcr100/msvcr100.spec +++ b/dlls/msvcr100/msvcr100.spec @@ -834,7 +834,7 @@ @ stub _iswxdigit_l @ stub _isxdigit_l @ cdecl _itoa(long ptr long) msvcrt._itoa -@ stub _itoa_s +@ cdecl _itoa_s(long ptr long long) msvcrt._itoa_s @ cdecl _itow(long ptr long) msvcrt._itow @ stub _itow_s @ cdecl _j0(double) msvcrt._j0 diff --git a/dlls/msvcr80/msvcr80.spec b/dlls/msvcr80/msvcr80.spec index c1d18d6..b5be55f 100644 --- a/dlls/msvcr80/msvcr80.spec +++ b/dlls/msvcr80/msvcr80.spec @@ -680,7 +680,7 @@ @ stub _iswxdigit_l @ stub _isxdigit_l @ cdecl _itoa(long ptr long) msvcrt._itoa -@ stub _itoa_s +@ cdecl _itoa_s(long ptr long long) msvcrt._itoa_s @ cdecl _itow(long ptr long) msvcrt._itow @ stub _itow_s @ cdecl _j0(double) msvcrt._j0 diff --git a/dlls/msvcr90/msvcr90.spec b/dlls/msvcr90/msvcr90.spec index 6d5d518..5647b13 100644 --- a/dlls/msvcr90/msvcr90.spec +++ b/dlls/msvcr90/msvcr90.spec @@ -668,7 +668,7 @@ @ stub _iswxdigit_l @ stub _isxdigit_l @ cdecl _itoa(long ptr long) msvcrt._itoa -@ stub _itoa_s +@ cdecl _itoa_s(long ptr long long) msvcrt._itoa_s @ cdecl _itow(long ptr long) msvcrt._itow @ stub _itow_s @ cdecl _j0(double) msvcrt._j0 diff --git a/dlls/msvcrt/msvcrt.spec b/dlls/msvcrt/msvcrt.spec index e628e48..b964724 100644 --- a/dlls/msvcrt/msvcrt.spec +++ b/dlls/msvcrt/msvcrt.spec @@ -607,7 +607,7 @@ # stub _iswxdigit_l # stub _isxdigit_l @ cdecl _itoa(long ptr long) ntdll._itoa -# stub _itoa_s +@ cdecl _itoa_s(long ptr long long) @ cdecl _itow(long ptr long) ntdll._itow # stub _itow_s @ cdecl _j0(double) diff --git a/dlls/msvcrt/string.c b/dlls/msvcrt/string.c index f44e6eb..0b1beae 100644 --- a/dlls/msvcrt/string.c +++ b/dlls/msvcrt/string.c @@ -637,6 +637,81 @@ unsigned __int64 CDECL MSVCRT_strtoui64(const char *nptr, char **endptr, int bas } /********************************************************************* + * _itoa_s (MSVCRT.@) + */ +int CDECL _itoa_s(int value, char *str, MSVCRT_size_t size, int radix) +{ + unsigned int val, digit; + int is_negative; + char buffer[33], *pos; + size_t len; + + if (!str || !size || radix < 2 || radix > 36) + { + if (str && size) + str[0] = '\0'; + + *MSVCRT__errno() = MSVCRT_EINVAL; + return MSVCRT_EINVAL; + } + + if (value < 0 && radix == 10) + { + is_negative = 1; + val = -value; + } + else + { + is_negative = 0; + val = value; + } + + pos = buffer + 32; + *pos = '\0'; + + do + { + digit = val % radix; + val /= radix; + + if (digit < 10) + *--pos = '0' + digit; + else + *--pos = 'a' + digit - 10; + } + while (val != 0); + + if (is_negative) + *--pos = '-'; + + len = buffer + 33 - pos; + if (len > size) + { + size_t i; + char *p = str; + + /* Copy the temporary buffer backwards up to the available number of + * characters. Don't copy the negative sign if present. */ + + if (is_negative) + { + p++; + size--; + } + + for (pos = buffer + 31, i = 0; i < size; i++) + *p++ = *pos--; + + str[0] = '\0'; + *MSVCRT__errno() = MSVCRT_ERANGE; + return MSVCRT_ERANGE; + } + + memcpy(str, pos, len); + return 0; +} + +/********************************************************************* * _ui64toa_s (MSVCRT.@) */ int CDECL MSVCRT__ui64toa_s(unsigned __int64 value, char *str, diff --git a/dlls/msvcrt/tests/string.c b/dlls/msvcrt/tests/string.c index 0ea1198..4955f75 100644 --- a/dlls/msvcrt/tests/string.c +++ b/dlls/msvcrt/tests/string.c @@ -59,6 +59,7 @@ static unsigned __int64 (__cdecl *p_strtoui64)(const char *, char **, int); static int (__cdecl *pwcstombs_s)(size_t*,char*,size_t,const wchar_t*,size_t); static int (__cdecl *pmbstowcs_s)(size_t*,wchar_t*,size_t,const char*,size_t); static errno_t (__cdecl *p_gcvt_s)(char*,size_t,double,int); +static errno_t (__cdecl *p_itoa_s)(int,char*,size_t,int); static int *p__mb_cur_max; static unsigned char *p_mbctype; @@ -1277,6 +1278,98 @@ static void test_gcvt(void) ok(buf[0] == '\0', "buf[0] = %c\n", buf[0]); } +static void test__itoa_s(void) +{ + errno_t ret; + char buffer[33]; + + if (!p_itoa_s) + { + win_skip("Skipping _itoa_s tests\n"); + return; + } + + errno = EBADF; + ret = p_itoa_s(0, NULL, 0, 0); + ok(ret == EINVAL, "Expected _itoa_s to return EINVAL, got %d\n", ret); + ok(errno == EINVAL, "Expected errno to be EINVAL, got %d\n", errno); + + memset(buffer, 'X', sizeof(buffer)); + errno = EBADF; + ret = p_itoa_s(0, buffer, 0, 0); + ok(ret == EINVAL, "Expected _itoa_s to return EINVAL, got %d\n", ret); + ok(errno == EINVAL, "Expected errno to be EINVAL, got %d\n", errno); + ok(buffer[0] == 'X', "Expected the output buffer to be untouched\n"); + + memset(buffer, 'X', sizeof(buffer)); + errno = EBADF; + ret = p_itoa_s(0, buffer, sizeof(buffer), 0); + ok(ret == EINVAL, "Expected _itoa_s to return EINVAL, got %d\n", ret); + ok(errno == EINVAL, "Expected errno to be EINVAL, got %d\n", errno); + ok(buffer[0] == '\0', "Expected the output buffer to be null terminated\n"); + + memset(buffer, 'X', sizeof(buffer)); + errno = EBADF; + ret = p_itoa_s(0, buffer, sizeof(buffer), 64); + ok(ret == EINVAL, "Expected _itoa_s to return EINVAL, got %d\n", ret); + ok(errno == EINVAL, "Expected errno to be EINVAL, got %d\n", errno); + ok(buffer[0] == '\0', "Expected the output buffer to be null terminated\n"); + + memset(buffer, 'X', sizeof(buffer)); + errno = EBADF; + ret = p_itoa_s(12345678, buffer, 4, 10); + ok(ret == ERANGE, "Expected _itoa_s to return ERANGE, got %d\n", ret); + ok(errno == ERANGE, "Expected errno to be ERANGE, got %d\n", errno); + ok(!memcmp(buffer, "\000765", 4), + "Expected the output buffer to be null terminated with truncated output\n"); + + memset(buffer, 'X', sizeof(buffer)); + errno = EBADF; + ret = p_itoa_s(12345678, buffer, 8, 10); + ok(ret == ERANGE, "Expected _itoa_s to return ERANGE, got %d\n", ret); + ok(errno == ERANGE, "Expected errno to be ERANGE, got %d\n", errno); + ok(!memcmp(buffer, "\0007654321", 8), + "Expected the output buffer to be null terminated with truncated output\n"); + + memset(buffer, 'X', sizeof(buffer)); + errno = EBADF; + ret = p_itoa_s(-12345678, buffer, 9, 10); + ok(ret == ERANGE, "Expected _itoa_s to return ERANGE, got %d\n", ret); + ok(errno == ERANGE, "Expected errno to be ERANGE, got %d\n", errno); + ok(!memcmp(buffer, "\00087654321", 9), + "Expected the output buffer to be null terminated with truncated output\n"); + + ret = p_itoa_s(12345678, buffer, 9, 10); + ok(ret == 0, "Expected _itoa_s to return 0, got %d\n", ret); + ok(!strcmp(buffer, "12345678"), + "Expected output buffer string to be \"12345678\", got \"%s\"\n", + buffer); + + ret = p_itoa_s(43690, buffer, sizeof(buffer), 2); + ok(ret == 0, "Expected _itoa_s to return 0, got %d\n", ret); + ok(!strcmp(buffer, "1010101010101010"), + "Expected output buffer string to be \"1010101010101010\", got \"%s\"\n", + buffer); + + ret = p_itoa_s(1092009, buffer, sizeof(buffer), 36); + ok(ret == 0, "Expected _itoa_s to return 0, got %d\n", ret); + ok(!strcmp(buffer, "nell"), + "Expected output buffer string to be \"nell\", got \"%s\"\n", + buffer); + + ret = p_itoa_s(5704, buffer, sizeof(buffer), 18); + ok(ret == 0, "Expected _itoa_s to return 0, got %d\n", ret); + ok(!strcmp(buffer, "hag"), + "Expected output buffer string to be \"hag\", got \"%s\"\n", + buffer); + + ret = p_itoa_s(-12345678, buffer, sizeof(buffer), 10); + ok(ret == 0, "Expected _itoa_s to return 0, got %d\n", ret); + ok(!strcmp(buffer, "-12345678"), + "Expected output buffer string to be \"-12345678\", got \"%s\"\n", + buffer); +} + START_TEST(string) { char mem[100]; @@ -1302,6 +1395,7 @@ START_TEST(string) pmbstowcs_s = (void *)GetProcAddress(hMsvcrt, "mbstowcs_s"); pwcstombs_s = (void *)GetProcAddress(hMsvcrt, "wcstombs_s"); p_gcvt_s = (void *)GetProcAddress(hMsvcrt, "_gcvt_s"); + p_itoa_s = (void *)GetProcAddress(hMsvcrt, "_itoa_s"); /* MSVCRT memcpy behaves like memmove for overlapping moves, MFC42 CString::Insert seems to rely on that behaviour */ @@ -1336,4 +1430,5 @@ START_TEST(string) test__strtod(); test_mbstowcs(); test_gcvt(); + test__itoa_s(); } diff --git a/include/msvcrt/stdlib.h b/include/msvcrt/stdlib.h index bef83f4..086c3e1 100644 --- a/include/msvcrt/stdlib.h +++ b/include/msvcrt/stdlib.h @@ -148,6 +148,7 @@ char* __cdecl _fullpath(char*,const char*,size_t); char* __cdecl _gcvt(double,int,char*); char* __cdecl _i64toa(__int64,char*,int); char* __cdecl _itoa(int,char*,int); +errno_t __cdecl _itoa_s(int,char*,size_t,int); char* __cdecl _ltoa(__msvcrt_long,char*,int); __msvcrt_ulong __cdecl _lrotl(__msvcrt_ulong,int); __msvcrt_ulong __cdecl _lrotr(__msvcrt_ulong,int);
1
0
0
0
Andrew Nguyen : msvcrt: Implement _localtime32_s.
by Alexandre Julliard
11 Oct '10
11 Oct '10
Module: wine Branch: master Commit: 60866103145d52121d5ac1f4c1501c0849d87191 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=60866103145d52121d5ac1f4c…
Author: Andrew Nguyen <anguyen(a)codeweavers.com> Date: Mon Oct 11 05:25:05 2010 -0500 msvcrt: Implement _localtime32_s. --- dlls/msvcr100/msvcr100.spec | 2 +- dlls/msvcr80/msvcr80.spec | 2 +- dlls/msvcr90/msvcr90.spec | 2 +- dlls/msvcrt/msvcrt.spec | 2 +- dlls/msvcrt/tests/time.c | 54 +++++++++++++++++++++++++++++++++++++++++++ dlls/msvcrt/time.c | 20 ++++++++++++++++ include/msvcrt/time.h | 1 + 7 files changed, 79 insertions(+), 4 deletions(-) diff --git a/dlls/msvcr100/msvcr100.spec b/dlls/msvcr100/msvcr100.spec index ace6201..042437e 100644 --- a/dlls/msvcr100/msvcr100.spec +++ b/dlls/msvcr100/msvcr100.spec @@ -847,7 +847,7 @@ @ cdecl -i386 _local_unwind2(ptr long) msvcrt._local_unwind2 @ cdecl -i386 _local_unwind4(ptr ptr long) msvcrt._local_unwind4 @ cdecl _localtime32(ptr) msvcrt._localtime32 -@ stub _localtime32_s +@ cdecl _localtime32_s(ptr ptr) msvcrt._localtime32_s @ cdecl _localtime64(ptr) msvcrt._localtime64 @ cdecl _localtime64_s(ptr ptr) msvcrt._localtime64_s @ cdecl _lock(long) msvcrt._lock diff --git a/dlls/msvcr80/msvcr80.spec b/dlls/msvcr80/msvcr80.spec index 3c03f09..c1d18d6 100644 --- a/dlls/msvcr80/msvcr80.spec +++ b/dlls/msvcr80/msvcr80.spec @@ -693,7 +693,7 @@ @ cdecl -i386 _local_unwind2(ptr long) msvcrt._local_unwind2 @ cdecl -i386 _local_unwind4(ptr ptr long) msvcrt._local_unwind4 @ cdecl _localtime32(ptr) msvcrt._localtime32 -@ stub _localtime32_s +@ cdecl _localtime32_s(ptr ptr) msvcrt._localtime32_s @ cdecl _localtime64(ptr) msvcrt._localtime64 @ cdecl _localtime64_s(ptr ptr) msvcrt._localtime64_s @ cdecl _lock(long) msvcrt._lock diff --git a/dlls/msvcr90/msvcr90.spec b/dlls/msvcr90/msvcr90.spec index 5917bcc..6d5d518 100644 --- a/dlls/msvcr90/msvcr90.spec +++ b/dlls/msvcr90/msvcr90.spec @@ -681,7 +681,7 @@ @ cdecl -i386 _local_unwind2(ptr long) msvcrt._local_unwind2 @ cdecl -i386 _local_unwind4(ptr ptr long) msvcrt._local_unwind4 @ cdecl _localtime32(ptr) msvcrt._localtime32 -@ stub _localtime32_s +@ cdecl _localtime32_s(ptr ptr) msvcrt._localtime32_s @ cdecl _localtime64(ptr) msvcrt._localtime64 @ cdecl _localtime64_s(ptr ptr) msvcrt._localtime64_s @ cdecl _lock(long) msvcrt._lock diff --git a/dlls/msvcrt/msvcrt.spec b/dlls/msvcrt/msvcrt.spec index 8f3a318..e628e48 100644 --- a/dlls/msvcrt/msvcrt.spec +++ b/dlls/msvcrt/msvcrt.spec @@ -620,7 +620,7 @@ @ cdecl -i386 _local_unwind2(ptr long) @ cdecl -i386 _local_unwind4(ptr ptr long) @ cdecl _localtime32(ptr) MSVCRT__localtime32 -# stub _localtime32_s +@ cdecl _localtime32_s(ptr ptr) @ cdecl _localtime64(ptr) MSVCRT__localtime64 @ cdecl _localtime64_s(ptr ptr) @ cdecl _lock(long) diff --git a/dlls/msvcrt/tests/time.c b/dlls/msvcrt/tests/time.c index 38e06c2..a56f53c 100644 --- a/dlls/msvcrt/tests/time.c +++ b/dlls/msvcrt/tests/time.c @@ -40,6 +40,7 @@ static struct tm* (__cdecl *p_gmtime32)(__time32_t*); static errno_t (__cdecl *p_gmtime32_s)(struct tm*, __time32_t*); static errno_t (__cdecl *p_strtime_s)(char*,size_t); static errno_t (__cdecl *p_strdate_s)(char*,size_t); +static errno_t (__cdecl *p_localtime32_s)(struct tm*, __time32_t*); static errno_t (__cdecl *p_localtime64_s)(struct tm*, __time64_t*); static void init(void) @@ -51,6 +52,7 @@ static void init(void) p_mkgmtime32 = (void*)GetProcAddress(hmod, "_mkgmtime32"); p_strtime_s = (void*)GetProcAddress(hmod, "_strtime_s"); p_strdate_s = (void*)GetProcAddress(hmod, "_strdate_s"); + p_localtime32_s = (void*)GetProcAddress(hmod, "_localtime32_s"); p_localtime64_s = (void*)GetProcAddress(hmod, "_localtime64_s"); } @@ -425,6 +427,57 @@ static void test_wstrtime(void) ok(count == 3, "Wrong format: count = %d, should be 3\n", count); } +static void test_localtime32_s(void) +{ + struct tm tm; + __time32_t time; + errno_t err; + + if (!p_localtime32_s) + { + win_skip("Skipping _localtime32_s tests\n"); + return; + } + + errno = EBADF; + err = p_localtime32_s(NULL, NULL); + ok(err == EINVAL, "Expected _localtime32_s to return EINVAL, got %d\n", err); + ok(errno == EINVAL, "Expected errno to be EINVAL, got %d\n", errno); + + errno = EBADF; + time = 0x12345678; + err = p_localtime32_s(NULL, &time); + ok(err == EINVAL, "Expected _localtime32_s to return EINVAL, got %d\n", err); + ok(errno == EINVAL, "Expected errno to be EINVAL, got %d\n", errno); + + memset(&tm, 0, sizeof(tm)); + errno = EBADF; + err = p_localtime32_s(&tm, NULL); + ok(err == EINVAL, "Expected _localtime32_s to return EINVAL, got %d\n", err); + ok(errno == EINVAL, "Expected errno to be EINVAL, got %d\n", errno); + ok(tm.tm_sec == -1 && tm.tm_min == -1 && tm.tm_hour == -1 && + tm.tm_mday == -1 && tm.tm_mon == -1 && tm.tm_year == -1 && + tm.tm_wday == -1 && tm.tm_yday == -1 && tm.tm_isdst == -1, + "Expected tm structure members to be initialized to -1, got " + "(%d, %d, %d, %d, %d, %d, %d, %d, %d)\n", tm.tm_sec, tm.tm_min, + tm.tm_hour, tm.tm_mday, tm.tm_mon, tm.tm_year, tm.tm_wday, tm.tm_yday, + tm.tm_isdst); + + memset(&tm, 0, sizeof(tm)); + time = -1; + errno = EBADF; + err = p_localtime32_s(&tm, &time); + ok(err == EINVAL, "Expected _localtime32_s to return EINVAL, got %d\n", err); + ok(errno == EINVAL, "Expected errno to be EINVAL, got %d\n", errno); + ok(tm.tm_sec == -1 && tm.tm_min == -1 && tm.tm_hour == -1 && + tm.tm_mday == -1 && tm.tm_mon == -1 && tm.tm_year == -1 && + tm.tm_wday == -1 && tm.tm_yday == -1 && tm.tm_isdst == -1, + "Expected tm structure members to be initialized to -1, got " + "(%d, %d, %d, %d, %d, %d, %d, %d, %d)\n", tm.tm_sec, tm.tm_min, + tm.tm_hour, tm.tm_mday, tm.tm_mon, tm.tm_year, tm.tm_wday, tm.tm_yday, + tm.tm_isdst); +} + static void test_localtime64_s(void) { struct tm tm; @@ -502,5 +555,6 @@ START_TEST(time) test_strtime(); test_wstrdate(); test_wstrtime(); + test_localtime32_s(); test_localtime64_s(); } diff --git a/dlls/msvcrt/time.c b/dlls/msvcrt/time.c index ae2463c..9d59625 100644 --- a/dlls/msvcrt/time.c +++ b/dlls/msvcrt/time.c @@ -260,6 +260,26 @@ struct MSVCRT_tm* CDECL MSVCRT__localtime32(const MSVCRT___time32_t* secs) } /********************************************************************* + * _localtime32_s (MSVCRT.@) + */ +int CDECL _localtime32_s(struct MSVCRT_tm *time, const MSVCRT___time32_t *secs) +{ + MSVCRT___time64_t secs64; + + if (!time || !secs || *secs < 0) + { + if (time) + write_invalid_msvcrt_tm(time); + + *MSVCRT__errno() = MSVCRT_EINVAL; + return MSVCRT_EINVAL; + } + + secs64 = *secs; + return _localtime64_s(time, &secs64); +} + +/********************************************************************* * localtime (MSVCRT.@) */ #ifdef _WIN64 diff --git a/include/msvcrt/time.h b/include/msvcrt/time.h index 194b47c..3a5e22f 100644 --- a/include/msvcrt/time.h +++ b/include/msvcrt/time.h @@ -103,6 +103,7 @@ double __cdecl _difftime64(__time64_t,__time64_t); struct tm* __cdecl _gmtime32(const __time32_t*); struct tm* __cdecl _gmtime64(const __time64_t*); struct tm* __cdecl _localtime32(const __time32_t*); +errno_t __cdecl _localtime32_s(struct tm*, const __time64_t*); struct tm* __cdecl _localtime64(const __time64_t*); errno_t __cdecl _localtime64_s(struct tm*, const __time64_t*); __time32_t __cdecl _mktime32(struct tm*);
1
0
0
0
Andrew Nguyen : msvcrt: Use the write_invalid_msvcrt_tm helper in _gmtime64_s.
by Alexandre Julliard
11 Oct '10
11 Oct '10
Module: wine Branch: master Commit: 90771ab6054ccdfca65de1e12dd7c03205a1d151 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=90771ab6054ccdfca65de1e12…
Author: Andrew Nguyen <anguyen(a)codeweavers.com> Date: Mon Oct 11 05:24:30 2010 -0500 msvcrt: Use the write_invalid_msvcrt_tm helper in _gmtime64_s. --- dlls/msvcrt/time.c | 14 +++----------- 1 files changed, 3 insertions(+), 11 deletions(-) diff --git a/dlls/msvcrt/time.c b/dlls/msvcrt/time.c index d0201e2..ae2463c 100644 --- a/dlls/msvcrt/time.c +++ b/dlls/msvcrt/time.c @@ -284,17 +284,9 @@ int CDECL MSVCRT__gmtime64_s(struct MSVCRT_tm *res, const MSVCRT___time64_t *sec SYSTEMTIME st; ULONGLONG time; - if(!res || !secs || *secs<0) { - if(res) { - res->tm_sec = -1; - res->tm_min = -1; - res->tm_hour = -1; - res->tm_mday = -1; - res->tm_year = -1; - res->tm_mon = -1; - res->tm_wday = -1; - res->tm_yday = -1; - res->tm_isdst = -1; + if (!res || !secs || *secs < 0) { + if (res) { + write_invalid_msvcrt_tm(res); } *MSVCRT__errno() = MSVCRT_EINVAL;
1
0
0
0
← Newer
1
...
58
59
60
61
62
63
64
...
118
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
Results per page:
10
25
50
100
200