Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 0.8, 0.8.1, and 0.8.2

cmenu: support both encodings Unicode & Ansi in help text

Just work around for ANSI applications using Windows shell.
'wcscpy_s' is good for preventing 'buffer overrun' problems.
And add 'uFlags' value to debug trace.

Changeset 70f7297adda2

Parent dc3f2148a26a

by Yuki KODAMA

Changes to one file · Browse files at 70f7297adda2 Showing diff from parent dc3f2148a26a Diff from another changeset...

 
414
415
416
417
 
418
419
420
 
427
428
429
430
 
 
 
 
 
 
 
 
431
432
433
 
414
415
416
 
417
418
419
420
 
427
428
429
 
430
431
432
433
434
435
436
437
438
439
440
@@ -414,7 +414,7 @@
  *pszName = 0;   char *psz;   - TDEBUG_TRACE("CShellExt::GetCommandString: idCmd = " << idCmd); + TDEBUG_TRACE("CShellExt::GetCommandString: idCmd = " << idCmd << ", uFlags = " << uFlags);   MenuIdCmdMap::iterator iter = MenuIdMap.find(static_cast<UINT>(idCmd));   if (iter != MenuIdMap.end())   { @@ -427,7 +427,14 @@
  psz = "";   }   - wcscpy((wchar_t*)pszName, _WCSTR(psz)); + if (uFlags & GCS_UNICODE) + { + wcscpy_s((wchar_t*)pszName, cchMax, _WCSTR(psz)); + } + else + { + strcpy_s((char*)pszName, cchMax, psz); + }   return NOERROR;  }