equal
deleted
inserted
replaced
|
1 /* |
|
2 * Copyright (c) 1999-2000 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 "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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "jutils.h" |
|
20 |
|
21 RJArray::RJArray(JNIEnv& aJni) |
|
22 : iJni(aJni) |
|
23 { |
|
24 } |
|
25 |
|
26 |
|
27 |
|
28 RJArray::~RJArray() |
|
29 { |
|
30 } |
|
31 |
|
32 |
|
33 |
|
34 void* RJArray::GetPrimitiveArrayCriticalLC(jarray aJavaArray, TBool aMutable) |
|
35 { |
|
36 iJavaArray = aJavaArray; |
|
37 iArrayPtr = REINTERPRET_CAST(TUint8*, iJni.GetPrimitiveArrayCritical(aJavaArray, NULL)); |
|
38 iMutable = aMutable; |
|
39 User::LeaveIfNull(iArrayPtr); |
|
40 CleanupStack::PushL(TCleanupItem(&CleanupArrayAccess, this)); |
|
41 return iArrayPtr; |
|
42 } |
|
43 |
|
44 |
|
45 |
|
46 void RJArray::CleanupArrayAccess(TAny* aRJArray) |
|
47 { |
|
48 RJArray* array = STATIC_CAST(RJArray*, aRJArray); |
|
49 array->ReleasePrimitiveArrayCritical(); |
|
50 } |
|
51 |
|
52 |
|
53 |
|
54 void RJArray::ReleasePrimitiveArrayCritical() |
|
55 { |
|
56 iJni.ReleasePrimitiveArrayCritical(iJavaArray, iArrayPtr, (iMutable ? 0 : JNI_ABORT)); |
|
57 } |