Skip to content

Commit 2e7c7d0

Browse files
author
Hana Dusíková
committed
another batch of MSVC warnings
1 parent ab3cd3f commit 2e7c7d0

File tree

6 files changed

+138
-126
lines changed

6 files changed

+138
-126
lines changed

include/ctre/evaluation.hpp

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -294,46 +294,46 @@ constexpr CTRE_FORCE_INLINE R evaluate(const Iterator begin, Iterator current, c
294294

295295
if constexpr (B != 0 && A > B) {
296296
return not_matched;
297-
}
298-
299-
const Iterator backup_current = current;
297+
} else {
298+
const Iterator backup_current = current;
300299

301-
size_t i{0};
300+
size_t i{0};
302301

303-
while (less_than<A>(i)) {
304-
auto outer_result = evaluate(begin, current, end, not_empty_match(f), captures, ctll::list<Content..., end_cycle_mark>());
302+
while (less_than<A>(i)) {
303+
auto outer_result = evaluate(begin, current, end, not_empty_match(f), captures, ctll::list<Content..., end_cycle_mark>());
305304

306-
if (!outer_result) return not_matched;
305+
if (!outer_result) return not_matched;
307306

308-
captures = outer_result.unmatch();
309-
current = outer_result.get_end_position();
307+
captures = outer_result.unmatch();
308+
current = outer_result.get_end_position();
310309

311-
++i;
312-
}
310+
++i;
311+
}
313312

314-
if (auto outer_result = evaluate(begin, current, end, consumed_something(f, backup_current != current), captures, ctll::list<Tail...>())) {
315-
return outer_result;
316-
}
313+
if (auto outer_result = evaluate(begin, current, end, consumed_something(f, backup_current != current), captures, ctll::list<Tail...>())) {
314+
return outer_result;
315+
}
317316

318-
while (less_than_or_infinite<B>(i)) {
319-
auto inner_result = evaluate(begin, current, end, not_empty_match(f), captures, ctll::list<Content..., end_cycle_mark>());
317+
while (less_than_or_infinite<B>(i)) {
318+
auto inner_result = evaluate(begin, current, end, not_empty_match(f), captures, ctll::list<Content..., end_cycle_mark>());
320319

321-
if (!inner_result) return not_matched;
320+
if (!inner_result) return not_matched;
322321

323-
auto outer_result = evaluate(begin, inner_result.get_end_position(), end, consumed_something(f), inner_result.unmatch(), ctll::list<Tail...>());
322+
auto outer_result = evaluate(begin, inner_result.get_end_position(), end, consumed_something(f), inner_result.unmatch(), ctll::list<Tail...>());
324323

325-
if (outer_result) {
326-
return outer_result;
327-
}
324+
if (outer_result) {
325+
return outer_result;
326+
}
328327

329-
captures = inner_result.unmatch();
330-
current = inner_result.get_end_position();
328+
captures = inner_result.unmatch();
329+
current = inner_result.get_end_position();
331330

332-
++i;
333-
}
331+
++i;
332+
}
334333

335-
// rest of regex
336-
return evaluate(begin, current, end, consumed_something(f), captures, ctll::list<Tail...>());
334+
// rest of regex
335+
return evaluate(begin, current, end, consumed_something(f), captures, ctll::list<Tail...>());
336+
}
337337
}
338338

339339
// possessive repeat
@@ -342,24 +342,24 @@ constexpr CTRE_FORCE_INLINE R evaluate(const Iterator begin, Iterator current, c
342342

343343
if constexpr ((B != 0) && (A > B)) {
344344
return not_matched;
345-
}
346-
347-
const auto backup_current = current;
345+
} else {
346+
const auto backup_current = current;
348347

349-
for (size_t i{0}; less_than_or_infinite<B>(i); ++i) {
350-
// try as many of inner as possible and then try outer once
351-
auto inner_result = evaluate(begin, current, end, not_empty_match(f), captures, ctll::list<Content..., end_cycle_mark>());
348+
for (size_t i{0}; less_than_or_infinite<B>(i); ++i) {
349+
// try as many of inner as possible and then try outer once
350+
auto inner_result = evaluate(begin, current, end, not_empty_match(f), captures, ctll::list<Content..., end_cycle_mark>());
352351

353-
if (!inner_result) {
354-
if (!less_than<A>(i)) break;
355-
return not_matched;
356-
}
352+
if (!inner_result) {
353+
if (!less_than<A>(i)) break;
354+
return not_matched;
355+
}
357356

358-
captures = inner_result.unmatch();
359-
current = inner_result.get_end_position();
360-
}
357+
captures = inner_result.unmatch();
358+
current = inner_result.get_end_position();
359+
}
361360

362-
return evaluate(begin, current, end, consumed_something(f, backup_current != current), captures, ctll::list<Tail...>());
361+
return evaluate(begin, current, end, consumed_something(f, backup_current != current), captures, ctll::list<Tail...>());
362+
}
363363
}
364364

