diff options
author | David Kalnischkies <kalnischkies@gmail.com> | 2011-09-13 17:46:48 +0200 |
---|---|---|
committer | David Kalnischkies <kalnischkies@gmail.com> | 2011-09-13 17:46:48 +0200 |
commit | 650faab01603caac04494d54cf6b10a65c00ea13 (patch) | |
tree | d89d9ec876c195d8f757e1351858ea7c200dd269 /apt-pkg/contrib/strutl.cc | |
parent | ea54214002c09eeb4dd498d97a564471ec9993c5 (diff) |
Support large files in the complete toolset. Indexes of this
size are pretty unlikely for now, but we need it for deb
packages which could become bigger than 4GB now (LP: #815895)
Diffstat (limited to 'apt-pkg/contrib/strutl.cc')
-rw-r--r-- | apt-pkg/contrib/strutl.cc | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/apt-pkg/contrib/strutl.cc b/apt-pkg/contrib/strutl.cc index 6586ef17b..04226f1b4 100644 --- a/apt-pkg/contrib/strutl.cc +++ b/apt-pkg/contrib/strutl.cc @@ -970,6 +970,34 @@ bool StrToNum(const char *Str,unsigned long &Res,unsigned Len,unsigned Base) return true; } /*}}}*/ +// StrToNum - Convert a fixed length string to a number /*{{{*/ +// --------------------------------------------------------------------- +/* This is used in decoding the crazy fixed length string headers in + tar and ar files. */ +bool StrToNum(const char *Str,unsigned long long &Res,unsigned Len,unsigned Base) +{ + char S[30]; + if (Len >= sizeof(S)) + return false; + memcpy(S,Str,Len); + S[Len] = 0; + + // All spaces is a zero + Res = 0; + unsigned I; + for (I = 0; S[I] == ' '; I++); + if (S[I] == 0) + return true; + + char *End; + Res = strtoull(S,&End,Base); + if (End == S) + return false; + + return true; +} + /*}}}*/ + // Base256ToNum - Convert a fixed length binary to a number /*{{{*/ // --------------------------------------------------------------------- /* This is used in decoding the 256bit encoded fixed length fields in |