oleaut32: Get rid of some magic offset values, use structure for that.
This commit is contained in:
parent
677302cf22
commit
22022d13d1
|
@ -2094,7 +2094,7 @@ static void MSFT_DoVars(TLBContext *pcx, ITypeInfoImpl *pTI, int cFuncs,
|
||||||
{
|
{
|
||||||
int infolen, nameoffset, reclength;
|
int infolen, nameoffset, reclength;
|
||||||
char recbuf[256];
|
char recbuf[256];
|
||||||
MSFT_VarRecord * pVarRec=(MSFT_VarRecord *) recbuf;
|
MSFT_VarRecord *pVarRec = (MSFT_VarRecord*)recbuf;
|
||||||
int i;
|
int i;
|
||||||
int recoffset;
|
int recoffset;
|
||||||
|
|
||||||
|
@ -2111,17 +2111,20 @@ static void MSFT_DoVars(TLBContext *pcx, ITypeInfoImpl *pTI, int cFuncs,
|
||||||
offset + infolen + (2*cFuncs + cVars + i + 1) * sizeof(INT));
|
offset + infolen + (2*cFuncs + cVars + i + 1) * sizeof(INT));
|
||||||
(*pptvd)->Name=MSFT_ReadName(pcx, nameoffset);
|
(*pptvd)->Name=MSFT_ReadName(pcx, nameoffset);
|
||||||
/* read the variable information record */
|
/* read the variable information record */
|
||||||
MSFT_ReadLEDWords(&reclength, sizeof(INT), pcx, recoffset);
|
MSFT_ReadLEDWords(&reclength, sizeof(pVarRec->Info), pcx, recoffset);
|
||||||
reclength &=0xff;
|
reclength &= 0xff;
|
||||||
MSFT_ReadLEDWords(pVarRec, reclength - sizeof(INT), pcx, DO_NOT_SEEK);
|
MSFT_ReadLEDWords(&pVarRec->DataType, reclength - FIELD_OFFSET(MSFT_VarRecord, DataType), pcx, DO_NOT_SEEK);
|
||||||
/* Optional data */
|
|
||||||
if(reclength >(6*sizeof(INT)) )
|
/* optional data */
|
||||||
(*pptvd)->HelpContext=pVarRec->HelpContext;
|
if(reclength > FIELD_OFFSET(MSFT_VarRecord, HelpContext))
|
||||||
if(reclength >(7*sizeof(INT)) )
|
(*pptvd)->HelpContext = pVarRec->HelpContext;
|
||||||
|
|
||||||
|
if(reclength > FIELD_OFFSET(MSFT_VarRecord, oHelpString))
|
||||||
(*pptvd)->HelpString = MSFT_ReadString(pcx, pVarRec->oHelpString) ;
|
(*pptvd)->HelpString = MSFT_ReadString(pcx, pVarRec->oHelpString) ;
|
||||||
if(reclength >(8*sizeof(INT)) )
|
|
||||||
if(reclength >(9*sizeof(INT)) )
|
if(reclength > FIELD_OFFSET(MSFT_VarRecord, HelpStringContext))
|
||||||
(*pptvd)->HelpStringContext=pVarRec->HelpStringContext;
|
(*pptvd)->HelpStringContext = pVarRec->HelpStringContext;
|
||||||
|
|
||||||
/* fill the VarDesc Structure */
|
/* fill the VarDesc Structure */
|
||||||
MSFT_ReadLEDWords(&(*pptvd)->vardesc.memid, sizeof(INT), pcx,
|
MSFT_ReadLEDWords(&(*pptvd)->vardesc.memid, sizeof(INT), pcx,
|
||||||
offset + infolen + (cFuncs + i + 1) * sizeof(INT));
|
offset + infolen + (cFuncs + i + 1) * sizeof(INT));
|
||||||
|
|
|
@ -231,7 +231,7 @@ typedef struct {
|
||||||
|
|
||||||
/* Variable description data */
|
/* Variable description data */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
/* INT recsize; // record size including some xtra stuff */
|
INT Info; /* record size including some extra stuff */
|
||||||
INT DataType; /* data type of the variable */
|
INT DataType; /* data type of the variable */
|
||||||
INT Flags; /* VarFlags (LOWORD) */
|
INT Flags; /* VarFlags (LOWORD) */
|
||||||
#ifdef WORDS_BIGENDIAN
|
#ifdef WORDS_BIGENDIAN
|
||||||
|
@ -250,7 +250,6 @@ typedef struct {
|
||||||
INT res9; /* unknown (-1) */
|
INT res9; /* unknown (-1) */
|
||||||
INT oCustData; /* custom data for variable */
|
INT oCustData; /* custom data for variable */
|
||||||
INT HelpStringContext;
|
INT HelpStringContext;
|
||||||
|
|
||||||
} MSFT_VarRecord;
|
} MSFT_VarRecord;
|
||||||
|
|
||||||
/* Structure of the reference data */
|
/* Structure of the reference data */
|
||||||
|
|
Loading…
Reference in New Issue