Fix bug in readWString

This commit is contained in:
Henrik Rydgard 2012-09-17 19:26:28 +02:00
parent 743631c217
commit c5370b497b
3 changed files with 10 additions and 4 deletions

View file

@ -209,12 +209,16 @@ int main(int argc, char *argv[]) {
PathAppend(path, (app_name + "\\").c_str());
#else
// Mac / Linux
const char *path = getenv("HOME");
if (!path) {
char path[512];
const char *the_path = getenv("HOME");
if (!the_path) {
struct passwd* pwd = getpwuid(getuid());
if (pwd)
path = pwd->pw_dir;
the_path = pwd->pw_dir;
}
strcpy(path, the_path);
if (path[strlen(path)-1] != '/')
strcat(path, "/");
#endif
NativeInit(argc, (const char **)argv, path, "/tmp", "BADCOFFEE");

View file

@ -18,10 +18,12 @@ class InlineFastList {
void Add(T t) {
data_[count_++] = t;
}
void RemoveAt(int index) {
data_[index] = data_[count_ - 1];
count_--;
}
void Remove(T t) { // Requires operator==
for (int i = 0; i < count_; i++) {
if (data_[i] == t) {

View file

@ -239,7 +239,7 @@ static std::string fromUnicode(const uint16_t *src, int len) {
std::string str;
str.resize(len);
for (int i=0; i<len; i++) {
str[i] = i > 255 ? ' ' : i;
str[i] = src[i] > 255 ? ' ' : src[i];
}
return str;
}