Convert archived names and comments to Unicode. Allows user to select a code page in GUI.
| 31 | // Convert archived names and comments to Unicode. |
| 32 | // Allows user to select a code page in GUI. |
| 33 | void ArcCharToWide(const char *Src,wchar *Dest,size_t DestSize,ACTW_ENCODING Encoding) |
| 34 | { |
| 35 | #if defined(_WIN_ALL) // Console Windows RAR. |
| 36 | if (Encoding==ACTW_UTF8) |
| 37 | UtfToWide(Src,Dest,DestSize); |
| 38 | else |
| 39 | { |
| 40 | Array<char> NameA; |
| 41 | if (Encoding==ACTW_OEM) |
| 42 | { |
| 43 | NameA.Alloc(DestSize+1); |
| 44 | IntToExt(Src,&NameA[0],NameA.Size()); |
| 45 | Src=&NameA[0]; |
| 46 | } |
| 47 | CharToWide(Src,Dest,DestSize); |
| 48 | } |
| 49 | #else // RAR for Unix. |
| 50 | if (Encoding==ACTW_UTF8) |
| 51 | UtfToWide(Src,Dest,DestSize); |
| 52 | else |
| 53 | CharToWide(Src,Dest,DestSize); |
| 54 | #endif |
| 55 | // Ensure that we return a zero terminate string for security reason. |
| 56 | // While [Jni]CharToWide might already do it, be protected in case of future |
| 57 | // changes in these functions. |
| 58 | if (DestSize>0) |
| 59 | Dest[DestSize-1]=0; |
| 60 | } |
| 61 | |
| 62 | |
| 63 |
no test coverage detected