Skip to content

Commit a954b48

Browse files
committed
fixing compilation error on linux in pipelinecache.cpp
1 parent a04c2e4 commit a954b48

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

src/pipelinecache.cpp

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -654,47 +654,48 @@ PipelineCacheIOResult PipelineCachePrivate::try_load_pipeline_cache_from_disk(co
654654
}
655655

656656
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)
659659
{
660660
fclose(file);
661661
return PipelineCacheIOResult::FileFailure;
662662
}
663+
size_t file_size = static_cast<size_t>(pos);
663664
rewind(file);
664665

665-
if (file_size < sizeof(PipelineCachePrivate::pipeline_cache_prefix_header))
666+
if (file_size < sizeof(pipeline_cache_prefix_header))
666667
{
667668
fclose(file);
668669
return PipelineCacheIOResult::InvalidFile;
669670
}
670671

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)
674675
{
675676
fclose(file);
676677
return PipelineCacheIOResult::InvalidFile;
677678
}
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))
679680
{
680681
fclose(file);
681682
return PipelineCacheIOResult::DataCorruption;
682683
}
683684
fclose(file);
684685

685-
if (header.magic != PipelineCachePrivate::vk_pipeline_cache_header_magic())
686+
if (header.magic != vk_pipeline_cache_header_magic())
686687
{
687688
return PipelineCacheIOResult::InvalidCache;
688689
}
689690

690-
if (header.version != PipelineCachePrivate::CURRENT_PIPELINE_CACHE_VERSION)
691+
if (header.version != CURRENT_PIPELINE_CACHE_VERSION)
691692
{
692693
return PipelineCacheIOResult::InvalidCache;
693694
}
694695

695696
void* cache_data_begin = buffer.data();
696697
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))
698699
{
699700
return PipelineCacheIOResult::InvalidCache;
700701
}

0 commit comments

Comments
 (0)