365365
// (gready) repeat

include/ctre/return_type.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,8 @@ template <size_t Id, typename Name = void> struct captured_content {
9494
#if __cpp_char8_t >= 201811
9595
if constexpr (std::is_same_v<Iterator, utf8_iterator>) {
9696
return static_cast<size_t>(std::distance(_begin.ptr, _end.ptr));
97+
} else {
98+
return static_cast<size_t>(std::distance(begin(), end()));
9799
}
98100
#endif
99101
return static_cast<size_t>(std::distance(begin(), end()));
@@ -121,6 +123,8 @@ template <size_t Id, typename Name = void> struct captured_content {
121123
#if __cpp_char8_t >= 201811
122124
if constexpr (std::is_same_v<Iterator, utf8_iterator>) {
123125
return std::basic_string<char_type>(data_unsafe(), static_cast<size_t>(unit_size()));
126+
} else {
127+
return std::basic_string<char_type>(begin(), end());
124128
}
125129
#endif
126130
return std::basic_string<char_type>(begin(), end());

include/unicode-db/unicode-db.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,10 +293,10 @@ struct flat_array {
293293
if(it == std::end(data))
294294
return false;
295295
}
296+
return false;
296297
} else {
297298
return detail::binary_search(std::begin(data), std::end(data), u);
298299
}
299-
return false;
300300
}
301301
};
302302

single-header/ctre-unicode.hpp

