Fixed stack problem.

This commit is contained in:
irungentoo 2013-08-18 11:59:34 -04:00
parent 45fec94452
commit 93104d1203

View File

@ -27,7 +27,7 @@
/* Export for use in Callbacks */ /* Export for use in Callbacks */
char *DATA_FILE = NULL; char *DATA_FILE = NULL;
char dir[31]; char dir[256];
void on_window_resize(int sig) void on_window_resize(int sig)
{ {
@ -38,13 +38,13 @@ void on_window_resize(int sig)
void setdir() void setdir()
{ {
#ifdef WIN32 #ifdef WIN32
strcpy(dir, "%appdata%/.tox/"); strcpy(dir, "%appdata%/.tox/");
#elif defined(MAC_OSX) #elif defined(MAC_OSX)
strcpy(dir, "~/Library/Application Support/.tox/"); strcpy(dir, "~/Library/Application Support/.tox/");
#elif defined(linux) #elif defined(linux)
strcpy(dir, "~/.tox/"); strcpy(dir, "~/.tox/");
#endif #endif
} }
static void init_term() static void init_term()
@ -84,15 +84,15 @@ static Messenger *init_tox()
m_callback_namechange(m, on_nickchange, NULL); m_callback_namechange(m, on_nickchange, NULL);
m_callback_statusmessage(m, on_statuschange, NULL); m_callback_statusmessage(m, on_statuschange, NULL);
m_callback_action(m, on_action, NULL); m_callback_action(m, on_action, NULL);
#ifdef __linux__ #ifdef __linux__
setname(m, (uint8_t *) "Cool guy", sizeof("Cool guy")); setname(m, (uint8_t *) "Cool guy", sizeof("Cool guy"));
#elif defined(WIN32) #elif defined(WIN32)
setname(m, (uint8_t *) "I should install GNU/Linux", sizeof("I should install GNU/Linux")); setname(m, (uint8_t *) "I should install GNU/Linux", sizeof("I should install GNU/Linux"));
#elif defined(MAC_OSX) #elif defined(MAC_OSX)
setname(m, (uint8_t *) "Hipster", sizeof("Hipster")); //This used to users of other Unixes are hipsters setname(m, (uint8_t *) "Hipster", sizeof("Hipster")); //This used to users of other Unixes are hipsters
#else #else
setname(m, (uint8_t *) "Registered Minix user #4", sizeof("Registered Minix user #4")); setname(m, (uint8_t *) "Registered Minix user #4", sizeof("Registered Minix user #4"));
#endif #endif
return m; return m;
} }
@ -106,13 +106,13 @@ int init_connection(void)
if (DHT_isconnected()) if (DHT_isconnected())
return 0; return 0;
#if WIN32 #if WIN32
FILE *fp = fopen("%appdata%/.tox/DHTservers", "r"); FILE *fp = fopen("%appdata%/.tox/DHTservers", "r");
#elif MAC_OSX #elif MAC_OSX
FILE *fp = fopen("~/Library/Application Support/.tox/DHTservers", "r"); FILE *fp = fopen("~/Library/Application Support/.tox/DHTservers", "r");
#else #else
FILE *fp = fopen("~/.tox/DHTservers", "r"); FILE *fp = fopen("~/.tox/DHTservers", "r");
#endif #endif
if (!fp) if (!fp)
return 1; return 1;
@ -309,7 +309,7 @@ int main(int argc, char *argv[])
strcat(DATA_FILE, dir); strcat(DATA_FILE, dir);
DATA_FILE = strdup("data"); DATA_FILE = strdup("data");
} else { } else {
DATA_FILE = malloc(strlen(user_config_dir) + strlen(CONFIGDIR) + strlen("data") + 1); DATA_FILE = malloc(strlen(user_config_dir) + strlen(CONFIGDIR) + strlen("data") + 1);
strcpy(DATA_FILE, user_config_dir); strcpy(DATA_FILE, user_config_dir);