git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@15227 27425a3e-05d8-49a3-a47f-9c15f0e5edd8
This commit is contained in:
parent
e3c3e9916a
commit
6100c01bdc
|
@ -58,7 +58,7 @@ extern "C" {
|
|||
msg_t vfs_parse_match_separator(const char **pathp);
|
||||
msg_t vfs_parse_match_end(const char **pathp);
|
||||
msg_t vfs_parse_get_fname(const char **pathp, char *fname);
|
||||
msg_t vfs_parse_copy_with_separator(char *dst, const char *src);
|
||||
size_t vfs_parse_copy_with_separator(char *dst, const char *src);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -136,7 +136,18 @@ msg_t vfs_parse_get_fname(const char **pathp, char *fname) {
|
|||
}
|
||||
}
|
||||
|
||||
msg_t vfs_parse_copy_with_separator(char *dst, const char *src) {
|
||||
/**
|
||||
* @brief Copies a path into a destination buffer.
|
||||
* @details Up to @p VFS_CFG_PATHLEN_MAX characters are copied. A path
|
||||
* separator is added to the end of the path if not present.
|
||||
*
|
||||
* @param[out] dst The destination buffer.
|
||||
* @param[in] src The source path.
|
||||
* @return The copied path size not including the final
|
||||
* zero.
|
||||
* @retval 0 If the path size exceeded @p VFS_CFG_PATHLEN_MAX.
|
||||
*/
|
||||
size_t vfs_parse_copy_with_separator(char *dst, const char *src) {
|
||||
size_t n = 0U;
|
||||
char lc = '\0';
|
||||
|
||||
|
@ -144,7 +155,7 @@ msg_t vfs_parse_copy_with_separator(char *dst, const char *src) {
|
|||
while ((*dst = *src) != '\0') {
|
||||
|
||||
if (n > VFS_CFG_PATHLEN_MAX) {
|
||||
return VFS_RET_ENAMETOOLONG;
|
||||
return 0U;
|
||||
}
|
||||
|
||||
lc = *src++;
|
||||
|
@ -156,7 +167,7 @@ msg_t vfs_parse_copy_with_separator(char *dst, const char *src) {
|
|||
if (lc != '/') {
|
||||
|
||||
if (n > VFS_CFG_PATHLEN_MAX) {
|
||||
return VFS_RET_ENAMETOOLONG;
|
||||
return 0U;
|
||||
}
|
||||
|
||||
*dst++ = '/';
|
||||
|
@ -164,7 +175,7 @@ msg_t vfs_parse_copy_with_separator(char *dst, const char *src) {
|
|||
n++;
|
||||
}
|
||||
|
||||
return (msg_t)n;
|
||||
return n;
|
||||
}
|
||||
|
||||
/** @} */
|
||||
|
|
Loading…
Reference in New Issue