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
0a92e106
Commit
0a92e106
authored
Dec 07, 2007
by
Michael Stefaniuc
Committed by
Alexandre Julliard
Dec 08, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
riched20: Remove the RTFAlloc() wrapper around heap_alloc().
parent
4210cafc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
35 deletions
+23
-35
reader.c
dlls/riched20/reader.c
+22
-34
rtf.h
dlls/riched20/rtf.h
+1
-1
No files found.
dlls/riched20/reader.c
View file @
0a92e106
...
@@ -76,18 +76,6 @@ static void RTFPutCodePageChar(RTF_Info *info, int c);
...
@@ -76,18 +76,6 @@ static void RTFPutCodePageChar(RTF_Info *info, int c);
/* ---------------------------------------------------------------------- */
/* ---------------------------------------------------------------------- */
/*
* Memory allocation routines
*/
/*
* Return pointer to block of size bytes, or NULL if there's
* not enough memory available.
*/
#define RTFAlloc(size) heap_alloc(size)
#define RTFReAlloc(ptr, size) heap_realloc(ptr, size)
#define RTFFree(ptr) heap_free(ptr)
/*
/*
* Saves a string on the heap and returns a pointer to it.
* Saves a string on the heap and returns a pointer to it.
...
@@ -96,7 +84,7 @@ static inline char *RTFStrSave(const char *s)
...
@@ -96,7 +84,7 @@ static inline char *RTFStrSave(const char *s)
{
{
char
*
p
;
char
*
p
;
p
=
RTFA
lloc
(
lstrlenA
(
s
)
+
1
);
p
=
heap_a
lloc
(
lstrlenA
(
s
)
+
1
);
if
(
p
==
NULL
)
if
(
p
==
NULL
)
return
NULL
;
return
NULL
;
return
lstrcpyA
(
p
,
s
);
return
lstrcpyA
(
p
,
s
);
...
@@ -143,14 +131,14 @@ RTFDestroyAttrs(RTF_Info *info)
...
@@ -143,14 +131,14 @@ RTFDestroyAttrs(RTF_Info *info)
while
(
info
->
fontList
)
while
(
info
->
fontList
)
{
{
fp
=
info
->
fontList
->
rtfNextFont
;
fp
=
info
->
fontList
->
rtfNextFont
;
RTFF
ree
(
info
->
fontList
->
rtfFName
);
heap_f
ree
(
info
->
fontList
->
rtfFName
);
RTFF
ree
(
info
->
fontList
);
heap_f
ree
(
info
->
fontList
);
info
->
fontList
=
fp
;
info
->
fontList
=
fp
;
}
}
while
(
info
->
colorList
)
while
(
info
->
colorList
)
{
{
cp
=
info
->
colorList
->
rtfNextColor
;
cp
=
info
->
colorList
->
rtfNextColor
;
RTFF
ree
(
info
->
colorList
);
heap_f
ree
(
info
->
colorList
);
info
->
colorList
=
cp
;
info
->
colorList
=
cp
;
}
}
while
(
info
->
styleList
)
while
(
info
->
styleList
)
...
@@ -160,12 +148,12 @@ RTFDestroyAttrs(RTF_Info *info)
...
@@ -160,12 +148,12 @@ RTFDestroyAttrs(RTF_Info *info)
while
(
eltList
)
while
(
eltList
)
{
{
ep
=
eltList
->
rtfNextSE
;
ep
=
eltList
->
rtfNextSE
;
RTFF
ree
(
eltList
->
rtfSEText
);
heap_f
ree
(
eltList
->
rtfSEText
);
RTFF
ree
(
eltList
);
heap_f
ree
(
eltList
);
eltList
=
ep
;
eltList
=
ep
;
}
}
RTFF
ree
(
info
->
styleList
->
rtfSName
);
heap_f
ree
(
info
->
styleList
->
rtfSName
);
RTFF
ree
(
info
->
styleList
);
heap_f
ree
(
info
->
styleList
);
info
->
styleList
=
sp
;
info
->
styleList
=
sp
;
}
}
}
}
...
@@ -176,11 +164,11 @@ RTFDestroy(RTF_Info *info)
...
@@ -176,11 +164,11 @@ RTFDestroy(RTF_Info *info)
{
{
if
(
info
->
rtfTextBuf
)
if
(
info
->
rtfTextBuf
)
{
{
RTFF
ree
(
info
->
rtfTextBuf
);
heap_f
ree
(
info
->
rtfTextBuf
);
RTFF
ree
(
info
->
pushedTextBuf
);
heap_f
ree
(
info
->
pushedTextBuf
);
}
}
RTFDestroyAttrs
(
info
);
RTFDestroyAttrs
(
info
);
RTFF
ree
(
info
->
cpOutputBuffer
);
heap_f
ree
(
info
->
cpOutputBuffer
);
}
}
...
@@ -196,15 +184,15 @@ void RTFInit(RTF_Info *info)
...
@@ -196,15 +184,15 @@ void RTFInit(RTF_Info *info)
if
(
info
->
rtfTextBuf
==
NULL
)
/* initialize the text buffers */
if
(
info
->
rtfTextBuf
==
NULL
)
/* initialize the text buffers */
{
{
info
->
rtfTextBuf
=
RTFA
lloc
(
rtfBufSiz
);
info
->
rtfTextBuf
=
heap_a
lloc
(
rtfBufSiz
);
info
->
pushedTextBuf
=
RTFA
lloc
(
rtfBufSiz
);
info
->
pushedTextBuf
=
heap_a
lloc
(
rtfBufSiz
);
if
(
info
->
rtfTextBuf
==
NULL
||
info
->
pushedTextBuf
==
NULL
)
if
(
info
->
rtfTextBuf
==
NULL
||
info
->
pushedTextBuf
==
NULL
)
ERR
(
"Cannot allocate text buffers.
\n
"
);
ERR
(
"Cannot allocate text buffers.
\n
"
);
info
->
rtfTextBuf
[
0
]
=
info
->
pushedTextBuf
[
0
]
=
'\0'
;
info
->
rtfTextBuf
[
0
]
=
info
->
pushedTextBuf
[
0
]
=
'\0'
;
}
}
RTFF
ree
(
info
->
inputName
);
heap_f
ree
(
info
->
inputName
);
RTFF
ree
(
info
->
outputName
);
heap_f
ree
(
info
->
outputName
);
info
->
inputName
=
info
->
outputName
=
NULL
;
info
->
inputName
=
info
->
outputName
=
NULL
;
for
(
i
=
0
;
i
<
rtfMaxClass
;
i
++
)
for
(
i
=
0
;
i
<
rtfMaxClass
;
i
++
)
...
@@ -245,7 +233,7 @@ void RTFInit(RTF_Info *info)
...
@@ -245,7 +233,7 @@ void RTFInit(RTF_Info *info)
if
(
!
info
->
cpOutputBuffer
)
if
(
!
info
->
cpOutputBuffer
)
{
{
info
->
dwMaxCPOutputCount
=
0x1000
;
info
->
dwMaxCPOutputCount
=
0x1000
;
info
->
cpOutputBuffer
=
RTFA
lloc
(
info
->
dwMaxCPOutputCount
);
info
->
cpOutputBuffer
=
heap_a
lloc
(
info
->
dwMaxCPOutputCount
);
}
}
}
}
...
@@ -2300,9 +2288,9 @@ void LookupInit(void)
...
@@ -2300,9 +2288,9 @@ void LookupInit(void)
rp
->
rtfKHash
=
Hash
(
rp
->
rtfKStr
);
rp
->
rtfKHash
=
Hash
(
rp
->
rtfKStr
);
index
=
rp
->
rtfKHash
%
(
RTF_KEY_COUNT
*
2
);
index
=
rp
->
rtfKHash
%
(
RTF_KEY_COUNT
*
2
);
if
(
!
rtfHashTable
[
index
].
count
)
if
(
!
rtfHashTable
[
index
].
count
)
rtfHashTable
[
index
].
value
=
RTFA
lloc
(
sizeof
(
RTFKey
*
));
rtfHashTable
[
index
].
value
=
heap_a
lloc
(
sizeof
(
RTFKey
*
));
else
else
rtfHashTable
[
index
].
value
=
RTFReA
lloc
(
rtfHashTable
[
index
].
value
,
sizeof
(
RTFKey
*
)
*
(
rtfHashTable
[
index
].
count
+
1
));
rtfHashTable
[
index
].
value
=
heap_rea
lloc
(
rtfHashTable
[
index
].
value
,
sizeof
(
RTFKey
*
)
*
(
rtfHashTable
[
index
].
count
+
1
));
rtfHashTable
[
index
].
value
[
rtfHashTable
[
index
].
count
++
]
=
rp
;
rtfHashTable
[
index
].
value
[
rtfHashTable
[
index
].
count
++
]
=
rp
;
}
}
}
}
...
@@ -2313,7 +2301,7 @@ void LookupCleanup(void)
...
@@ -2313,7 +2301,7 @@ void LookupCleanup(void)
for
(
i
=
0
;
i
<
RTF_KEY_COUNT
*
2
;
i
++
)
for
(
i
=
0
;
i
<
RTF_KEY_COUNT
*
2
;
i
++
)
{
{
RTFF
ree
(
rtfHashTable
[
i
].
value
);
heap_f
ree
(
rtfHashTable
[
i
].
value
);
rtfHashTable
[
i
].
value
=
NULL
;
rtfHashTable
[
i
].
value
=
NULL
;
rtfHashTable
[
i
].
count
=
0
;
rtfHashTable
[
i
].
count
=
0
;
}
}
...
@@ -2682,7 +2670,7 @@ static void
...
@@ -2682,7 +2670,7 @@ static void
RTFFlushCPOutputBuffer
(
RTF_Info
*
info
)
RTFFlushCPOutputBuffer
(
RTF_Info
*
info
)
{
{
int
bufferMax
=
info
->
dwCPOutputCount
*
2
*
sizeof
(
WCHAR
);
int
bufferMax
=
info
->
dwCPOutputCount
*
2
*
sizeof
(
WCHAR
);
WCHAR
*
buffer
=
RTFA
lloc
(
bufferMax
);
WCHAR
*
buffer
=
heap_a
lloc
(
bufferMax
);
int
length
;
int
length
;
length
=
MultiByteToWideChar
(
info
->
codePage
,
0
,
info
->
cpOutputBuffer
,
length
=
MultiByteToWideChar
(
info
->
codePage
,
0
,
info
->
cpOutputBuffer
,
...
@@ -2690,7 +2678,7 @@ RTFFlushCPOutputBuffer(RTF_Info *info)
...
@@ -2690,7 +2678,7 @@ RTFFlushCPOutputBuffer(RTF_Info *info)
info
->
dwCPOutputCount
=
0
;
info
->
dwCPOutputCount
=
0
;
RTFPutUnicodeString
(
info
,
buffer
,
length
);
RTFPutUnicodeString
(
info
,
buffer
,
length
);
RTFF
ree
((
char
*
)
buffer
);
heap_f
ree
((
char
*
)
buffer
);
}
}
void
void
...
@@ -2719,7 +2707,7 @@ RTFPutCodePageChar(RTF_Info *info, int c)
...
@@ -2719,7 +2707,7 @@ RTFPutCodePageChar(RTF_Info *info, int c)
if
(
info
->
dwCPOutputCount
>=
info
->
dwMaxCPOutputCount
)
if
(
info
->
dwCPOutputCount
>=
info
->
dwMaxCPOutputCount
)
{
{
info
->
dwMaxCPOutputCount
*=
2
;
info
->
dwMaxCPOutputCount
*=
2
;
info
->
cpOutputBuffer
=
RTFReA
lloc
(
info
->
cpOutputBuffer
,
info
->
dwMaxCPOutputCount
);
info
->
cpOutputBuffer
=
heap_rea
lloc
(
info
->
cpOutputBuffer
,
info
->
dwMaxCPOutputCount
);
}
}
info
->
cpOutputBuffer
[
info
->
dwCPOutputCount
++
]
=
c
;
info
->
cpOutputBuffer
[
info
->
dwCPOutputCount
++
]
=
c
;
}
}
dlls/riched20/rtf.h
View file @
0a92e106
...
@@ -1005,7 +1005,7 @@ struct RTFStyleElt
...
@@ -1005,7 +1005,7 @@ struct RTFStyleElt
* if no memory available.
* if no memory available.
*/
*/
# define New(t) (
(t *) RTFAlloc ((int)
sizeof (t)))
# define New(t) (
heap_alloc (
sizeof (t)))
/* Parser stack size */
/* Parser stack size */
...
...
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