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
b52874e5
Commit
b52874e5
authored
Jan 17, 2006
by
Vitaliy Margolen
Committed by
Alexandre Julliard
Jan 17, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winemenubuilder: Report a few more errors.
Use Heap[Alloc|Free] instead of malloc|free.
parent
a40ce393
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
12 deletions
+17
-12
winemenubuilder.c
programs/winemenubuilder/winemenubuilder.c
+17
-12
No files found.
programs/winemenubuilder/winemenubuilder.c
View file @
b52874e5
...
...
@@ -159,7 +159,10 @@ static BOOL SaveIconResAsXPM(const BITMAPINFO *pIcon, const char *szXPMFileName,
char
*
comment
;
if
(
!
((
pIcon
->
bmiHeader
.
biBitCount
==
4
)
||
(
pIcon
->
bmiHeader
.
biBitCount
==
8
)))
{
WINE_FIXME
(
"Unsupported color depth %d-bit
\n
"
,
pIcon
->
bmiHeader
.
biBitCount
);
return
FALSE
;
}
if
(
!
(
fXPMFile
=
fopen
(
szXPMFileName
,
"w"
)))
{
...
...
@@ -168,7 +171,7 @@ static BOOL SaveIconResAsXPM(const BITMAPINFO *pIcon, const char *szXPMFileName,
}
i
=
WideCharToMultiByte
(
CP_UNIXCP
,
0
,
commentW
,
-
1
,
NULL
,
0
,
NULL
,
NULL
);
comment
=
malloc
(
i
);
comment
=
HeapAlloc
(
GetProcessHeap
(),
0
,
i
);
WideCharToMultiByte
(
CP_UNIXCP
,
0
,
commentW
,
-
1
,
comment
,
i
,
NULL
,
NULL
);
nHeight
=
pIcon
->
bmiHeader
.
biHeight
/
2
;
...
...
@@ -234,12 +237,12 @@ static BOOL SaveIconResAsXPM(const BITMAPINFO *pIcon, const char *szXPMFileName,
#undef MASK
#undef COLOR
free
(
comment
);
HeapFree
(
GetProcessHeap
(),
0
,
comment
);
fclose
(
fXPMFile
);
return
TRUE
;
error:
free
(
comment
);
HeapFree
(
GetProcessHeap
(),
0
,
comment
);
fclose
(
fXPMFile
);
unlink
(
szXPMFileName
);
return
FALSE
;
...
...
@@ -373,12 +376,14 @@ static int ExtractFromICO(LPCWSTR szFileName, const char *szXPMFileName)
goto
error1
;
}
if
(
fread
(
&
iconDir
,
sizeof
(
ICONDIR
),
1
,
fICOFile
)
!=
1
)
goto
error2
;
if
((
iconDir
.
idReserved
!=
0
)
||
(
iconDir
.
idType
!=
1
))
if
(
fread
(
&
iconDir
,
sizeof
(
ICONDIR
),
1
,
fICOFile
)
!=
1
||
(
iconDir
.
idReserved
!=
0
)
||
(
iconDir
.
idType
!=
1
))
{
WINE_ERR
(
"Invalid ico file format
\n
"
);
goto
error2
;
}
if
((
pIconDirEntry
=
malloc
(
iconDir
.
idCount
*
sizeof
(
ICONDIRENTRY
)))
==
NULL
)
if
((
pIconDirEntry
=
HeapAlloc
(
GetProcessHeap
(),
0
,
iconDir
.
idCount
*
sizeof
(
ICONDIRENTRY
)))
==
NULL
)
goto
error2
;
if
(
fread
(
pIconDirEntry
,
sizeof
(
ICONDIRENTRY
),
iconDir
.
idCount
,
fICOFile
)
!=
iconDir
.
idCount
)
goto
error3
;
...
...
@@ -389,7 +394,7 @@ static int ExtractFromICO(LPCWSTR szFileName, const char *szXPMFileName)
nIndex
=
i
;
nMax
=
pIconDirEntry
[
i
].
bHeight
*
pIconDirEntry
[
i
].
bWidth
;
}
if
((
pIcon
=
malloc
(
pIconDirEntry
[
nIndex
].
dwBytesInRes
))
==
NULL
)
if
((
pIcon
=
HeapAlloc
(
GetProcessHeap
(),
0
,
pIconDirEntry
[
nIndex
].
dwBytesInRes
))
==
NULL
)
goto
error3
;
if
(
fseek
(
fICOFile
,
pIconDirEntry
[
nIndex
].
dwImageOffset
,
SEEK_SET
))
goto
error4
;
...
...
@@ -399,16 +404,16 @@ static int ExtractFromICO(LPCWSTR szFileName, const char *szXPMFileName)
if
(
!
SaveIconResAsXPM
(
pIcon
,
szXPMFileName
,
szFileName
))
goto
error4
;
free
(
pIcon
);
free
(
pIconDirEntry
);
HeapFree
(
GetProcessHeap
(),
0
,
pIcon
);
HeapFree
(
GetProcessHeap
(),
0
,
pIconDirEntry
);
fclose
(
fICOFile
);
HeapFree
(
GetProcessHeap
(),
0
,
filename
);
return
1
;
error4:
free
(
pIcon
);
HeapFree
(
GetProcessHeap
(),
0
,
pIcon
);
error3:
free
(
pIconDirEntry
);
HeapFree
(
GetProcessHeap
(),
0
,
pIconDirEntry
);
error2:
fclose
(
fICOFile
);
error1:
...
...
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