Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
712b3571
Commit
712b3571
authored
Nov 01, 2012
by
Francois Gouget
Committed by
Alexandre Julliard
Nov 02, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winemenubuilder: Use the same icon name on Mac OS X as on Unix.
parent
923ac2e5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
46 deletions
+36
-46
winemenubuilder.c
programs/winemenubuilder/winemenubuilder.c
+36
-46
No files found.
programs/winemenubuilder/winemenubuilder.c
View file @
712b3571
...
...
@@ -199,7 +199,6 @@ static WCHAR* assoc_query(ASSOCSTR assocStr, LPCWSTR name, LPCWSTR extra);
static
HRESULT
open_icon
(
LPCWSTR
filename
,
int
index
,
BOOL
bWait
,
IStream
**
ppStream
);
/* Utility routines */
#ifndef __APPLE__
static
unsigned
short
crc16
(
const
char
*
string
)
{
unsigned
short
crc
=
0
;
...
...
@@ -218,7 +217,6 @@ static unsigned short crc16(const char* string)
}
return
crc
;
}
#endif
static
char
*
strdupA
(
const
char
*
str
)
{
...
...
@@ -1069,6 +1067,35 @@ static HRESULT open_icon(LPCWSTR filename, int index, BOOL bWait, IStream **ppSt
return
hr
;
}
static
char
*
compute_native_identifier
(
int
exeIndex
,
LPCWSTR
icoPathW
)
{
char
*
nativeIdentifier
;
char
*
icoPathA
;
unsigned
short
crc
;
char
*
basename
,
*
ext
;
icoPathA
=
wchars_to_utf8_chars
(
icoPathW
);
if
(
icoPathA
==
NULL
)
return
NULL
;
crc
=
crc16
(
icoPathA
);
basename
=
strrchr
(
icoPathA
,
'\\'
);
if
(
basename
==
NULL
)
basename
=
icoPathA
;
else
{
*
basename
=
0
;
basename
++
;
}
ext
=
strrchr
(
basename
,
'.'
);
if
(
ext
)
*
ext
=
0
;
nativeIdentifier
=
heap_printf
(
"%04X_%s.%d"
,
crc
,
basename
,
exeIndex
);
HeapFree
(
GetProcessHeap
(),
0
,
icoPathA
);
return
nativeIdentifier
;
}
#ifdef __APPLE__
#define ICNS_SLOTS 6
...
...
@@ -1102,9 +1129,6 @@ static HRESULT platform_write_icon(IStream *icoStream, int exeIndex, LPCWSTR ico
}
best
[
ICNS_SLOTS
];
int
indexes
[
ICNS_SLOTS
];
int
i
;
GUID
guid
;
WCHAR
*
guidStrW
=
NULL
;
char
*
guidStrA
=
NULL
;
char
*
icnsPath
=
NULL
;
LARGE_INTEGER
zero
;
HRESULT
hr
;
...
...
@@ -1165,26 +1189,16 @@ static HRESULT platform_write_icon(IStream *icoStream, int exeIndex, LPCWSTR ico
}
}
hr
=
CoCreateGuid
(
&
guid
);
if
(
FAILED
(
hr
))
{
WINE_WARN
(
"CoCreateGuid failed, error 0x%08X
\n
"
,
hr
);
goto
end
;
}
hr
=
StringFromCLSID
(
&
guid
,
&
guidStrW
);
if
(
FAILED
(
hr
))
{
WINE_WARN
(
"StringFromCLSID failed, error 0x%08X
\n
"
,
hr
);
goto
end
;
}
guidStrA
=
wchars_to_utf8_chars
(
guidStrW
);
if
(
guidStrA
==
NULL
)
if
(
destFilename
)
*
nativeIdentifier
=
heap_printf
(
"%s"
,
destFilename
);
else
*
nativeIdentifier
=
compute_native_identifier
(
exeIndex
,
icoPathW
);
if
(
*
nativeIdentifier
==
NULL
)
{
hr
=
E_OUTOFMEMORY
;
WINE_WARN
(
"out of memory converting GUID string
\n
"
);
goto
end
;
}
icnsPath
=
heap_printf
(
"/tmp/%s.icns"
,
guidStrA
);
icnsPath
=
heap_printf
(
"/tmp/%s.icns"
,
*
nativeIdentifier
);
if
(
icnsPath
==
NULL
)
{
hr
=
E_OUTOFMEMORY
;
...
...
@@ -1209,8 +1223,6 @@ static HRESULT platform_write_icon(IStream *icoStream, int exeIndex, LPCWSTR ico
end:
HeapFree
(
GetProcessHeap
(),
0
,
iconDirEntries
);
CoTaskMemFree
(
guidStrW
);
HeapFree
(
GetProcessHeap
(),
0
,
guidStrA
);
if
(
SUCCEEDED
(
hr
))
*
nativeIdentifier
=
icnsPath
;
else
...
...
@@ -1244,10 +1256,7 @@ static HRESULT platform_write_icon(IStream *icoStream, int exeIndex, LPCWSTR ico
ICONDIRENTRY
*
iconDirEntries
=
NULL
;
int
numEntries
;
int
i
;
char
*
icoPathA
=
NULL
;
char
*
iconsDir
=
NULL
;
unsigned
short
crc
;
char
*
p
,
*
q
;
HRESULT
hr
=
S_OK
;
LARGE_INTEGER
zero
;
...
...
@@ -1255,28 +1264,10 @@ static HRESULT platform_write_icon(IStream *icoStream, int exeIndex, LPCWSTR ico
if
(
FAILED
(
hr
))
goto
end
;
icoPathA
=
wchars_to_utf8_chars
(
icoPathW
);
if
(
icoPathA
==
NULL
)
{
hr
=
E_OUTOFMEMORY
;
goto
end
;
}
crc
=
crc16
(
icoPathA
);
p
=
strrchr
(
icoPathA
,
'\\'
);
if
(
p
==
NULL
)
p
=
icoPathA
;
else
{
*
p
=
0
;
p
++
;
}
q
=
strrchr
(
p
,
'.'
);
if
(
q
)
*
q
=
0
;
if
(
destFilename
)
*
nativeIdentifier
=
heap_printf
(
"%s"
,
destFilename
);
else
*
nativeIdentifier
=
heap_printf
(
"%04X_%s.%d"
,
crc
,
p
,
exeIndex
);
*
nativeIdentifier
=
compute_native_identifier
(
exeIndex
,
icoPathW
);
if
(
*
nativeIdentifier
==
NULL
)
{
hr
=
E_OUTOFMEMORY
;
...
...
@@ -1353,7 +1344,6 @@ static HRESULT platform_write_icon(IStream *icoStream, int exeIndex, LPCWSTR ico
end:
HeapFree
(
GetProcessHeap
(),
0
,
iconDirEntries
);
HeapFree
(
GetProcessHeap
(),
0
,
icoPathA
);
HeapFree
(
GetProcessHeap
(),
0
,
iconsDir
);
return
hr
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment