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

Function GetNextImage

DevIL/examples/windows_example/WindowsTest.cpp:1436–1499  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1434
1435
1436bool GetNextImage()
1437{
1438 HANDLE Search;
1439 WIN32_FIND_DATA FindData;
1440 int i = 0, j, Total = 0, FileNamePos = -1;
1441 TCHAR *Ext, *CurName;
1442
1443 Search = FindFirstFile(L"*.*", &FindData);
1444 CurName = wcsrchr(CurFileName, '\\');
1445 if (CurName == NULL) {
1446 CurName = CurFileName;
1447 }
1448 else {
1449 CurName++; // Skip the '\'
1450 }
1451
1452 do {
1453 if (!_wcsicmp(FindData.cFileName, L".") || !_wcsicmp(FindData.cFileName, L".."))
1454 continue;
1455 Ext = GetExtension(FindData.cFileName);
1456 if (Ext == NULL)
1457 continue;
1458 for (j = 0; ExtList[j] != NULL; j++) {
1459 if (CheckExtension(FindData.cFileName, ExtList[j])) {
1460 if (!_wcsicmp(FindData.cFileName, CurName))
1461 FileNamePos = Total;
1462 Total++;
1463 break;
1464 }
1465 }
1466 } while (FindNextFile(Search, &FindData));
1467
1468 FindClose(Search);
1469 Search = FindFirstFile(L"*.*", &FindData);
1470
1471 if (Total == 0 || FileNamePos == -1)
1472 return false;
1473
1474 if (FileNamePos == Total-1)
1475 FileNamePos = -1;
1476
1477 do {
1478 if (!_wcsicmp(FindData.cFileName, L".") || !_wcsicmp(FindData.cFileName, L".."))
1479 continue;
1480 Ext = GetExtension(FindData.cFileName);
1481 if (Ext == NULL)
1482 continue;
1483 for (j = 0; ExtList[j] != NULL; j++) {
1484 if (CheckExtension(FindData.cFileName, ExtList[j])) {
1485 if (FileNamePos == i-1) {
1486 wcscpy(OpenFileName, FindData.cFileName);
1487 i++;
1488 break;
1489 }
1490 i++;
1491 break;
1492 }
1493 }

Callers 1

WndProcFunction · 0.70

Calls 2

GetExtensionFunction · 0.85
CheckExtensionFunction · 0.85

Tested by

no test coverage detected