1/*
2 * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
3 * Distributed under the terms of the MIT License.
4 */
5
6
7#include <package/hpkg/v1/PackageData.h>
8
9#include <string.h>
10
11#include <package/hpkg/v1/HPKGDefsPrivate.h>
12
13
14namespace BPackageKit {
15
16namespace BHPKG {
17
18namespace V1 {
19
20
21using namespace BPrivate;
22
23
24BPackageData::BPackageData()
25	:
26	fCompressedSize(0),
27	fUncompressedSize(0),
28	fChunkSize(0),
29	fCompression(B_HPKG_COMPRESSION_NONE),
30	fEncodedInline(true)
31{
32}
33
34
35void
36BPackageData::SetData(uint64 size, uint64 offset)
37{
38	fUncompressedSize = fCompressedSize = size;
39	fOffset = offset;
40	fEncodedInline = false;
41}
42
43
44void
45BPackageData::SetData(uint8 size, const void* data)
46{
47	fUncompressedSize = fCompressedSize = size;
48	if (size > 0)
49		memcpy(fInlineData, data, size);
50	fEncodedInline = true;
51}
52
53
54}	// namespace V1
55
56}	// namespace BHPKG
57
58}	// namespace BPackageKit
59