Jump to content

UniUconvToUcs: Difference between revisions

From EDM2
m additional commenting and correction from IBM documentation
Ak120 (talk | contribs)
 
(11 intermediate revisions by 3 users not shown)
Line 1: Line 1:
== UniUconvToUcs ==
Convert a code page string to a UCS string.
; UniUconvToUcs(uconvObj, inBuffer, inBufferLen, ucsBuffer, ucsBufferLen, nonIdenticalConv) : Convert a code page string to a UCS string.
=== Syntax ===
UniUconvToUcs(uconvObj, inBuffer, inBufferLen, ucsBuffer, ucsBufferLen, nonIdenticalConv)  


=== 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]].
; inBuffer - (void **) - input : The input buffer.
;inBuffer - (void **) - input: The input buffer.
; inBufferLen - (size_t *) - input/output : The input buffer's length, in bytes.
;inBufferLen - (size_t *) - input/output: The input buffer's length, in bytes.
; ucsBuffer - [[OS2 API:DataType:UniChar|UniChar]] - output : The ucs buffer.
;ucsBuffer - [[UniChar]] - output: The ucs buffer.
; ucsBufferLen - (size_t *) - output : Number of unicode character elements in the ucsBuffer.
;ucsBufferLen - (size_t *) - output: Number of Unicode character elements in the ucsBuffer.
; nonIdenticalConv - (size_t *) - output : Number of non-identical conversions.
;nonIdenticalConv - (size_t *) - output: Number of non-identical conversions.


