@@ -654,47 +654,48 @@ PipelineCacheIOResult PipelineCachePrivate::try_load_pipeline_cache_from_disk(co
654
654
}
655
655
656
656
fseek (file, 0 , SEEK_END);
657
- size_t file_size = ftell (file);
658
- if (file_size == -1 )
657
+ long pos = ftell (file);
658
+ if (pos == -1L )
659
659
{
660
660
fclose (file);
661
661
return PipelineCacheIOResult::FileFailure;
662
662
}
663
+ size_t file_size = static_cast <size_t >(pos);
663
664
rewind (file);
664
665
665
- if (file_size < sizeof (PipelineCachePrivate:: pipeline_cache_prefix_header))
666
+ if (file_size < sizeof (pipeline_cache_prefix_header))
666
667
{
667
668
fclose (file);
668
669
return PipelineCacheIOResult::InvalidFile;
669
670
}
670
671
671
- std::vector<char > buffer (file_size - sizeof (PipelineCachePrivate:: pipeline_cache_prefix_header));
672
- PipelineCachePrivate:: pipeline_cache_prefix_header header;
673
- if (fread (&header, sizeof (PipelineCachePrivate:: pipeline_cache_prefix_header), 1 , file) != 1 )
672
+ std::vector<char > buffer (file_size - sizeof (pipeline_cache_prefix_header));
673
+ pipeline_cache_prefix_header header;
674
+ if (fread (&header, sizeof (pipeline_cache_prefix_header), 1 , file) != 1 )
674
675
{
675
676
fclose (file);
676
677
return PipelineCacheIOResult::InvalidFile;
677
678
}
678
- if (fread (buffer.data (), 1 , file_size - sizeof (PipelineCachePrivate:: pipeline_cache_prefix_header), file) != file_size - sizeof (PipelineCachePrivate::pipeline_cache_prefix_header))
679
+ if (fread (buffer.data (), 1 , file_size - sizeof (pipeline_cache_prefix_header), file) != file_size - sizeof (PipelineCachePrivate::pipeline_cache_prefix_header))
679
680
{
680
681
fclose (file);
681
682
return PipelineCacheIOResult::DataCorruption;
682
683
}
683
684
fclose (file);
684
685
685
- if (header.magic != PipelineCachePrivate:: vk_pipeline_cache_header_magic ())
686
+ if (header.magic != vk_pipeline_cache_header_magic ())
686
687
{
687
688
return PipelineCacheIOResult::InvalidCache;
688
689
}
689
690
690
- if (header.version != PipelineCachePrivate:: CURRENT_PIPELINE_CACHE_VERSION)
691
+ if (header.version != CURRENT_PIPELINE_CACHE_VERSION)
691
692
{
692
693
return PipelineCacheIOResult::InvalidCache;
693
694
}
694
695
695
696
void * cache_data_begin = buffer.data ();
696
697
const VkPhysicalDeviceProperties& device_properties = vkdev->info .physicalDeviceProperties ();
697
- if (!PipelineCachePrivate:: validate_pipeline_cache_header (header, device_properties))
698
+ if (!validate_pipeline_cache_header (header, device_properties))
698
699
{
699
700
return PipelineCacheIOResult::InvalidCache;
700
701
}
0 commit comments