# # patch "ChangeLog" # from [0efd318d22c59269a1c02defbcd9b5782a6d7a9f] # to [3b65978ec3897497e7ebb0f154f9749d67d1c1c8] # # patch "file_io.cc" # from [aa6562b55467ac15f77741a9f3383a29aff99450] # to [ab7652248f7318010eadb5e2040e324eb8d09013] # # patch "netcmd.cc" # from [844f0f7559a6415ef30a28d99fa6ea76a1c71a0c] # to [382d4509ec3334facb63b5bbacc05a66f1f174ea] # # patch "tests/t_normalized_filenames.at" # from [fedb790a819bcbed4a3402f5d09c3be7b59a4a38] # to [5e0d909dd5f1dbd5502d327e94a108bcc60bec74] # # patch "transforms.cc" # from [589f2e927da5c33a2adb9bfea8f9b70d041ce212] # to [cab17760583496bd28f1bea2835fcd90fe79ef2f] # # patch "vocab.hh" # from [e7d7947fe544166a511b44911cff89fa62ace2e9] # to [77bb3d7df9abc7e4e5202cb20b313c925dad2c13] # --- ChangeLog +++ ChangeLog @@ -1,5 +1,13 @@ 2005-07-08 Matt Johnston + * tests/t_normalized_filenames.at: expect exit code of 1 not 3 for + "cat manifest" with a directory in MT/work + * file_io.cc, netcmd.cc, transforms.cc, vocab.hh: revert changes which + used swap() for strings and atomic types since strings are + copy-on-write. + +2005-07-08 Matt Johnston + * file_io.cc (ident_existing_file): new function to calculate the ident of a file failing gracefully if it doesn't exist or is a directory. --- file_io.cc +++ file_io.cc @@ -405,7 +405,7 @@ if (!file) throw oops(string("cannot open file ") + p.string() + " for reading"); CryptoPP::FileSource f(file, true, new CryptoPP::StringSink(in)); - dat.swap(in); + dat = in; } // This function can only be called once per run. @@ -417,7 +417,7 @@ have_consumed_stdin = true; string in; CryptoPP::FileSource f(cin, true, new CryptoPP::StringSink(in)); - dat.swap(in); + dat = in; } void @@ -482,7 +482,7 @@ read_data(path, tdat); string tmp1, tmp2; - tdat.swap(tmp2); + tmp2 = tdat(); if (do_charconv) { tmp1 = tmp2; charset_convert(ext_charset, db_charset, tmp1, tmp2); @@ -491,7 +491,7 @@ tmp1 = tmp2; line_end_convert(db_linesep, tmp1, tmp2); } - dat.swap(tmp2); + dat = tmp2; } --- netcmd.cc +++ netcmd.cc @@ -437,11 +437,10 @@ "data netcmd, data payload"); if (compressed_p == 1) { - gzip zdat; + gzip zdat(dat); data tdat; - zdat.swap(dat); decode_gzip(zdat, tdat); - tdat.swap(dat); + dat = tdat(); } assert_end_of_buffer(payload, pos, "data netcmd payload"); } @@ -459,10 +458,8 @@ { gzip zdat; encode_gzip(dat, zdat); - string tmp; - zdat.swap(tmp); payload += static_cast(1); // compressed flag - insert_variable_length_string(tmp, payload); + insert_variable_length_string(zdat(), payload); } else { --- tests/t_normalized_filenames.at +++ tests/t_normalized_filenames.at @@ -7,7 +7,7 @@ # the inner code directly. AT_DATA(MT/work, [add_file "." ]) -AT_CHECK(MONOTONE cat manifest, [3], [ignore], [ignore]) +AT_CHECK(MONOTONE cat manifest, [1], [ignore], [ignore]) AT_DATA(MT/work, [add_file "./bar" ]) --- transforms.cc +++ transforms.cc @@ -168,7 +168,7 @@ new CryptoPP::Gzip( new CryptoPP::Base64Encoder( new CryptoPP::StringSink(tmp)))); - out.swap(tmp); + out = tmp; } template @@ -183,7 +183,7 @@ new CryptoPP::Gunzip( new CryptoPP::StringSink(tmp)))); - out.swap(tmp); + out = tmp; } // specialise them --- vocab.hh +++ vocab.hh @@ -33,8 +33,6 @@ enc(std::string const & s); \ enc(INNER const & inner); \ enc(enc const & other); \ - void swap(std::string & str) \ - { i.swap(str); } \ std::string const & operator()() const \ { return i(); } \ bool operator<(enc const & x) const \ @@ -88,8 +86,6 @@ ty(ty const & other); \ std::string const & operator()() const \ { return s; } \ - void swap(std::string & str) \ - { s.swap(str); } \ bool operator<(ty const & other) const \ { return s < other(); } \ ty const & operator=(ty const & other); \