86728d203f7108352fbfa5efb3bf161dd11916d6
1 #ifndef __WILC_STRUTILS_H__
2 #define __WILC_STRUTILS_H__
5 * @file wilc_strutils.h
6 * @brief Basic string utilities
8 * @sa wilc_oswrapper.h top level OS wrapper file
13 #include <linux/types.h>
14 #include <linux/string.h>
15 #include "wilc_errorsupport.h"
19 * @brief Internal implementation for memory copy
20 * @param[in] pvTarget the target buffer to which the data is copied into
21 * @param[in] pvSource pointer to the second memory location
22 * @param[in] u32Count the size of the data to copy
23 * @note this function should not be used directly, use WILC_memcpy instead
28 void WILC_memcpy_INTERNAL(void *pvTarget
, const void *pvSource
, u32 u32Count
);
31 * @brief Copies the contents of a memory buffer into another
32 * @param[in] pvTarget the target buffer to which the data is copied into
33 * @param[in] pvSource pointer to the second memory location
34 * @param[in] u32Count the size of the data to copy
35 * @return WILC_SUCCESS if copy is successfully handeled
36 * WILC_FAIL if copy failed
37 * @note this function repeats the functionality of standard memcpy,
38 * however memcpy is undefined if the two buffers overlap but this
39 * implementation will check for overlap and report error
44 static WILC_ErrNo
WILC_memcpy(void *pvTarget
, const void *pvSource
, u32 u32Count
)
47 (((u8
*)pvTarget
<= (u8
*)pvSource
)
48 && (((u8
*)pvTarget
+ u32Count
) > (u8
*)pvSource
))
50 || (((u8
*)pvSource
<= (u8
*)pvTarget
)
51 && (((u8
*)pvSource
+ u32Count
) > (u8
*)pvTarget
))
53 /* ovelapped memory, return Error */
56 WILC_memcpy_INTERNAL(pvTarget
, pvSource
, u32Count
);
64 * @brief Compares two strings up to u32Count characters
65 * @details Compares 2 strings reporting which is bigger, NULL is considered
66 * the smallest string, then a zero length string then all other
67 * strings depending on thier ascii characters order with small case
68 * converted to uppder case
69 * @param[in] pcStr1 the first string, NULL is valid and considered smaller
70 * than any other non-NULL string (incliding zero lenght strings)
71 * @param[in] pcStr2 the second string, NULL is valid and considered smaller
72 * than any other non-NULL string (incliding zero lenght strings)
73 * @param[in] u32Count copying will proceed until a null character in pcStr1 or
74 * pcStr2 is encountered or u32Count of bytes copied
75 * @return 0 if the 2 strings are equal, 1 if pcStr1 is bigger than pcStr2,
76 * -1 if pcStr1 smaller than pcStr2
81 s32
WILC_strncmp(const char *pcStr1
, const char *pcStr2
,
This page took 0.032884 seconds and 4 git commands to generate.