Modify

Opened 7 years ago

Closed 7 years ago

Last modified 6 years ago

#4791 closed Patches (fixed)

boost/token_functions.hpp: warning isspace/ispunct called with wrong character type

Reported by: arnetheduck@… Owned by: marshall
Milestone: To Be Determined Component: tokenizer
Version: Boost 1.44.0 Severity: Problem
Keywords: Cc:

Description

When using a date_time parser, MSVC reports warning C6328 because ispunct / iswpunct and isspace/iswspace are called with the wrong type.

The char_type should be extended to int / wint_t to accomodate all valid values and EOF/WEOF.

The following patch (against 1.44.0) solves the issue.

=== modified file boost/token_functions.hpp
--- boost/token_functions.hpp	2010-10-07 09:40:43 +0000
+++ boost/token_functions.hpp	2010-10-25 11:25:48 +0000
@@ -218,9 +218,9 @@
     {
 #if !defined(BOOST_NO_CWCTYPE)
       if (sizeof(char_type) == 1)
-        return std::isspace(c) != 0;
+        return std::isspace(static_cast<int>(c)) != 0;
       else
-        return std::iswspace(c) != 0;
+        return std::iswspace(static_cast<std::wint_t>(c)) != 0;
 #else
       return static_cast< unsigned >(c) <= 255 && std::isspace(c) != 0;
 #endif
@@ -230,9 +230,9 @@
     {
 #if !defined(BOOST_NO_CWCTYPE)
       if (sizeof(char_type) == 1)
-        return std::ispunct(c) != 0;
+        return std::ispunct(static_cast<int>(c)) != 0;
       else
-        return std::iswpunct(c) != 0;
+        return std::iswpunct(static_cast<std::wint_t>(c)) != 0;
 #else
       return static_cast< unsigned >(c) <= 255 && std::ispunct(c) != 0;
 #endif

Attachments (0)

Change History (3)

comment:1 Changed 7 years ago by marshall

  • Owner changed from jsiek to marshall
  • Status changed from new to assigned

comment:2 Changed 7 years ago by marshall

  • Resolution set to fixed
  • Status changed from assigned to closed

(In [66855]) Merge patch to release; fixes #4791

comment:3 Changed 6 years ago by Kazutoshi Satoda <k_satoda@…>

A related patch #5086 was submitted.

Add Comment

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain marshall.
The resolution will be deleted. Next status will be 'reopened'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.