Static Code Analysis: Add more checks. Avoid unhandled ATL exceptions by checking memory allocation. Avoid throwing exception in File constructor and simplify code.

This commit is contained in:
Mounir IDRASSI
2015-02-09 11:01:03 +01:00
parent d1a3316e44
commit 4e03adc2e7
3 changed files with 184 additions and 74 deletions
+1
View File
@@ -134,6 +134,7 @@ DWORD BaseCom::ReadWriteFile (BOOL write, BOOL device, BSTR filePath, BSTR *buff
try
{
auto_ptr <File> file (device ? new Device (string (szFilePathA.m_psz), !write) : new File (string (szFilePathA.m_psz), !write));
file->CheckOpened ();
file->SeekAt (offset);
if (write)