示例#1
0
文件: string.c 项目: felfert/FreeRDP
WCHAR* _wcsdup(const WCHAR* strSource)
{
	WCHAR* strDestination;

	if (strSource == NULL)
		return NULL;

#if sun
	strDestination = wsdup(strSource);
#elif defined(__APPLE__) && defined(__MACH__)
	strDestination = malloc(wcslen(strSource));

	if (strDestination != NULL)
		wcscpy(strDestination, strSource);
#else
	strDestination = (WCHAR*) wcsdup((wchar_t*) strSource);
#endif

	if (strDestination == NULL)
		perror("wcsdup");

	return strDestination;
}
示例#2
0
WCHAR* _wcsdup(const WCHAR* strSource)
{
	WCHAR* strDestination;

	if (strSource == NULL)
		return NULL;

#if defined(sun) && sun
	strDestination = wsdup(strSource);
#elif defined(__APPLE__) && defined(__MACH__) || defined(ANDROID)
	strDestination = malloc(wcslen((wchar_t*)strSource));

	if (strDestination != NULL)
		wcscpy((wchar_t*)strDestination, (const wchar_t*)strSource);

#else
	strDestination = (WCHAR*) wcsdup((wchar_t*) strSource);
#endif

	if (strDestination == NULL)
		WLog_ERR(TAG,"wcsdup");

	return strDestination;
}
示例#3
0
文件: memory.c 项目: Cyclic/FreeRDP
wchar_t* xwcsdup(const wchar_t* wstr)
{
	wchar_t* mem;

	if (wstr == NULL)
		return NULL;

#ifdef _WIN32
	mem = _wcsdup(wstr);
#elif sun
	mem = wsdup(wstr);
#elif (defined(__APPLE__) && defined(__MACH__)) || defined(ANDROID)
	mem = xmalloc(wcslen(wstr));
	if (mem != NULL)
		wcscpy(mem, wstr);
#else
	mem = wcsdup(wstr);
#endif

	if (mem == NULL)
		perror("wstrdup");

	return mem;
}