Fix build issues

This commit is contained in:
Georg Hagen
2025-02-14 12:16:53 +01:00
parent 82e5b1871a
commit afe84ff9a5
2 changed files with 11 additions and 3 deletions

View File

@@ -54,10 +54,19 @@ namespace OpenVulkano
fwrite(&value, sizeof(value), 1, file); fwrite(&value, sizeof(value), 1, file);
} }
template<typename T>
static FILE* FOpen(const T* path)
{
if constexpr (std::is_same_v<T, char>)
return fopen(path, "wb");
else
return _wfopen(path, "wb");
}
public: public:
JpegWithTagsWriter(const std::filesystem::path& filePath) JpegWithTagsWriter(const std::filesystem::path& filePath)
{ {
file = fopen(filePath.c_str(), "wb"); file = FOpen(filePath.c_str());
if (file == nullptr) throw std::runtime_error("Can't open file."); if (file == nullptr) throw std::runtime_error("Can't open file.");
// Write soi marker // Write soi marker
fputc(0xFF, file); fputc(0xFF, file);

View File

@@ -97,8 +97,7 @@ namespace OpenVulkano::Image
[[maybe_unused]] XmpBuilder& XmpBuilder::SetCreateDateNow() [[maybe_unused]] XmpBuilder& XmpBuilder::SetCreateDateNow()
{ {
std::chrono::system_clock::now(); std::time_t currentTime = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now());
std::time_t currentTime = std::chrono::system_clock::to_time_t(now);
SetCreateDate(currentTime); SetCreateDate(currentTime);
} }