Skip to content

Commit 9548d4e

Browse files
authoredMay 16, 2019
fix toupper function call (#19705)
* fix toupper function call * Original pointer cast does nothing, as it doesn't change signature * toupper arugment type should be unsigned char Reference: https://en.cppreference.com/w/cpp/string/byte/toupper * add missing header
2 parents be3b7a2 + 2204a8a commit 9548d4e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed
 

‎cocos/renderer/CCRenderState.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727

2828
#include "renderer/CCRenderState.h"
2929

30+
#include <cctype>
3031
#include <string>
3132

3233
#include "renderer/CCTexture2D.h"
@@ -481,7 +482,8 @@ static RenderState::Blend parseBlend(const std::string& value)
481482
{
482483
// Convert the string to uppercase for comparison.
483484
std::string upper(value);
484-
std::transform(upper.begin(), upper.end(), upper.begin(), (int(*)(int))toupper);
485+
std::transform(upper.begin(), upper.end(), upper.begin(), [](unsigned char c) {
486+
return std::toupper(c);});
485487
if (upper == "ZERO")
486488
return RenderState::BLEND_ZERO;
487489
else if (upper == "ONE")

0 commit comments

Comments
 (0)