[commit] r1580 - trunk/GME/Gme

GMESRC Repository Notifications gme-commit at list.isis.vanderbilt.edu
Mon Oct 3 16:06:24 CDT 2011


Author: ksmyth
Date: Mon Oct  3 16:06:24 2011
New Revision: 1580

Log:
null-terminate clipboard data. Fixes XML Parse error that shows up occasionally with GME1 to GME2 copy-paste (junk data at the end)

Modified:
   trunk/GME/Gme/GMEOLEData.cpp

Modified: trunk/GME/Gme/GMEOLEData.cpp
==============================================================================
--- trunk/GME/Gme/GMEOLEData.cpp	Mon Oct  3 16:06:14 2011	(r1579)
+++ trunk/GME/Gme/GMEOLEData.cpp	Mon Oct  3 16:06:24 2011	(r1580)
@@ -230,7 +230,7 @@
 	ASSERT( target != NULL );
 
 	// create a temporary filename
-      TCHAR *fname = _ttempnam(_T("c:\\temp"), _T("tmp"));
+      TCHAR *fname = _ttempnam(_T("c:\\temp"), _T("GMEtmp"));
 	CString filename = fname;
 	free(fname);
 
@@ -240,7 +240,7 @@
 		CFile *memfile = pDataObject->GetFileData(CF_UNICODETEXT);
 		if( memfile == NULL )
 			return false;
-		memfile->SeekToBegin();
+		// FIXME: memfile->GetLength() isn't the same as pFile->GetLength() in OnRenderFileData
 
 		// copy
 		CFile file;
@@ -410,6 +410,7 @@
 				c = file.Read(buff, buffsize);
 				pFile->Write(buff, c);
 			} while( c == buffsize );
+			pFile->Write(L"", sizeof(wchar_t));
 
 			file.Close();
 			CFile::Remove(filename);
@@ -491,8 +492,7 @@
 				pFile->Write(buff, c);
 			} while( c == buffsize );
 
-			buff[0] = 0;
-			pFile->Write(buff, 1);
+			pFile->Write(L"", sizeof(wchar_t));
 
 			file.Close();
 			CFile::Remove(filename);


More information about the gme-commit mailing list