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
4bd11764
Commit
4bd11764
authored
Nov 10, 2006
by
Mike McCormack
Committed by
Alexandre Julliard
Nov 10, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
oleaut32: Use HeapAlloc/Free instead of malloc/free.
parent
5ec9d9b2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
24 deletions
+43
-24
ungif.c
dlls/oleaut32/ungif.c
+43
-24
No files found.
dlls/oleaut32/ungif.c
View file @
4bd11764
...
...
@@ -51,6 +51,25 @@
#include <string.h>
#include "ungif.h"
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
static
void
*
ungif_alloc
(
size_t
sz
)
{
return
HeapAlloc
(
GetProcessHeap
(),
0
,
sz
);
}
static
void
*
ungif_calloc
(
size_t
num
,
size_t
sz
)
{
return
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
num
*
sz
);
}
static
void
ungif_free
(
void
*
ptr
)
{
HeapFree
(
GetProcessHeap
(),
0
,
ptr
);
}
#define LZ_MAX_CODE 4095
/* Biggest code possible in 12 bits. */
#define LZ_BITS 12
...
...
@@ -127,14 +146,14 @@ MakeMapObject(int ColorCount,
return
((
ColorMapObject
*
)
NULL
);
}
Object
=
m
alloc
(
sizeof
(
ColorMapObject
));
Object
=
ungif_
alloc
(
sizeof
(
ColorMapObject
));
if
(
Object
==
(
ColorMapObject
*
)
NULL
)
{
return
((
ColorMapObject
*
)
NULL
);
}
Object
->
Colors
=
(
GifColorType
*
)
calloc
(
ColorCount
,
sizeof
(
GifColorType
));
Object
->
Colors
=
ungif_
calloc
(
ColorCount
,
sizeof
(
GifColorType
));
if
(
Object
->
Colors
==
(
GifColorType
*
)
NULL
)
{
return
((
ColorMapObject
*
)
NULL
)
;
return
NULL
;
}
Object
->
ColorCount
=
ColorCount
;
...
...
@@ -154,8 +173,8 @@ static void
FreeMapObject
(
ColorMapObject
*
Object
)
{
if
(
Object
!=
NULL
)
{
free
(
Object
->
Colors
);
free
(
Object
);
ungif_
free
(
Object
->
Colors
);
ungif_
free
(
Object
);
/*** FIXME:
* When we are willing to break API we need to make this function
* FreeMapObject(ColorMapObject **Object)
...
...
@@ -173,7 +192,7 @@ AddExtensionBlock(SavedImage * New,
ExtensionBlock
*
ep
;
if
(
New
->
ExtensionBlocks
==
NULL
)
New
->
ExtensionBlocks
=
m
alloc
(
sizeof
(
ExtensionBlock
));
New
->
ExtensionBlocks
=
ungif_
alloc
(
sizeof
(
ExtensionBlock
));
else
New
->
ExtensionBlocks
=
realloc
(
New
->
ExtensionBlocks
,
sizeof
(
ExtensionBlock
)
*
...
...
@@ -185,7 +204,7 @@ AddExtensionBlock(SavedImage * New,
ep
=
&
New
->
ExtensionBlocks
[
New
->
ExtensionBlockCount
++
];
ep
->
ByteCount
=
Len
;
ep
->
Bytes
=
m
alloc
(
ep
->
ByteCount
);
ep
->
Bytes
=
ungif_
alloc
(
ep
->
ByteCount
);
if
(
ep
->
Bytes
==
NULL
)
return
(
GIF_ERROR
);
...
...
@@ -207,8 +226,8 @@ FreeExtension(SavedImage * Image)
}
for
(
ep
=
Image
->
ExtensionBlocks
;
ep
<
(
Image
->
ExtensionBlocks
+
Image
->
ExtensionBlockCount
);
ep
++
)
free
(
ep
->
Bytes
);
free
(
Image
->
ExtensionBlocks
);
ungif_
free
(
ep
->
Bytes
);
ungif_
free
(
Image
->
ExtensionBlocks
);
Image
->
ExtensionBlocks
=
NULL
;
}
...
...
@@ -231,12 +250,12 @@ FreeSavedImages(GifFileType * GifFile) {
sp
->
ImageDesc
.
ColorMap
=
NULL
;
}
free
(
sp
->
RasterBits
);
ungif_
free
(
sp
->
RasterBits
);
if
(
sp
->
ExtensionBlocks
)
FreeExtension
(
sp
);
}
free
(
GifFile
->
SavedImages
);
ungif_
free
(
GifFile
->
SavedImages
);
GifFile
->
SavedImages
=
NULL
;
}
...
...
@@ -374,7 +393,7 @@ DGifGetImageDesc(GifFileType * GifFile) {
return
GIF_ERROR
;
}
}
else
{
if
((
GifFile
->
SavedImages
=
m
alloc
(
sizeof
(
SavedImage
)))
==
NULL
)
{
if
((
GifFile
->
SavedImages
=
ungif_
alloc
(
sizeof
(
SavedImage
)))
==
NULL
)
{
return
GIF_ERROR
;
}
}
...
...
@@ -828,7 +847,7 @@ DGifSlurp(GifFileType * GifFile) {
sp
=
&
GifFile
->
SavedImages
[
GifFile
->
ImageCount
-
1
];
ImageSize
=
sp
->
ImageDesc
.
Width
*
sp
->
ImageDesc
.
Height
;
sp
->
RasterBits
=
m
alloc
(
ImageSize
*
sizeof
(
GifPixelType
));
sp
->
RasterBits
=
ungif_
alloc
(
ImageSize
*
sizeof
(
GifPixelType
));
if
(
sp
->
RasterBits
==
NULL
)
{
return
GIF_ERROR
;
}
...
...
@@ -895,16 +914,16 @@ DGifOpen(void *userData,
GifFileType
*
GifFile
;
GifFilePrivateType
*
Private
;
GifFile
=
m
alloc
(
sizeof
(
GifFileType
));
GifFile
=
ungif_
alloc
(
sizeof
(
GifFileType
));
if
(
GifFile
==
NULL
)
{
return
NULL
;
}
memset
(
GifFile
,
'\0'
,
sizeof
(
GifFileType
));
Private
=
m
alloc
(
sizeof
(
GifFilePrivateType
));
Private
=
ungif_
alloc
(
sizeof
(
GifFilePrivateType
));
if
(
!
Private
)
{
free
(
GifFile
);
ungif_
free
(
GifFile
);
return
NULL
;
}
...
...
@@ -915,8 +934,8 @@ DGifOpen(void *userData,
/* Lets see if this is a GIF file: */
if
(
READ
(
GifFile
,
Buf
,
GIF_STAMP_LEN
)
!=
GIF_STAMP_LEN
)
{
free
(
Private
);
free
(
GifFile
);
ungif_
free
(
Private
);
ungif_
free
(
GifFile
);
return
NULL
;
}
...
...
@@ -924,14 +943,14 @@ DGifOpen(void *userData,
* something more useful with it. */
Buf
[
GIF_STAMP_LEN
]
=
0
;
if
(
memcmp
(
GIF_STAMP
,
Buf
,
GIF_VERSION_POS
)
!=
0
)
{
free
(
Private
);
free
(
GifFile
);
ungif_
free
(
Private
);
ungif_
free
(
GifFile
);
return
NULL
;
}
if
(
DGifGetScreenDesc
(
GifFile
)
==
GIF_ERROR
)
{
free
(
Private
);
free
(
GifFile
);
ungif_
free
(
Private
);
ungif_
free
(
GifFile
);
return
NULL
;
}
...
...
@@ -961,7 +980,7 @@ DGifCloseFile(GifFileType * GifFile) {
GifFile
->
SColorMap
=
NULL
;
}
free
(
Private
);
ungif_
free
(
Private
);
Private
=
NULL
;
if
(
GifFile
->
SavedImages
)
{
...
...
@@ -969,7 +988,7 @@ DGifCloseFile(GifFileType * GifFile) {
GifFile
->
SavedImages
=
NULL
;
}
free
(
GifFile
);
ungif_
free
(
GifFile
);
return
GIF_OK
;
}
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