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.
15 typedef long long __int64
;/*For cygwin build*/
17 #include "CompressDll.h"
18 #include "EfiCompress.h"
26 IN OUT UINT32
*DstSize
29 JNIEXPORT jbyteArray JNICALL Java_org_tianocore_framework_tasks_Compress_CallCompress
30 (JNIEnv
*env
, jobject obj
, jbyteArray SourceBuffer
, jint SourceSize
, jstring path
)
36 jbyteArray OutputBuffer
;
42 TempByte
= (*env
)->GetByteArrayElements(env
, SourceBuffer
, 0);
43 InputBuffer
= (char*) TempByte
;
47 // First call compress function and get need buffer size
57 if (Result
= EFI_BUFFER_TOO_SMALL
) {
58 DestBuffer
= malloc (DestSize
);
62 // Second call compress and get the DestBuffer value
72 // new a MV array to store the return compressed buffer
74 OutputBuffer
= (*env
)->NewByteArray(env
, DestSize
);
75 (*env
)->SetByteArrayRegion(env
, OutputBuffer
,0, DestSize
, (jbyte
*) DestBuffer
);
94 unsigned int hDllHandle
,