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/PackageData.h> 8 9 #include <string.h> 10 11 #include <package/hpkg/HPKGDefsPrivate.h> 12 13 14 namespace BPackageKit { 15 16 namespace BHPKG { 17 18 19 using namespace BPrivate; 20 21 22 BPackageData::BPackageData() 23 : 24 fCompressedSize(0), 25 fUncompressedSize(0), 26 fChunkSize(0), 27 fCompression(B_HPKG_COMPRESSION_NONE), 28 fEncodedInline(true) 29 { 30 } 31 32 33 void 34 BPackageData::SetData(uint64 size, uint64 offset) 35 { 36 fUncompressedSize = fCompressedSize = size; 37 fOffset = offset; 38 fEncodedInline = false; 39 } 40 41 42 void 43 BPackageData::SetData(uint8 size, const void* data) 44 { 45 fUncompressedSize = fCompressedSize = size; 46 if (size > 0) 47 memcpy(fInlineData, data, size); 48 fEncodedInline = true; 49 } 50 51 52 } // namespace BHPKG 53 54 } // namespace BPackageKit 55