Changeset b06414f in mainline
- Timestamp:
- 2017-05-19T14:04:36Z (8 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- e540bc87
- Parents:
- 2628642
- Location:
- uspace
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/str.c
r2628642 rb06414f 951 951 } 952 952 953 int str_to_utf16(uint16_t *dest, size_t size, const char *src) 953 /** Convert string to UTF16 string. 954 * 955 * Convert string @a src to utf16 string. The output is written to the buffer 956 * specified by @a dest and @a dlen. @a dlen must be non-zero and the string 957 * written will always be well-formed. Surrogate pairs also supported. 958 * 959 * @param dest Destination buffer. 960 * @param dlen Number of utf16 characters that fit in the destination buffer. 961 * @param src Source string. 962 * 963 * @return EOK, if success, negative otherwise. 964 */ 965 int str_to_utf16(uint16_t *dest, size_t dlen, const char *src) 954 966 { 955 967 int rc = EOK; … … 958 970 wchar_t c; 959 971 960 assert( size> 0);972 assert(dlen > 0); 961 973 962 974 while ((c = str_decode(src, &offset, STR_NO_LIMIT)) != 0) { 963 975 if (c > 0x10000) { 964 if (idx + 2 >= size- 1) {976 if (idx + 2 >= dlen - 1) { 965 977 rc = EOVERFLOW; 966 978 break; … … 975 987 976 988 idx++; 977 if (idx >= size- 1) {989 if (idx >= dlen - 1) { 978 990 rc = EOVERFLOW; 979 991 break; -
uspace/lib/c/include/str.h
r2628642 rb06414f 98 98 extern wchar_t *str_to_awstr(const char *src); 99 99 extern int utf16_to_str(char *dest, size_t size, const uint16_t *src); 100 extern int str_to_utf16(uint16_t *dest, size_t size, const char *src);100 extern int str_to_utf16(uint16_t *dest, size_t dlen, const char *src); 101 101 102 102 extern char *str_chr(const char *str, wchar_t ch); -
uspace/srv/fs/fat/fat_dentry.h
r2628642 rb06414f 83 83 #define FAT_LFN_CHKSUM(d) ((d)->lfn.check_sum) 84 84 85 #define FAT_LFN_NAME_SIZE 260 85 #define FAT_LFN_NAME_LEN 260 /* characters */ 86 #define FAT_LFN_NAME_SIZE STR_BOUNDS(FAT_LFN_NAME_LEN) /* bytes */ 86 87 #define FAT_LFN_MAX_COUNT 20 87 88 #define FAT_LFN_PART1_SIZE 5 -
uspace/srv/fs/fat/fat_directory.c
r2628642 rb06414f 155 155 { 156 156 fat_dentry_t *d = NULL; 157 uint16_t wname[FAT_LFN_NAME_ SIZE];157 uint16_t wname[FAT_LFN_NAME_LEN]; 158 158 size_t lfn_offset, lfn_size; 159 159 bool long_entry = false; … … 293 293 int long_entry_count; 294 294 uint8_t checksum; 295 uint16_t wname[FAT_LFN_NAME_ SIZE];295 uint16_t wname[FAT_LFN_NAME_LEN]; 296 296 size_t lfn_size, lfn_offset; 297 297 298 rc = str_to_utf16(wname, FAT_LFN_NAME_ SIZE, name);298 rc = str_to_utf16(wname, FAT_LFN_NAME_LEN, name); 299 299 if (rc != EOK) 300 300 return rc;
Note:
See TracChangeset
for help on using the changeset viewer.