Fix two portability defects found building with MSVC - #1408
Conversation
Neither is Windows-specific in itself; both are latent in the tree today.
ocb_internal.cc's ntz() passes an unsigned* where _BitScanForward takes
an unsigned long*, so the MSVC branch it lives in does not compile:
error C2664: 'unsigned char _BitScanForward(unsigned long *,unsigned
long)': cannot convert argument 1 from 'unsigned int *' to
'unsigned long *'
The file's own notes say it is tested against recent MSVC, so this looks
like drift rather than intent.
swrite.h declares a function taking a ssize_t without including anything
that defines one, and has been getting away with it because every
current includer happens to pull in <unistd.h> first. Include
<sys/types.h> so the header stands on its own.
No change to generated code on POSIX.
|
What's the use-case for building with MSVC? As far as I know, this is a fully unsupported compiler for us Edit: ah, I see from your other PR that you're working on Windows support for mosh-client. I admit that I personally have long thought that this would be possible, but I'm not sure how much Windows-specific review capability we have. |
|
Thanks for the edit — yes, a native mosh-client on Windows is where this is going. On this PR specifically, the two changes aren't the same kind of thing, and my title obscured that.
On review capability: that seems to me the real question, and I'd rather answer it with automation than with your time. If it would help, I can add a Windows job to The POSIX side is meant to need no Windows knowledge to review: every change sits behind The rest of the work is split into small branches for the same reason: each is meant to be reviewable, or refusable, on its own. |
Neither is Windows-specific in itself; both are latent in the tree today.
ocb_internal.cc's ntz() passes an unsigned* where _BitScanForward takes
an unsigned long*, so the MSVC branch it lives in does not compile:
The file's own notes say it is tested against recent MSVC, so this looks
like drift rather than intent.
swrite.h declares a function taking a ssize_t without including anything
that defines one, and has been getting away with it because every
current includer happens to pull in <unistd.h> first. Include
<sys/types.h> so the header stands on its own.
No change to generated code on POSIX.