16 #include <sys/types.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)
107 for (i = 0; i < nblks; i++)
116 unsigned char rp[16];
117 rp[0] = rp[1] = rp[2] = rp[3] = 0;
118 is.read((
char *)rp + 4 -
rsl,
rsl);
120 is.read((
char *)rp,
csl);
131 std::vector<Url> ret;
133 for (i = 0; i <
urls.size(); i++)
#define ZYPP_THROW(EXCPT)
Drops a logline and throws the Exception.
Base class for Exception.
String related utilities and Regular expression matching.
Easy-to use interface to the ZYPP dependency resolver.