From 87a7411dda76fb69baae34f7411f6120e335b39e Mon Sep 17 00:00:00 2001 From: Andy McFadden Date: Thu, 15 Jan 2015 10:48:35 -0800 Subject: [PATCH] Unicode conversion for volume name in volume copier We needed to convert the volume name correctly for the volume list and the progress dialogs when copying to or from a file. This shouldn't affect how anything works, but it looks nicer with HFS volumes that have non-ASCII characters. --- app/VolumeCopyDialog.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/app/VolumeCopyDialog.cpp b/app/VolumeCopyDialog.cpp index 070c417..a852272 100644 --- a/app/VolumeCopyDialog.cpp +++ b/app/VolumeCopyDialog.cpp @@ -14,6 +14,7 @@ #include "stdafx.h" #include "VolumeCopyDialog.h" #include "Main.h" +#include "../reformat/Charset.h" BEGIN_MESSAGE_MAP(VolumeCopyDialog, CDialog) @@ -324,18 +325,18 @@ void VolumeCopyDialog::LoadList(void) void VolumeCopyDialog::AddToList(CListCtrl* pListView, DiskImg* pDiskImg, DiskFS* pDiskFS, int* pIndex) { - CString volName, format, sizeStr, blocksStr; - long numBlocks; + CString sizeStr, blocksStr; assert(pListView != NULL); assert(pDiskImg != NULL); assert(pDiskFS != NULL); assert(pIndex != NULL); - numBlocks = pDiskImg->GetNumBlocks(); + long numBlocks = pDiskImg->GetNumBlocks(); - volName = pDiskFS->GetVolumeName(); - format = DiskImg::ToString(pDiskImg->GetFSFormat()); + CStringA volNameA = pDiskFS->GetVolumeName(); + CString volName(Charset::ConvertMORToUNI(volNameA)); + CString format = DiskImg::ToString(pDiskImg->GetFSFormat()); blocksStr.Format(L"%ld", pDiskImg->GetNumBlocks()); if (numBlocks > 1024*1024*2) sizeStr.Format(L"%.2fGB", (double) numBlocks / (1024.0*1024.0*2.0)); @@ -390,7 +391,7 @@ void VolumeCopyDialog::OnCopyToFile(void) DiskFS* pSrcFS = NULL; DiskImg dstImg; DIError dierr; - CString errMsg, saveName, msg, srcName; + CString errMsg, saveName, msg; int result; result = GetSelectedDisk(&pSrcImg, &pSrcFS); @@ -399,7 +400,8 @@ void VolumeCopyDialog::OnCopyToFile(void) assert(pSrcImg != NULL); assert(pSrcFS != NULL); - srcName = pSrcFS->GetVolumeName(); + CStringA srcNameA = pSrcFS->GetVolumeName(); + CString srcName(Charset::ConvertMORToUNI(srcNameA)); /* force the format to be generic ProDOS-ordered blocks */ originalFormat = pSrcImg->GetFSFormat(); @@ -564,7 +566,7 @@ void VolumeCopyDialog::OnCopyFromFile(void) MainWindow* pMain = (MainWindow*)::AfxGetMainWnd(); //DiskImg::FSFormat originalFormat = DiskImg::kFormatUnknown; CString openFilters; - CString loadName, targetName, errMsg, warning; + CString loadName, errMsg, warning; DiskImg* pDstImg = NULL; DiskFS* pDstFS = NULL; DiskImg srcImg; @@ -584,10 +586,8 @@ void VolumeCopyDialog::OnCopyFromFile(void) if (!result) return; -// if (pDstFS == NULL) -// targetName = "the target volume"; -// else - targetName = pDstFS->GetVolumeName(); + CStringA targetNameA = pDstFS->GetVolumeName(); + CString targetName(Charset::ConvertMORToUNI(targetNameA)); /*