diff OrthancServer/FromDcmtkBridge.cpp @ 2017:08ce34cfacad

refactoring
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 13 Jun 2016 15:49:10 +0200
parents 655489d9165d
children 4a151d26c98a
line wrap: on
line diff
--- a/OrthancServer/FromDcmtkBridge.cpp	Mon Jun 13 15:26:20 2016 +0200
+++ b/OrthancServer/FromDcmtkBridge.cpp	Mon Jun 13 15:49:10 2016 +0200
@@ -115,15 +115,16 @@
   static void LoadEmbeddedDictionary(DcmDataDictionary& dictionary,
                                      EmbeddedResources::FileResourceId resource)
   {
-    Toolbox::TemporaryFile tmp;
+    std::string content;
+    EmbeddedResources::GetFileResource(content, resource);
 
-    FILE* fp = fopen(tmp.GetPath().c_str(), "wb");
-    fwrite(EmbeddedResources::GetFileResourceBuffer(resource), 
-           EmbeddedResources::GetFileResourceSize(resource), 1, fp);
-    fclose(fp);
+    Toolbox::TemporaryFile tmp;
+    tmp.Write(content);
 
     if (!dictionary.loadDictionary(tmp.GetPath().c_str()))
     {
+      LOG(ERROR) << "Cannot read embedded dictionary. Under Windows, make sure that " 
+                 << "your TEMP directory does not contain special characters.";
       throw OrthancException(ErrorCode_InternalError);
     }
   }