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:
meep-eep
2006-01-20 05:53:33 +00:00
parent 8dc56b570f
commit 507a30e01b
4 changed files with 30 additions and 3 deletions
+1 -1
View File
@@ -261,7 +261,7 @@ extern void FlushColorXForms (void);
#define GetColorMapIndex GetStringTableIndex
#define SetAbsColorMapIndex SetAbsStringTableIndex
#define SetRelColorMapIndex SetRelStringTableIndex
#define GetColorMapLength GetStringLength
#define GetColorMapLength GetStringLengthBin
#define GetColorMapAddress GetStringAddress
#define GetColorMapContents GetStringContents
+1 -1
View File
@@ -115,7 +115,7 @@ extern DIRENTRY_REF LoadDirEntryTable (uio_DirHandle *dirHandle,
#define GetDirEntryTableIndex GetStringTableIndex
#define SetAbsDirEntryTableIndex SetAbsStringTableIndex
#define SetRelDirEntryTableIndex SetRelStringTableIndex
#define GetDirEntryLength GetStringLength
#define GetDirEntryLength GetStringLengthBin
#define GetDirEntryAddress GetStringAddress
#define GetDirEntryContents GetStringContents
+27 -1
View File
@@ -172,6 +172,32 @@ GetStringLength (STRING String)
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
GetStringSoundClip (STRING String)
{
@@ -270,7 +296,7 @@ GetStringContents (STRING String, STRINGPTR StringBuf, BOOLEAN
COUNT StringLength;
if ((StringAddr = GetStringAddress (String)) != 0 &&
(StringLength = GetStringLength (String)) != 0)
(StringLength = GetDirEntryLength (String)) != 0)
{
memcpy (StringBuf, StringAddr, StringLength);
if (AppendSpace)
+1
View File
@@ -44,6 +44,7 @@ extern STRING SetAbsStringTableIndex (STRING String, COUNT
extern STRING SetRelStringTableIndex (STRING String, SIZE
StringTableOffs);
extern COUNT GetStringLength (STRING String);
extern COUNT GetStringLengthBin (STRING String);
extern STRINGPTR GetStringAddress (STRING String);
extern STRINGPTR GetStringSoundClip (STRING String);
extern STRINGPTR GetStringTimeStamp (STRING String);