- std::ifstream from(FileName.c_str());
- dbg.Error(!from, "gdcmDict::gdcmDict: can't open dictionary",
- FileName.c_str());
-
- while (!from.eof()) {
- from >> std::hex;
- from >> group; /// MEMORY LEAK in std::istream::operator>>
- from >> element;
- from >> vr;
- from >> fourth;
- eatwhite(from);
- getline(from, name); /// MEMORY LEAK in std::getline<>
+ std::ifstream from( filename.c_str() );
+ if( !from )
+ {
+ dbg.Verbose(2,"Dict::Dict: can't open dictionary", filename.c_str());
+ // Using default embeded one:
+ FillDefaultDataDict( this );
+ }
+ else
+ {
+ while (!from.eof())
+ {
+ from >> std::hex;
+ from >> group;
+ from >> element;
+ from >> vr;
+ from >> fourth;
+ from >> std::ws; //remove white space
+ std::getline(from, name);
+
+ const DictEntry newEntry(group, element, vr, fourth, name);
+ AddNewEntry(newEntry);
+ }