mirror of
https://github.com/pybind/pybind11.git
synced 2025-01-19 17:32:37 +00:00
Fix off-by-one in source_file_line_basename()
This commit is contained in:
parent
1bf2577e1f
commit
cfd98a7de2
@ -68,13 +68,13 @@ inline const char *cpp_version_in_use() {
|
||||
}
|
||||
|
||||
inline const char *source_file_line_basename(const char *sfl) {
|
||||
unsigned i_sep = 0;
|
||||
unsigned i_base = 0;
|
||||
for (unsigned i = 0; sfl[i] != '\0'; i++) {
|
||||
if (sfl[i] == '/' || sfl[i] == '\\') {
|
||||
i_sep = i;
|
||||
i_base = i + 1;
|
||||
}
|
||||
}
|
||||
return sfl + i_sep;
|
||||
return sfl + i_base;
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
Loading…
Reference in New Issue
Block a user