fix compile on osx and linux

added  GetPluginDirectory (please check on windows)


git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2490 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
nakeee
2009-02-28 23:21:51 +00:00
parent 7d4e374c21
commit 324abc9a7f
6 changed files with 119 additions and 43 deletions

View File

@ -37,14 +37,24 @@ const char *GetLastErrorMsg()
return errStr;
}
char *strndup (char const *s, size_t n)
#ifdef __APPLE__
// strlen with cropping after size n
size_t strnlen(const char *s, size_t n)
{
const char *p = (const char *)memchr(s, 0, n);
return(p ? p-s : n);
}
#endif
// strdup with cropping after size n
char* strndup(char const *s, size_t n)
{
size_t len = strnlen(s, n);
char *dup = (char *)malloc(len + 1);
if (dup == NULL)
return NULL;
dup[len] = '\0';
return (char *)memcpy(dup, s, len);
}