8 Contributors: |
8 Contributors: |
9 --> |
9 --> |
10 <!DOCTYPE concept |
10 <!DOCTYPE concept |
11 PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd"> |
11 PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd"> |
12 <concept id="GUID-261ADCEC-C8C8-46E3-A7DC-804AC868C233" xml:lang="en"><title>Descriptors</title><prolog><metadata><keywords/></metadata></prolog><conbody> |
12 <concept id="GUID-261ADCEC-C8C8-46E3-A7DC-804AC868C233" xml:lang="en"><title>Descriptors</title><prolog><metadata><keywords/></metadata></prolog><conbody> |
13 <p>Descriptors are self-describing strings that can be used to store binary |
13 <p>Descriptors are self-describing strings that can be used to |
14 data and text. Each descriptor object holds the length of the string as well |
14 store binary data and text. Each descriptor object holds the length |
15 as its type which identifies the underlying memory layout of the data it holds. |
15 of the string as well as its type which identifies the underlying |
16 For more information on different descriptor classes, see <xref href="GUID-11EEFB3D-0414-5BEB-9D78-56A4B9154008.dita">Using |
16 memory layout of the data it holds. For more information on different |
17 Descriptors</xref>.</p> |
17 descriptor classes, see <xref href="GUID-11EEFB3D-0414-5BEB-9D78-56A4B9154008.dita">Using Descriptors</xref>.</p> |
18 <p>There are modifiable and non-modifiable descriptors, the latter type |
18 <p>There are modifiable and non-modifiable descriptors, the latter |
19 is identified by a "C" suffix in the class name. The length of a non-modifiable |
19 type is identified by a "C" suffix in the class name. The length of |
20 descriptor is defined when compiling an application, and the length of a modifiable |
20 a non-modifiable descriptor is defined when compiling an application, |
21 descriptor can vary within the limits set by <codeph>iMaxLength</codeph>. |
21 and the length of a modifiable descriptor can vary within the limits |
22 Nonmodifiable descriptors are more secure, as their length is checked during |
22 set by <codeph>iMaxLength</codeph>. Nonmodifiable descriptors are |
23 compilation. The following figure shows the differences between these types.</p> |
23 more secure, as their length is checked during compilation. The following |
24 <fig id="GUID-A8F9937F-25A6-4E80-845F-35994B7E13E5"><title>Differences between modifiable, nonmodifiable, and pointer descriptors</title><image href="GUID-40619192-8C2F-4267-BFCA-F53E10BF5A31_d0e14149_href.png"/></fig> |
24 figure shows the differences between these types.</p> |
25 <p>When designing applications, avoid using fixed-length buffers as parameters |
25 <fig id="GUID-A8F9937F-25A6-4E80-845F-35994B7E13E5"><title>Differences between modifiable, nonmodifiable, and pointer |
26 and use base classes (preferably constant base type <codeph><xref href="jar:GUID-35228542-8C95-4849-A73F-2B4F082F0C44.jar!/sdk/doc_source/reference/reference-cpp/Kernel_Architecture_2/e32cmn.hGlobals.html#%3a%3aTDesC" format="application/java-archive">TDesC</xref></codeph>) |
26 descriptors</title><image href="GUID-40619192-8C2F-4267-BFCA-F53E10BF5A31_d0e14249_href.png"/></fig> |
27 instead. Descriptor objects provide a flexible interface for manipulating |
27 <p>When designing applications, avoid using fixed-length buffers |
28 the contained string, including size and length checks. Take advantage of |
28 as parameters and use base classes (preferably constant base type <codeph><xref href="jar:GUID-35228542-8C95-4849-A73F-2B4F082F0C44.jar!/sdk/doc_source/reference/reference-cpp/Kernel_Architecture_2/e32cmn.hGlobals.html#%3a%3aTDesC" format="application/java-archive">TDesC</xref></codeph>) instead. Descriptor objects provide |
29 these when possible.</p> |
29 a flexible interface for manipulating the contained string, including |
30 <p>For more information and examples, see the <xref href="GUID-0817AD1D-58CF-5108-ACBF-26DFD4BA395E.dita">Descriptors |
30 size and length checks. Take advantage of these when possible.</p> |
31 Overview</xref> topic.</p> |
31 <p>For more information and examples, see the <xref href="GUID-0817AD1D-58CF-5108-ACBF-26DFD4BA395E.dita">Descriptors Overview</xref> topic.</p> |
32 </conbody></concept> |
32 </conbody></concept> |