Symbian3/PDK/Source/GUID-261ADCEC-C8C8-46E3-A7DC-804AC868C233.dita
author Dominic Pinkman <Dominic.Pinkman@Nokia.com>
Thu, 11 Mar 2010 18:02:22 +0000
changeset 3 46218c8b8afa
parent 1 25a17d01db0c
child 5 f345bda72bc4
permissions -rw-r--r--
week 10 bug fix submission (SF PDK version): Bug 1892, Bug 1897, Bug 1319. Also 3 or 4 documents were found to contain code blocks with SFL, which has been fixed. Partial fix for broken links, links to Forum Nokia, and the 'Symbian platform' terminology issues.

<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
<!-- This component and the accompanying materials are made available under the terms of the License 
"Eclipse Public License v1.0" which accompanies this distribution, 
and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
<!-- Initial Contributors:
    Nokia Corporation - initial contribution.
Contributors: 
-->
<!DOCTYPE concept
  PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
<concept id="GUID-261ADCEC-C8C8-46E3-A7DC-804AC868C233" xml:lang="en"><title>Descriptors</title><prolog><metadata><keywords/></metadata></prolog><conbody>
<p>Descriptors are self-describing strings that can be used to store binary data and text. Each descriptor object holds the length of the string as well as its type which identifies the underlying memory layout of the data it holds. For more information on different descriptor classes, see <xref href="jar:GUID-35228542-8C95-4849-A73F-2B4F082F0C44.jar!/sdk/doc_source/NewStarter/2-essentials.html#gsguide%2eessentials%2edescriptors" format="application/java-archive">Descriptors</xref>.</p>
<p>There are modifiable and non-modifiable descriptors, the latter type is identified by a "C" suffix in the class name. The length of a non-modifiable descriptor is defined when compiling an application, and the length of a modifiable descriptor can vary within the limits set by <codeph>iMaxLength</codeph>. Nonmodifiable descriptors are more secure, as their length is checked during compilation. The following figure shows the differences between these types.</p>
<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_d0e8647_href.png"/></fig>
<p>When designing applications, avoid using fixed-length buffers 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 a flexible interface for manipulating the contained string, including size and length checks. Take advantage of these when possible.</p>
<p>For an example, see <xref href="http://www.forum.nokia.com/info/sw.nokia.com/id/3397e4ea-c067-4a4a-bf16-9747e1968b3e/S60_Platform_Descriptor_Example_v2_0_en.zip.html" scope="external">S60 Platform: Descriptor Example</xref> on Forum Nokia.</p>
</conbody></concept>