Jump to content

UniFreeUconvObject: Difference between revisions

From EDM2
m corrected
Ak120 (talk | contribs)
mNo edit summary
 
(7 intermediate revisions by 3 users not shown)
Line 1: Line 1:
== UniFreeUconvObject ==
Free the conversion object from memory.
; UniFreeUconvObject(uconvObj) : Free the conversion object from memory.
 
=== Syntax ===
UniFreeUconvObject(uconvObj)


=== Parameters ===
=== Parameters ===
; uconvObj - [[OS2 API:DataType:UconvObject|UconvObject]] - input : The conversion object created from [[OS2_API:UniCreateUconvObject|UniCreateUconvObject]].
; uconvObj - [[UconvObject]] - input : The conversion object created from [[UniCreateUconvObject]].


=== Constants ===
=== Constants ===
Line 10: Line 12:
=== Returns ===
=== Returns ===
An integer with values of:
An integer with values of:
* [[OS2 API:Unicode:error#ULS_BADOBJECT|ULS_BADOBJECT]]
* [[Unicode Errors#ULS_BADOBJECT|ULS_BADOBJECT]]
* [[OS2 API:Unicode:error#ULS_SUCCESS|ULS_SUCCESS]]
* [[Unicode Errors#ULS_SUCCESS|ULS_SUCCESS]]


=== Module ===
=== Calling Convention ===
 
=== Define (C/C++) ===
 
=== Export name/Ordinal ===
 
=== Calling conversion ===
[[Cdecl32]]
[[Cdecl32]]


=== Example Code ===
=== Example Code ===
  [[OS2 API:DataType:UconvObject|UconvObject]] uconvObj;
  character  in = "C:\SOMEPATH\FILE.TXT";
size_t      unicodeBuffLen = 12;
ULONG      codePage;
ULONG      cpLen;      // length set by DosQueryCp
UniChar    unicodeBuff, // length of unicodeBuffLen
            tempPath;    // length of CCHMAXPATH
UconvObject uconvObj;
character  out;        // allocate to CCHMAXPATH
  integer    rc;
  integer    rc;
  ...
 
  rc = DosQueryCp(size of ULONG, codePage, cpLen);
 
/* determine string for the conversion of codePage */
rc = UniMapCpToUcsCp(codePage, unicodeBuff, unicodeBuffLen);
rc = UniCreateUconvObject(unicodeBuff, uconvObj);
rc = UniStrToUcs(uconvObj, tempPath, in, CCHMAXPATH);
  rc = UniFreeUconvObject(uconvObj);
  rc = UniFreeUconvObject(uconvObj);
...


=== Related Functions ===
/* conversion for current codepage that can be used for paths */
[[OS2 API:UniCreateUconvObject|UniCreateUconvObject]]
rc = UniCreateUconvObject((UniChar pointer)L"@path=yes", uconvObj);
[[OS2 API:UniQueryUconvObject|UniQueryUconvObject]]
rc = UniStrFromUcs(uconvObj, out, tempPath, CCHMAXPATH);
[[OS2 API:UniSetUconvObject|UniSetUconvObject]]
rc = UniFreeUconvObject(uconvObj);


=== Notes ===
/* use out - don't forget to de-allocate out when finished with it. */
/* error checking left out for brevity */


=== Related Functions ===
*[[UniCreateUconvObject]]
*[[UniQueryUconvObject]]
*[[UniSetUconvObject]]


=== OS Version Introduced ===
=== OS Version Introduced ===
OS/2 Warp
OS/2 Warp
[[Category:Uni]]

Latest revision as of 18:07, 4 December 2019

Free the conversion object from memory.

Syntax

UniFreeUconvObject(uconvObj)

Parameters

uconvObj - UconvObject - input
The conversion object created from UniCreateUconvObject.

Constants

None

Returns

An integer with values of:

Calling Convention

Cdecl32

Example Code

character   in = "C:\SOMEPATH\FILE.TXT";

size_t      unicodeBuffLen = 12;
ULONG       codePage;
ULONG       cpLen;       // length set by DosQueryCp
UniChar     unicodeBuff, // length of unicodeBuffLen
            tempPath;    // length of CCHMAXPATH
UconvObject uconvObj;
character   out;         // allocate to CCHMAXPATH
integer     rc;
rc = DosQueryCp(size of ULONG, codePage, cpLen);
/* determine string for the conversion of codePage */
rc = UniMapCpToUcsCp(codePage, unicodeBuff, unicodeBuffLen);
rc = UniCreateUconvObject(unicodeBuff, uconvObj);
rc = UniStrToUcs(uconvObj, tempPath, in, CCHMAXPATH);
rc = UniFreeUconvObject(uconvObj);
/* conversion for current codepage that can be used for paths */
rc = UniCreateUconvObject((UniChar pointer)L"@path=yes", uconvObj);
rc = UniStrFromUcs(uconvObj, out, tempPath, CCHMAXPATH);
rc = UniFreeUconvObject(uconvObj);
/* use out - don't forget to de-allocate out when finished with it. */
/* error checking left out for brevity */

Related Functions

OS Version Introduced

OS/2 Warp