MCPcopy Create free account
hub / github.com/DentonW/DevIL / GetUtxName

Function GetUtxName

DevIL/src-IL/src/il_utx.cpp:106–135  ·  view source on GitHub ↗

Gets a name variable from the file. Keep in mind that the return value must be freed.

Source from the content-addressed store, hash-verified

104
105// Gets a name variable from the file. Keep in mind that the return value must be freed.
106string GetUtxName(UTXHEADER &Header)
107{
108#define NAME_MAX_LEN 256 //@TODO: Figure out if these can possibly be longer.
109 char Name[NAME_MAX_LEN];
110 ILubyte Length = 0;
111
112 // New style (Unreal Tournament) name. This has a byte at the beginning telling
113 // how long the string is (plus terminating 0), followed by the terminating 0.
114 if (Header.Version >= 64) {
115 Length = igetc();
116 if (iread(Name, Length, 1) != 1)
117 return "";
118 if (Name[Length-1] != 0)
119 return "";
120 return string(Name);
121 }
122
123 // Old style (Unreal) name. This string length is unknown, but it is terminated
124 // by a 0.
125 do {
126 Name[Length++] = igetc();
127 } while (!ieof() && Name[Length-1] != 0 && Length < NAME_MAX_LEN);
128
129 // Never reached the terminating 0.
130 if (Length == NAME_MAX_LEN && Name[Length-1] != 0)
131 return "";
132
133 return string(Name);
134#undef NAME_MAX_LEN
135}
136
137
138bool GetUtxNameTable(vector <UTXENTRYNAME> &NameEntries, UTXHEADER &Header)

Callers 1

GetUtxNameTableFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected