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
8939587b
Commit
8939587b
authored
Oct 24, 2006
by
Mike McCormack
Committed by
Alexandre Julliard
Oct 24, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
riched20: Create macro functions for allocating and freeing memory.
parent
e971e0fb
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
31 additions
and
29 deletions
+31
-29
clipboard.c
dlls/riched20/clipboard.c
+4
-4
editor.c
dlls/riched20/editor.c
+2
-2
editor.h
dlls/riched20/editor.h
+20
-4
reader.c
dlls/riched20/reader.c
+3
-17
richole.c
dlls/riched20/richole.c
+2
-2
No files found.
dlls/riched20/clipboard.c
View file @
8939587b
...
...
@@ -77,7 +77,7 @@ static ULONG WINAPI EnumFormatImpl_Release(IEnumFORMATETC *iface)
if
(
!
ref
)
{
GlobalFree
(
This
->
fmtetc
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
richedit_free
(
This
);
}
return
ref
;
...
...
@@ -152,7 +152,7 @@ static HRESULT EnumFormatImpl_Create(FORMATETC *fmtetc, UINT fmtetc_cnt, IEnumFO
EnumFormatImpl
*
ret
;
TRACE
(
"
\n
"
);
ret
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
EnumFormatImpl
));
ret
=
richedit_alloc
(
sizeof
(
EnumFormatImpl
));
ret
->
lpVtbl
=
&
VT_EnumFormatImpl
;
ret
->
ref
=
1
;
ret
->
cur
=
0
;
...
...
@@ -195,7 +195,7 @@ static ULONG WINAPI DataObjectImpl_Release(IDataObject* iface)
if
(
This
->
unicode
)
GlobalFree
(
This
->
unicode
);
if
(
This
->
rtf
)
GlobalFree
(
This
->
rtf
);
if
(
This
->
fmtetc
)
GlobalFree
(
This
->
fmtetc
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
richedit_free
(
This
);
}
return
ref
;
...
...
@@ -388,7 +388,7 @@ HRESULT ME_GetDataObject(ME_TextEditor *editor, CHARRANGE *lpchrg, LPDATAOBJECT
DataObjectImpl
*
obj
;
TRACE
(
"(%p,%d,%d)
\n
"
,
editor
,
lpchrg
->
cpMin
,
lpchrg
->
cpMax
);
obj
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
DataObjectImpl
));
obj
=
richedit_alloc
(
sizeof
(
DataObjectImpl
));
if
(
cfRTF
==
0
)
cfRTF
=
RegisterClipboardFormatA
(
"Rich Text Format"
);
...
...
dlls/riched20/editor.c
View file @
8939587b
...
...
@@ -1998,7 +1998,7 @@ LRESULT WINAPI RichEditANSIWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lP
/* potentially each char may be a CR, why calculate the exact value with O(N) when
we can just take a bigger buffer? :) */
int
crlfmul
=
(
ex
->
flags
&
GT_USECRLF
)
?
2
:
1
;
LPWSTR
buffer
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
crlfmul
*
nCount
+
1
)
*
sizeof
(
WCHAR
));
LPWSTR
buffer
=
richedit_alloc
(
(
crlfmul
*
nCount
+
1
)
*
sizeof
(
WCHAR
));
DWORD
buflen
=
ex
->
cb
;
LRESULT
rc
;
DWORD
flags
=
0
;
...
...
@@ -2006,7 +2006,7 @@ LRESULT WINAPI RichEditANSIWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lP
buflen
=
ME_GetTextW
(
editor
,
buffer
,
nStart
,
nCount
,
ex
->
flags
&
GT_USECRLF
);
rc
=
WideCharToMultiByte
(
ex
->
codepage
,
flags
,
buffer
,
-
1
,
(
LPSTR
)
lParam
,
ex
->
cb
,
ex
->
lpDefaultChar
,
ex
->
lpUsedDefaultChar
);
HeapFree
(
GetProcessHeap
(),
0
,
buffer
);
richedit_free
(
buffer
);
return
rc
;
}
}
...
...
dlls/riched20/editor.h
View file @
8939587b
...
...
@@ -21,9 +21,26 @@
#include "editstr.h"
#include "wine/unicode.h"
#define ALLOC_OBJ(type) HeapAlloc(me_heap, 0, sizeof(type))
#define ALLOC_N_OBJ(type, count) HeapAlloc(me_heap, 0, (count)*sizeof(type))
#define FREE_OBJ(ptr) HeapFree(me_heap, 0, ptr)
extern
HANDLE
me_heap
;
static
inline
void
*
richedit_alloc
(
size_t
len
)
{
return
HeapAlloc
(
me_heap
,
0
,
len
);
}
static
inline
BOOL
richedit_free
(
void
*
ptr
)
{
return
HeapFree
(
me_heap
,
0
,
ptr
);
}
static
inline
void
*
richedit_realloc
(
void
*
ptr
,
size_t
len
)
{
return
HeapReAlloc
(
me_heap
,
0
,
ptr
,
len
);
}
#define ALLOC_OBJ(type) richedit_alloc(sizeof(type))
#define ALLOC_N_OBJ(type, count) richedit_alloc((count)*sizeof(type))
#define FREE_OBJ(ptr) richedit_free(ptr)
#define RUN_IS_HIDDEN(run) ((run)->style->fmt.dwMask & CFM_HIDDEN \
&& (run)->style->fmt.dwEffects & CFE_HIDDEN)
...
...
@@ -264,7 +281,6 @@ ME_DisplayItem *ME_FindItemAtOffset(ME_TextEditor *editor, ME_DIType nItemType,
void
ME_StreamInFill
(
ME_InStream
*
stream
);
int
ME_AutoURLDetect
(
ME_TextEditor
*
editor
,
WCHAR
curChar
);
extern
int
me_debug
;
extern
HANDLE
me_heap
;
extern
void
DoWrap
(
ME_TextEditor
*
editor
);
/* writer.c */
...
...
dlls/riched20/reader.c
View file @
8939587b
...
...
@@ -86,17 +86,9 @@ static void RTFPutCodePageChar(RTF_Info *info, int c);
* Return pointer to block of size bytes, or NULL if there's
* not enough memory available.
*/
static
inline
void
*
RTFAlloc
(
int
size
)
{
return
HeapAlloc
(
me_heap
,
0
,
size
);
}
static
inline
void
*
RTFReAlloc
(
void
*
ptr
,
int
size
)
{
return
HeapReAlloc
(
me_heap
,
0
,
ptr
,
size
);
}
#define RTFAlloc(size) richedit_alloc(size)
#define RTFReAlloc(ptr, size) richedit_realloc(ptr, size)
#define RTFFree(ptr) richedit_free(ptr)
/*
* Saves a string on the heap and returns a pointer to it.
...
...
@@ -112,12 +104,6 @@ static inline char *RTFStrSave(char *s)
}
static
inline
void
RTFFree
(
void
*
p
)
{
HeapFree
(
me_heap
,
0
,
p
);
}
/* ---------------------------------------------------------------------- */
...
...
dlls/riched20/richole.c
View file @
8939587b
...
...
@@ -112,7 +112,7 @@ IRichEditOle_fnRelease(IRichEditOle *me)
if
(
!
ref
)
{
TRACE
(
"Destroying %p
\n
"
,
This
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
richedit_free
(
This
);
}
return
ref
;
}
...
...
@@ -529,7 +529,7 @@ LRESULT CreateIRichEditOle(ME_TextEditor *editor, LPVOID *ppObj)
{
IRichEditOleImpl
*
reo
;
reo
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
IRichEditOleImpl
));
reo
=
richedit_alloc
(
sizeof
(
IRichEditOleImpl
));
if
(
!
reo
)
return
0
;
...
...
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