@@ -53,7 +53,7 @@ bool charmap_ForEach(
5353 mappings[nodeIdx] = mapping;
5454 for (unsigned c = 0 ; c < 256 ; c++) {
5555 if (size_t nextIdx = node.next [c]; nextIdx)
56- prefixes.push ({nextIdx, mapping + ( char )c });
56+ prefixes.push ({nextIdx, mapping + static_cast < char >(c) });
5757 }
5858 }
5959 mapFunc (charmap.name );
@@ -64,7 +64,7 @@ bool charmap_ForEach(
6464}
6565
6666void charmap_New (std::string const &name, std::string const *baseName) {
67- size_t baseIdx = ( size_t )- 1 ;
67+ size_t baseIdx = SIZE_MAX ;
6868
6969 if (baseName != nullptr ) {
7070 if (auto search = charmapMap.find (*baseName); search == charmapMap.end ())
@@ -82,7 +82,7 @@ void charmap_New(std::string const &name, std::string const *baseName) {
8282 charmapMap[name] = charmapList.size ();
8383 Charmap &charmap = charmapList.emplace_back ();
8484
85- if (baseIdx != ( size_t )- 1 )
85+ if (baseIdx != SIZE_MAX )
8686 charmap.nodes = charmapList[baseIdx].nodes ; // Copies `charmapList[baseIdx].nodes`
8787 else
8888 charmap.nodes .emplace_back (); // Zero-init the root node
@@ -129,7 +129,7 @@ void charmap_Add(std::string const &mapping, std::vector<int32_t> &&value) {
129129 size_t nodeIdx = 0 ;
130130
131131 for (char c : mapping) {
132- size_t &nextIdxRef = charmap.nodes [nodeIdx].next [( uint8_t )c ];
132+ size_t &nextIdxRef = charmap.nodes [nodeIdx].next [static_cast < uint8_t >(c) ];
133133 size_t nextIdx = nextIdxRef;
134134
135135 if (!nextIdx) {
@@ -157,7 +157,7 @@ bool charmap_HasChar(std::string const &input) {
157157 size_t nodeIdx = 0 ;
158158
159159 for (char c : input) {
160- nodeIdx = charmap.nodes [nodeIdx].next [( uint8_t )c ];
160+ nodeIdx = charmap.nodes [nodeIdx].next [static_cast < uint8_t >(c) ];
161161
162162 if (!nodeIdx)
163163 return false ;
@@ -184,7 +184,7 @@ size_t charmap_ConvertNext(std::string_view &input, std::vector<int32_t> *output
184184 size_t inputIdx = 0 ;
185185
186186 for (size_t nodeIdx = 0 ; inputIdx < input.length ();) {
187- nodeIdx = charmap.nodes [nodeIdx].next [( uint8_t ) input[inputIdx]];
187+ nodeIdx = charmap.nodes [nodeIdx].next [static_cast < uint8_t >( input[inputIdx]) ];
188188
189189 if (!nodeIdx)
190190 break ;
0 commit comments