14#include <zypp-core/base/Logger.h>
42 for (i = 0; i < buflen; i++)
44#define c2h(c) (((c)>='0' && (c)<='9') ? ((c)-'0') \
45 : ((c)>='a' && (c)<='f') ? ((c)-('a'-10)) \
46 : ((c)>='A' && (c)<='F') ? ((c)-('A'-10)) \
57 buf[i] = (buf[i] << 4) | v;
68 std::ifstream is(filename.
c_str());
71 is.exceptions(std::ifstream::eofbit | std::ifstream::failbit | std::ifstream::badbit);
75 is.getline(buf,
sizeof(buf));
78 if (!strncmp(buf,
"Length: ", 8))
79 filesize = (off_t)strtoull(buf + 8, 0, 10);
80 else if (!strncmp(buf,
"Hash-Lengths: ", 14))
81 (
void)sscanf(buf + 14,
"%d,%d,%d", &
sql, &
rsl, &
csl);
82 else if (!strncmp(buf,
"Blocksize: ", 11))
84 else if (!strncmp(buf,
"URL: http://", 12) || !strncmp(buf,
"URL: https://", 13) || !strncmp(buf,
"URL: ftp://", 11) || !strncmp(buf,
"URL: tftp://", 12) )
85 urls.push_back(buf + 5);
86 else if (!strncmp(buf,
"SHA-1: ", 7))
88 unsigned char sha1[20];
101 if (csl < 3 || csl > 16 || rsl < 1 || rsl > 4 || sql < 1 || sql > 2)
110 for (i = 0; i < nblks; i++)
119 unsigned char rp[16];
120 rp[0] = rp[1] = rp[2] = rp[3] = 0;
122 is.read((
char *)rp + 4 -
rsl,
rsl);
123 }
catch (
const std::exception &e ) {
138 is.read((
char *)rp,
csl);
139 }
catch (
const std::exception &e ) {
171 std::vector<Url> ret;
173 for (i = 0; i <
urls.size(); i++)
Base class for Exception.
const char * c_str() const
String representation.
String related utilities and Regular expression matching.
Easy-to use interface to the ZYPP dependency resolver.
#define ZYPP_THROW(EXCPT)
Drops a logline and throws the Exception.