diff options
| author | Yong He <yonghe@outlook.com> | 2017-11-04 18:07:09 -0400 |
|---|---|---|
| committer | Yong He <yonghe@outlook.com> | 2017-11-04 18:07:09 -0400 |
| commit | d1009d1a5ac7463dc74169ed7c6e1e692b3541d7 (patch) | |
| tree | b21cd74ca6daabd655f5a2625c2698de16a92dd1 /source/core | |
| parent | 1f9686ce87573efdd4ad56040deb2d424fe51929 (diff) | |
| parent | 784bd914cface6e5837ef0da7aee0df2e16c4999 (diff) | |
merge with fixWarnings branch
Diffstat (limited to 'source/core')
| -rw-r--r-- | source/core/common.h | 8 | ||||
| -rw-r--r-- | source/core/slang-string.h | 4 |
2 files changed, 10 insertions, 2 deletions
diff --git a/source/core/common.h b/source/core/common.h index dbb837821..3a4543085 100644 --- a/source/core/common.h +++ b/source/core/common.h @@ -43,6 +43,14 @@ namespace Slang #define SLANG_RETURN_NEVER /* empty */ #endif +#ifdef _MSC_VER +#define UNREACHABLE_RETURN(x) +#define UNREACHABLE(x) +#else +#define UNREACHABLE_RETURN(x) return x; +#define UNREACHABLE(x) x; +#endif + SLANG_RETURN_NEVER void signalUnexpectedError(char const* message); } diff --git a/source/core/slang-string.h b/source/core/slang-string.h index 3f2b85d28..0808d9715 100644 --- a/source/core/slang-string.h +++ b/source/core/slang-string.h @@ -523,7 +523,7 @@ namespace Slang UInt IndexOf(const char * str, UInt id) const // String str { - if (id < 0 || id >= getLength()) + if (id >= getLength()) return UInt(-1); auto findRs = strstr(begin() + id, str); UInt res = findRs ? findRs - begin() : -1; @@ -612,7 +612,7 @@ namespace Slang { if (!buffer) return false; - return (IndexOf(str) >= 0) ? true : false; + return (IndexOf(str) != UInt(-1)) ? true : false; } bool Contains(const String & str) const |