=== Constants ===
=== Constants ===
Line 15: Line 16:
=== Returns ===
=== Returns ===
An integer with values of:
An integer with values of:
* [[OS2 API:Unicode:error#ULS_INVALID|ULS_INVALID]]
*ULS_INVALID
* [[OS2 API:Unicode:error#ULS_SUCCESS|ULS_SUCCESS]]
*ULS_SUCCESS
<!--
<!--
* [[OS2 API:Unicode:error#UCONV_E2BIG|UCONV_E2BIG]]
* UCONV_E2BIG
* [[OS2 API:Unicode:error#UCONV_EBADF|UCONV_EBADF]]
* UCONV_EBADF
* [[OS2 API:Unicode:error#UCONV_EILSEQ|UCONV_EILSEQ]]
* UCONV_EILSEQ
* [[OS2 API:Unicode:error#UCONV_EINVAL|UCONV_EINVAL]]
* UCONV_EINVAL
-->
-->
[[OS2_API:UniUconvToUcs|UniconvToUcs]] updates the variables pointed to by the arguments to reflect the extent of the conversion and returns, in nonidentical, the number of substitutions (non-identical conversions) performed. If the entire string in the input buffer is converted, the value pointed to by inbytesLen will be 0. If the input conversion is stopped due to any condition mentioned above, the value pointed to by inbytesLen will be nonzero and a nonzero value is returned to indicate the condition. If an error occurs, [[OS2_API:UniUconvToUcs|UniUconvToUcs]] returns a nonzero value.
'''UniUconvToUcs''' updates the variables pointed to by the arguments to reflect the extent of the conversion and returns, in nonidentical, the number of substitutions (non-identical conversions) performed. If the entire string in the input buffer is converted, the value pointed to by inBufferLen will be 0. If the input conversion is stopped due to any condition mentioned above, the value pointed to by inBufferLen will be nonzero and a nonzero value is returned to indicate the condition. If an error occurs, '''UniUconvToUcs''' returns a nonzero value.


=== Module ===
=== Module ===
Line 31: Line 32:
=== Export name/Ordinal ===
=== Export name/Ordinal ===


=== Calling conversion ===
=== Calling Convention ===
[[Cdecl32]]
[[Cdecl32]]


=== Example Code ===
=== Example Code ===
  [[OS2 API:DataType:UconvObject|UconvObject]] uconvObj;
  UconvObject uconvObj;
  void**      inBuffer;
  void**      inBuffer;
  size_t*    inBufferLen;
  size_t*    inBufferLen;
  [[OS2 API:DataType:UniChar|UniChar]]     ucsBuffer;
  UniChar    ucsBuffer;
  size_t*    ucsBufferLen;
  size_t*    ucsBufferLen;
  size_t*    nonIdenticalConv;
  size_t*    nonIdenticalConv;
Line 47: Line 48:


=== Related Functions ===
=== Related Functions ===
[[OS2 API:UniUconvFromUcs|UniconvFromUcs]]
*[[UniUconvFromUcs]]
[[OS2 API:UniStrFromUcs|UniStrFromUcs]]
*[[UniStrFromUcs]]
[[OS2 API:UniStrToUcs|UniStrToUcs]]
*[[UniStrToUcs]]


=== Notes ===
=== Notes ===
The sequence of the code page characters in inBuffer is converted into a sequence of Unicode characters in ucsBuffer.  The code page was set by [[OS2_API:UniCreateUconvObject|UniCreateUnconvObject]] call in the [[OS2_API:DataType:UconvObject|UconvObject]].
The sequence of the code page characters in inBuffer is converted into a sequence of Unicode characters in ucsBuffer.  The code page was set by [[UniCreateUconvObject]] call in the [[UconvObject]].


Conversion is only on bytes that convert.  The process stops converting on the first non-valid byte.  If the ucsBuffer isn't large enough, conversion ends on the byte previous to any buffer overflow. inBuffer is updated truncating the point of failure to the end and updating the ucsBufferLen to indicate the number of successfully converted elements.
Conversion is only on bytes that convert.  The process stops converting on the first non-valid byte.  If the ucsBuffer isn't large enough, conversion ends on the byte previous to any buffer overflow. inBuffer is updated truncating the point of failure to the end and updating the ucsBufferLen to indicate the number of successfully converted elements.


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

Latest revision as of 21:12, 14 March 2018

Convert a code page string to a UCS string.

Syntax

UniUconvToUcs(uconvObj, inBuffer, inBufferLen, ucsBuffer, ucsBufferLen, nonIdenticalConv) 

Parameters

uconvObj - UconvObject - input
The conversion object created from UniCreateUconvObject.
inBuffer - (void **) - input
The input buffer.
inBufferLen - (size_t *) - input/output
The input buffer's length, in bytes.
ucsBuffer - UniChar - output
The ucs buffer.
ucsBufferLen - (size_t *) - output
Number of Unicode character elements in the ucsBuffer.
nonIdenticalConv - (size_t *) - output
Number of non-identical conversions.

Constants

None

Returns

An integer with values of:

  • ULS_INVALID
  • ULS_SUCCESS

UniUconvToUcs updates the variables pointed to by the arguments to reflect the extent of the conversion and returns, in nonidentical, the number of substitutions (non-identical conversions) performed. If the entire string in the input buffer is converted, the value pointed to by inBufferLen will be 0. If the input conversion is stopped due to any condition mentioned above, the value pointed to by inBufferLen will be nonzero and a nonzero value is returned to indicate the condition. If an error occurs, UniUconvToUcs returns a nonzero value.

Module

Define (C/C++)

Export name/Ordinal

Calling Convention

Cdecl32

Example Code

UconvObject uconvObj;
void**      inBuffer;
size_t*     inBufferLen;
UniChar     ucsBuffer;
size_t*     ucsBufferLen;
size_t*     nonIdenticalConv;
integer     rc;
...
rc = UniUconvToUcs(uconvObj, inBuffer, inBufferLen, ucsBuffer, ucsBufferLen, nonIdenticalConv);
...

Related Functions

Notes

The sequence of the code page characters in inBuffer is converted into a sequence of Unicode characters in ucsBuffer. The code page was set by UniCreateUconvObject call in the UconvObject.

Conversion is only on bytes that convert. The process stops converting on the first non-valid byte. If the ucsBuffer isn't large enough, conversion ends on the byte previous to any buffer overflow. inBuffer is updated truncating the point of failure to the end and updating the ucsBufferLen to indicate the number of successfully converted elements.

OS Version Introduced

OS/2 Warp