Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
48ebc410
Commit
48ebc410
authored
Mar 29, 2022
by
Rémi Bernon
Committed by
Alexandre Julliard
Mar 29, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32: Fix indentation of Global* functions.
Signed-off-by:
Rémi Bernon
<
rbernon@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
56c57f8a
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
36 deletions
+35
-36
heap.c
dlls/kernel32/heap.c
+35
-36
No files found.
dlls/kernel32/heap.c
View file @
48ebc410
...
...
@@ -231,9 +231,8 @@ BOOL WINAPI GlobalUnlock(HGLOBAL hmem)
* Handle: Success
* NULL: Failure
*/
HGLOBAL
WINAPI
GlobalHandle
(
LPCVOID
pmem
/* [in] Pointer to global memory block */
)
{
HGLOBAL
WINAPI
GlobalHandle
(
LPCVOID
pmem
)
{
HGLOBAL
handle
;
PGLOBAL32_INTERN
maybe_intern
;
LPCVOID
test
;
...
...
@@ -244,7 +243,7 @@ HGLOBAL WINAPI GlobalHandle(
return
0
;
}
RtlLockHeap
(
GetProcessHeap
()
);
RtlLockHeap
(
GetProcessHeap
()
);
__TRY
{
handle
=
0
;
...
...
@@ -252,18 +251,21 @@ HGLOBAL WINAPI GlobalHandle(
/* note that if pmem is a pointer to a block allocated by */
/* GlobalAlloc with GMEM_MOVEABLE then magic test in HeapValidate */
/* will fail. */
if
(
ISPOINTER
(
pmem
))
{
if
(
HeapValidate
(
GetProcessHeap
(),
HEAP_NO_SERIALIZE
,
pmem
))
{
if
(
ISPOINTER
(
pmem
))
{
if
(
HeapValidate
(
GetProcessHeap
(),
HEAP_NO_SERIALIZE
,
pmem
))
{
handle
=
(
HGLOBAL
)
pmem
;
/* valid fixed block */
break
;
}
handle
=
POINTER_TO_HANDLE
(
pmem
);
}
else
handle
=
(
HGLOBAL
)
pmem
;
handle
=
POINTER_TO_HANDLE
(
pmem
);
}
else
handle
=
(
HGLOBAL
)
pmem
;
/* Now test handle either passed in or retrieved from pointer */
maybe_intern
=
HANDLE_TO_INTERN
(
handle
);
if
(
maybe_intern
->
Magic
==
MAGIC_GLOBAL_USED
)
{
if
(
maybe_intern
->
Magic
==
MAGIC_GLOBAL_USED
)
{
test
=
maybe_intern
->
Pointer
;
if
(
HeapValidate
(
GetProcessHeap
(),
HEAP_NO_SERIALIZE
,
(
const
char
*
)
test
-
HGLOBAL_STORAGE
)
&&
/* obj(-handle) valid arena? */
HeapValidate
(
GetProcessHeap
(),
HEAP_NO_SERIALIZE
,
maybe_intern
))
/* intern valid arena? */
...
...
@@ -278,12 +280,11 @@ HGLOBAL WINAPI GlobalHandle(
handle
=
0
;
}
__ENDTRY
RtlUnlockHeap
(
GetProcessHeap
()
);
RtlUnlockHeap
(
GetProcessHeap
()
);
return
handle
;
}
/***********************************************************************
* GlobalReAlloc (KERNEL32.@)
*
...
...
@@ -322,42 +323,41 @@ SIZE_T WINAPI GlobalSize(HGLOBAL hmem)
if
(
!
((
ULONG_PTR
)
hmem
>>
16
))
{
SetLastError
(
ERROR_INVALID_HANDLE
);
SetLastError
(
ERROR_INVALID_HANDLE
);
return
0
;
}
if
(
ISPOINTER
(
hmem
))
if
(
ISPOINTER
(
hmem
))
{
retval
=
HeapSize
(
GetProcessHeap
(),
0
,
hmem
);
retval
=
HeapSize
(
GetProcessHeap
(),
0
,
hmem
);
if
(
retval
==
~
(
SIZE_T
)
0
)
/* It might be a GMEM_MOVEABLE data pointer */
{
retval
=
HeapSize
(
GetProcessHeap
(),
0
,
(
char
*
)
hmem
-
HGLOBAL_STORAGE
);
retval
=
HeapSize
(
GetProcessHeap
(),
0
,
(
char
*
)
hmem
-
HGLOBAL_STORAGE
);
if
(
retval
!=
~
(
SIZE_T
)
0
)
retval
-=
HGLOBAL_STORAGE
;
}
}
else
{
RtlLockHeap
(
GetProcessHeap
()
);
pintern
=
HANDLE_TO_INTERN
(
hmem
);
RtlLockHeap
(
GetProcessHeap
()
);
pintern
=
HANDLE_TO_INTERN
(
hmem
);
if
(
pintern
->
Magic
==
MAGIC_GLOBAL_USED
)
if
(
pintern
->
Magic
==
MAGIC_GLOBAL_USED
)
{
if
(
!
pintern
->
Pointer
)
/* handle case of GlobalAlloc( ??,0) */
retval
=
0
;
else
{
retval
=
HeapSize
(
GetProcessHeap
(),
0
,
(
char
*
)
pintern
->
Pointer
-
HGLOBAL_STORAGE
);
retval
=
HeapSize
(
GetProcessHeap
(),
0
,
(
char
*
)
pintern
->
Pointer
-
HGLOBAL_STORAGE
);
if
(
retval
!=
~
(
SIZE_T
)
0
)
retval
-=
HGLOBAL_STORAGE
;
}
}
else
{
WARN
(
"invalid handle %p (Magic: 0x%04x)
\n
"
,
hmem
,
pintern
->
Magic
);
SetLastError
(
ERROR_INVALID_HANDLE
);
retval
=
0
;
WARN
(
"invalid handle %p (Magic: 0x%04x)
\n
"
,
hmem
,
pintern
->
Magic
);
SetLastError
(
ERROR_INVALID_HANDLE
);
retval
=
0
;
}
RtlUnlockHeap
(
GetProcessHeap
()
);
RtlUnlockHeap
(
GetProcessHeap
()
);
}
if
(
retval
==
~
(
SIZE_T
)
0
)
retval
=
0
;
return
retval
;
...
...
@@ -418,27 +418,26 @@ UINT WINAPI GlobalFlags(HGLOBAL hmem)
DWORD
retval
;
PGLOBAL32_INTERN
pintern
;
if
(
ISPOINTER
(
hmem
))
if
(
ISPOINTER
(
hmem
))
{
retval
=
0
;
retval
=
0
;
}
else
{
RtlLockHeap
(
GetProcessHeap
()
);
pintern
=
HANDLE_TO_INTERN
(
hmem
);
if
(
pintern
->
Magic
==
MAGIC_GLOBAL_USED
)
RtlLockHeap
(
GetProcessHeap
()
);
pintern
=
HANDLE_TO_INTERN
(
hmem
);
if
(
pintern
->
Magic
==
MAGIC_GLOBAL_USED
)
{
retval
=
pintern
->
LockCount
+
(
pintern
->
Flags
<<
8
);
if
(
pintern
->
Pointer
==
0
)
retval
|=
GMEM_DISCARDED
;
retval
=
pintern
->
LockCount
+
(
pintern
->
Flags
<<
8
);
if
(
pintern
->
Pointer
==
0
)
retval
|=
GMEM_DISCARDED
;
}
else
{
WARN
(
"invalid handle %p (Magic: 0x%04x)
\n
"
,
hmem
,
pintern
->
Magic
);
SetLastError
(
ERROR_INVALID_HANDLE
);
WARN
(
"invalid handle %p (Magic: 0x%04x)
\n
"
,
hmem
,
pintern
->
Magic
);
SetLastError
(
ERROR_INVALID_HANDLE
);
retval
=
GMEM_INVALID_HANDLE
;
}
RtlUnlockHeap
(
GetProcessHeap
()
);
RtlUnlockHeap
(
GetProcessHeap
()
);
}
return
retval
;
}
...
...
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