ref: 69d6dd0c2492df09266f552d040e91c9dc6b959b
parent: 9e1ce3eb2aa64369587f9cf840c7ebe21950bde3
author: David <gek@katherine>
date: Tue Mar 9 13:07:20 EST 2021
Automatic commit.
--- a/SDL_Examples/include/stringutil.h
+++ b/SDL_Examples/include/stringutil.h
@@ -82,10 +82,10 @@
}
//Someone once said sub-string search was an O(n^2) algorithm. What the hell?
-static inline int strfind(const char* text, const char* subtext){- int ti = 0;
- int si = 0;
- int st = strlen(subtext);
+static inline long long strfind(const char* text, const char* subtext){+ long long ti = 0;
+ long long si = 0;
+ long long st = strlen(subtext);
for(;text[ti] != '\0';ti++){ if(text[ti] == subtext[si]) {si++;
@@ -101,8 +101,8 @@
//Read file until terminator character is found.
//Returns the number of characters copied.
-static inline unsigned int read_until_terminator(FILE* f, char* buf, const unsigned int buflen, char terminator){- unsigned int i = 0;
+static inline unsigned long long read_until_terminator(FILE* f, char* buf, const unsigned long long buflen, char terminator){+ unsigned long long i = 0;
char c;
for(i = 0; i < (buflen-1); i++)
{@@ -116,12 +116,12 @@
}
//Same as above but allocates memory to guarantee it can hold the entire thing. Grows naturally.
-static inline char* read_until_terminator_alloced(FILE* f, unsigned int* lenout, char terminator, unsigned int initsize){+static inline char* read_until_terminator_alloced(FILE* f, unsigned long long* lenout, char terminator, unsigned long long initsize){char c;
char* buf = STRUTIL_ALLOC(initsize);
if(!buf) return NULL;
- unsigned int bcap = initsize;
- unsigned int blen = 0;
+ unsigned long long bcap = initsize;
+ unsigned long long blen = 0;
while(1){ if(feof(f)){break;}c = fgetc(f);
@@ -141,7 +141,7 @@
}
-static inline void* read_file_into_alloced_buffer(FILE* f, unsigned int* len){+static inline void* read_file_into_alloced_buffer(FILE* f, unsigned long long* len){void* buf = NULL;
if(!f) return NULL;
fseek(f, 0, SEEK_END);
--
⑨