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
July 2016
----- 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
680 discussions
Start a n
N
ew thread
Alistair Leslie-Hughes : inetcomm: Support LPSTR to LPWSTR conversion in GetProp.
by Alexandre Julliard
06 Jul '16
06 Jul '16
Module: wine Branch: master Commit: 16231678ca6fa3a2d9c404a0e99897ed62c77a2b URL:
http://source.winehq.org/git/wine.git/?a=commit;h=16231678ca6fa3a2d9c404a0e…
Author: Alistair Leslie-Hughes <leslie_alistair(a)hotmail.com> Date: Fri Jul 1 07:57:42 2016 +0000 inetcomm: Support LPSTR to LPWSTR conversion in GetProp. Signed-off-by: Alistair Leslie-Hughes <leslie_alistair(a)hotmail.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/inetcomm/Makefile.in | 2 +- dlls/inetcomm/mimeole.c | 7 ++++++- dlls/inetcomm/tests/mimeole.c | 14 ++++++++++++++ 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/dlls/inetcomm/Makefile.in b/dlls/inetcomm/Makefile.in index d3d1ded..d00aa67 100644 --- a/dlls/inetcomm/Makefile.in +++ b/dlls/inetcomm/Makefile.in @@ -1,6 +1,6 @@ MODULE = inetcomm.dll IMPORTLIB = inetcomm -IMPORTS = uuid oleaut32 ole32 ws2_32 user32 advapi32 +IMPORTS = uuid propsys oleaut32 ole32 ws2_32 user32 advapi32 C_SRCS = \ imaptransport.c \ diff --git a/dlls/inetcomm/mimeole.c b/dlls/inetcomm/mimeole.c index 486ac57..f4537f3 100644 --- a/dlls/inetcomm/mimeole.c +++ b/dlls/inetcomm/mimeole.c @@ -31,6 +31,7 @@ #include "objbase.h" #include "ole2.h" #include "mimeole.h" +#include "propvarutil.h" #include "wine/list.h" #include "wine/debug.h" @@ -785,7 +786,11 @@ static HRESULT WINAPI MimeBody_GetProp( hr = find_prop(This, pszName, &header); if(hr == S_OK) { - PropVariantCopy(pValue, &header->value); + TRACE("type %d->%d\n", header->value.vt, pValue->vt); + + hr = PropVariantChangeType(pValue, &header->value, 0, pValue->vt); + if(FAILED(hr)) + FIXME("Conversion not currently supported (%d->%d)\n", header->value.vt, pValue->vt); } return hr; diff --git a/dlls/inetcomm/tests/mimeole.c b/dlls/inetcomm/tests/mimeole.c index 46fd1d5..84b2c8d 100644 --- a/dlls/inetcomm/tests/mimeole.c +++ b/dlls/inetcomm/tests/mimeole.c @@ -335,6 +335,7 @@ static void test_CreateMessage(void) static void test_MessageSetProp(void) { static const char topic[] = "wine topic"; + static const WCHAR topicW[] = {'w','i','n','e',' ','t','o','p','i','c',0}; HRESULT hr; IMimeMessage *msg; IMimeBody *body; @@ -370,6 +371,7 @@ static void test_MessageSetProp(void) hr = IMimeBody_GetProp(body, "Wine-Topic", 0, &prop); ok(hr == MIME_E_NOT_FOUND, "ret %08x\n", hr); + prop.vt = VT_LPSTR; hr = IMimeBody_GetProp(body, "Thread-Topic", 0, &prop); ok(hr == S_OK, "ret %08x\n", hr); if(hr == S_OK) @@ -386,6 +388,7 @@ static void test_MessageSetProp(void) ok(hr == S_OK, "ret %08x\n", hr); PropVariantClear(&prop); + prop.vt = VT_LPSTR; hr = IMimeBody_GetProp(body, PIDTOSTR(PID_HDR_SUBJECT), 0, &prop); ok(hr == S_OK, "ret %08x\n", hr); if(hr == S_OK) @@ -396,6 +399,7 @@ static void test_MessageSetProp(void) } /* Using the name or PID returns the same result. */ + prop.vt = VT_LPSTR; hr = IMimeBody_GetProp(body, "Subject", 0, &prop); ok(hr == S_OK, "ret %08x\n", hr); if(hr == S_OK) @@ -405,6 +409,16 @@ static void test_MessageSetProp(void) PropVariantClear(&prop); } + prop.vt = VT_LPWSTR; + hr = IMimeBody_GetProp(body, "Subject", 0, &prop); + ok(hr == S_OK, "ret %08x\n", hr); + if(hr == S_OK) + { + ok(prop.vt == VT_LPWSTR, "type %d\n", prop.vt); + ok(!lstrcmpW(prop.u.pwszVal, topicW), "got %s\n", wine_dbgstr_w(prop.u.pwszVal)); + PropVariantClear(&prop); + } + prop.vt = VT_LPSTR; prop.u.pszVal = CoTaskMemAlloc(strlen(topic)+1); strcpy(prop.u.pszVal, topic);
1
0
0
0
Alistair Leslie-Hughes : inetcomm: Return S_OK from IMimeMessgae Commit.
by Alexandre Julliard
06 Jul '16
06 Jul '16
Module: wine Branch: master Commit: bf026723597747663ae3e872051a483bdf5b7c55 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=bf026723597747663ae3e8720…
Author: Alistair Leslie-Hughes <leslie_alistair(a)hotmail.com> Date: Fri Jul 1 07:57:30 2016 +0000 inetcomm: Return S_OK from IMimeMessgae Commit. Signed-off-by: Alistair Leslie-Hughes <leslie_alistair(a)hotmail.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/inetcomm/mimeole.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/inetcomm/mimeole.c b/dlls/inetcomm/mimeole.c index f98c2db..486ac57 100644 --- a/dlls/inetcomm/mimeole.c +++ b/dlls/inetcomm/mimeole.c @@ -2077,7 +2077,7 @@ static HRESULT WINAPI MimeMessage_Commit( DWORD dwFlags) { FIXME("(%p)->(0x%x)\n", iface, dwFlags); - return E_NOTIMPL; + return S_OK; }
1
0
0
0
Alistair Leslie-Hughes : inetcomm: Ignore option OID_CLEANUP_TREE_ON_SAVE.
by Alexandre Julliard
06 Jul '16
06 Jul '16
Module: wine Branch: master Commit: 6e6a6ff9d5217f80547f26196346f2d3d191a0b0 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=6e6a6ff9d5217f80547f26196…
Author: Alistair Leslie-Hughes <leslie_alistair(a)hotmail.com> Date: Fri Jul 1 07:57:18 2016 +0000 inetcomm: Ignore option OID_CLEANUP_TREE_ON_SAVE. Signed-off-by: Alistair Leslie-Hughes <leslie_alistair(a)hotmail.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/inetcomm/mimeole.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dlls/inetcomm/mimeole.c b/dlls/inetcomm/mimeole.c index 2ccc162..f98c2db 100644 --- a/dlls/inetcomm/mimeole.c +++ b/dlls/inetcomm/mimeole.c @@ -2509,6 +2509,9 @@ static HRESULT WINAPI MimeMessage_SetOption( case OID_SAVEBODY_KEEPBOUNDARY: FIXME("OID_SAVEBODY_KEEPBOUNDARY (value %d): ignoring\n", pValue->u.boolVal); break; + case OID_CLEANUP_TREE_ON_SAVE: + FIXME("OID_CLEANUP_TREE_ON_SAVE (value %d): ignoring\n", pValue->u.boolVal); + break; default: FIXME("Unhandled oid %08x\n", oid); hr = MIME_E_INVALID_OPTION_ID;
1
0
0
0
Alistair Leslie-Hughes : inetcomm: Implement IMimeBody DeleteProp.
by Alexandre Julliard
06 Jul '16
06 Jul '16
Module: wine Branch: master Commit: 2854c92d6315ae9a550092fa2273be96f34393f6 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=2854c92d6315ae9a550092fa2…
Author: Alistair Leslie-Hughes <leslie_alistair(a)hotmail.com> Date: Fri Jul 1 07:57:07 2016 +0000 inetcomm: Implement IMimeBody DeleteProp. Signed-off-by: Alistair Leslie-Hughes <leslie_alistair(a)hotmail.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/inetcomm/mimeole.c | 23 +++++++++++++++++-- dlls/inetcomm/tests/mimeole.c | 53 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 74 insertions(+), 2 deletions(-) diff --git a/dlls/inetcomm/mimeole.c b/dlls/inetcomm/mimeole.c index 766503d..2ccc162 100644 --- a/dlls/inetcomm/mimeole.c +++ b/dlls/inetcomm/mimeole.c @@ -898,8 +898,27 @@ static HRESULT WINAPI MimeBody_DeleteProp( LPCSTR pszName) { MimeBody *This = impl_from_IMimeBody(iface); - FIXME("(%p)->(%s) stub\n", This, debugstr_a(pszName)); - return E_NOTIMPL; + header_t *cursor; + BOOL found; + + TRACE("(%p)->(%s) stub\n", This, debugstr_a(pszName)); + + LIST_FOR_EACH_ENTRY(cursor, &This->headers, header_t, entry) + { + if(ISPIDSTR(pszName)) + found = STRTOPID(pszName) == cursor->prop->id; + else + found = !lstrcmpiA(pszName, cursor->prop->name); + + if(found) + { + list_remove(&cursor->entry); + HeapFree(GetProcessHeap(), 0, cursor); + return S_OK; + } + } + + return MIME_E_NOT_FOUND; } static HRESULT WINAPI MimeBody_CopyProps( diff --git a/dlls/inetcomm/tests/mimeole.c b/dlls/inetcomm/tests/mimeole.c index 8063b86..46fd1d5 100644 --- a/dlls/inetcomm/tests/mimeole.c +++ b/dlls/inetcomm/tests/mimeole.c @@ -604,6 +604,58 @@ static void test_BindToObject(void) IMimeMessage_Release(msg); } +static void test_BodyDeleteProp(void) +{ + static const char topic[] = "wine topic"; + HRESULT hr; + IMimeMessage *msg; + IMimeBody *body; + PROPVARIANT prop; + + hr = MimeOleCreateMessage(NULL, &msg); + ok(hr == S_OK, "ret %08x\n", hr); + + PropVariantInit(&prop); + + hr = IMimeMessage_BindToObject(msg, HBODY_ROOT, &IID_IMimeBody, (void**)&body); + ok(hr == S_OK, "ret %08x\n", hr); + + hr = IMimeBody_DeleteProp(body, "Subject"); + ok(hr == MIME_E_NOT_FOUND, "ret %08x\n", hr); + + hr = IMimeBody_DeleteProp(body, PIDTOSTR(PID_HDR_SUBJECT)); + ok(hr == MIME_E_NOT_FOUND, "ret %08x\n", hr); + + prop.vt = VT_LPSTR; + prop.u.pszVal = CoTaskMemAlloc(strlen(topic)+1); + strcpy(prop.u.pszVal, topic); + hr = IMimeBody_SetProp(body, "Subject", 0, &prop); + ok(hr == S_OK, "ret %08x\n", hr); + PropVariantClear(&prop); + + hr = IMimeBody_DeleteProp(body, "Subject"); + ok(hr == S_OK, "ret %08x\n", hr); + + hr = IMimeBody_GetProp(body, "Subject", 0, &prop); + ok(hr == MIME_E_NOT_FOUND, "ret %08x\n", hr); + + prop.vt = VT_LPSTR; + prop.u.pszVal = CoTaskMemAlloc(strlen(topic)+1); + strcpy(prop.u.pszVal, topic); + hr = IMimeBody_SetProp(body, PIDTOSTR(PID_HDR_SUBJECT), 0, &prop); + ok(hr == S_OK, "ret %08x\n", hr); + PropVariantClear(&prop); + + hr = IMimeBody_DeleteProp(body, PIDTOSTR(PID_HDR_SUBJECT)); + ok(hr == S_OK, "ret %08x\n", hr); + + hr = IMimeBody_GetProp(body, PIDTOSTR(PID_HDR_SUBJECT), 0, &prop); + ok(hr == MIME_E_NOT_FOUND, "ret %08x\n", hr); + + IMimeBody_Release(body); + IMimeMessage_Release(msg); +} + static void test_MimeOleGetPropertySchema(void) { HRESULT hr; @@ -627,6 +679,7 @@ START_TEST(mimeole) test_MessageGetPropInfo(); test_MessageOptions(); test_BindToObject(); + test_BodyDeleteProp(); test_MimeOleGetPropertySchema(); OleUninitialize(); }
1
0
0
0
Alistair Leslie-Hughes : propsys: Support VT_LPWSTR in PropVariantChangeType.
by Alexandre Julliard
06 Jul '16
06 Jul '16
Module: wine Branch: master Commit: 173515e7333e6c06405c2999f93825aa96c82452 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=173515e7333e6c06405c2999f…
Author: Alistair Leslie-Hughes <leslie_alistair(a)hotmail.com> Date: Fri Jul 1 07:56:55 2016 +0000 propsys: Support VT_LPWSTR in PropVariantChangeType. Signed-off-by: Alistair Leslie-Hughes <leslie_alistair(a)hotmail.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/propsys/propvar.c | 14 ++++++++++++++ dlls/propsys/tests/propsys.c | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+) diff --git a/dlls/propsys/propvar.c b/dlls/propsys/propvar.c index 7b1cec5..002555e 100644 --- a/dlls/propsys/propvar.c +++ b/dlls/propsys/propvar.c @@ -257,6 +257,9 @@ HRESULT WINAPI PropVariantChangeType(PROPVARIANT *ppropvarDest, REFPROPVARIANT p FIXME("(%p, %p, %d, %d, %d): semi-stub!\n", ppropvarDest, propvarSrc, propvarSrc->vt, flags, vt); + if(vt == propvarSrc->vt) + return PropVariantCopy(ppropvarDest, propvarSrc); + switch (vt) { case VT_I2: @@ -325,6 +328,17 @@ HRESULT WINAPI PropVariantChangeType(PROPVARIANT *ppropvarDest, REFPROPVARIANT p } return hr; } + case VT_LPWSTR: + { + WCHAR *res; + hr = PropVariantToStringAlloc(propvarSrc, &res); + if (SUCCEEDED(hr)) + { + ppropvarDest->vt = VT_LPWSTR; + ppropvarDest->u.pwszVal = res; + } + return hr; + } } switch (propvarSrc->vt) diff --git a/dlls/propsys/tests/propsys.c b/dlls/propsys/tests/propsys.c index d7d83d8..b658678 100644 --- a/dlls/propsys/tests/propsys.c +++ b/dlls/propsys/tests/propsys.c @@ -891,6 +891,42 @@ static void test_intconversions(void) ok(llval == -7, "got wrong value %s\n", debugstr_longlong(llval)); } +static void test_PropVariantChangeType_LPWSTR(void) +{ + PROPVARIANT dest, src; + HRESULT hr; + + PropVariantInit(&dest); + + src.vt = VT_NULL; + hr = PropVariantChangeType(&dest, &src, 0, VT_LPWSTR); + ok(hr == S_OK, "hr=%x\n", hr); + ok(dest.vt == VT_LPWSTR, "got %d\n", dest.vt); + ok(!lstrcmpW(dest.u.pwszVal, emptyW), "got %s\n", wine_dbgstr_w(dest.u.pwszVal)); + PropVariantClear(&dest); + PropVariantClear(&src); + + src.vt = VT_LPSTR; + src.u.pszVal = CoTaskMemAlloc(strlen(topic)+1); + strcpy(src.u.pszVal, topic); + hr = PropVariantChangeType(&dest, &src, 0, VT_LPWSTR); + ok(hr == S_OK, "hr=%x\n", hr); + ok(dest.vt == VT_LPWSTR, "got %d\n", dest.vt); + ok(!lstrcmpW(dest.u.pwszVal, topicW), "got %s\n", wine_dbgstr_w(dest.u.pwszVal)); + PropVariantClear(&dest); + PropVariantClear(&src); + + src.vt = VT_LPWSTR; + src.u.pwszVal = CoTaskMemAlloc( (lstrlenW(topicW)+1) * sizeof(WCHAR)); + lstrcpyW(src.u.pwszVal, topicW); + hr = PropVariantChangeType(&dest, &src, 0, VT_LPWSTR); + ok(hr == S_OK, "hr=%x\n", hr); + ok(dest.vt == VT_LPWSTR, "got %d\n", dest.vt); + ok(!lstrcmpW(dest.u.pwszVal, topicW), "got %s\n", wine_dbgstr_w(dest.u.pwszVal)); + PropVariantClear(&dest); + PropVariantClear(&src); +} + START_TEST(propsys) { test_PSStringFromPropertyKey(); @@ -902,4 +938,5 @@ START_TEST(propsys) test_PropVariantToStringAlloc(); test_PropVariantCompare(); test_intconversions(); + test_PropVariantChangeType_LPWSTR(); }
1
0
0
0
Alistair Leslie-Hughes : propsys: Add semi-stub for PropVariantToStringAlloc.
by Alexandre Julliard
06 Jul '16
06 Jul '16
Module: wine Branch: master Commit: 1807e5346f106b8cf55b176e4df9e9de2ca5d93f URL:
http://source.winehq.org/git/wine.git/?a=commit;h=1807e5346f106b8cf55b176e4…
Author: Alistair Leslie-Hughes <leslie_alistair(a)hotmail.com> Date: Fri Jul 1 07:56:42 2016 +0000 propsys: Add semi-stub for PropVariantToStringAlloc. Signed-off-by: Alistair Leslie-Hughes <leslie_alistair(a)hotmail.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/propsys/propsys.spec | 2 +- dlls/propsys/propvar.c | 37 +++++++++++++++++++++++++++++++++++++ dlls/propsys/tests/propsys.c | 28 +++++++++++++++++++++++++++- include/propvarutil.h | 2 ++ 4 files changed, 67 insertions(+), 2 deletions(-) diff --git a/dlls/propsys/propsys.spec b/dlls/propsys/propsys.spec index 92b6d7c..674df2cb 100644 --- a/dlls/propsys/propsys.spec +++ b/dlls/propsys/propsys.spec @@ -134,7 +134,7 @@ @ stub PropVariantToInt64WithDefault @ stub PropVariantToStrRet @ stub PropVariantToString -@ stub PropVariantToStringAlloc +@ stdcall PropVariantToStringAlloc(ptr ptr) @ stub PropVariantToStringVector @ stub PropVariantToStringVectorAlloc @ stub PropVariantToStringWithDefault diff --git a/dlls/propsys/propvar.c b/dlls/propsys/propvar.c index fd22c9d..7b1cec5 100644 --- a/dlls/propsys/propvar.c +++ b/dlls/propsys/propvar.c @@ -209,6 +209,43 @@ HRESULT WINAPI PropVariantToUInt64(REFPROPVARIANT propvarIn, ULONGLONG *ret) return hr; } +HRESULT WINAPI PropVariantToStringAlloc(REFPROPVARIANT propvarIn, WCHAR **ret) +{ + WCHAR *res = NULL; + HRESULT hr = S_OK; + + TRACE("%p,%p semi-stub\n", propvarIn, ret); + + switch(propvarIn->vt) + { + case VT_NULL: + res = CoTaskMemAlloc(1*sizeof(WCHAR)); + res[0] = '\0'; + break; + case VT_LPSTR: + if(propvarIn->u.pszVal) + { + DWORD len; + + len = MultiByteToWideChar(CP_ACP, 0, propvarIn->u.pszVal, -1, NULL, 0); + res = CoTaskMemAlloc(len*sizeof(WCHAR)); + if(!res) + return E_OUTOFMEMORY; + + MultiByteToWideChar(CP_ACP, 0, propvarIn->u.pszVal, -1, res, len); + } + break; + default: + FIXME("Unsupported conversion (%d)\n", propvarIn->vt); + hr = E_FAIL; + break; + } + + *ret = res; + + return hr; +} + /****************************************************************** * PropVariantChangeType (PROPSYS.@) */ diff --git a/dlls/propsys/tests/propsys.c b/dlls/propsys/tests/propsys.c index 0dd052c..d7d83d8 100644 --- a/dlls/propsys/tests/propsys.c +++ b/dlls/propsys/tests/propsys.c @@ -38,6 +38,10 @@ DEFINE_GUID(GUID_NULL,0,0,0,0,0,0,0,0,0,0,0); DEFINE_GUID(dummy_guid, 0xdeadbeef, 0xdead, 0xbeef, 0xde, 0xad, 0xbe, 0xef, 0xca, 0xfe, 0xba, 0xbe); DEFINE_GUID(expect_guid, 0x12345678, 0x1234, 0x1234, 0x12, 0x34, 0x12, 0x34, 0x56, 0x78, 0x90, 0x12); +static const char topic[] = "wine topic"; +static const WCHAR topicW[] = {'w','i','n','e',' ','t','o','p','i','c',0}; +static const WCHAR emptyW[] = {0}; + static int strcmp_wa(LPCWSTR strw, const char *stra) { CHAR buf[512]; @@ -150,7 +154,6 @@ static void test_PSStringFromPropertyKey(void) static void test_PSPropertyKeyFromString(void) { - static const WCHAR emptyW[] = {0}; static const WCHAR fmtid_clsidW[] = {'S','t','d','F','o','n','t',' ','1',0}; static const WCHAR fmtid_truncatedW[] = {'{','1','2','3','4','5','6','7','8','-','1','2','3','4','-', '1','2','3','4','-',0}; @@ -616,6 +619,28 @@ static void test_PropVariantToGUID(void) PropVariantClear(&propvar); } +static void test_PropVariantToStringAlloc(void) +{ + PROPVARIANT prop; + WCHAR *str; + HRESULT hres; + + prop.vt = VT_NULL; + hres = PropVariantToStringAlloc(&prop, &str); + ok(hres == S_OK, "returned %x\n", hres); + ok(!lstrcmpW(str, emptyW), "got %s\n", wine_dbgstr_w(str)); + CoTaskMemFree(str); + + prop.vt = VT_LPSTR; + prop.u.pszVal = CoTaskMemAlloc(strlen(topic)+1); + strcpy(prop.u.pszVal, topic); + hres = PropVariantToStringAlloc(&prop, &str); + ok(hres == S_OK, "returned %x\n", hres); + ok(!lstrcmpW(str, topicW), "got %s\n", wine_dbgstr_w(str)); + CoTaskMemFree(str); + PropVariantClear(&prop); +} + static void test_PropVariantCompare(void) { PROPVARIANT empty, null, emptyarray, i2_0, i2_2, i4_large, i4_largeneg, i4_2, str_2, str_02, str_b; @@ -874,6 +899,7 @@ START_TEST(propsys) test_InitPropVariantFromGUIDAsString(); test_InitPropVariantFromBuffer(); test_PropVariantToGUID(); + test_PropVariantToStringAlloc(); test_PropVariantCompare(); test_intconversions(); } diff --git a/include/propvarutil.h b/include/propvarutil.h index 4791543..d0aecdb 100644 --- a/include/propvarutil.h +++ b/include/propvarutil.h @@ -77,6 +77,8 @@ HRESULT WINAPI PropVariantToUInt16(REFPROPVARIANT propvarIn, USHORT *ret); HRESULT WINAPI PropVariantToUInt32(REFPROPVARIANT propvarIn, ULONG *ret); HRESULT WINAPI PropVariantToUInt64(REFPROPVARIANT propvarIn, ULONGLONG *ret); +HRESULT WINAPI PropVariantToStringAlloc(REFPROPVARIANT propvarIn, WCHAR **ret); + #ifdef __cplusplus HRESULT InitPropVariantFromBoolean(BOOL fVal, PROPVARIANT *ppropvar);
1
0
0
0
Michael Stefaniuc : ole32: Standardize COM aggregation for the DataCache.
by Alexandre Julliard
06 Jul '16
06 Jul '16
Module: wine Branch: master Commit: d17e760cb37a5f0a64fe631c799f4f923388880b URL:
http://source.winehq.org/git/wine.git/?a=commit;h=d17e760cb37a5f0a64fe631c7…
Author: Michael Stefaniuc <mstefani(a)redhat.de> Date: Wed Jul 6 08:49:39 2016 +0200 ole32: Standardize COM aggregation for the DataCache. Signed-off-by: Michael Stefaniuc <mstefani(a)redhat.de> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ole32/datacache.c | 67 +++++++++++++++++--------------------------------- 1 file changed, 22 insertions(+), 45 deletions(-) diff --git a/dlls/ole32/datacache.c b/dlls/ole32/datacache.c index 21f63d3..441a874 100644 --- a/dlls/ole32/datacache.c +++ b/dlls/ole32/datacache.c @@ -131,8 +131,8 @@ struct DataCache /* * List all interface here */ + IUnknown IUnknown_inner; IDataObject IDataObject_iface; - IUnknown IUnknown_iface; IPersistStorage IPersistStorage_iface; IViewObject2 IViewObject2_iface; IOleCache2 IOleCache2_iface; @@ -150,7 +150,7 @@ struct DataCache /* * IUnknown implementation of the outer object. */ - IUnknown* outerUnknown; + IUnknown *outer_unk; /* * The user of this object can setup ONE advise sink @@ -188,7 +188,7 @@ static inline DataCache *impl_from_IDataObject( IDataObject *iface ) static inline DataCache *impl_from_IUnknown( IUnknown *iface ) { - return CONTAINING_RECORD(iface, DataCache, IUnknown_iface); + return CONTAINING_RECORD(iface, DataCache, IUnknown_inner); } static inline DataCache *impl_from_IPersistStorage( IPersistStorage *iface ) @@ -970,7 +970,7 @@ static HRESULT WINAPI DataCache_IDataObject_QueryInterface( { DataCache *this = impl_from_IDataObject(iface); - return IUnknown_QueryInterface(this->outerUnknown, riid, ppvObject); + return IUnknown_QueryInterface(this->outer_unk, riid, ppvObject); } /************************************************************************ @@ -981,7 +981,7 @@ static ULONG WINAPI DataCache_IDataObject_AddRef( { DataCache *this = impl_from_IDataObject(iface); - return IUnknown_AddRef(this->outerUnknown); + return IUnknown_AddRef(this->outer_unk); } /************************************************************************ @@ -992,7 +992,7 @@ static ULONG WINAPI DataCache_IDataObject_Release( { DataCache *this = impl_from_IDataObject(iface); - return IUnknown_Release(this->outerUnknown); + return IUnknown_Release(this->outer_unk); } /************************************************************************ @@ -1150,7 +1150,7 @@ static HRESULT WINAPI DataCache_IPersistStorage_QueryInterface( { DataCache *this = impl_from_IPersistStorage(iface); - return IUnknown_QueryInterface(this->outerUnknown, riid, ppvObject); + return IUnknown_QueryInterface(this->outer_unk, riid, ppvObject); } /************************************************************************ @@ -1161,7 +1161,7 @@ static ULONG WINAPI DataCache_IPersistStorage_AddRef( { DataCache *this = impl_from_IPersistStorage(iface); - return IUnknown_AddRef(this->outerUnknown); + return IUnknown_AddRef(this->outer_unk); } /************************************************************************ @@ -1172,7 +1172,7 @@ static ULONG WINAPI DataCache_IPersistStorage_Release( { DataCache *this = impl_from_IPersistStorage(iface); - return IUnknown_Release(this->outerUnknown); + return IUnknown_Release(this->outer_unk); } /************************************************************************ @@ -1511,7 +1511,7 @@ static HRESULT WINAPI DataCache_IViewObject2_QueryInterface( { DataCache *this = impl_from_IViewObject2(iface); - return IUnknown_QueryInterface(this->outerUnknown, riid, ppvObject); + return IUnknown_QueryInterface(this->outer_unk, riid, ppvObject); } /************************************************************************ @@ -1522,7 +1522,7 @@ static ULONG WINAPI DataCache_IViewObject2_AddRef( { DataCache *this = impl_from_IViewObject2(iface); - return IUnknown_AddRef(this->outerUnknown); + return IUnknown_AddRef(this->outer_unk); } /************************************************************************ @@ -1533,7 +1533,7 @@ static ULONG WINAPI DataCache_IViewObject2_Release( { DataCache *this = impl_from_IViewObject2(iface); - return IUnknown_Release(this->outerUnknown); + return IUnknown_Release(this->outer_unk); } /************************************************************************ @@ -1935,7 +1935,7 @@ static HRESULT WINAPI DataCache_IOleCache2_QueryInterface( { DataCache *this = impl_from_IOleCache2(iface); - return IUnknown_QueryInterface(this->outerUnknown, riid, ppvObject); + return IUnknown_QueryInterface(this->outer_unk, riid, ppvObject); } /************************************************************************ @@ -1946,7 +1946,7 @@ static ULONG WINAPI DataCache_IOleCache2_AddRef( { DataCache *this = impl_from_IOleCache2(iface); - return IUnknown_AddRef(this->outerUnknown); + return IUnknown_AddRef(this->outer_unk); } /************************************************************************ @@ -1957,7 +1957,7 @@ static ULONG WINAPI DataCache_IOleCache2_Release( { DataCache *this = impl_from_IOleCache2(iface); - return IUnknown_Release(this->outerUnknown); + return IUnknown_Release(this->outer_unk); } /***************************************************************************** @@ -2134,7 +2134,7 @@ static HRESULT WINAPI DataCache_IOleCacheControl_QueryInterface( { DataCache *this = impl_from_IOleCacheControl(iface); - return IUnknown_QueryInterface(this->outerUnknown, riid, ppvObject); + return IUnknown_QueryInterface(this->outer_unk, riid, ppvObject); } /************************************************************************ @@ -2145,7 +2145,7 @@ static ULONG WINAPI DataCache_IOleCacheControl_AddRef( { DataCache *this = impl_from_IOleCacheControl(iface); - return IUnknown_AddRef(this->outerUnknown); + return IUnknown_AddRef(this->outer_unk); } /************************************************************************ @@ -2156,7 +2156,7 @@ static ULONG WINAPI DataCache_IOleCacheControl_Release( { DataCache *this = impl_from_IOleCacheControl(iface); - return IUnknown_Release(this->outerUnknown); + return IUnknown_Release(this->outer_unk); } /************************************************************************ @@ -2378,31 +2378,16 @@ static DataCache* DataCache_Construct( * Initialize the virtual function table. */ newObject->IDataObject_iface.lpVtbl = &DataCache_IDataObject_VTable; - newObject->IUnknown_iface.lpVtbl = &DataCache_NDIUnknown_VTable; + newObject->IUnknown_inner.lpVtbl = &DataCache_NDIUnknown_VTable; newObject->IPersistStorage_iface.lpVtbl = &DataCache_IPersistStorage_VTable; newObject->IViewObject2_iface.lpVtbl = &DataCache_IViewObject2_VTable; newObject->IOleCache2_iface.lpVtbl = &DataCache_IOleCache2_VTable; newObject->IOleCacheControl_iface.lpVtbl = &DataCache_IOleCacheControl_VTable; newObject->IAdviseSink_iface.lpVtbl = &DataCache_IAdviseSink_VTable; - - /* - * Start with one reference count. The caller of this function - * must release the interface pointer when it is done. - */ + newObject->outer_unk = pUnkOuter ? pUnkOuter : &newObject->IUnknown_inner; newObject->ref = 1; /* - * Initialize the outer unknown - * We don't keep a reference on the outer unknown since, the way - * aggregation works, our lifetime is at least as large as its - * lifetime. - */ - if (pUnkOuter==NULL) - pUnkOuter = &newObject->IUnknown_iface; - - newObject->outerUnknown = pUnkOuter; - - /* * Initialize the other members of the structure. */ newObject->sinkAspects = 0; @@ -2475,16 +2460,8 @@ HRESULT WINAPI CreateDataCache( if (newCache == 0) return E_OUTOFMEMORY; - /* - * Make sure it supports the interface required by the caller. - */ - hr = IUnknown_QueryInterface(&newCache->IUnknown_iface, riid, ppvObj); - - /* - * Release the reference obtained in the constructor. If - * the QueryInterface was unsuccessful, it will free the class. - */ - IUnknown_Release(&newCache->IUnknown_iface); + hr = IUnknown_QueryInterface(&newCache->IUnknown_inner, riid, ppvObj); + IUnknown_Release(&newCache->IUnknown_inner); return hr; }
1
0
0
0
Michael Stefaniuc : ole32: Avoid casts from the IMultiQI iface to the COM object.
by Alexandre Julliard
06 Jul '16
06 Jul '16
Module: wine Branch: master Commit: 08e571cf95c50fe2be7d4ad07c3d288f014fbca7 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=08e571cf95c50fe2be7d4ad07…
Author: Michael Stefaniuc <mstefani(a)redhat.de> Date: Wed Jul 6 08:46:56 2016 +0200 ole32: Avoid casts from the IMultiQI iface to the COM object. Signed-off-by: Michael Stefaniuc <mstefani(a)redhat.de> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ole32/marshal.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/dlls/ole32/marshal.c b/dlls/ole32/marshal.c index e0a3c3d..b39dac0 100644 --- a/dlls/ole32/marshal.c +++ b/dlls/ole32/marshal.c @@ -73,6 +73,11 @@ struct proxy_manager void *dest_context_data; /* reserved context value (LOCK) */ }; +static inline struct proxy_manager *impl_from_IMultiQI( IMultiQI *iface ) +{ + return CONTAINING_RECORD(iface, struct proxy_manager, IMultiQI_iface); +} + static inline struct proxy_manager *impl_from_IMarshal( IMarshal *iface ) { return CONTAINING_RECORD(iface, struct proxy_manager, IMarshal_iface); @@ -231,16 +236,16 @@ static HRESULT WINAPI ClientIdentity_QueryInterface(IMultiQI * iface, REFIID rii return hr; } -static ULONG WINAPI ClientIdentity_AddRef(IMultiQI * iface) +static ULONG WINAPI ClientIdentity_AddRef(IMultiQI *iface) { - struct proxy_manager * This = (struct proxy_manager *)iface; + struct proxy_manager *This = impl_from_IMultiQI(iface); TRACE("%p - before %d\n", iface, This->refs); return InterlockedIncrement(&This->refs); } -static ULONG WINAPI ClientIdentity_Release(IMultiQI * iface) +static ULONG WINAPI ClientIdentity_Release(IMultiQI *iface) { - struct proxy_manager * This = (struct proxy_manager *)iface; + struct proxy_manager *This = impl_from_IMultiQI(iface); ULONG refs = InterlockedDecrement(&This->refs); TRACE("%p - after %d\n", iface, refs); if (!refs) @@ -250,7 +255,7 @@ static ULONG WINAPI ClientIdentity_Release(IMultiQI * iface) static HRESULT WINAPI ClientIdentity_QueryMultipleInterfaces(IMultiQI *iface, ULONG cMQIs, MULTI_QI *pMQIs) { - struct proxy_manager * This = (struct proxy_manager *)iface; + struct proxy_manager *This = impl_from_IMultiQI(iface); REMQIRESULT *qiresults = NULL; ULONG nonlocal_mqis = 0; ULONG i;
1
0
0
0
Michael Stefaniuc : user32/tests: Use wine_dbgstr_rect() to print RECTs.
by Alexandre Julliard
06 Jul '16
06 Jul '16
Module: wine Branch: master Commit: a1f0d09ab3c408907b3098b7e12a7a24528f6cc4 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=a1f0d09ab3c408907b3098b7e…
Author: Michael Stefaniuc <mstefani(a)redhat.de> Date: Wed Jul 6 08:57:04 2016 +0200 user32/tests: Use wine_dbgstr_rect() to print RECTs. Signed-off-by: Michael Stefaniuc <mstefani(a)redhat.de> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/user32/tests/scroll.c | 21 ++++++--------------- dlls/user32/tests/win.c | 3 +-- 2 files changed, 7 insertions(+), 17 deletions(-) diff --git a/dlls/user32/tests/scroll.c b/dlls/user32/tests/scroll.c index 7691af3..0bda5dd 100644 --- a/dlls/user32/tests/scroll.c +++ b/dlls/user32/tests/scroll.c @@ -222,11 +222,8 @@ static void test_GetScrollBarInfo(void) ok( ret, "The GetWindowRect() call should not fail.\n" ); ok( !(sbi.rgstate[0] & (STATE_SYSTEM_INVISIBLE|STATE_SYSTEM_OFFSCREEN)), "unexpected rgstate(0x%x)\n", sbi.rgstate[0]); - ok( EqualRect(&rect, &sbi.rcScrollBar), - "WindowRect(%d, %d, %d, %d) != rcScrollBar(%d, %d, %d, %d)\n", - rect.top, rect.left, rect.bottom, rect.right, - sbi.rcScrollBar.top, sbi.rcScrollBar.left, - sbi.rcScrollBar.bottom, sbi.rcScrollBar.right ); + ok(EqualRect(&rect, &sbi.rcScrollBar), "WindowRect %s != rcScrollBar %s\n", + wine_dbgstr_rect(&rect), wine_dbgstr_rect(&sbi.rcScrollBar)); /* Test windows horizontal and vertical scrollbar to make sure rcScrollBar * is still returned in screen coordinates by moving the window, and @@ -243,11 +240,8 @@ static void test_GetScrollBarInfo(void) OffsetRect(&rect, 5, 5); ret = pGetScrollBarInfo( hMainWnd, OBJID_HSCROLL, &sbi); ok( ret, "The GetScrollBarInfo() call should not fail.\n" ); - ok( EqualRect(&rect, &sbi.rcScrollBar), - "PreviousRect(%d, %d, %d, %d) != CurrentRect(%d, %d, %d, %d)\n", - rect.top, rect.left, rect.bottom, rect.right, - sbi.rcScrollBar.top, sbi.rcScrollBar.left, - sbi.rcScrollBar.bottom, sbi.rcScrollBar.right ); + ok(EqualRect(&rect, &sbi.rcScrollBar), "PreviousRect %s != CurrentRect %s\n", + wine_dbgstr_rect(&rect), wine_dbgstr_rect(&sbi.rcScrollBar)); sbi.cbSize = sizeof(sbi); ret = pGetScrollBarInfo( hMainWnd, OBJID_VSCROLL, &sbi); @@ -260,11 +254,8 @@ static void test_GetScrollBarInfo(void) OffsetRect(&rect, 5, 5); ret = pGetScrollBarInfo( hMainWnd, OBJID_VSCROLL, &sbi); ok( ret, "The GetScrollBarInfo() call should not fail.\n" ); - ok( EqualRect(&rect, &sbi.rcScrollBar), - "PreviousRect(%d, %d, %d, %d) != CurrentRect(%d, %d, %d, %d)\n", - rect.top, rect.left, rect.bottom, rect.right, - sbi.rcScrollBar.top, sbi.rcScrollBar.left, - sbi.rcScrollBar.bottom, sbi.rcScrollBar.right ); + ok(EqualRect(&rect, &sbi.rcScrollBar), "PreviousRect %s != CurrentRect %s\n", + wine_dbgstr_rect(&rect), wine_dbgstr_rect(&sbi.rcScrollBar)); DestroyWindow(hScroll); DestroyWindow(hMainWnd); diff --git a/dlls/user32/tests/win.c b/dlls/user32/tests/win.c index 8505983..7195102 100644 --- a/dlls/user32/tests/win.c +++ b/dlls/user32/tests/win.c @@ -2504,8 +2504,7 @@ static void test_SetWindowPos(HWND hwnd, HWND hwnd2) ret = SetWindowPos(hwnd_child, hwnd_desktop, 0, 0, 0, 0, 0); ok(!ret, "Got %d\n", ret); GetWindowRect(hwnd_child, &rc2); - ok(EqualRect(&rc1, &rc2), "(%d, %d, %d, %d) != (%d, %d, %d, %d)\n", - rc1.top, rc1.left, rc1.bottom, rc1.right, rc2.top, rc2.left, rc2.bottom, rc2.right); + ok(EqualRect(&rc1, &rc2), "%s != %s\n", wine_dbgstr_rect(&rc1), wine_dbgstr_rect(&rc2)); check_active_state(hwnd2, hwnd2, hwnd2); ret = SetWindowPos(hwnd_desktop, hwnd_child, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE);
1
0
0
0
Alexandre Julliard : tools: Compare file contents directly in Perl instead of invoking cmp.
by Alexandre Julliard
06 Jul '16
06 Jul '16
Module: wine Branch: master Commit: af91122caf39c22cbf635d79f39fa44f91f47541 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=af91122caf39c22cbf635d79f…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Wed Jul 6 15:32:16 2016 +0900 tools: Compare file contents directly in Perl instead of invoking cmp. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- tools/make_makefiles | 81 ++++++++++++++++++++++------------------------------ tools/make_specfiles | 30 +++++++++---------- 2 files changed, 47 insertions(+), 64 deletions(-) diff --git a/tools/make_makefiles b/tools/make_makefiles index 4f1d882..8411ecb 100755 --- a/tools/make_makefiles +++ b/tools/make_makefiles @@ -84,25 +84,21 @@ sub dirname($) } # update a file if changed -sub update_file($) +sub update_file($$) { my $file = shift; - my $ret = !(-f $file) || system "cmp $file $file.new >/dev/null"; - if (!$ret) + my $new = shift; + + open FILE, ">$file.new" or die "cannot create $file.new"; + print FILE $new; + close FILE; + rename "$file.new", "$file"; + print "$file updated\n"; + if ($file eq "configure.ac") { - unlink "$file.new"; + system "autoconf"; + print "configure updated\n"; } - else - { - rename "$file.new", "$file"; - print "$file updated\n"; - if ($file eq "configure.ac") - { - system "autoconf"; - print "configure updated\n"; - } - } - return $ret; } # replace some lines in a file between two markers @@ -111,34 +107,28 @@ sub replace_in_file($$$@) my $file = shift; my $start = shift; my $end = shift; + my ($old, $new); - open NEW_FILE, ">$file.new" or die "cannot create $file.new"; - - if (defined($start)) + open OLD_FILE, "$file" or die "cannot open $file"; + while (<OLD_FILE>) { - open OLD_FILE, "$file" or die "cannot open $file"; - while (<OLD_FILE>) - { - last if /$start/; - print NEW_FILE $_; - } + $old .= $_; + last if /$start/; + $new .= $_; } - print NEW_FILE @_; + $new .= join "", @_; - if (defined($end)) + my $skip = 1; + while (<OLD_FILE>) { - my $skip=1; - while (<OLD_FILE>) - { - print NEW_FILE $_ unless $skip; - $skip = 0 if /$end/; - } + $old .= $_; + $new .= $_ unless $skip; + $skip = 0 if /$end/; } - close OLD_FILE if defined($start); - close NEW_FILE; - return update_file($file); + close OLD_FILE; + update_file($file, $new) if $old ne $new; } # replace all source variables in a makefile @@ -147,14 +137,14 @@ sub replace_makefile_variables($) my $file = shift; my $make = $makefiles{$file}; my $source_vars_regexp = join "|", @source_vars; - my $modified = 0; my %replaced; - - open NEW_FILE, ">$file.in.new" or die "cannot create $file.in.new"; + my $old; + my $new; open OLD_FILE, "$file.in" or die "cannot open $file.in"; while (<OLD_FILE>) { + $old .= $_; if (/^\s*($source_vars_regexp)(\s*)=/) { # try to preserve formatting @@ -178,6 +168,7 @@ sub replace_makefile_variables($) { $_ = <OLD_FILE>; last unless $_; + $old .= $_; $old_str .= $_; } my $new_str = ""; @@ -188,18 +179,17 @@ sub replace_makefile_variables($) elsif ($multiline) { $new_str = "$var = \\\n\t" . join(" \\\n\t", sort @values) . "\n"; - print NEW_FILE $new_str; + $new .= $new_str; } else { $new_str = "$var$spaces= @values\n"; - print NEW_FILE $new_str; + $new .= $new_str; } - $modified = 1 if ($old_str ne $new_str); $replaced{$var} = 1; next; } - print NEW_FILE $_; + $new .= $_; } foreach my $var (@source_vars) { @@ -207,13 +197,10 @@ sub replace_makefile_variables($) next unless defined ${$make}{"=$var"}; my @values = @{${$make}{"=$var"}}; next unless @values; - print NEW_FILE "\n$var = \\\n\t" . join(" \\\n\t", sort @values) . "\n"; - $modified = 1; + $new .= "\n$var = \\\n\t" . join(" \\\n\t", sort @values) . "\n"; } close OLD_FILE; - close NEW_FILE; - return update_file("$file.in") if $modified; - unlink "$file.in.new"; + update_file("$file.in", $new) if $old ne $new; } # parse the specified makefile and load the variables diff --git a/tools/make_specfiles b/tools/make_specfiles index 85d39d8..b0cc3f4 100755 --- a/tools/make_specfiles +++ b/tools/make_specfiles @@ -263,21 +263,17 @@ foreach my $arg (@ARGV) elsif ($arg eq "-d") { $show_duplicates = 1; } } -sub update_file($) +# update a file if changed +sub update_file($$) { my $file = shift; - my $ret = !(-f $file) || system "cmp $file $file.new >/dev/null"; - if (!$ret) - { - unlink "$file.new"; - } - else - { - #system "diff -u $file $file.new"; - rename "$file.new", "$file"; - print "$file updated\n"; - } - return $ret; + my $new = shift; + + open FILE, ">$file.new" or die "cannot create $file.new"; + print FILE $new; + close FILE; + rename "$file.new", "$file"; + print "$file updated\n"; } # parse a spec file line @@ -319,11 +315,12 @@ sub update_spec_file($) my $name = shift; my $file = "dlls/$name/$name.spec"; my %stubs; + my ($old, $new); open SPEC, "<$file" or die "cannot open $file"; - open NEW, ">$file.new" or die "cannot create $file.new"; while (<SPEC>) { + $old .= $_; chomp; my $commented_out = 0; @@ -389,11 +386,10 @@ sub update_spec_file($) $_ .= $descr{comment} || ""; done: - print NEW "$_\n"; + $new .= "$_\n"; } close SPEC; - close NEW; - update_file( $file ); + update_file( $file, $new ) if $old ne $new; } sub sync_spec_files(@)
1
0
0
0
← Newer
1
...
48
49
50
51
52
53
54
...
68
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
Results per page:
10
25
50
100
200