Skip to content

Commit

Permalink
Some off-by-ones
Browse files Browse the repository at this point in the history
  • Loading branch information
mridgers committed Jun 15, 2023
1 parent a385a16 commit 3f59046
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions clink/core/include/core/str.h
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ StrImpl<TYPE>& StrImpl<TYPE>::operator << (const TYPE* rhs)
template <typename TYPE> template <int32 I>
StrImpl<TYPE>& StrImpl<TYPE>::operator << (const TYPE (&rhs)[I])
{
concat(rhs, I);
concat(rhs, I - 1);
return *this;
}

Expand Down Expand Up @@ -357,7 +357,7 @@ int32 to_utf16(wchar_t* out, int32 max_count, StrIterImpl<char>& iter);
class StrBase : public StrImpl<char>
{
public:
template <int32 I> StrBase(char (&data)[I]) : StrImpl<char>(data, I) {}
template <int32 I> StrBase(char (&data)[I]) : StrImpl<char>(data, I - 1) {}
StrBase(char* data, int32 size) : StrImpl<char>(data, size) {}
StrBase(const StrBase&) = delete;
StrBase(const StrBase&&) = delete;
Expand All @@ -370,7 +370,7 @@ class StrBase : public StrImpl<char>
class WstrBase : public StrImpl<wchar_t>
{
public:
template <int32 I> WstrBase(char (&data)[I]) : StrImpl<wchar_t>(data, I) {}
template <int32 I> WstrBase(char (&data)[I]) : StrImpl<wchar_t>(data, I - 1) {}
WstrBase(wchar_t* data, int32 size) : StrImpl<wchar_t>(data, size) {}
WstrBase(const WstrBase&) = delete;
WstrBase(const WstrBase&&) = delete;
Expand Down
2 changes: 1 addition & 1 deletion clink/terminal/include/terminal/printer.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,5 @@ template <int32 S> void Printer::print(const char (&data)[S])
//------------------------------------------------------------------------------
template <int32 S> void Printer::print(const Attributes attr, const char (&data)[S])
{
print(attr, data, S);
print(attr, data, S - 1);
}
2 changes: 1 addition & 1 deletion clink/terminal/include/terminal/terminal_out.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ class TerminalOut
//------------------------------------------------------------------------------
template <int32 S> void TerminalOut::write(const char (&chars)[S])
{
write(chars, S);
write(chars, S - 1);
}

0 comments on commit 3f59046

Please sign in to comment.