Lines changed: 46 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -3001,6 +3001,8 @@ template <size_t Id, typename Name = void> struct captured_content {
30013001
#if __cpp_char8_t >= 201811
30023002
if constexpr (std::is_same_v<Iterator, utf8_iterator>) {
30033003
return static_cast<size_t>(std::distance(_begin.ptr, _end.ptr));
3004+
} else {
3005+
return static_cast<size_t>(std::distance(begin(), end()));
30043006
}
30053007
#endif
30063008
return static_cast<size_t>(std::distance(begin(), end()));
@@ -3028,6 +3030,8 @@ template <size_t Id, typename Name = void> struct captured_content {
30283030
#if __cpp_char8_t >= 201811
30293031
if constexpr (std::is_same_v<Iterator, utf8_iterator>) {
30303032
return std::basic_string<char_type>(data_unsafe(), static_cast<size_t>(unit_size()));
3033+
} else {
3034+
return std::basic_string<char_type>(begin(), end());
30313035
}
30323036
#endif
30333037
return std::basic_string<char_type>(begin(), end());
@@ -4240,46 +4244,46 @@ constexpr CTRE_FORCE_INLINE R evaluate(const Iterator begin, Iterator current, c
42404244

42414245
if constexpr (B != 0 && A > B) {
42424246
return not_matched;
4243-
}
4244-
4245-
const Iterator backup_current = current;
4247+
} else {
4248+
const Iterator backup_current = current;
42464249

4247-
size_t i{0};
4250+
size_t i{0};
42484251

4249-
while (less_than<A>(i)) {
4250-
auto outer_result = evaluate(begin, current, end, not_empty_match(f), captures, ctll::list<Content..., end_cycle_mark>());
4252+
while (less_than<A>(i)) {
4253+
auto outer_result = evaluate(begin, current, end, not_empty_match(f), captures, ctll::list<Content..., end_cycle_mark>());
42514254

4252-
if (!outer_result) return not_matched;
4255+
if (!outer_result) return not_matched;
42534256

4254-
captures = outer_result.unmatch();
4255-
current = outer_result.get_end_position();
4257+
captures = outer_result.unmatch();
4258+
current = outer_result.get_end_position();
42564259

4257-
++i;
4258-
}
4260+
++i;
4261+
}
42594262

4260-
if (auto outer_result = evaluate(begin, current, end, consumed_something(f, backup_current != current), captures, ctll::list<Tail...>())) {
4261-
return outer_result;
4262-
}
4263+
if (auto outer_result = evaluate(begin, current, end, consumed_something(f, backup_current != current), captures, ctll::list<Tail...>())) {
4264+
return outer_result;
4265+
}
42634266

4264-
while (less_than_or_infinite<B>(i)) {
4265-
auto inner_result = evaluate(begin, current, end, not_empty_match(f), captures, ctll::list<Content..., end_cycle_mark>());
4267+
while (less_than_or_infinite<B>(i)) {
4268+
auto inner_result = evaluate(begin, current, end, not_empty_match(f), captures, ctll::list<Content..., end_cycle_mark>());
42664269

4267-
if (!inner_result) return not_matched;
4270+
if (!inner_result) return not_matched;
42684271

4269-
auto outer_result = evaluate(begin, inner_result.get_end_position(), end, consumed_something(f), inner_result.unmatch(), ctll::list<Tail...>());
4272+
auto outer_result = evaluate(begin, inner_result.get_end_position(), end, consumed_something(f), inner_result.unmatch(), ctll::list<Tail...>());
42704273

4271-
if (outer_result) {
4272-
return outer_result;
4273-
}
4274+
if (outer_result) {
4275+
return outer_result;
4276+
}
42744277

4275-
captures = inner_result.unmatch();
4276-
current = inner_result.get_end_position();
4278+
captures = inner_result.unmatch();
4279+
current = inner_result.get_end_position();
42774280

4278-
++i;
4279-
}
4281+
++i;
4282+
}
42804283

4281-
// rest of regex
4282-
return evaluate(begin, current, end, consumed_something(f), captures, ctll::list<Tail...>());
4284+
// rest of regex
4285+
return evaluate(begin, current, end, consumed_something(f), captures, ctll::list<Tail...>());
4286+
}
42834287
}
42844288

42854289
// possessive repeat
@@ -4288,24 +4292,24 @@ constexpr CTRE_FORCE_INLINE R evaluate(const Iterator begin, Iterator current, c
42884292

42894293
if constexpr ((B != 0) && (A > B)) {
42904294
return not_matched;
4291-
}
4292-
4293-
const auto backup_current = current;
4295+
} else {
4296+
const auto backup_current = current;
42944297

4295-
for (size_t i{0}; less_than_or_infinite<B>(i); ++i) {
4296-
// try as many of inner as possible and then try outer once
4297-
auto inner_result = evaluate(begin, current, end, not_empty_match(f), captures, ctll::list<Content..., end_cycle_mark>());
4298+
for (size_t i{0}; less_than_or_infinite<B>(i); ++i) {
4299+
// try as many of inner as possible and then try outer once
4300+
auto inner_result = evaluate(begin, current, end, not_empty_match(f), captures, ctll::list<Content..., end_cycle_mark>());
42984301

4299-
if (!inner_result) {
4300-
if (!less_than<A>(i)) break;
4301-
return not_matched;
4302-
}
4302+
if (!inner_result) {
4303+
if (!less_than<A>(i)) break;
4304+
return not_matched;
4305+
}
43034306

4304-
captures = inner_result.unmatch();
4305-
current = inner_result.get_end_position();
4306-
}
4307+
captures = inner_result.unmatch();
4308+
current = inner_result.get_end_position();
4309+
}
43074310

4308-
return evaluate(begin, current, end, consumed_something(f, backup_current != current), captures, ctll::list<Tail...>());
4311+
return evaluate(begin, current, end, consumed_something(f, backup_current != current), captures, ctll::list<Tail...>());
4312+
}
43094313
}
43104314

43114315
// (gready) repeat
@@ -5598,10 +5602,10 @@ struct flat_array {
55985602
if(it == std::end(data))
55995603
return false;
56005604
}
5605+
return false;
56015606
} else {
56025607
return detail::binary_search(std::begin(data), std::end(data), u);
56035608
}
5604-
return false;
56055609
}
56065610
};
56075611

0 commit comments

Comments
 (0)