]>
Commit | Line | Data |
---|---|---|
1 | #include <string> | |
2 | #include <iostream> | |
3 | ||
4 | // for memcpy | |
5 | #include <cstring> | |
6 | ||
7 | #include <apt-pkg/error.h> | |
8 | #include <apt-pkg/gpgv.h> | |
9 | ||
10 | #include "sources.h" | |
11 | ||
12 | bool DscExtract::TakeDsc(const void *newData, unsigned long newSize) | |
13 | { | |
14 | if(newSize > maxSize) | |
15 | return _error->Error("DSC data is too large %lu!", newSize); | |
16 | ||
17 | if (newSize == 0) | |
18 | { | |
19 | Length = 0; | |
20 | return true; | |
21 | } | |
22 | memcpy(Data, newData, newSize); | |
23 | Length = newSize; | |
24 | ||
25 | return true; | |
26 | } | |
27 | ||
28 | bool DscExtract::Read(std::string FileName) | |
29 | { | |
30 | FileFd F; | |
31 | if (OpenMaybeClearSignedFile(FileName, F) == false) | |
32 | return false; | |
33 | ||
34 | unsigned long long const FSize = F.FileSize(); | |
35 | if(FSize > maxSize) | |
36 | return _error->Error("DSC file '%s' is too large!",FileName.c_str()); | |
37 | ||
38 | if (F.Read(Data, FSize) == false) | |
39 | return false; | |
40 | Length = FSize; | |
41 | ||
42 | IsClearSigned = (FileName != F.Name()); | |
43 | ||
44 | return true; | |
45 | } | |
46 | ||
47 |