From 6c514fed47b5884b2025e43e9a6f6ee413a6fd5e Mon Sep 17 00:00:00 2001 From: malaterre Date: Fri, 4 Nov 2005 15:46:03 +0000 Subject: [PATCH] ENH: Rework the 1000 limit problem, the code is better but not perfect, at least we will get an error --- src/gdcmDicomDir.cxx | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/gdcmDicomDir.cxx b/src/gdcmDicomDir.cxx index b8667b17..f382906c 100644 --- a/src/gdcmDicomDir.cxx +++ b/src/gdcmDicomDir.cxx @@ -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 : " -- 2.48.1