Ver Fonte

Cleanup.

Branimir Karadžić há 7 anos atrás
pai
commit
5852051238
1 ficheiros alterados com 5 adições e 3 exclusões
  1. 5 3
      src/crtnone.cpp

+ 5 - 3
src/crtnone.cpp

@@ -109,7 +109,7 @@ extern "C" int isprint(int _ch)
 	return bx::isPrint(_ch);
 }
 
-extern "C" int toupper (int _ch)
+extern "C" int toupper(int _ch)
 {
 	return bx::toUpper(_ch);
 }
@@ -122,8 +122,10 @@ extern "C" size_t mbstowcs(wchar_t* _dst, const char* _src, size_t _max)
 
 extern "C" char* strdup(const char* _src)
 {
-	uint32_t size = bx::strLen(_src);
-	return (char*)malloc(size);
+	uint32_t size = bx::strLen(_src)+1;
+	char* dup = (char*)malloc(size);
+	bx::strCopy(dup, size, _src);
+	return dup;
 }
 
 extern "C" long int strtol(const char* _str, char** _end, int _base)