|
1 /* |
|
2 * Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the License "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Extension to RFile class to load custom data from file. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 // INCLUDES |
|
22 #include <e32base.h> |
|
23 #include <f32file.h> |
|
24 #include "FileExt.h" |
|
25 |
|
26 // EXTERNAL DATA STRUCTURES |
|
27 |
|
28 // EXTERNAL FUNCTION PROTOTYPES |
|
29 |
|
30 // CONSTANTS |
|
31 |
|
32 // MACROS |
|
33 |
|
34 |
|
35 // ----------------------------------------------------------------------------- |
|
36 // AppendBufL |
|
37 // ----------------------------------------------------------------------------- |
|
38 // |
|
39 void AppendBufL( TPtr8& aDest, HBufC* aSrc ) |
|
40 { |
|
41 TInt length = aSrc ? aSrc->Length() * 2 : KNullBuffer; |
|
42 |
|
43 APPEND_BUF_INT( aDest, length ); |
|
44 |
|
45 if( length > 0 ) |
|
46 { |
|
47 TPtr8 tmp8( (TUint8*)aSrc->Ptr(), length, length); |
|
48 __ASSERT_DEBUG( (aDest.MaxLength() - aDest.Length()) > tmp8.Length() , User::Panic( KNullDesC, KErrTooBig ) ); |
|
49 aDest.Append( tmp8 ); |
|
50 } |
|
51 } |
|
52 |
|
53 // ----------------------------------------------------------------------------- |
|
54 // AppendBufL |
|
55 // ----------------------------------------------------------------------------- |
|
56 // |
|
57 void AppendBufL( TPtr8& aDest, HBufC8* aSrc ) |
|
58 { |
|
59 TInt length = aSrc ? aSrc->Length() : KNullBuffer; |
|
60 |
|
61 APPEND_BUF_INT( aDest, length ); |
|
62 |
|
63 if( length > 0 ) |
|
64 { |
|
65 __ASSERT_DEBUG( (aDest.MaxLength() - aDest.Length()) > length, User::Panic( KNullDesC, KErrTooBig ) ); |
|
66 aDest.Append( *aSrc ); |
|
67 } |
|
68 } |
|
69 |
|
70 |
|
71 |
|
72 // End of File |