blob: d5bf21f0477e484752148aaf8c5fa1c4e1bfcd45
1 | /* ***** BEGIN LICENSE BLOCK ***** |
2 | * Source last modified: $Id: pack_utils.h,v 1.1.1.1.2.1 2005/05/04 18:21:22 hubbe Exp $ |
3 | * |
4 | * REALNETWORKS CONFIDENTIAL--NOT FOR DISTRIBUTION IN SOURCE CODE FORM |
5 | * Portions Copyright (c) 1995-2005 RealNetworks, Inc. |
6 | * All Rights Reserved. |
7 | * |
8 | * The contents of this file, and the files included with this file, |
9 | * are subject to the current version of the Real Format Source Code |
10 | * Porting and Optimization License, available at |
11 | * https://helixcommunity.org/2005/license/realformatsource (unless |
12 | * RealNetworks otherwise expressly agrees in writing that you are |
13 | * subject to a different license). You may also obtain the license |
14 | * terms directly from RealNetworks. You may not use this file except |
15 | * in compliance with the Real Format Source Code Porting and |
16 | * Optimization License. There are no redistribution rights for the |
17 | * source code of this file. Please see the Real Format Source Code |
18 | * Porting and Optimization License for the rights, obligations and |
19 | * limitations governing use of the contents of the file. |
20 | * |
21 | * RealNetworks is the developer of the Original Code and owns the |
22 | * copyrights in the portions it created. |
23 | * |
24 | * This file, and the files included with this file, is distributed and |
25 | * made available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, |
26 | * EITHER EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS ALL |
27 | * SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF |
28 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT |
29 | * OR NON-INFRINGEMENT. |
30 | * |
31 | * Technology Compatibility Kit Test Suite(s) Location: |
32 | * https://rarvcode-tck.helixcommunity.org |
33 | * |
34 | * Contributor(s): |
35 | * |
36 | * ***** END LICENSE BLOCK ***** */ |
37 | |
38 | #ifndef PACK_UTILS_H |
39 | #define PACK_UTILS_H |
40 | |
41 | #include "helix_types.h" |
42 | #include "helix_result.h" |
43 | #include "rm_memory.h" |
44 | |
45 | /* Pack a 32-bit value big-endian */ |
46 | void rm_pack32(UINT32 ulValue, BYTE** ppBuf, UINT32* pulLen); |
47 | /* Pack a 32-bit value little-endian */ |
48 | void rm_pack32_le(UINT32 ulValue, BYTE** ppBuf, UINT32* pulLen); |
49 | /* Pack a 16-bit value big-endian */ |
50 | void rm_pack16(UINT16 usValue, BYTE** ppBuf, UINT32* pulLen); |
51 | /* Pack a 16-bit value little-endian */ |
52 | void rm_pack16_le(UINT16 usValue, BYTE** ppBuf, UINT32* pulLen); |
53 | void rm_pack8(BYTE ucValue, BYTE** ppBuf, UINT32* pulLen); |
54 | |
55 | /* Unpacking utilties */ |
56 | UINT32 rm_unpack32(BYTE** ppBuf, UINT32* pulLen); |
57 | UINT16 rm_unpack16(BYTE** ppBuf, UINT32* pulLen); |
58 | /* rm_unpack32() and rm_unpack16() have the side |
59 | * effect of incrementing *ppBuf and decrementing |
60 | * *pulLen. The functions below (rm_unpack32_nse() |
61 | * rm_unpack16_nse()) do not change pBuf and ulLen. |
62 | * That is, they have No Side Effect, hence the suffix |
63 | * _nse. |
64 | */ |
65 | UINT32 rm_unpack32_nse(BYTE* pBuf, UINT32 ulLen); |
66 | UINT16 rm_unpack16_nse(BYTE* pBuf, UINT32 ulLen); |
67 | BYTE rm_unpack8(BYTE** ppBuf, UINT32* pulLen); |
68 | HX_RESULT rm_unpack_string(BYTE** ppBuf, |
69 | UINT32* pulLen, |
70 | UINT32 ulStrLen, |
71 | char** ppStr, |
72 | void* pUserMem, |
73 | rm_malloc_func_ptr fpMalloc, |
74 | rm_free_func_ptr fpFree); |
75 | HX_RESULT rm_unpack_buffer(BYTE** ppBuf, |
76 | UINT32* pulLen, |
77 | UINT32 ulBufLen, |
78 | BYTE** ppUnPackBuf, |
79 | void* pUserMem, |
80 | rm_malloc_func_ptr fpMalloc, |
81 | rm_free_func_ptr fpFree); |
82 | HX_RESULT rm_unpack_array(BYTE** ppBuf, |
83 | UINT32* pulLen, |
84 | UINT32 ulNumElem, |
85 | UINT32 ulElemSize, |
86 | void** ppArr, |
87 | void* pUserMem, |
88 | rm_malloc_func_ptr fpMalloc, |
89 | rm_free_func_ptr fpFree); |
90 | |
91 | UINT32 rm_unpack32_from_byte_string(BYTE** ppBuf, UINT32* pulLen); |
92 | |
93 | #endif /* #ifndef PACK_UTILS_H */ |
94 |