diff options
author | Michael Vogt <mvo@ubuntu.com> | 2014-05-08 09:48:51 +0200 |
---|---|---|
committer | Michael Vogt <mvo@ubuntu.com> | 2014-05-08 09:48:51 +0200 |
commit | 864a3375f7bf0b3772f4f2ae212b802f6cab5ff9 (patch) | |
tree | 1df83bd5badeea61a237ecf5c6aac884cd9ae0ee /ftparchive/sources.cc | |
parent | 34de054cffeb8e64c09efd452a78271bb85d4831 (diff) | |
parent | c6e9cc582c7093b08c7c057c1f7885eb07e06959 (diff) |
Merge remote-tracking branch 'mvo/bugfix/update-progress-reporting' into debian/experimental
Diffstat (limited to 'ftparchive/sources.cc')
-rw-r--r-- | ftparchive/sources.cc | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/ftparchive/sources.cc b/ftparchive/sources.cc new file mode 100644 index 000000000..d0878a70a --- /dev/null +++ b/ftparchive/sources.cc @@ -0,0 +1,47 @@ +#include <string> +#include <iostream> + +// for memcpy +#include <cstring> + +#include <apt-pkg/error.h> +#include <apt-pkg/gpgv.h> + +#include "sources.h" + +bool DscExtract::TakeDsc(const void *newData, unsigned long newSize) +{ + if(newSize > maxSize) + return _error->Error("DSC data is too large %lu!", newSize); + + if (newSize == 0) + { + Length = 0; + return true; + } + memcpy(Data, newData, newSize); + Length = newSize; + + return true; +} + +bool DscExtract::Read(std::string FileName) +{ + FileFd F; + if (OpenMaybeClearSignedFile(FileName, F) == false) + return false; + + unsigned long long const FSize = F.FileSize(); + if(FSize > maxSize) + return _error->Error("DSC file '%s' is too large!",FileName.c_str()); + + if (F.Read(Data, FSize) == false) + return false; + Length = FSize; + + IsClearSigned = (FileName != F.Name()); + + return true; +} + + |