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

Function GetPrevImage

DevIL/examples/windows_example/WindowsTest.cpp:1370–1433  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1368
1369
1370bool GetPrevImage()
1371{
1372 HANDLE Search;
1373 WIN32_FIND_DATA FindData;
1374 int i = 0, j, Total = 0, FileNamePos = -1;
1375 TCHAR *Ext, *CurName;
1376
1377 Search = FindFirstFile(L"*.*", &FindData);
1378 CurName = wcsrchr(CurFileName, '\\');
1379 if (CurName == NULL) {
1380 CurName = CurFileName;
1381 }
1382 else {
1383 CurName++; // Skip the '\'
1384 }
1385
1386 do {
1387 if (!_wcsicmp(FindData.cFileName, L".") || !_wcsicmp(FindData.cFileName, L".."))
1388 continue;
1389 Ext = GetExtension(FindData.cFileName);
1390 if (Ext == NULL)
1391 continue;
1392 for (j = 0; ExtList[j] != NULL; j++) {
1393 if (CheckExtension(FindData.cFileName, ExtList[j])) {
1394 if (!_wcsicmp(FindData.cFileName, CurName))
1395 FileNamePos = Total;
1396 Total++;
1397 break;
1398 }
1399 }
1400 } while (FindNextFile(Search, &FindData));
1401
1402 FindClose(Search);
1403 Search = FindFirstFile(L"*.*", &FindData);
1404
1405 if (Total == 0 || FileNamePos == -1)
1406 return false;
1407
1408 if (FileNamePos == 0)
1409 FileNamePos = Total;
1410
1411 do {
1412 if (!_wcsicmp(FindData.cFileName, L".") || !_wcsicmp(FindData.cFileName, L".."))
1413 continue;
1414 Ext = GetExtension(FindData.cFileName);
1415 if (Ext == NULL)
1416 continue;
1417 for (j = 0; ExtList[j] != NULL; j++) {
1418 if (CheckExtension(FindData.cFileName, ExtList[j])) {
1419 if (FileNamePos == i+1) {
1420 wcscpy(OpenFileName, FindData.cFileName);
1421 i++;
1422 break;
1423 }
1424 i++;
1425 break;
1426 }
1427 }

Callers 1

WndProcFunction · 0.70

Calls 2

GetExtensionFunction · 0.85
CheckExtensionFunction · 0.85

Tested by

no test coverage detected