X-Git-Url: http://git.vrable.net/?p=cumulus.git;a=blobdiff_plain;f=ref.cc;h=2a45781c4570f941691066ca222c20fd018cf18c;hp=4020c01c7eb0c189bdaae022b134102d9f8eb52b;hb=HEAD;hpb=6450a89067119296800fc1148bb8a88d26857b6e diff --git a/ref.cc b/ref.cc index 4020c01..2a45781 100644 --- a/ref.cc +++ b/ref.cc @@ -1,7 +1,6 @@ -/* Cumulus: Smart Filesystem Backup to Dumb Servers - * - * Copyright (C) 2007 The Regents of the University of California - * Written by Michael Vrable +/* Cumulus: Efficient Filesystem Backup to the Cloud + * Copyright (C) 2007-2008 The Cumulus Developers + * See the AUTHORS file for a list of contributors. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -25,6 +24,7 @@ #include #include +#include #include #include #include @@ -97,9 +97,7 @@ string ObjectReference::to_string() const if (range_valid) { char buf[64]; - if (range_exact) { - sprintf(buf, "[=%zu]", range_length); - } else if (type == REF_ZERO) { + if (range_exact || type == REF_ZERO) { sprintf(buf, "[%zu]", range_length); } else { sprintf(buf, "[%zu+%zu]", range_start, range_length); @@ -166,6 +164,9 @@ ObjectReference ObjectReference::parse(const std::string& str) if (*t == '[') { t++; + // An equal sign was once used for a length assertion but is now + // deprecated. Skip it if present, and mark that we are expecting a + // length-only reference. if (*t == '=') { range_exact = true; t++; @@ -179,6 +180,7 @@ ObjectReference ObjectReference::parse(const std::string& str) if (*t == ']') { string val(s, t - s); range2 = atoll(val.c_str()); + range_exact = true; } else { if (*t != '+') return ObjectReference();