]> Creatis software - gdcm.git/commitdiff
ENH: Rework the 1000 limit problem, the code is better but not perfect, at least...
authormalaterre <malaterre>
Fri, 4 Nov 2005 15:46:03 +0000 (15:46 +0000)
committermalaterre <malaterre>
Fri, 4 Nov 2005 15:46:03 +0000 (15:46 +0000)
src/gdcmDicomDir.cxx

index b8667b1743bfc3885c91ee8cad9effae4255e5d0..f382906c22bd0e36dc7537f04dc84a3c95ffe838 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDicomDir.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/11/04 15:26:22 $
-  Version:   $Revision: 1.168 $
+  Date:      $Date: 2005/11/04 15:46:03 $
+  Version:   $Revision: 1.169 $
   
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -229,9 +229,16 @@ bool DicomDir::DoTheLoadingJob( )
       {
          // user passed '.' as Name
          // we get current directory name
-         char dummy[1000];      // Hope 1000 is enough!
-         getcwd(dummy, (size_t)1000);
-         SetFileName( dummy ); // will be converted into a string
+         char buf[2048];
+         const char *cwd = getcwd(buf, 2048);
+         if( cwd )
+           {
+           SetFileName( cwd ); // will be converted into a string
+           }
+         else
+           {
+           gdcmErrorMacro( "Path was too long to fit on 2048 bytes" );
+           }
       }
       NewMeta();
       gdcmDebugMacro( "Parse directory and create the DicomDir : "