changeset 6296:0f7a1d78bc41 utf8-path

fix
author Alain Mazy <am@orthanc.team>
date Thu, 04 Sep 2025 08:44:25 +0200
parents 88aa865b6a54
children 7a70d71a69bc
files OrthancFramework/Sources/Compression/ZipWriter.cpp OrthancFramework/Sources/Compression/ZipWriter.h OrthancFramework/UnitTestsSources/FileStorageTests.cpp
diffstat 3 files changed, 7 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancFramework/Sources/Compression/ZipWriter.cpp	Wed Sep 03 18:46:39 2025 +0200
+++ b/OrthancFramework/Sources/Compression/ZipWriter.cpp	Thu Sep 04 08:44:25 2025 +0200
@@ -603,7 +603,7 @@
     return compressionLevel_;
   }
 
-  void ZipWriter::OpenFile(const boost::filesystem::path& path)
+  void ZipWriter::OpenFile(const char* filename)
   {
     Open();
 
@@ -614,7 +614,7 @@
 
     if (isZip64_)
     {
-      result = zipOpenNewFileInZip64(pimpl_->file_, SystemToolbox::PathToUtf8(path).c_str(),
+      result = zipOpenNewFileInZip64(pimpl_->file_, filename,
                                      &zfi,
                                      NULL,   0,
                                      NULL,   0,
@@ -624,7 +624,7 @@
     }
     else
     {
-      result = zipOpenNewFileInZip(pimpl_->file_, SystemToolbox::PathToUtf8(path_).c_str(),
+      result = zipOpenNewFileInZip(pimpl_->file_, filename,
                                    &zfi,
                                    NULL,   0,
                                    NULL,   0,
--- a/OrthancFramework/Sources/Compression/ZipWriter.h	Wed Sep 03 18:46:39 2025 +0200
+++ b/OrthancFramework/Sources/Compression/ZipWriter.h	Thu Sep 04 08:44:25 2025 +0200
@@ -164,7 +164,7 @@
 
     const boost::filesystem::path& GetOutputPath() const;
 
-    void OpenFile(const boost::filesystem::path &path);
+    void OpenFile(const char* filename);
 
     void Write(const void* data, size_t length);
 
--- a/OrthancFramework/UnitTestsSources/FileStorageTests.cpp	Wed Sep 03 18:46:39 2025 +0200
+++ b/OrthancFramework/UnitTestsSources/FileStorageTests.cpp	Thu Sep 04 08:44:25 2025 +0200
@@ -144,14 +144,14 @@
 
 TEST(FilesystemStorage, FileAlreadyExistsUtf8)
 {
-  FilesystemStorage s("\d0\95UnitTestsStorageFileAlreadyExists");
+  FilesystemStorage s("\xd0\x95UnitTestsStorageFileAlreadyExists");
   s.Clear();
 
   std::vector<uint8_t> data;
   StringToVector(data, Toolbox::GenerateUuid());
 
-  SystemToolbox::MakeDirectory(SystemToolbox::PathFromUtf8("\d0\95UnitTestsStorageFileAlreadyExists/12/34"));
-  SystemToolbox::WriteFile("toto", SystemToolbox::PathFromUtf8("\d0\95UnitTestsStorageFileAlreadyExists/12/34/12345678-1234-1234-1234-1234567890ab"));
+  SystemToolbox::MakeDirectory(SystemToolbox::PathFromUtf8("\xd0\x95UnitTestsStorageFileAlreadyExists/12/34"));
+  SystemToolbox::WriteFile("toto", SystemToolbox::PathFromUtf8("\xd0\x95UnitTestsStorageFileAlreadyExists/12/34/12345678-1234-1234-1234-1234567890ab"));
   ASSERT_THROW(s.Create("12345678-1234-1234-1234-1234567890ab", &data[0], data.size(), FileContentType_Unknown), OrthancException);
   s.Clear();
 }