MCPcopy Create free account
hub / github.com/abbeycode/UnrarKit / ArcCharToWide

Function ArcCharToWide

Libraries/unrar/strfn.cpp:33–60  ·  view source on GitHub ↗

Convert archived names and comments to Unicode. Allows user to select a code page in GUI.

Source from the content-addressed store, hash-verified

31// Convert archived names and comments to Unicode.
32// Allows user to select a code page in GUI.
33void 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

Callers 1

ReadHeader15Method · 0.85

Calls 5

UtfToWideFunction · 0.85
IntToExtFunction · 0.85
CharToWideFunction · 0.85
AllocMethod · 0.80
SizeMethod · 0.45

Tested by

no test coverage detected