Skip to content

Commit

Permalink
Merge pull request #176 from arduino/patch_isascii
Browse files Browse the repository at this point in the history
isAscii: avoid dependency on _GNU_SOURCE
  • Loading branch information
facchinm authored Dec 21, 2022
2 parents 9821ad0 + 981a9f6 commit 691d84d
Show file tree
Hide file tree
Showing 5 changed files with 18,074 additions and 3 deletions.
4 changes: 2 additions & 2 deletions api/WCharacter.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ inline bool isAlpha(int c)
// that fits into the ASCII character set.
inline bool isAscii(int c)
{
return ( isascii (c) == 0 ? false : true);
return ((c & ~0x7f) != 0 ? false : true );
}


Expand Down Expand Up @@ -145,7 +145,7 @@ inline bool isHexadecimalDigit(int c)
// ASCII character set, by clearing the high-order bits.
inline int toAscii(int c)
{
return toascii (c);
return (c & 0x7f);
}


Expand Down
4 changes: 3 additions & 1 deletion test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ project(test-ArduinoCore-API)

include_directories(../api)
include_directories(include)
include_directories(external/catch/v2.13.1/include)
include_directories(external/catch/v2.13.9/include)

##########################################################################

Expand Down Expand Up @@ -81,6 +81,7 @@ set(TEST_SRCS
src/String/test_toLowerCase.cpp
src/String/test_toUpperCase.cpp
src/String/test_trim.cpp
src/WCharacter/test_isAscii.cpp
src/WCharacter/test_isControl.cpp
src/WCharacter/test_isDigit.cpp
src/WCharacter/test_isHexadecimalDigit.cpp
Expand All @@ -89,6 +90,7 @@ set(TEST_SRCS
src/WCharacter/test_isSpace.cpp
src/WCharacter/test_isUpperCase.cpp
src/WCharacter/test_isWhitespace.cpp
src/WCharacter/test_toAscii.cpp
)

set(TEST_DUT_SRCS
Expand Down
Loading

0 comments on commit 691d84d

Please sign in to comment.