- for (StartIndex = 0; OSIconName != NULL && OSIconName[StartIndex]; StartIndex = NextIndex) {
- // find the next name in the list
- NextIndex = 0;
- for (Index = StartIndex; OSIconName[Index]; Index++) {
- if (OSIconName[Index] == ',') {
- NextIndex = Index + 1;
- break;
- }
- }
- if (OSIconName[Index] == 0)
- NextIndex = Index;
-
- // construct full path
- if (Index > StartIndex + 15) // prevent buffer overflow
- continue;
- CopyMem(CutoutName, OSIconName + StartIndex, (Index - StartIndex) * sizeof(CHAR16));
- CutoutName[Index - StartIndex] = 0;
- SPrint(FileName, 255, L"icons\\%s_%s.icns",
- BootLogo ? L"boot" : L"os", CutoutName);
-
+ while ((CutoutName = FindCommaDelimited(OSIconName, Index++)) != NULL) {
+ SPrint(FileName, 255, L"icons\\%s_%s.icns", BootLogo ? L"boot" : L"os", CutoutName);
+