mirror of https://github.com/mgba-emu/mgba.git
Util: Add endswith
This commit is contained in:
parent
b442282650
commit
f491196bc4
1
CHANGES
1
CHANGES
|
@ -74,6 +74,7 @@ Misc:
|
|||
- Qt: Make reseting when pasued frame-accurate
|
||||
- GBA Video: Optimize compositing cases slightly
|
||||
- VFS: Improve zip file detection
|
||||
- Util: Add endswith
|
||||
|
||||
0.4.1: (2016-07-11)
|
||||
Bugfixes:
|
||||
|
|
|
@ -39,6 +39,15 @@ char* strnrstr(const char* restrict haystack, const char* restrict needle, size_
|
|||
return last;
|
||||
}
|
||||
|
||||
bool endswith(const char* restrict s1, const char* restrict end) {
|
||||
size_t len = strlen(s1);
|
||||
size_t endLen = strlen(end);
|
||||
if (len < endLen) {
|
||||
return false;
|
||||
}
|
||||
return strcmp(&s1[len - endLen], end) == 0;
|
||||
}
|
||||
|
||||
uint32_t utf16Char(const uint16_t** unicode, size_t* length) {
|
||||
if (*length < 2) {
|
||||
*length = 0;
|
||||
|
|
|
@ -18,6 +18,7 @@ char* strdup(const char* str);
|
|||
#endif
|
||||
|
||||
char* strnrstr(const char* restrict s1, const char* restrict s2, size_t len);
|
||||
bool endswith(const char* restrict s1, const char* restrict end);
|
||||
|
||||
size_t toUtf8(uint32_t unichar, char* buffer);
|
||||
int utfcmp(const uint16_t* utf16, const char* utf8, size_t utf16Length, size_t utf8Length);
|
||||
|
|
Loading…
Reference in New Issue