[tlbuild] hashcode return type
Eddie Kohler
kohler at cs.ucla.edu
Thu Jun 11 23:25:19 CEST 2009
Hi Karl,
Thanks for the bug report. I'm going to apply the attached patch, which
switches the code to use a consistent hashcode_t type for the return value
from hashcode() functions.
Eddie
Karl Berry wrote:
> Hi Eddie,
>
> When I grep in lcdf-typetools 2.78 for hashcode, they all have a return
> type of "unsigned" with two exceptions: lcdf/permstr.hh (return type
> size_t) and liblcdf/string.cc (return type uint32_t). There's also a
> second uint32_t instance in string.cc that is commented out.
>
> A person building on Cygwin (Angelo Graziosi
> <angelo.graziosi at alice.it>), reports a conflict with the uint32_t. His
> fix was to change string.hh to use uint32_t.
>
> I tried changing the uint32_t in string.cc to unsigned, and that worked
> for me too (on i386-linux). I don't know what's up with the one in
> permstr.hh.
>
> In any case, could we reconcile this, one way or another?
>
> If uint32_t is used, I think the necessary header might need to be
> included in more places. [Personally I try to avoid such types like the
> plague :).]
>
> I'll append Angelo's patch (had to tinker with the formatting, don't
> know if it actually applies, sorry), in case it helps. My "patch" is
> one line, string.cc:534 --
> -uint32_t
> +unsigned
>
> Wdyt?
>
> Thanks,
> Karl
>
> ===============================
> --- texlive-source/texk/lcdf-typetools/include/lcdf/string.hh.orig 2009-03-20 10:50:07.000000000 +0100
> +++ texlive-source/texk/lcdf-typetools/include/lcdf/string.hh
> 2009-05-11 17:53:22.859375000 +0200
> @@ -243,10 +243,10 @@
> * @invariant If end1 - begin1 == end2 - begin2 and memcmp(begin1, begin2,
> * end1 - begin1) == 0, then hashcode(begin1, end1) == hashcode(begin2,
> * end2). */
> - static unsigned hashcode(const char *begin, const char *end);
> + static uint32_t hashcode(const char *begin, const char *end);
>
> /** @overload */
> - static inline unsigned hashcode(const unsigned char *begin,
> + static inline uint32_t hashcode(const unsigned char *begin,
> const unsigned char *end) {
> return hashcode(reinterpret_cast<const char *>(begin),
> reinterpret_cast<const char *>(end));
> @@ -258,7 +258,7 @@
> * "SuperFastHash."
> *
> * @invariant If s1 == s2, then s1.hashcode() == s2.hashcode(). */
> - inline unsigned hashcode() const {
> + inline uint32_t hashcode() const {
> return length() ? hashcode(begin(), end()) : 0;
> }
> ===============================
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hashcode.patch
Type: text/x-patch
Size: 6661 bytes
Desc: not available
URL: <http://tug.org/pipermail/tlbuild/attachments/20090611/bd183bc8/attachment.bin>
More information about the tlbuild
mailing list