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
66e3a855
Commit
66e3a855
authored
Mar 10, 1999
by
Francis Beaudet
Committed by
Alexandre Julliard
Mar 10, 1999
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed index calculations of the upper and lower bounds of a safearray.
Fixed a wrong initialization of the VT sizes array.
parent
e4828b6b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
7 deletions
+14
-7
safearray.c
ole/safearray.c
+14
-7
No files found.
ole/safearray.c
View file @
66e3a855
...
...
@@ -48,7 +48,7 @@ duplicateData(SAFEARRAY *psa, SAFEARRAY **ppsaOut);
A size of zero is defined for the unsupported types. */
#define VARTYPE_NOT_SUPPORTED 0
static
ULONG
VARTYPE_SIZE
[
43
]
=
const
static
ULONG
VARTYPE_SIZE
[
]
=
{
/* this is taken from wtypes.h. Only [S]es are supported by the SafeArray */
VARTYPE_NOT_SUPPORTED
,
/* VT_EMPTY [V] [P] nothing */
...
...
@@ -66,6 +66,7 @@ VARTYPE_NOT_SUPPORTED, /* VT_NULL [V] [P] SQL style Nul */
24
,
/* VT_VARIANT [V][T][P][S] VARIANT * */
4
,
/* VT_UNKNOWN [V][T] [S] IUnknown * */
16
,
/* VT_DECIMAL [V][T] [S] 16 byte fixed point */
VARTYPE_NOT_SUPPORTED
,
/* no VARTYPE here..... */
VARTYPE_NOT_SUPPORTED
,
/* VT_I1 [T] signed char */
1
,
/* VT_UI1 [V][T][P][S] unsigned char */
VARTYPE_NOT_SUPPORTED
,
/* VT_UI2 [T][P] unsigned short */
...
...
@@ -96,6 +97,9 @@ VARTYPE_NOT_SUPPORTED, /* VT_ARRAY [V] SAFEARRAY* */
VARTYPE_NOT_SUPPORTED
/* VT_BYREF [V] void* for local use */
};
const
static
int
LAST_VARTYPE
=
sizeof
(
VARTYPE_SIZE
)
/
sizeof
(
ULONG
);
/*************************************************************************
* Allocate the appropriate amount of memory for the SafeArray descriptor
*/
...
...
@@ -157,7 +161,8 @@ SAFEARRAY* WINAPI SafeArrayCreate(
USHORT
cDim
;
/* Validate supported VARTYPE */
if
(
VARTYPE_SIZE
[
vt
]
==
VARTYPE_NOT_SUPPORTED
)
if
(
(
vt
>=
LAST_VARTYPE
)
||
(
VARTYPE_SIZE
[
vt
]
==
VARTYPE_NOT_SUPPORTED
)
)
return
NULL
;
/* Allocate memory for the array descriptor */
...
...
@@ -180,6 +185,7 @@ SAFEARRAY* WINAPI SafeArrayCreate(
/* allocate memory for the data... */
if
(
FAILED
(
hRes
=
SafeArrayAllocData
(
psa
)))
{
SafeArrayDestroyDescriptor
(
psa
);
ERR
(
ole
,
"() : Failed to allocate the Safe Array data
\n
"
);
return
NULL
;
}
...
...
@@ -356,8 +362,8 @@ HRESULT WINAPI SafeArrayGetUBound(
if
(
nDim
>
psa
->
cDims
)
return
DISP_E_BADINDEX
;
*
plUbound
=
psa
->
rgsabound
[
nDim
].
lLbound
+
psa
->
rgsabound
[
nDim
].
cElements
-
1
;
*
plUbound
=
psa
->
rgsabound
[
nDim
-
1
].
lLbound
+
psa
->
rgsabound
[
nDim
-
1
].
cElements
-
1
;
return
S_OK
;
}
...
...
@@ -376,7 +382,7 @@ HRESULT WINAPI SafeArrayGetLBound(
if
(
nDim
>
psa
->
cDims
)
return
DISP_E_BADINDEX
;
*
plLbound
=
psa
->
rgsabound
[
nDim
].
lLbound
;
*
plLbound
=
psa
->
rgsabound
[
nDim
-
1
].
lLbound
;
return
S_OK
;
}
...
...
@@ -661,7 +667,8 @@ SAFEARRAY* WINAPI SafeArrayCreateVector(
SAFEARRAY
*
psa
;
/* Validate supported VARTYPE */
if
(
VARTYPE_SIZE
[
vt
]
==
VARTYPE_NOT_SUPPORTED
)
if
(
(
vt
>=
LAST_VARTYPE
)
||
(
VARTYPE_SIZE
[
vt
]
==
VARTYPE_NOT_SUPPORTED
)
)
return
NULL
;
/* Allocate memory for the array descriptor and data contiguously */
...
...
@@ -758,7 +765,7 @@ static BOOL validArg(
/* size of the descriptor + data when created with CreateVector */
fullSize
=
sizeof
(
*
psa
)
+
(
psa
->
cbElements
*
psa
->
rgsabound
[
0
].
cElements
);
return
((
psaSize
==
descSize
)
|
(
psaSize
=
=
fullSize
));
return
((
psaSize
>=
descSize
)
||
(
psaSize
>
=
fullSize
));
}
/************************************************************************
...
...
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