# # patch "ChangeLog" # from [badb54a59901332d5fa17f7661a8fbcf2bbef177] # to [df3449d3918b3cf7a0c5ff2505ec3b64fb9e7c31] # # patch "transforms.cc" # from [4a8abc713cd78dfc923d4178350efed6e7a5506c] # to [3ccd48020afe7014b1aa666c08ef8a4d84dac312] # ======================================================================== --- ChangeLog badb54a59901332d5fa17f7661a8fbcf2bbef177 +++ ChangeLog df3449d3918b3cf7a0c5ff2505ec3b64fb9e7c31 @@ -1,5 +1,13 @@ 2005-08-13 Patrick Mauritz + * schema_migration.cc (lowercase): it's only used for processing sha1 + values whos size we know: make array size constant + * transforms.cc (encode_hexenc, decode_hexenc): they have to work with + all kinds of string sizes, so at least make them nicer by using + boost::scoped_array + +2005-08-13 Patrick Mauritz + * revision.cc: make copy constructor of revision_set behave like normal constructor in case it's copying a freshly created object ======================================================================== --- transforms.cc 4a8abc713cd78dfc923d4178350efed6e7a5506c +++ transforms.cc 3ccd48020afe7014b1aa666c08ef8a4d84dac312 @@ -15,6 +15,7 @@ #include #include #include +#include #include "botan/botan.h" #include "botan/gzip.h" @@ -82,18 +83,16 @@ string encode_hexenc(string const & in) { - char *buf = new char[in.size() * 2]; + boost::scoped_array buf(new char[in.size() * 2]); static char const *tab = "0123456789abcdef"; - char *c = buf; + char *c = buf.get(); for (string::const_iterator i = in.begin(); i != in.end(); ++i) { *c++ = tab[(*i >> 4) & 0xf]; *c++ = tab[*i & 0xf]; } - string tmp=string(buf, in.size() *2); - delete[] buf; - return tmp; + return string(buf.get(), in.size() *2); } static inline char decode_hex_char(char c) @@ -108,8 +107,8 @@ string decode_hexenc(string const & in) { I(in.size() % 2 == 0); - char * buf = new char[in.size() / 2]; - char *c = buf; + boost::scoped_array buf(new char[in.size() / 2]); + char *c = buf.get(); for (string::const_iterator i = in.begin(); i != in.end(); ++i) { @@ -118,9 +117,7 @@ t |= decode_hex_char(*i); *c++ = t; } - string tmp=string(buf, in.size() / 2); - delete[] buf; - return tmp; + return string(buf.get(), in.size() / 2); } struct