diff --git a/src/gpu/shader.cpp b/src/gpu/shader.cpp index 52dbf681..fc0a662b 100644 --- a/src/gpu/shader.cpp +++ b/src/gpu/shader.cpp @@ -404,7 +404,12 @@ Shader::Shader(char const *vert, char const *frag) int Shader::GetAttribCount() const { +#if !defined __CELLOS_LV2__ return data->attrib_locations.Count(); +#else + // TODO + return 0; +#endif } ShaderAttrib Shader::GetAttribLocation(VertexUsage usage, int index) const diff --git a/src/lol/base/string.h b/src/lol/base/string.h index 395daca5..c287fa8d 100644 --- a/src/lol/base/string.h +++ b/src/lol/base/string.h @@ -192,40 +192,18 @@ public: return -1; } - bool StartsWith(char const* token) const + bool StartsWith(String const &s) const { - const char* p = C(); - while (*token != '\0') - { - if (*p != *token) - return false; - - ++p; - ++token; - } - - return true; + using namespace std; + return Count() >= s.Count() + && memcmp(C(), s.C(), s.Count()) == 0; } - bool EndsWith(char const* token) const + bool EndsWith(String const &s) const { - const char* p = C(); - int token_idx = strlen(token) - 1; - int c_idx = strlen(p) - 1; - - if (c_idx < token_idx) - return false; - - while (token_idx >= 0) - { - if (token[token_idx] != p[c_idx]) - return false; - - --token_idx; - --c_idx; - } - - return true; + using namespace std; + return Count() >= s.Count() + && memcmp(C() + Count() - s.Count(), s.C(), s.Count()) == 0; } inline String operator +(String const &s) const