changeset 6082:f09fb1c3a6bd

fix uninitialized variable
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 04 Apr 2025 22:03:54 +0200 (6 weeks ago)
parents 36fed5f5dae9
children 6e04db96fae3
files OrthancServer/Sources/OrthancRestApi/OrthancRestArchive.cpp
diffstat 1 files changed, 3 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancServer/Sources/OrthancRestApi/OrthancRestArchive.cpp	Fri Apr 04 21:47:28 2025 +0200
+++ b/OrthancServer/Sources/OrthancRestApi/OrthancRestArchive.cpp	Fri Apr 04 22:03:54 2025 +0200
@@ -660,16 +660,6 @@
     }
 
     ServerContext& context = OrthancRestApi::GetContext(call);
-    bool transcode = false;
-    DicomTransferSyntax transferSyntax = DicomTransferSyntax_LittleEndianImplicit;  // Initialize variable to avoid warnings
-    unsigned int lossyQuality;
-
-    if (call.HasArgument(GET_TRANSCODE))
-    {
-      transcode = true;
-      transferSyntax = GetTransferSyntax(call.GetArgument(GET_TRANSCODE, ""));
-      lossyQuality = GetLossyQuality(call);
-    }
     
     if (!call.HasArgument(GET_RESOURCES))
     {
@@ -679,10 +669,10 @@
     std::unique_ptr<ArchiveJob> job(new ArchiveJob(context, IS_MEDIA, DEFAULT_IS_EXTENDED, ResourceType_Patient));
     AddResourcesOfInterestFromString(*job, call.GetArgument(GET_RESOURCES, ""));
 
-    if (transcode)
+    if (call.HasArgument(GET_TRANSCODE))
     {
-      job->SetTranscode(transferSyntax);
-      job->SetLossyQuality(lossyQuality);
+      job->SetTranscode(GetTransferSyntax(call.GetArgument(GET_TRANSCODE, "")));
+      job->SetLossyQuality(GetLossyQuality(call));
     }
 
     const std::string filename = call.GetArgument(GET_FILENAME, "Archive.zip");  // New in Orthanc 1.12.7