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
December 2006
----- 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
4 participants
720 discussions
Start a n
N
ew thread
Jacek Caban : mshtml: Improve loading document detection in AsyncOpen.
by Alexandre Julliard
22 Dec '06
22 Dec '06
Module: wine Branch: master Commit: f35c66c693f5ec90bcf526d4d1b5edac49187941 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=f35c66c693f5ec90bcf526d4d…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Thu Dec 21 23:32:25 2006 +0100 mshtml: Improve loading document detection in AsyncOpen. --- dlls/mshtml/nsembed.c | 1 + dlls/mshtml/nsiface.idl | 2 ++ dlls/mshtml/nsio.c | 32 +++++++++++++++++++++++++++++--- 3 files changed, 32 insertions(+), 3 deletions(-) diff --git a/dlls/mshtml/nsembed.c b/dlls/mshtml/nsembed.c index f1c2dd2..08917d1 100644 --- a/dlls/mshtml/nsembed.c +++ b/dlls/mshtml/nsembed.c @@ -931,6 +931,7 @@ static nsresult NSAPI nsURIContentListen } nsIWineURI_SetNSContainer(wine_uri, This); + nsIWineURI_SetIsDocumentURI(wine_uri, TRUE); if(This->bscallback && This->bscallback->mon) { LPWSTR url = NULL; diff --git a/dlls/mshtml/nsiface.idl b/dlls/mshtml/nsiface.idl index 3cff0da..fafa15d 100644 --- a/dlls/mshtml/nsiface.idl +++ b/dlls/mshtml/nsiface.idl @@ -1531,4 +1531,6 @@ interface nsIWineURI : nsIURI nsresult SetNSContainer(NSContainer *aNSContainer); nsresult GetMoniker(IMoniker **aMoniker); nsresult SetMoniker(IMoniker *aMoniker); + nsresult GetIsDocumentURI(PRBool *aIsDocumentURI); + nsresult SetIsDocumentURI(PRBool aIsDocumentURI); } diff --git a/dlls/mshtml/nsio.c b/dlls/mshtml/nsio.c index 4ce041e..6366ba2 100644 --- a/dlls/mshtml/nsio.c +++ b/dlls/mshtml/nsio.c @@ -54,6 +54,7 @@ typedef struct { NSContainer *container; IMoniker *mon; LPSTR spec; + PRBool is_doc_uri; } nsURI; #define NSURI(x) ((nsIURI*) &(x)->lpWineURIVtbl) @@ -598,11 +599,14 @@ static nsresult NSAPI nsChannel_AsyncOpe BSCallback *bscallback; nsIWineURI *wine_uri; IMoniker *mon; + PRBool is_doc_uri; nsresult nsres; TRACE("(%p)->(%p %p)\n", This, aListener, aContext); - if(This->load_flags & LOAD_INITIAL_DOCUMENT_URI) { + nsIWineURI_GetIsDocumentURI(This->uri, &is_doc_uri); + + if(is_doc_uri && (This->load_flags & LOAD_INITIAL_DOCUMENT_URI)) { NSContainer *container; nsIWineURI_GetNSContainer(This->uri, &container); @@ -633,7 +637,6 @@ static nsresult NSAPI nsChannel_AsyncOpe if(NS_FAILED(nsres)) ERR("AddRequest failed:%08x\n", nsres); } - return WINE_NS_LOAD_FROM_MONIKER; } }else if(container->doc) { @@ -1589,6 +1592,26 @@ static nsresult NSAPI nsURI_SetMoniker(n return NS_OK; } +static nsresult NSAPI nsURI_GetIsDocumentURI(nsIWineURI *iface, PRBool *aIsDocumentURI) +{ + nsURI *This = NSURI_THIS(iface); + + TRACE("(%p)->(%p)\n", This, aIsDocumentURI); + + *aIsDocumentURI = This->is_doc_uri; + return NS_OK; +} + +static nsresult NSAPI nsURI_SetIsDocumentURI(nsIWineURI *iface, PRBool aIsDocumentURI) +{ + nsURI *This = NSURI_THIS(iface); + + TRACE("(%p)->(%x)\n", This, aIsDocumentURI); + + This->is_doc_uri = aIsDocumentURI; + return NS_OK; +} + #undef NSURI_THIS static const nsIWineURIVtbl nsWineURIVtbl = { @@ -1624,7 +1647,9 @@ static const nsIWineURIVtbl nsWineURIVtb nsURI_GetNSContainer, nsURI_SetNSContainer, nsURI_GetMoniker, - nsURI_SetMoniker + nsURI_SetMoniker, + nsURI_GetIsDocumentURI, + nsURI_SetIsDocumentURI }; static nsresult create_uri(nsIURI *uri, NSContainer *container, nsIURI **_retval) @@ -1637,6 +1662,7 @@ static nsresult create_uri(nsIURI *uri, ret->container = container; ret->mon = NULL; ret->spec = NULL; + ret->is_doc_uri = FALSE; if(container) nsIWebBrowserChrome_AddRef(NSWBCHROME(container));
1
0
0
0
Jacek Caban : mshtml: Use Gecko' s AsyncOpen if URI is has no nsIWineURI interface.
by Alexandre Julliard
22 Dec '06
22 Dec '06
Module: wine Branch: master Commit: 30157c3a703ead706b46db34bd2a5df10c215d08 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=30157c3a703ead706b46db34b…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Thu Dec 21 23:31:53 2006 +0100 mshtml: Use Gecko's AsyncOpen if URI is has no nsIWineURI interface. --- dlls/mshtml/nsio.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dlls/mshtml/nsio.c b/dlls/mshtml/nsio.c index 4b48511..4ce041e 100644 --- a/dlls/mshtml/nsio.c +++ b/dlls/mshtml/nsio.c @@ -607,8 +607,8 @@ static nsresult NSAPI nsChannel_AsyncOpe nsIWineURI_GetNSContainer(This->uri, &container); if(!container) { - ERR("container = NULL\n"); - return NS_ERROR_UNEXPECTED; + TRACE("container = NULL\n"); + return nsIChannel_AsyncOpen(This->channel, aListener, aContext); } if(container->bscallback) {
1
0
0
0
Huw Davies : gdi32: Extract the constituent TrueType files from Mac suitcase fonts into the user 's caches directory
by Alexandre Julliard
21 Dec '06
21 Dec '06
Module: wine Branch: master Commit: 4e6860433e72714ed1e500eb523710656e71ba02 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=4e6860433e72714ed1e500eb5…
Author: Huw Davies <huw(a)codeweavers.com> Date: Thu Dec 21 15:21:13 2006 +0000 gdi32: Extract the constituent TrueType files from Mac suitcase fonts into the user's caches directory and use these instead of the original suitcase. --- configure | 6 +- configure.ac | 1 + dlls/gdi32/Makefile.in | 2 +- dlls/gdi32/freetype.c | 257 ++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 264 insertions(+), 2 deletions(-) diff --git a/configure b/configure index 6779121..3e9b56e 100755 --- a/configure +++ b/configure @@ -759,6 +759,7 @@ IOKITLIB LDEXECFLAGS DISKARBITRATIONLIB COREAUDIO +CARBONLIB CROSSTEST CROSSCC CROSSWINDRES @@ -13462,6 +13463,8 @@ fi esac if test "$ac_cv_header_Carbon_Carbon_h" = "yes" then + CARBONLIB="-framework Carbon" + QUARTZFILES='$(QUARTZFILES)' fi ;; @@ -21426,6 +21429,7 @@ IOKITLIB!$IOKITLIB$ac_delim LDEXECFLAGS!$LDEXECFLAGS$ac_delim DISKARBITRATIONLIB!$DISKARBITRATIONLIB$ac_delim COREAUDIO!$COREAUDIO$ac_delim +CARBONLIB!$CARBONLIB$ac_delim CROSSTEST!$CROSSTEST$ac_delim CROSSCC!$CROSSCC$ac_delim CROSSWINDRES!$CROSSWINDRES$ac_delim @@ -21442,7 +21446,7 @@ LIBOBJS!$LIBOBJS$ac_delim LTLIBOBJS!$LTLIBOBJS$ac_delim _ACEOF - if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 76; then + if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 77; then break elif $ac_last_try; then { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 diff --git a/configure.ac b/configure.ac index efbf32d..9fc757b 100644 --- a/configure.ac +++ b/configure.ac @@ -1023,6 +1023,7 @@ case $host_os in dnl Enable quartz driver on Mac OS X if test "$ac_cv_header_Carbon_Carbon_h" = "yes" then + AC_SUBST(CARBONLIB,"-framework Carbon") QUARTZFILES='$(QUARTZFILES)' fi ;; diff --git a/dlls/gdi32/Makefile.in b/dlls/gdi32/Makefile.in index df6f89b..e3b2d67 100644 --- a/dlls/gdi32/Makefile.in +++ b/dlls/gdi32/Makefile.in @@ -7,7 +7,7 @@ MODULE = gdi32.dll IMPORTLIB = libgdi32.$(IMPLIBEXT) IMPORTS = advapi32 kernel32 ntdll EXTRAINCL = @FREETYPEINCL@ -EXTRALIBS = @ICULIBS@ +EXTRALIBS = @ICULIBS@ @CARBONLIB@ SPEC_SRCS16 = \ dispdib.spec \ diff --git a/dlls/gdi32/freetype.c b/dlls/gdi32/freetype.c index 84daf4f..b9a46bc 100644 --- a/dlls/gdi32/freetype.c +++ b/dlls/gdi32/freetype.c @@ -37,6 +37,44 @@ #include <stdio.h> #include <assert.h> +#ifdef HAVE_CARBON_CARBON_H +#define LoadResource __carbon_LoadResource +#define CompareString __carbon_CompareString +#define GetCurrentThread __carbon_GetCurrentThread +#define GetCurrentProcess __carbon_GetCurrentProcess +#define AnimatePalette __carbon_AnimatePalette +#define EqualRgn __carbon_EqualRgn +#define FillRgn __carbon_FillRgn +#define FrameRgn __carbon_FrameRgn +#define GetPixel __carbon_GetPixel +#define InvertRgn __carbon_InvertRgn +#define LineTo __carbon_LineTo +#define OffsetRgn __carbon_OffsetRgn +#define PaintRgn __carbon_PaintRgn +#define Polygon __carbon_Polygon +#define ResizePalette __carbon_ResizePalette +#define SetRectRgn __carbon_SetRectRgn +#include <Carbon/Carbon.h> +#undef LoadResource +#undef CompareString +#undef GetCurrentThread +#undef _CDECL +#undef DPRINTF +#undef GetCurrentProcess +#undef AnimatePalette +#undef EqualRgn +#undef FillRgn +#undef FrameRgn +#undef GetPixel +#undef InvertRgn +#undef LineTo +#undef OffsetRgn +#undef PaintRgn +#undef Polygon +#undef ResizePalette +#undef SetRectRgn +#endif /* HAVE_CARBON_CARBON_H */ + #include "windef.h" #include "winbase.h" #include "winternl.h" @@ -438,6 +476,204 @@ static const WCHAR font_mutex_nameW[] = * cga40woa.fon=cga40850.fon */ +#ifdef HAVE_CARBON_CARBON_H +static char *find_cache_dir(void) +{ + FSRef ref; + OSErr err; + static char cached_path[MAX_PATH]; + static const char *wine = "/Wine", *fonts = "/Fonts"; + + if(*cached_path) return cached_path; + + err = FSFindFolder(kUserDomain, kCachedDataFolderType, kCreateFolder, &ref); + if(err != noErr) + { + WARN("can't create cached data folder\n"); + return NULL; + } + err = FSRefMakePath(&ref, (unsigned char*)cached_path, sizeof(cached_path)); + if(err != noErr) + { + WARN("can't create cached data path\n"); + *cached_path = '\0'; + return NULL; + } + if(strlen(cached_path) + strlen(wine) + strlen(fonts) + 1 > sizeof(cached_path)) + { + ERR("Could not create full path\n"); + *cached_path = '\0'; + return NULL; + } + strcat(cached_path, wine); + + if(mkdir(cached_path, 0700) == -1 && errno != EEXIST) + { + WARN("Couldn't mkdir %s\n", cached_path); + *cached_path = '\0'; + return NULL; + } + strcat(cached_path, fonts); + if(mkdir(cached_path, 0700) == -1 && errno != EEXIST) + { + WARN("Couldn't mkdir %s\n", cached_path); + *cached_path = '\0'; + return NULL; + } + return cached_path; +} + +/****************************************************************** + * expand_mac_font + * + * Extracts individual TrueType font files from a Mac suitcase font + * and saves them into the user's caches directory (see + * find_cache_dir()). + * Returns a NULL terminated array of filenames. + * + * We do this because they are apps that try to read ttf files + * themselves and they don't like Mac suitcase files. + */ +static char **expand_mac_font(const char *path) +{ + FSRef ref; + SInt16 res_ref; + OSStatus s; + unsigned int idx; + const char *out_dir; + const char *filename; + int output_len; + struct { + char **array; + unsigned int size, max_size; + } ret; + + TRACE("path %s\n", path); + + s = FSPathMakeRef((unsigned char*)path, &ref, FALSE); + if(s != noErr) + { + WARN("failed to get ref\n"); + return NULL; + } + + s = FSOpenResourceFile(&ref, 0, NULL, fsRdPerm, &res_ref); + if(s != noErr) + { + TRACE("no data fork, so trying resource fork\n"); + res_ref = FSOpenResFile(&ref, fsRdPerm); + if(res_ref == -1) + { + TRACE("unable to open resource fork\n"); + return NULL; + } + } + + ret.size = 0; + ret.max_size = 10; + ret.array = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, ret.max_size * sizeof(*ret.array)); + if(!ret.array) + { + CloseResFile(res_ref); + return NULL; + } + + out_dir = find_cache_dir(); + + filename = strrchr(path, '/'); + if(!filename) filename = path; + else filename++; + + /* output filename has the form out_dir/filename_%04x.ttf */ + output_len = strlen(out_dir) + 1 + strlen(filename) + 5 + 5; + + UseResFile(res_ref); + idx = 1; + while(1) + { + FamRec *fam_rec; + unsigned short *num_faces_ptr, num_faces, face; + AsscEntry *assoc; + Handle fond; + + fond = Get1IndResource('FOND', idx); + if(!fond) break; + TRACE("got fond resource %d\n", idx); + HLock(fond); + + fam_rec = *(FamRec**)fond; + num_faces_ptr = (unsigned short *)(fam_rec + 1); + num_faces = GET_BE_WORD(*num_faces_ptr); + num_faces++; + assoc = (AsscEntry*)(num_faces_ptr + 1); + TRACE("num faces %04x\n", num_faces); + for(face = 0; face < num_faces; face++, assoc++) + { + Handle sfnt; + unsigned short size, font_id; + char *output; + + size = GET_BE_WORD(assoc->fontSize); + font_id = GET_BE_WORD(assoc->fontID); + if(size != 0) + { + TRACE("skipping id %04x because it's not scalable (fixed size %d)\n", font_id, size); + continue; + } + + TRACE("trying to load sfnt id %04x\n", font_id); + sfnt = GetResource('sfnt', font_id); + if(!sfnt) + { + TRACE("can't get sfnt resource %04x\n", font_id); + continue; + } + + output = HeapAlloc(GetProcessHeap(), 0, output_len); + if(output) + { + int fd; + + sprintf(output, "%s/%s_%04x.ttf", out_dir, filename, font_id); + + fd = open(output, O_CREAT | O_EXCL | O_WRONLY, 0600); + if(fd != -1 || errno == EEXIST) + { + if(fd != -1) + { + unsigned char *sfnt_data; + + HLock(sfnt); + sfnt_data = *(unsigned char**)sfnt; + write(fd, sfnt_data, GetHandleSize(sfnt)); + HUnlock(sfnt); + close(fd); + } + if(ret.size >= ret.max_size - 1) /* Always want the last element to be NULL */ + { + ret.max_size *= 2; + ret.array = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, ret.array, ret.max_size * sizeof(*ret.array)); + } + ret.array[ret.size++] = output; + } + else + { + WARN("unable to create %s\n", output); + HeapFree(GetProcessHeap(), 0, output); + } + } + ReleaseResource(sfnt); + } + HUnlock(fond); + ReleaseResource(fond); + idx++; + } + CloseResFile(res_ref); + + return ret.array; +} + +#endif /* HAVE_CARBON_CARBON_H */ static inline BOOL is_win9x(void) { @@ -722,6 +958,27 @@ static BOOL AddFontFileToList(const char int i, bitmap_num, internal_leading; FONTSIGNATURE fs; +#ifdef HAVE_CARBON_CARBON_H + if(!fake_family) + { + char **mac_list = expand_mac_font(file); + if(mac_list) + { + BOOL had_one = FALSE; + char **cursor; + for(cursor = mac_list; *cursor; cursor++) + { + had_one = TRUE; + AddFontFileToList(*cursor, NULL, flags); + HeapFree(GetProcessHeap(), 0, *cursor); + } + HeapFree(GetProcessHeap(), 0, mac_list); + if(had_one) + return TRUE; + } + } +#endif /* HAVE_CARBON_CARBON_H */ + do { char *family_name = fake_family;
1
0
0
0
Francois Gouget : setupapi: Fix handling of 'CopyFiles=@file'.
by Alexandre Julliard
21 Dec '06
21 Dec '06
Module: wine Branch: master Commit: 8cfd0251646862dd1415c9ac028958c044b38eb1 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=8cfd0251646862dd1415c9ac0…
Author: Francois Gouget <fgouget(a)codeweavers.com> Date: Thu Dec 21 14:48:15 2006 +0100 setupapi: Fix handling of 'CopyFiles=@file'. --- dlls/setupapi/install.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/dlls/setupapi/install.c b/dlls/setupapi/install.c index 4c60b86..46f1b94 100644 --- a/dlls/setupapi/install.c +++ b/dlls/setupapi/install.c @@ -113,7 +113,7 @@ static BOOL copy_files_callback( HINF hi struct files_callback_info *info = arg; if (field[0] == '@') /* special case: copy single file */ - SetupQueueDefaultCopyW( info->queue, info->layout, info->src_root, NULL, field, info->copy_flags ); + SetupQueueDefaultCopyW( info->queue, info->layout, info->src_root, NULL, field+1, info->copy_flags ); else SetupQueueCopySectionW( info->queue, info->src_root, info->layout, hinf, field, info->copy_flags ); return TRUE;
1
0
0
0
Ken Thomases : iphlpapi: Fixed a problem with enumerating network interfaces.
by Alexandre Julliard
21 Dec '06
21 Dec '06
Module: wine Branch: master Commit: 6b033cc1e61a1ac50753b52c1b267f34a3a7ee54 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=6b033cc1e61a1ac50753b52c1…
Author: Ken Thomases <ken(a)codeweavers.com> Date: Thu Dec 21 14:47:20 2006 +0100 iphlpapi: Fixed a problem with enumerating network interfaces. Keep increasing the buffer until the returned length is more than two records smaller than the buffer we provided. --- dlls/iphlpapi/ifenum.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/dlls/iphlpapi/ifenum.c b/dlls/iphlpapi/ifenum.c index 52e8413..fb3348f 100644 --- a/dlls/iphlpapi/ifenum.c +++ b/dlls/iphlpapi/ifenum.c @@ -690,7 +690,7 @@ static DWORD enumIPAddresses(PDWORD pcAd ifc->ifc_buf = HeapAlloc(GetProcessHeap(), 0, ifc->ifc_len); ioctlRet = ioctl(fd, SIOCGIFCONF, ifc); } while (ioctlRet == 0 && - ifc->ifc_len == (sizeof(struct ifreq) * guessedNumAddresses)); + ifc->ifc_len > (sizeof(struct ifreq) * (guessedNumAddresses - 2))); if (ioctlRet == 0) { ifPtr = ifc->ifc_buf;
1
0
0
0
Alexandre Julliard : ntdll: Added support for physically ejecting devices on Mac OS.
by Alexandre Julliard
21 Dec '06
21 Dec '06
Module: wine Branch: master Commit: 9ff161860c51d62f7f05989116cd73908f5611e9 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=9ff161860c51d62f7f0598911…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Thu Dec 21 14:14:20 2006 +0100 ntdll: Added support for physically ejecting devices on Mac OS. --- dlls/ntdll/cdrom.c | 99 +++++++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 98 insertions(+), 1 deletions(-) diff --git a/dlls/ntdll/cdrom.c b/dlls/ntdll/cdrom.c index 65712a7..45a2b47 100644 --- a/dlls/ntdll/cdrom.c +++ b/dlls/ntdll/cdrom.c @@ -77,7 +77,9 @@ #ifdef HAVE_IOKIT_IOKITLIB_H # ifndef SENSEBUFLEN +# include <sys/disk.h> # include <IOKit/IOKitLib.h> +# include <IOKit/storage/IOMedia.h> # include <IOKit/scsi/SCSICmds_REQUEST_SENSE_Defs.h> # define SENSEBUFLEN kSenseDefaultSize # endif @@ -302,6 +304,82 @@ static int CDROM_MediaChanged(int dev) } #endif + +/****************************************************************** + * open_parent_device + * + * On Mac OS, open the device for the whole disk from a fd that points to a partition. + * This is ugly and inefficient, but we have no choice since the partition fd doesn't + * support the eject ioctl. + */ +#ifdef __APPLE__ +static int open_parent_device( int fd ) +{ + struct stat st; + int i, parent_fd = -1; + io_service_t service; + CFMutableDictionaryRef dict; + CFTypeRef val; + + if (fstat( fd, &st ) == -1) return -1; + if (!S_ISCHR( st.st_mode )) return -1; + + /* create a dictionary with the right major/minor numbers */ + + if (!(dict = IOServiceMatching( kIOMediaClass ))) return -1; + + i = major( st.st_rdev ); + val = CFNumberCreate( NULL, kCFNumberIntType, &i ); + CFDictionaryAddValue( dict, CFSTR( "BSD Major" ), val ); + CFRelease( val ); + + i = minor( st.st_rdev ); + val = CFNumberCreate( NULL, kCFNumberIntType, &i ); + CFDictionaryAddValue( dict, CFSTR( "BSD Minor" ), val ); + CFRelease( val ); + + CFDictionaryAddValue( dict, CFSTR("Removable"), kCFBooleanTrue ); + + service = IOServiceGetMatchingService( kIOMasterPortDefault, dict ); + + /* now look for the parent that has the "Whole" attribute set to TRUE */ + + while (service) + { + io_service_t parent = 0; + CFBooleanRef whole; + CFStringRef str; + int ok; + + if (!IOObjectConformsTo( service, kIOMediaClass )) + goto next; + if (!(whole = IORegistryEntryCreateCFProperty( service, CFSTR("Whole"), NULL, 0 ))) + goto next; + ok = (whole == kCFBooleanTrue); + CFRelease( whole ); + if (!ok) goto next; + + if ((str = IORegistryEntryCreateCFProperty( service, CFSTR("BSD Name"), NULL, 0 ))) + { + char name[100]; + strcpy( name, "/dev/r" ); + CFStringGetCString( str, name + 6, sizeof(name) - 6, kCFStringEncodingUTF8 ); + CFRelease( str ); + parent_fd = open( name, O_RDONLY ); + } + IOObjectRelease( service ); + break; + +next: + IORegistryEntryGetParentEntry( service, kIOServicePlane, &parent ); + IOObjectRelease( service ); + service = parent; + } + return parent_fd; +} +#endif + + /****************************************************************** * CDROM_SyncCache [internal] * @@ -628,6 +706,9 @@ static NTSTATUS CDROM_SetTray(int fd, BO return CDROM_GetStatusCode((ioctl(fd, CDIOCALLOW, NULL)) || (ioctl(fd, doEject ? CDIOCEJECT : CDIOCCLOSE, NULL)) || (ioctl(fd, CDIOCPREVENT, NULL))); +#elif defined(__APPLE__) + if (doEject) return CDROM_GetStatusCode( ioctl( fd, DKIOCEJECT, NULL ) ); + else return STATUS_NOT_SUPPORTED; #else return STATUS_NOT_SUPPORTED; #endif @@ -2059,7 +2140,23 @@ NTSTATUS CDROM_DeviceIoControl(HANDLE hD CDROM_ClearCacheEntry(dev); if (lpInBuffer != NULL || nInBufferSize != 0 || lpOutBuffer != NULL || nOutBufferSize != 0) status = STATUS_INVALID_PARAMETER; - else status = CDROM_SetTray(fd, TRUE); + else + { +#ifdef __APPLE__ + int parent_fd = open_parent_device( fd ); + if (parent_fd != -1) + { + /* This is ugly as hell, but Mac OS is unable to eject from the device fd, + * it wants an fd for the whole device, and it also requires the device fd + * to be closed first, so we have to close the handle that the caller gave us */ + NtClose( hDevice ); + if (needs_close) close( fd ); + fd = parent_fd; + needs_close = 1; + } +#endif + status = CDROM_SetTray(fd, TRUE); + } break; case IOCTL_CDROM_MEDIA_REMOVAL:
1
0
0
0
Alexandre Julliard : ntdll: File positions should be aligned to sector boundaries in PE loader.
by Alexandre Julliard
21 Dec '06
21 Dec '06
Module: wine Branch: master Commit: 9fed1205cae7cdb7abacfd3c86523cb22db16ef8 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=9fed1205cae7cdb7abacfd3c8…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Thu Dec 21 12:34:44 2006 +0100 ntdll: File positions should be aligned to sector boundaries in PE loader. --- dlls/kernel32/tests/loader.c | 4 ---- dlls/ntdll/virtual.c | 24 +++++++++++++----------- server/mapping.c | 42 +++++++++++++++++++++--------------------- 3 files changed, 34 insertions(+), 36 deletions(-) diff --git a/dlls/kernel32/tests/loader.c b/dlls/kernel32/tests/loader.c index 8811334..4f00e4d 100644 --- a/dlls/kernel32/tests/loader.c +++ b/dlls/kernel32/tests/loader.c @@ -404,9 +404,7 @@ START_TEST(loader) ok(info.Type == SEC_IMAGE, "%d: %x != SEC_IMAGE\n", i, info.Type); if (nt_header.OptionalHeader.SectionAlignment >= si.dwPageSize) -todo_wine { ok(!memcmp((const char *)hlib + section.VirtualAddress + section.PointerToRawData, &nt_header, section.SizeOfRawData), "wrong section data\n"); -} else ok(!memcmp((const char *)hlib + section.PointerToRawData, section_data, section.SizeOfRawData), "wrong section data\n"); @@ -418,9 +416,7 @@ todo_wine { start = (const char *)hlib + section.VirtualAddress + section.PointerToRawData + section.SizeOfRawData; size = ALIGN_SIZE((ULONG_PTR)start, si.dwPageSize) - (ULONG_PTR)start; -todo_wine { ok(memcmp(start, filler, size), "%d: alignment should not be not cleared\n", i); -} } } diff --git a/dlls/ntdll/virtual.c b/dlls/ntdll/virtual.c index 152af7b..fe33566 100644 --- a/dlls/ntdll/virtual.c +++ b/dlls/ntdll/virtual.c @@ -1051,18 +1051,18 @@ static NTSTATUS map_image( HANDLE hmappi for (i = pos = 0; i < nt->FileHeader.NumberOfSections; i++, sec++) { - SIZE_T map_size, file_size, end; + static const SIZE_T sector_align = 0x1ff; + SIZE_T map_size, file_start, file_size, end; if (!sec->Misc.VirtualSize) - { - file_size = sec->SizeOfRawData; - map_size = ROUND_SIZE( 0, file_size ); - } + map_size = ROUND_SIZE( 0, sec->SizeOfRawData ); else - { map_size = ROUND_SIZE( 0, sec->Misc.VirtualSize ); - file_size = min( sec->SizeOfRawData, map_size ); - } + + /* file positions are rounded to sector boundaries regardless of OptionalHeader.FileAlignment */ + file_start = sec->PointerToRawData & ~sector_align; + file_size = (sec->SizeOfRawData + (sec->PointerToRawData & sector_align) + sector_align) & ~sector_align; + if (file_size > map_size) file_size = map_size; /* a few sanity checks */ end = sec->VirtualAddress + ROUND_SIZE( sec->VirtualAddress, map_size ); @@ -1115,9 +1115,11 @@ static NTSTATUS map_image( HANDLE hmappi /* Note: if the section is not aligned properly map_file_into_view will magically * fall back to read(), so we don't need to check anything here. */ - end = sec->PointerToRawData + file_size; - if (sec->PointerToRawData >= st.st_size || end > st.st_size || end < sec->PointerToRawData || - map_file_into_view( view, fd, sec->VirtualAddress, file_size, sec->PointerToRawData, + end = file_start + file_size; + if (sec->PointerToRawData >= st.st_size || + end > ((st.st_size + sector_align) & ~sector_align) || + end < file_start || + map_file_into_view( view, fd, sec->VirtualAddress, file_size, file_start, VPROT_COMMITTED | VPROT_READ | VPROT_WRITECOPY, removable ) != STATUS_SUCCESS) { diff --git a/server/mapping.c b/server/mapping.c index 052ea41..c7eb075 100644 --- a/server/mapping.c +++ b/server/mapping.c @@ -119,25 +119,26 @@ static struct file *get_shared_file( str return NULL; } -/* return the size of the memory mapping of a given section */ -static inline unsigned int get_section_map_size( const IMAGE_SECTION_HEADER *sec ) +/* return the size of the memory mapping and file range of a given section */ +static inline void get_section_sizes( const IMAGE_SECTION_HEADER *sec, size_t *map_size, + off_t *file_start, size_t *file_size ) { - if (!sec->Misc.VirtualSize) return ROUND_SIZE( sec->SizeOfRawData ); - else return ROUND_SIZE( sec->Misc.VirtualSize ); -} + static const unsigned int sector_align = 0x1ff; -/* return the size of the file mapping of a given section */ -static inline unsigned int get_section_filemap_size( const IMAGE_SECTION_HEADER *sec ) -{ - if (!sec->Misc.VirtualSize) return sec->SizeOfRawData; - else return min( sec->SizeOfRawData, ROUND_SIZE( sec->Misc.VirtualSize ) ); + if (!sec->Misc.VirtualSize) *map_size = ROUND_SIZE( sec->SizeOfRawData ); + else *map_size = ROUND_SIZE( sec->Misc.VirtualSize ); + + *file_start = sec->PointerToRawData & ~sector_align; + *file_size = (sec->SizeOfRawData + (sec->PointerToRawData & sector_align) + sector_align) & ~sector_align; + if (*file_size > *map_size) *file_size = *map_size; } /* allocate and fill the temp file for a shared PE image mapping */ static int build_shared_mapping( struct mapping *mapping, int fd, IMAGE_SECTION_HEADER *sec, unsigned int nb_sec ) { - unsigned int i, size, max_size, total_size; + unsigned int i; + size_t file_size, map_size, max_size, total_size; off_t shared_pos, read_pos, write_pos; char *buffer = NULL; int shared_fd; @@ -151,9 +152,9 @@ static int build_shared_mapping( struct if ((sec[i].Characteristics & IMAGE_SCN_MEM_SHARED) && (sec[i].Characteristics & IMAGE_SCN_MEM_WRITE)) { - size = get_section_filemap_size( &sec[i] ); - if (size > max_size) max_size = size; - total_size += get_section_map_size( &sec[i] ); + get_section_sizes( &sec[i], &map_size, &read_pos, &file_size ); + if (file_size > max_size) max_size = file_size; + total_size += map_size; } } if (!(mapping->shared_size = total_size)) return 1; /* nothing to do */ @@ -175,20 +176,19 @@ static int build_shared_mapping( struct { if (!(sec[i].Characteristics & IMAGE_SCN_MEM_SHARED)) continue; if (!(sec[i].Characteristics & IMAGE_SCN_MEM_WRITE)) continue; + get_section_sizes( &sec[i], &map_size, &read_pos, &file_size ); write_pos = shared_pos; - shared_pos += get_section_map_size( &sec[i] ); - read_pos = sec[i].PointerToRawData; - size = get_section_filemap_size( &sec[i] ); - if (!read_pos || !size) continue; - toread = size; + shared_pos += map_size; + if (!sec[i].PointerToRawData || !file_size) continue; + toread = file_size; while (toread) { - long res = pread( fd, buffer + sec[i].SizeOfRawData - toread, toread, read_pos ); + long res = pread( fd, buffer + file_size - toread, toread, read_pos ); if (res <= 0) goto error; toread -= res; read_pos += res; } - if (pwrite( shared_fd, buffer, size, write_pos ) != size) goto error; + if (pwrite( shared_fd, buffer, file_size, write_pos ) != file_size) goto error; } free( buffer ); return 1;
1
0
0
0
Paul Vriens : kernel32/tests: Don't use full path for executable in tests.
by Alexandre Julliard
21 Dec '06
21 Dec '06
Module: wine Branch: master Commit: 11c186fbe709573b16ca45c7701512e9c0fc31f3 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=11c186fbe709573b16ca45c77…
Author: Paul Vriens <paul.vriens.wine(a)gmail.com> Date: Wed Dec 20 18:28:11 2006 +0100 kernel32/tests: Don't use full path for executable in tests. --- dlls/kernel32/tests/process.c | 25 +++++++++++++++++++------ 1 files changed, 19 insertions(+), 6 deletions(-) diff --git a/dlls/kernel32/tests/process.c b/dlls/kernel32/tests/process.c index 0755761..52251a6 100644 --- a/dlls/kernel32/tests/process.c +++ b/dlls/kernel32/tests/process.c @@ -37,6 +37,7 @@ static LPVOID (WINAPI *pVirtualFreeEx)(H static char base[MAX_PATH]; static char selfname[MAX_PATH]; +static char* exename; static char resfile[MAX_PATH]; static int myARGC; @@ -151,14 +152,23 @@ static WCHAR* decodeW(const char* str) * generates basic information like: * base: absolute path to curr dir * selfname: the way to reinvoke ourselves + * exename: executable without the path * function-pointers, which are not implemented in all windows versions */ static int init(void) { + char *p; + myARGC = winetest_get_mainargs( &myARGV ); if (!GetCurrentDirectoryA(sizeof(base), base)) return 0; strcpy(selfname, myARGV[0]); + /* Strip the path of selfname */ + if ((p = strrchr(selfname, '\\')) != NULL) exename = p + 1; + else exename = selfname; + + if ((p = strrchr(exename, '/')) != NULL) exename = p + 1; + hkernel32 = GetModuleHandleA("kernel32"); pVirtualAllocEx = (void *) GetProcAddress(hkernel32, "VirtualAllocEx"); pVirtualFreeEx = (void *) GetProcAddress(hkernel32, "VirtualFreeEx"); @@ -758,7 +768,8 @@ static void test_CommandLine(void) /* Test for Bug1330 to show that XP doesn't change '/' to '\\' in argv[0]*/ get_file_name(resfile); - sprintf(buffer, "./%s tests/process.c %s \"a\\\"b\\\\\" c\\\" d", selfname, resfile); + /* Use exename to avoid buffer containing things like 'C:' */ + sprintf(buffer, "./%s tests/process.c %s \"a\\\"b\\\\\" c\\\" d", exename, resfile); SetLastError(0xdeadbeef); ret = CreateProcessA(NULL, buffer, NULL, NULL, FALSE, 0L, NULL, NULL, &startup, &info); ok(ret, "CreateProcess (%s) failed : %d\n", buffer, GetLastError()); @@ -766,13 +777,14 @@ static void test_CommandLine(void) ok(WaitForSingleObject(info.hProcess, 30000) == WAIT_OBJECT_0, "Child process termination\n"); /* child process has changed result file, so let profile functions know about it */ WritePrivateProfileStringA(NULL, NULL, NULL, resfile); - sprintf(buffer, "./%s", selfname); + sprintf(buffer, "./%s", exename); okChildString("Arguments", "argvA0", buffer); release_memory(); assert(DeleteFileA(resfile) != 0); get_file_name(resfile); - sprintf(buffer, ".\\%s tests/process.c %s \"a\\\"b\\\\\" c\\\" d", selfname, resfile); + /* Use exename to avoid buffer containing things like 'C:' */ + sprintf(buffer, ".\\%s tests/process.c %s \"a\\\"b\\\\\" c\\\" d", exename, resfile); SetLastError(0xdeadbeef); ret = CreateProcessA(NULL, buffer, NULL, NULL, FALSE, 0L, NULL, NULL, &startup, &info); ok(ret, "CreateProcess (%s) failed : %d\n", buffer, GetLastError()); @@ -780,7 +792,7 @@ static void test_CommandLine(void) ok(WaitForSingleObject(info.hProcess, 30000) == WAIT_OBJECT_0, "Child process termination\n"); /* child process has changed result file, so let profile functions know about it */ WritePrivateProfileStringA(NULL, NULL, NULL, resfile); - sprintf(buffer, ".\\%s", selfname); + sprintf(buffer, ".\\%s", exename); okChildString("Arguments", "argvA0", buffer); release_memory(); assert(DeleteFileA(resfile) != 0); @@ -791,7 +803,8 @@ static void test_CommandLine(void) *(lpFilePart -1 ) = 0; p = strrchr(fullpath, '\\'); assert (p); - sprintf(buffer, "..%s/%s tests/process.c %s \"a\\\"b\\\\\" c\\\" d", p, selfname, resfile); + /* Use exename to avoid buffer containing things like 'C:' */ + sprintf(buffer, "..%s/%s tests/process.c %s \"a\\\"b\\\\\" c\\\" d", p, exename, resfile); SetLastError(0xdeadbeef); ret = CreateProcessA(NULL, buffer, NULL, NULL, FALSE, 0L, NULL, NULL, &startup, &info); ok(ret, "CreateProcess (%s) failed : %d\n", buffer, GetLastError()); @@ -799,7 +812,7 @@ static void test_CommandLine(void) ok(WaitForSingleObject(info.hProcess, 30000) == WAIT_OBJECT_0, "Child process termination\n"); /* child process has changed result file, so let profile functions know about it */ WritePrivateProfileStringA(NULL, NULL, NULL, resfile); - sprintf(buffer, "..%s/%s", p, selfname); + sprintf(buffer, "..%s/%s", p, exename); okChildString("Arguments", "argvA0", buffer); release_memory(); assert(DeleteFileA(resfile) != 0);
1
0
0
0
Ken Thomases : winecoreaudio: Replace pthread mutex with OSSpinLock.
by Alexandre Julliard
21 Dec '06
21 Dec '06
Module: wine Branch: master Commit: 5cbc520318980cdeb22b39d7da81f6bc6b87ec12 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=5cbc520318980cdeb22b39d7d…
Author: Ken Thomases <ken(a)codeweavers.com> Date: Thu Dec 21 03:50:18 2006 -0600 winecoreaudio: Replace pthread mutex with OSSpinLock. --- dlls/winmm/winecoreaudio/audio.c | 72 +++++++++++++++++--------------------- 1 files changed, 32 insertions(+), 40 deletions(-) diff --git a/dlls/winmm/winecoreaudio/audio.c b/dlls/winmm/winecoreaudio/audio.c index e5b9e41..d7dc314 100644 --- a/dlls/winmm/winecoreaudio/audio.c +++ b/dlls/winmm/winecoreaudio/audio.c @@ -32,9 +32,6 @@ # include <unistd.h> #endif #include <fcntl.h> -#ifdef HAVE_PTHREAD_H -# include <pthread.h> -#endif #include "windef.h" #include "winbase.h" @@ -55,6 +52,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(wave); #if defined(HAVE_COREAUDIO_COREAUDIO_H) && defined(HAVE_AUDIOUNIT_AUDIOUNIT_H) #include <CoreAudio/CoreAudio.h> #include <CoreFoundation/CoreFoundation.h> +#include <libkern/OSAtomic.h> /* Due to AudioUnit headers conflict define some needed types. @@ -152,7 +150,7 @@ typedef struct { DWORD tickCountMS; /* time in MS of last AudioUnit callback */ - pthread_mutex_t lock; /* synchronization stuff */ + OSSpinLock lock; /* synchronization stuff */ BOOL trace_on; BOOL warn_on; @@ -177,7 +175,7 @@ typedef struct { char interface_name[32];*/ /* synchronization stuff */ - pthread_mutex_t lock; + OSSpinLock lock; } WINE_WAVEIN; static WINE_WAVEOUT WOutDev [MAX_WAVEOUTDRV]; @@ -505,7 +503,7 @@ LONG CoreAudio_WaveInit(void) WOutDev[i].caps.dwFormats |= WAVE_FORMAT_1M16; WOutDev[i].caps.dwFormats |= WAVE_FORMAT_1S16; - pthread_mutex_init(&WOutDev[i].lock, NULL); /* initialize the mutex */ + WOutDev[i].lock = 0; /* initialize the mutex */ } /* create mach messages handler */ @@ -554,18 +552,11 @@ LONG CoreAudio_WaveInit(void) void CoreAudio_WaveRelease(void) { /* Stop CFRunLoop in messageThread */ - int i; - TRACE("()\n"); CFMessagePortSendRequest(Port_SendToMessageThread, kStopLoopMessage, NULL, 0.0, 0.0, NULL, NULL); CFRelease(Port_SendToMessageThread); Port_SendToMessageThread = NULL; - - for (i = 0; i < MAX_WAVEOUTDRV; ++i) - { - pthread_mutex_destroy(&WOutDev[i].lock); - } } /*======================================================================* @@ -661,18 +652,19 @@ static DWORD wodOpen(WORD wDevID, LPWAVE } wwo = &WOutDev[wDevID]; - pthread_mutex_lock(&wwo->lock); + if (!OSSpinLockTry(&wwo->lock)) + return MMSYSERR_ALLOCATED; if (wwo->state != WINE_WS_CLOSED) { - pthread_mutex_unlock(&wwo->lock); + OSSpinLockUnlock(&wwo->lock); return MMSYSERR_ALLOCATED; } if (!AudioUnit_CreateDefaultAudioUnit((void *) wwo, &wwo->audioUnit)) { ERR("CoreAudio_CreateDefaultAudioUnit(%p) failed\n", wwo); - pthread_mutex_unlock(&wwo->lock); + OSSpinLockUnlock(&wwo->lock); return MMSYSERR_ERROR; } @@ -701,7 +693,7 @@ static DWORD wodOpen(WORD wDevID, LPWAVE if (!ret) { AudioUnit_CloseAudioUnit(wwo->audioUnit); - pthread_mutex_unlock(&wwo->lock); + OSSpinLockUnlock(&wwo->lock); return WAVERR_BADFORMAT; /* FIXME return an error based on the OSStatus */ } wwo->streamDescription = streamFormat; @@ -712,7 +704,7 @@ static DWORD wodOpen(WORD wDevID, LPWAVE ERR("AudioOutputUnitStart failed: %08x\n", ret); AudioUnitUninitialize(wwo->audioUnit); AudioUnit_CloseAudioUnit(wwo->audioUnit); - pthread_mutex_unlock(&wwo->lock); + OSSpinLockUnlock(&wwo->lock); return MMSYSERR_ERROR; /* FIXME return an error based on the OSStatus */ } @@ -738,7 +730,7 @@ static DWORD wodOpen(WORD wDevID, LPWAVE wwo->warn_on = WARN_ON(wave); wwo->err_on = ERR_ON(wave); - pthread_mutex_unlock(&wwo->lock); + OSSpinLockUnlock(&wwo->lock); retval = wodNotifyClient(wwo, WOM_OPEN, 0L, 0L); @@ -762,11 +754,11 @@ static DWORD wodClose(WORD wDevID) } wwo = &WOutDev[wDevID]; - pthread_mutex_lock(&wwo->lock); + OSSpinLockLock(&wwo->lock); if (wwo->lpQueuePtr) { WARN("buffers still playing !\n"); - pthread_mutex_unlock(&wwo->lock); + OSSpinLockUnlock(&wwo->lock); ret = WAVERR_STILLPLAYING; } else { @@ -776,7 +768,7 @@ static DWORD wodClose(WORD wDevID) wwo->state = WINE_WS_CLOSED; /* mark the device as closed */ - pthread_mutex_unlock(&wwo->lock); + OSSpinLockUnlock(&wwo->lock); err = AudioUnitUninitialize(wwo->audioUnit); if (err) { @@ -920,7 +912,7 @@ static void wodHelper_NotifyCompletions( LPWAVEHDR lpWaveHdr; LPWAVEHDR lpFirstDoneWaveHdr = NULL; - pthread_mutex_lock(&wwo->lock); + OSSpinLockLock(&wwo->lock); /* First, excise all of the done headers from the queue into * a free-standing list. */ @@ -957,8 +949,8 @@ static void wodHelper_NotifyCompletions( lpLastDoneWaveHdr->lpNext = NULL; } } - - pthread_mutex_unlock(&wwo->lock); + + OSSpinLockUnlock(&wwo->lock); /* Now, send the "done" notification for each header in our list. */ for (lpWaveHdr = lpFirstDoneWaveHdr; lpWaveHdr; lpWaveHdr = lpWaveHdr->lpNext) @@ -1007,7 +999,7 @@ static DWORD wodWrite(WORD wDevID, LPWAV lpWaveHdr->dwFlags |= WHDR_INQUEUE; lpWaveHdr->lpNext = 0; - pthread_mutex_lock(&wwo->lock); + OSSpinLockLock(&wwo->lock); /* insert buffer at the end of queue */ for (wh = &(wwo->lpQueuePtr); *wh; wh = &((*wh)->lpNext)) /* Do nothing */; @@ -1024,8 +1016,8 @@ static DWORD wodWrite(WORD wDevID, LPWAV wwo->dwPartialOffset = 0; } - pthread_mutex_unlock(&wwo->lock); - + OSSpinLockUnlock(&wwo->lock); + return MMSYSERR_NOERROR; } @@ -1058,10 +1050,10 @@ static DWORD wodPause(WORD wDevID) (char) (status >> 24), (char) (status >> 16), (char) (status >> 8), (char) status); } - pthread_mutex_lock(&WOutDev[wDevID].lock); + OSSpinLockLock(&WOutDev[wDevID].lock); if (WOutDev[wDevID].state == WINE_WS_PLAYING || WOutDev[wDevID].state == WINE_WS_STOPPED) WOutDev[wDevID].state = WINE_WS_PAUSED; - pthread_mutex_unlock(&WOutDev[wDevID].lock); + OSSpinLockUnlock(&WOutDev[wDevID].lock); return MMSYSERR_NOERROR; } @@ -1089,7 +1081,7 @@ static DWORD wodRestart(WORD wDevID) * Although we can be in PAUSED state with the Audio Unit still running, * that's harmless because the render callback will just produce silence. */ - pthread_mutex_lock(&WOutDev[wDevID].lock); + OSSpinLockLock(&WOutDev[wDevID].lock); if (WOutDev[wDevID].state == WINE_WS_PAUSED) { if (WOutDev[wDevID].lpPlayPtr) @@ -1097,7 +1089,7 @@ static DWORD wodRestart(WORD wDevID) else WOutDev[wDevID].state = WINE_WS_STOPPED; } - pthread_mutex_unlock(&WOutDev[wDevID].lock); + OSSpinLockUnlock(&WOutDev[wDevID].lock); status = AudioOutputUnitStart(WOutDev[wDevID].audioUnit); if (status) { @@ -1132,16 +1124,16 @@ static DWORD wodReset(WORD wDevID) /* updates current notify list */ /* if resetting, remove all wave headers and notify client that all headers were completed */ wodHelper_NotifyCompletions(wwo, TRUE); - - pthread_mutex_lock(&wwo->lock); - + + OSSpinLockLock(&wwo->lock); + wwo->lpPlayPtr = wwo->lpQueuePtr = wwo->lpLoopPtr = NULL; wwo->state = WINE_WS_STOPPED; wwo->dwPlayedTotal = wwo->dwWrittenTotal = 0; wwo->dwPartialOffset = 0; /* Clear partial wavehdr */ - pthread_mutex_unlock(&wwo->lock); + OSSpinLockUnlock(&wwo->lock); status = AudioOutputUnitStart(wwo->audioUnit); @@ -1175,9 +1167,9 @@ static DWORD wodGetPosition(WORD wDevID, wwo = &WOutDev[wDevID]; - pthread_mutex_lock(&WOutDev[wDevID].lock); + OSSpinLockLock(&WOutDev[wDevID].lock); val = wwo->dwPlayedTotal; - pthread_mutex_unlock(&WOutDev[wDevID].lock); + OSSpinLockUnlock(&WOutDev[wDevID].lock); return bytes_to_mmtime(lpTime, val, &wwo->format); } @@ -1363,7 +1355,7 @@ OSStatus CoreAudio_woAudioUnitIOProc(voi unsigned int dataNeeded = ioData->mBuffers[0].mDataByteSize; unsigned int dataProvided = 0; - pthread_mutex_lock(&wwo->lock); + OSSpinLockLock(&wwo->lock); while (dataNeeded > 0 && wwo->state == WINE_WS_PLAYING && wwo->lpPlayPtr) { @@ -1393,7 +1385,7 @@ OSStatus CoreAudio_woAudioUnitIOProc(voi } } - pthread_mutex_unlock(&wwo->lock); + OSSpinLockUnlock(&wwo->lock); /* We can't provide any more wave data. Fill the rest with silence. */ if (dataNeeded > 0)
1
0
0
0
Ken Thomases : winecoreaudio: Move a memset out of a mutex-guarded section.
by Alexandre Julliard
21 Dec '06
21 Dec '06
Module: wine Branch: master Commit: 234558c2c7bcc815c43791acf6fdf4ad7262376d URL:
http://source.winehq.org/git/wine.git/?a=commit;h=234558c2c7bcc815c43791acf…
Author: Ken Thomases <ken(a)codeweavers.com> Date: Thu Dec 21 03:50:09 2006 -0600 winecoreaudio: Move a memset out of a mutex-guarded section. --- dlls/winmm/winecoreaudio/audio.c | 61 ++++++++++++++++++------------------- 1 files changed, 30 insertions(+), 31 deletions(-) diff --git a/dlls/winmm/winecoreaudio/audio.c b/dlls/winmm/winecoreaudio/audio.c index a28057d..e5b9e41 100644 --- a/dlls/winmm/winecoreaudio/audio.c +++ b/dlls/winmm/winecoreaudio/audio.c @@ -1365,47 +1365,46 @@ OSStatus CoreAudio_woAudioUnitIOProc(voi pthread_mutex_lock(&wwo->lock); - while (dataNeeded > 0) + while (dataNeeded > 0 && wwo->state == WINE_WS_PLAYING && wwo->lpPlayPtr) { - if (wwo->state == WINE_WS_PLAYING && wwo->lpPlayPtr) - { - unsigned int available = wwo->lpPlayPtr->dwBufferLength - wwo->dwPartialOffset; - unsigned int toCopy; - - if (available >= dataNeeded) - toCopy = dataNeeded; - else - toCopy = available; + unsigned int available = wwo->lpPlayPtr->dwBufferLength - wwo->dwPartialOffset; + unsigned int toCopy; - if (toCopy > 0) - { - memcpy((char*)ioData->mBuffers[0].mData + dataProvided, - wwo->lpPlayPtr->lpData + wwo->dwPartialOffset, toCopy); - wwo->dwPartialOffset += toCopy; - wwo->dwPlayedTotal += toCopy; - dataProvided += toCopy; - dataNeeded -= toCopy; - available -= toCopy; - } + if (available >= dataNeeded) + toCopy = dataNeeded; + else + toCopy = available; - if (available == 0) - { - wodHelper_PlayPtrNext(wwo); - needNotify = 1; - } + if (toCopy > 0) + { + memcpy((char*)ioData->mBuffers[0].mData + dataProvided, + wwo->lpPlayPtr->lpData + wwo->dwPartialOffset, toCopy); + wwo->dwPartialOffset += toCopy; + wwo->dwPlayedTotal += toCopy; + dataProvided += toCopy; + dataNeeded -= toCopy; + available -= toCopy; } - else + + if (available == 0) { - if (!dataProvided) - *ioActionFlags |= kAudioUnitRenderAction_OutputIsSilence; - memset((char*)ioData->mBuffers[0].mData + dataProvided, 0, dataNeeded); - dataProvided += dataNeeded; - dataNeeded = 0; + wodHelper_PlayPtrNext(wwo); + needNotify = 1; } } pthread_mutex_unlock(&wwo->lock); + /* We can't provide any more wave data. Fill the rest with silence. */ + if (dataNeeded > 0) + { + if (!dataProvided) + *ioActionFlags |= kAudioUnitRenderAction_OutputIsSilence; + memset((char*)ioData->mBuffers[0].mData + dataProvided, 0, dataNeeded); + dataProvided += dataNeeded; + dataNeeded = 0; + } + /* We only fill buffer 0. Set any others that might be requested to 0. */ for (buffer = 1; buffer < ioData->mNumberBuffers; buffer++) {
1
0
0
0
← Newer
1
...
15
16
17
18
19
20
21
...
72
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
Results per page:
10
25
50
100
200