Fixed places which expected GetStringLength() to return the amount
of memory used instead of the number of chars. git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@2211 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
@@ -261,7 +261,7 @@ extern void FlushColorXForms (void);
|
|||||||
#define GetColorMapIndex GetStringTableIndex
|
#define GetColorMapIndex GetStringTableIndex
|
||||||
#define SetAbsColorMapIndex SetAbsStringTableIndex
|
#define SetAbsColorMapIndex SetAbsStringTableIndex
|
||||||
#define SetRelColorMapIndex SetRelStringTableIndex
|
#define SetRelColorMapIndex SetRelStringTableIndex
|
||||||
#define GetColorMapLength GetStringLength
|
#define GetColorMapLength GetStringLengthBin
|
||||||
#define GetColorMapAddress GetStringAddress
|
#define GetColorMapAddress GetStringAddress
|
||||||
#define GetColorMapContents GetStringContents
|
#define GetColorMapContents GetStringContents
|
||||||
|
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ extern DIRENTRY_REF LoadDirEntryTable (uio_DirHandle *dirHandle,
|
|||||||
#define GetDirEntryTableIndex GetStringTableIndex
|
#define GetDirEntryTableIndex GetStringTableIndex
|
||||||
#define SetAbsDirEntryTableIndex SetAbsStringTableIndex
|
#define SetAbsDirEntryTableIndex SetAbsStringTableIndex
|
||||||
#define SetRelDirEntryTableIndex SetRelStringTableIndex
|
#define SetRelDirEntryTableIndex SetRelStringTableIndex
|
||||||
#define GetDirEntryLength GetStringLength
|
#define GetDirEntryLength GetStringLengthBin
|
||||||
#define GetDirEntryAddress GetStringAddress
|
#define GetDirEntryAddress GetStringAddress
|
||||||
#define GetDirEntryContents GetStringContents
|
#define GetDirEntryContents GetStringContents
|
||||||
|
|
||||||
|
|||||||
@@ -172,6 +172,32 @@ GetStringLength (STRING String)
|
|||||||
return (StringLength);
|
return (StringLength);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
COUNT
|
||||||
|
GetStringLengthBin (STRING String)
|
||||||
|
{
|
||||||
|
COUNT StringLength;
|
||||||
|
STRING_TABLE StringTable;
|
||||||
|
|
||||||
|
StringTable = GetStringTable (String);
|
||||||
|
if (StringTable == 0)
|
||||||
|
StringLength = 0;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
COUNT StringIndex;
|
||||||
|
STRING_TABLEPTR StringTablePtr;
|
||||||
|
|
||||||
|
StringIndex = STRING_INDEX (String);
|
||||||
|
LockStringTable (StringTable, &StringTablePtr);
|
||||||
|
|
||||||
|
StringLength = (COUNT)(
|
||||||
|
StringTablePtr->StringOffsets[StringIndex + 1]
|
||||||
|
- StringTablePtr->StringOffsets[StringIndex]);
|
||||||
|
UnlockStringTable (StringTable);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (StringLength);
|
||||||
|
}
|
||||||
|
|
||||||
STRINGPTR
|
STRINGPTR
|
||||||
GetStringSoundClip (STRING String)
|
GetStringSoundClip (STRING String)
|
||||||
{
|
{
|
||||||
@@ -270,7 +296,7 @@ GetStringContents (STRING String, STRINGPTR StringBuf, BOOLEAN
|
|||||||
COUNT StringLength;
|
COUNT StringLength;
|
||||||
|
|
||||||
if ((StringAddr = GetStringAddress (String)) != 0 &&
|
if ((StringAddr = GetStringAddress (String)) != 0 &&
|
||||||
(StringLength = GetStringLength (String)) != 0)
|
(StringLength = GetDirEntryLength (String)) != 0)
|
||||||
{
|
{
|
||||||
memcpy (StringBuf, StringAddr, StringLength);
|
memcpy (StringBuf, StringAddr, StringLength);
|
||||||
if (AppendSpace)
|
if (AppendSpace)
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ extern STRING SetAbsStringTableIndex (STRING String, COUNT
|
|||||||
extern STRING SetRelStringTableIndex (STRING String, SIZE
|
extern STRING SetRelStringTableIndex (STRING String, SIZE
|
||||||
StringTableOffs);
|
StringTableOffs);
|
||||||
extern COUNT GetStringLength (STRING String);
|
extern COUNT GetStringLength (STRING String);
|
||||||
|
extern COUNT GetStringLengthBin (STRING String);
|
||||||
extern STRINGPTR GetStringAddress (STRING String);
|
extern STRINGPTR GetStringAddress (STRING String);
|
||||||
extern STRINGPTR GetStringSoundClip (STRING String);
|
extern STRINGPTR GetStringSoundClip (STRING String);
|
||||||
extern STRINGPTR GetStringTimeStamp (STRING String);
|
extern STRINGPTR GetStringTimeStamp (STRING String);
|
||||||
|
|||||||
Reference in New Issue
Block a user