aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2019-03-20 19:25:03 +1100
committerNeil <nyamatongwe@gmail.com>2019-03-20 19:25:03 +1100
commitc1c2292b419acb1873d58f60e3e6515f91dea010 (patch)
treeb68d296a55b51b62e30f6597c64f4812dbee9ec6 /src
parent31a735c8ec0a4f7c62b162cd1c173bfef76737c5 (diff)
downloadscintilla-mirror-c1c2292b419acb1873d58f60e3e6515f91dea010.tar.gz
Backport: Use noexcept where sensible. Rename UTF8 string_view parameters for clarity.
Backport of changeset 7326:2f9b5e1c97ae, but without variable renames, since they are not applicable.
Diffstat (limited to 'src')
-rw-r--r--src/UniConversion.cxx6
-rw-r--r--src/UniConversion.h6
2 files changed, 6 insertions, 6 deletions
diff --git a/src/UniConversion.cxx b/src/UniConversion.cxx
index 8cbb3cdd2..5b75ca63c 100644
--- a/src/UniConversion.cxx
+++ b/src/UniConversion.cxx
@@ -16,7 +16,7 @@ using namespace Scintilla;
namespace Scintilla {
-size_t UTF8Length(const wchar_t *uptr, size_t tlen) {
+size_t UTF8Length(const wchar_t *uptr, size_t tlen) noexcept {
size_t len = 0;
for (size_t i = 0; i < tlen && uptr[i];) {
const unsigned int uch = uptr[i];
@@ -65,7 +65,7 @@ void UTF8FromUTF16(const wchar_t *uptr, size_t tlen, char *putf, size_t len) {
putf[k] = '\0';
}
-void UTF8FromUTF32Character(int uch, char *putf) {
+void UTF8FromUTF32Character(int uch, char *putf) noexcept {
size_t k = 0;
if (uch < 0x80) {
putf[k++] = static_cast<char>(uch);
@@ -85,7 +85,7 @@ void UTF8FromUTF32Character(int uch, char *putf) {
putf[k] = '\0';
}
-size_t UTF16Length(const char *s, size_t len) {
+size_t UTF16Length(const char *s, size_t len) noexcept {
size_t ulen = 0;
for (size_t i = 0; i < len;) {
const unsigned char ch = s[i];
diff --git a/src/UniConversion.h b/src/UniConversion.h
index 9f405e1ed..e8e98df5f 100644
--- a/src/UniConversion.h
+++ b/src/UniConversion.h
@@ -14,10 +14,10 @@ const int UTF8MaxBytes = 4;
const int unicodeReplacementChar = 0xFFFD;
-size_t UTF8Length(const wchar_t *uptr, size_t tlen);
+size_t UTF8Length(const wchar_t *uptr, size_t tlen) noexcept;
void UTF8FromUTF16(const wchar_t *uptr, size_t tlen, char *putf, size_t len);
-void UTF8FromUTF32Character(int uch, char *putf);
-size_t UTF16Length(const char *s, size_t len);
+void UTF8FromUTF32Character(int uch, char *putf) noexcept;
+size_t UTF16Length(const char *s, size_t len) noexcept;
size_t UTF16FromUTF8(const char *s, size_t len, wchar_t *tbuf, size_t tlen);
size_t UTF32Length(const char *s, size_t len) noexcept;
size_t UTF32FromUTF8(const char *s, size_t len, unsigned int *tbuf, size_t tlen);