You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@stdcxx.apache.org by Martin Sebor <se...@roguewave.com> on 2007/10/05 05:46:50 UTC
Re: svn commit: r581929 - in /incubator/stdcxx/branches/4.2.0: include/loc/_punct.cc
src/file.cpp
faridz@apache.org wrote:
> Author: faridz
> Date: Thu Oct 4 07:37:59 2007
> New Revision: 581929
>
> URL: http://svn.apache.org/viewvc?rev=581929&view=rev
> Log:
> 2007-10-04 Farid Zaripov <fa...@epam.com>
>
> STDCXX-564
> * _punct.cc (__rw_match_name): Cast 1UL constant to _RWSTD_SIZE_T
> to avoid 64-bit MSVC warning C4334: '<<' : result of 32-bit shift
> implicitly converted to 64 bits (was 64-bit shift intended?).
> * file.cpp [_WIN64]: Disable 64-bit MSVC warning C4244 for
> __rw_fseek(), __rw_fread(), __rw_fwrite() functions.
>
> Modified:
> incubator/stdcxx/branches/4.2.0/include/loc/_punct.cc
> incubator/stdcxx/branches/4.2.0/src/file.cpp
>
> Modified: incubator/stdcxx/branches/4.2.0/include/loc/_punct.cc
> URL: http://svn.apache.org/viewvc/incubator/stdcxx/branches/4.2.0/include/loc/_punct.cc?rev=581929&r1=581928&r2=581929&view=diff
> ==============================================================================
> --- incubator/stdcxx/branches/4.2.0/include/loc/_punct.cc (original)
> +++ incubator/stdcxx/branches/4.2.0/include/loc/_punct.cc Thu Oct 4 07:37:59 2007
> @@ -87,7 +87,10 @@
>
> typedef _STD::char_traits<_CharT> _Traits;
>
> - if (__bits & 1UL << __k) {
> + const _RWSTD_SIZE_T __mask =
> + _RWSTD_STATIC_CAST(_RWSTD_SIZE_T, 1UL) << __k;
The cast is missing a space before the open paren.
Martin
> +
> + if (__bits & __mask) {
> // `name' is still in the set, see if the next char matches
> // (case insensitive comparison done if `ctp' is nonzero)
> if ( __pos < __sizes [__k]
> @@ -108,7 +111,7 @@
>
> // this match is a duplicate of the last best one
> // remove this match from the set
> - __bits &= ~(1UL << __k);
> + __bits &= ~__mask;
> --__nmatch;
> }
> else if ( __sizes [__k] < __sizes [__inx]
> @@ -137,7 +140,7 @@
>
> // clear the bit for the `name' that failed to match
> // and decrement the numeber of matches
> - __bits &= ~(1UL << __k);
> + __bits &= ~__mask;
> --__nmatch;
> }
> }
>
> Modified: incubator/stdcxx/branches/4.2.0/src/file.cpp
> URL: http://svn.apache.org/viewvc/incubator/stdcxx/branches/4.2.0/src/file.cpp?rev=581929&r1=581928&r2=581929&view=diff
> ==============================================================================
> --- incubator/stdcxx/branches/4.2.0/src/file.cpp (original)
> +++ incubator/stdcxx/branches/4.2.0/src/file.cpp Thu Oct 4 07:37:59 2007
> @@ -475,13 +475,18 @@
> }
>
>
> +#ifdef _WIN64
> +// disable MSVC warning: conversion from '__int64' to 'long', possible loss of data
> +#pragma warning (disable: 4244)
> +#endif
I'm not sure we want to simply silence the warning here. It points out
a real problem in our library on Windows, i.e., that __rw_fseek() cannot
seek past the range of 32-bits. We should open an issue for this to
remember to revisit this limitation in the future (and then it will
be appropriate to silence the warning :)
Martin
> +
> _RWSTD_EXPORT long
> __rw_fseek (void *file, int flags, _RWSTD_PTRDIFF_T offset, int origin)
> {
> if (flags & _RWSTD_IOS_STDIO) {
> FILE* const fp = _RWSTD_STATIC_CAST (FILE*, file);
>
> - const int pos = fseek (fp, offset, origin);
> + const int pos = fseek (fp, long (offset), origin);
> if (pos < 0)
> return long (pos);
>
> @@ -522,6 +527,11 @@
>
> return write (fd, buf, size);
> }
> +
> +#ifdef _WIN64
> +// restore MSVC warning: conversion from '__int64' to 'long', possible loss of data
> +#pragma warning (default: 4244)
> +#endif
>
>
> _RWSTD_EXPORT extern const void* __rw_std_streams[];
>
>
>