2 Compression DLL used by PCD Tools
4 Copyright (c) 2006, Intel Corporation All rights reserved.
5 This program and the accompanying materials are licensed and made available
6 under the terms and conditions of the BSD License which accompanies this
7 distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
14 #include "CompressDll.h"
15 #include "EfiCompress.h"
23 IN OUT UINT32
*DstSize
26 JNIEXPORT jbyteArray JNICALL Java_org_tianocore_framework_tasks_Compress_CallCompress
27 (JNIEnv
*env
, jobject obj
, jbyteArray SourceBuffer
, jint SourceSize
, jstring path
)
33 jbyteArray OutputBuffer
;
39 TempByte
= (*env
)->GetByteArrayElements(env
, SourceBuffer
, 0);
40 InputBuffer
= (char*) TempByte
;
44 // First call compress function and get need buffer size
54 if (Result
= EFI_BUFFER_TOO_SMALL
) {
55 DestBuffer
= malloc (DestSize
);
59 // Second call compress and get the DestBuffer value
69 // new a MV array to store the return compressed buffer
71 OutputBuffer
= (*env
)->NewByteArray(env
, DestSize
);
72 (*env
)->SetByteArrayRegion(env
, OutputBuffer
,0, DestSize
, (jbyte
*) DestBuffer
);
91 unsigned int hDllHandle
,