summaryrefslogtreecommitdiff
path: root/drivers/staging/wilc1000/wilc_strutils.c
blob: c6af13cba5439745db6198a23be1d74bb04993b6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#define _CRT_SECURE_NO_DEPRECATE

#include "wilc_oswrapper.h"


/*!
 *  @author	syounan
 *  @date	18 Aug 2010
 *  @version	1.0
 */
WILC_Sint32 WILC_memcmp(const void *pvArg1, const void *pvArg2, WILC_Uint32 u32Count)
{
	return memcmp(pvArg1, pvArg2, u32Count);
}


/*!
 *  @author	syounan
 *  @date	18 Aug 2010
 *  @version	1.0
 */
void WILC_memcpy_INTERNAL(void *pvTarget, const void *pvSource, WILC_Uint32 u32Count)
{
	memcpy(pvTarget, pvSource, u32Count);
}

/*!
 *  @author	syounan
 *  @date	18 Aug 2010
 *  @version	1.0
 */
void *WILC_memset(void *pvTarget, u8 u8SetValue, WILC_Uint32 u32Count)
{
	return memset(pvTarget, u8SetValue, u32Count);
}

/*!
 *  @author	syounan
 *  @date	18 Aug 2010
 *  @version	1.0
 */
WILC_Char *WILC_strncpy(WILC_Char *pcTarget, const WILC_Char *pcSource,
			WILC_Uint32 u32Count)
{
	return strncpy(pcTarget, pcSource, u32Count);
}

WILC_Sint32 WILC_strncmp(const WILC_Char *pcStr1, const WILC_Char *pcStr2,
			 WILC_Uint32 u32Count)
{
	WILC_Sint32 s32Result;

	if (pcStr1 == NULL && pcStr2 == NULL)	{
		s32Result = 0;
	} else if (pcStr1 == NULL)	   {
		s32Result = -1;
	} else if (pcStr2 == NULL)	   {
		s32Result = 1;
	} else {
		s32Result = strncmp(pcStr1, pcStr2, u32Count);
		if (s32Result < 0) {
			s32Result = -1;
		} else if (s32Result > 0)    {
			s32Result = 1;
		}
	}

	return s32Result;
}

/*!
 *  @author	syounan
 *  @date	18 Aug 2010
 *  @version	1.0
 */
WILC_Uint32 WILC_strlen(const WILC_Char *pcStr)
{
	return (WILC_Uint32)strlen(pcStr);
}