MCPcopy Create free account
hub / github.com/CloverHackyColor/CloverBootloader / iStrLen

Function iStrLen

rEFIt_UEFI/Platform/smbios.cpp:233–252  ·  view source on GitHub ↗

This function determines ascii string length ending by space. search restricted to MaxLen, for example iStrLen("ABC ", 20) == 3 if MaxLen=0 then as usual strlen but bugless

Source from the content-addressed store, hash-verified

231// iStrLen("ABC ", 20) == 3
232// if MaxLen=0 then as usual strlen but bugless
233UINTN iStrLen(CONST CHAR8* String, UINTN MaxLen)
234{
235 UINTN Len = 0;
236 CONST CHAR8* BA;
237 if(MaxLen > 0) {
238 for (Len=0; Len<MaxLen; Len++) {
239 if (String[Len] == 0) {
240 break;
241 }
242 }
243 BA = &String[Len - 1];
244 while ((Len != 0) && ((*BA == ' ') || (*BA == 0))) {
245 BA--; Len--;
246 }
247 } else {
248 BA = String;
249 while(*BA){BA++; Len++;}
250 }
251 return Len;
252}
253
254
255// Internal functions for flat SMBIOS

Callers 6

RefitMainFunction · 0.85
GetCPUPropertiesFunction · 0.85
UpdateSmbiosStringFunction · 0.85
GetTableType1Function · 0.85
GetTableType2Function · 0.85
PatchTableType17Function · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected