From: Guy H <da...@us...> - 2005-01-31 22:54:14
|
Update of /cvsroot/anyedit/AnyEditv2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21965/AnyEditv2 Modified Files: FileTypeManager.cpp FileTypeManager.h Log Message: 1. Fixed memory leak 2. Change some member variables name to fit hungerian notations Index: FileTypeManager.h =================================================================== RCS file: /cvsroot/anyedit/AnyEditv2/FileTypeManager.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** FileTypeManager.h 27 Jan 2005 13:41:39 -0000 1.8 --- FileTypeManager.h 31 Jan 2005 22:54:03 -0000 1.9 *************** *** 119,126 **** /// Map of language number pointing to a CSytnaxFile object. ! CMap<int, int, CSyntaxFile*, CSyntaxFile*> mapSyntaxFiles; /// Map of Extension strings pointing to a language number. ! CMapStringToString mapExtensions; /// Load all the configured syntax files. --- 119,126 ---- /// Map of language number pointing to a CSytnaxFile object. ! CMap<int, int, CSyntaxFile*, CSyntaxFile*> m_mapSyntaxFiles; /// Map of Extension strings pointing to a language number. ! CMapStringToString m_mapExtensions; /// Load all the configured syntax files. Index: FileTypeManager.cpp =================================================================== RCS file: /cvsroot/anyedit/AnyEditv2/FileTypeManager.cpp,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** FileTypeManager.cpp 27 Jan 2005 13:41:39 -0000 1.25 --- FileTypeManager.cpp 31 Jan 2005 22:54:02 -0000 1.26 *************** *** 54,63 **** // Cleanup Syntax File objects ! pos = mapSyntaxFiles.GetStartPosition(); while( NULL != pos ) { int iLanguageNr; CSyntaxFile* pSyntaxFile = NULL; ! mapSyntaxFiles.GetNextAssoc( pos, iLanguageNr, pSyntaxFile ); if( NULL != pSyntaxFile ) delete pSyntaxFile; } --- 54,63 ---- // Cleanup Syntax File objects ! pos = m_mapSyntaxFiles.GetStartPosition(); while( NULL != pos ) { int iLanguageNr; CSyntaxFile* pSyntaxFile = NULL; ! m_mapSyntaxFiles.GetNextAssoc( pos, iLanguageNr, pSyntaxFile ); if( NULL != pSyntaxFile ) delete pSyntaxFile; } *************** *** 95,99 **** // Create new file. pSyntaxFile = new CSyntaxFile(); ! if( NULL == pSyntaxFile ) continue; // throw memory exception! } else --- 95,100 ---- // Create new file. pSyntaxFile = new CSyntaxFile(); ! if (NULL == pSyntaxFile) ! continue; // throw memory exception! } else *************** *** 121,124 **** --- 122,126 ---- if( !file1.Open( szDefaultFileName, CFile::modeRead | CFile::typeBinary ) ) { + delete pSyntaxFile; continue; } *************** *** 126,129 **** --- 128,132 ---- if( !file2.Open( szFileName, CFile::modeCreate | CFile::modeWrite | CFile::typeBinary ) ) { + delete pSyntaxFile; continue; } *************** *** 141,145 **** } // Add the parsed object to the Syntax file map. ! mapSyntaxFiles.SetAt( iCount, pSyntaxFile ); } } --- 144,148 ---- } // Add the parsed object to the Syntax file map. ! m_mapSyntaxFiles.SetAt( iCount, pSyntaxFile ); } } *************** *** 186,190 **** szUppercaseExtension.MakeUpper(); ! mapExtensions.SetAt( szUppercaseExtension, szLanguageNr ); iStart = iEnd + 1; --- 189,193 ---- szUppercaseExtension.MakeUpper(); ! m_mapExtensions.SetAt( szUppercaseExtension, szLanguageNr ); iStart = iEnd + 1; *************** *** 202,206 **** szUppercaseExtension.MakeUpper(); ! mapExtensions.SetAt( szUppercaseExtension, szLanguageNr ); } m_arrFilters.InsertAt(iCount, strFilter); --- 205,209 ---- szUppercaseExtension.MakeUpper(); ! m_mapExtensions.SetAt( szUppercaseExtension, szLanguageNr ); } m_arrFilters.InsertAt(iCount, strFilter); *************** *** 217,221 **** szExtension.MakeUpper(); ! mapExtensions.Lookup( szExtension, szLanguageNr ); return atoi( szLanguageNr ); --- 220,224 ---- szExtension.MakeUpper(); ! m_mapExtensions.Lookup( szExtension, szLanguageNr ); return atoi( szLanguageNr ); *************** *** 226,230 **** { CSyntaxFile* pSyntaxFile = NULL; ! mapSyntaxFiles.Lookup( iLanguage, pSyntaxFile ); return pSyntaxFile; } --- 229,233 ---- { CSyntaxFile* pSyntaxFile = NULL; ! m_mapSyntaxFiles.Lookup( iLanguage, pSyntaxFile ); return pSyntaxFile; } |