• Wez Furlong's avatar
    folly: to_narrow for windows compatibility · efd0e727
    Wez Furlong authored
    Summary:
    The default warning settings for the MSVC compiler result in an
    extremely noisy build output, to the point where it can take minutes of reading
    through pages of output to locate the actual error when debugging a build
    problem.  The majority of these warnings are the result of implicit integer
    narrowing that is silently permitted in our posix builds.
    
    Rather than blanket suppress these conversion warnings and mask potential bugs,
    this commit makes a pass over the code and adds `folly::to_narrow` to a number
    of call sites to make it explicit that a narrowing operation is taking place
    and that it is (probably!) intentional.   We make a lot of assumptions
    throughout our various projects that we won't allow data larger than 2GB
    through eg: thrift and as a result, a lot of wire/serialization related code
    uses `uint32_t` for sizes instead of `size_t`.
    
    Reviewed By: yfeldblum
    
    Differential Revision: D20562029
    
    fbshipit-source-id: 706ba9cf330d40a2b3f911e5e9a8b9de325ebc80
    efd0e727
Utility.h 11.3 KB