Changeset b2906c0 in mainline
- Timestamp:
- 2017-07-11T18:44:04Z (8 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- f3504c1
- Parents:
- 9bf4488
- Location:
- uspace
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/str.c
r9bf4488 rb2906c0 995 995 dest[idx] = '\0'; 996 996 return rc; 997 } 998 999 /** Get size of UTF-16 string. 1000 * 1001 * Get the number of words which are used by the UTF-16 string @a ustr 1002 * (excluding the NULL-terminator). 1003 * 1004 * @param ustr UTF-16 string to consider. 1005 * 1006 * @return Number of words used by the UTF-16 string 1007 * 1008 */ 1009 size_t utf16_wsize(const uint16_t *ustr) 1010 { 1011 size_t wsize = 0; 1012 1013 while (*ustr++ != 0) 1014 wsize++; 1015 1016 return wsize; 997 1017 } 998 1018 -
uspace/lib/c/include/str.h
r9bf4488 rb2906c0 99 99 extern int utf16_to_str(char *dest, size_t size, const uint16_t *src); 100 100 extern int str_to_utf16(uint16_t *dest, size_t dlen, const char *src); 101 extern size_t utf16_wsize(const uint16_t *ustr); 101 102 102 103 extern char *str_chr(const char *str, wchar_t ch); -
uspace/srv/fs/exfat/exfat_dentry.c
r9bf4488 rb2906c0 130 130 } 131 131 132 size_t exfat_utf16_length(const uint16_t *wstr)133 {134 size_t len = 0;135 136 while (*wstr++ != 0)137 len++;138 139 return len;140 }141 142 132 /** 143 133 * @} -
uspace/srv/fs/exfat/exfat_dentry.h
r9bf4488 rb2906c0 161 161 extern bool exfat_valid_name(const char *); 162 162 163 extern size_t exfat_utf16_length(const uint16_t *);164 165 166 163 #endif 167 164 -
uspace/srv/fs/exfat/exfat_directory.c
r9bf4488 rb2906c0 371 371 ds.stream.valid_data_size = 0; 372 372 ds.stream.data_size = 0; 373 ds.stream.name_size = exfat_utf16_length(wname);373 ds.stream.name_size = utf16_wsize(wname); 374 374 ds.stream.hash = host2uint16_t_le(exfat_name_hash(wname, uctable, 375 375 uctable_chars)); -
uspace/srv/fs/fat/fat_dentry.c
r9bf4488 rb2906c0 427 427 } 428 428 429 size_t utf16_length(const uint16_t *wstr)430 {431 size_t len = 0;432 433 while (*wstr++ != 0)434 len++;435 436 return len;437 }438 439 429 /** 440 430 * @} -
uspace/srv/fs/fat/fat_dentry.h
r9bf4488 rb2906c0 152 152 153 153 extern void str_to_ascii(char *, const char *, size_t, uint8_t); 154 extern size_t utf16_length(const uint16_t *);155 154 156 155 extern bool fat_valid_name(const char *); -
uspace/srv/fs/fat/fat_directory.c
r9bf4488 rb2906c0 301 301 return rc; 302 302 303 lfn_size = utf16_ length(wname);303 lfn_size = utf16_wsize(wname); 304 304 long_entry_count = lfn_size / FAT_LFN_ENTRY_SIZE; 305 305 if (lfn_size % FAT_LFN_ENTRY_SIZE) -
uspace/srv/fs/udf/udf_osta.c
r9bf4488 rb2906c0 51 51 #include "udf_osta.h" 52 52 #include "udf_cksum.h" 53 54 /** Calculate length of UTF-16 string55 *56 * FIXME: This is wrong! UTF-16 is not a fixed-width encoding,57 * it is a variable-width encoding (mind the surrogate58 * pairs).59 *60 */61 static size_t utf16_length(uint16_t *string) {62 size_t len = 0;63 64 while (*string++ != 0)65 len++;66 67 return len;68 }69 53 70 54 /** Illegal UNIX characters are NULL and slash. … … 296 280 ucode_chars = 297 281 udf_uncompress_unicode(len, (uint8_t *) id, raw_name, MAX_BUF); 298 ucode_chars = min(ucode_chars, utf16_ length(raw_name));282 ucode_chars = min(ucode_chars, utf16_wsize(raw_name)); 299 283 nice_uchars = 300 284 udf_translate_name(unix_name, raw_name, ucode_chars);
Note:
See TracChangeset
for help on using the changeset viewer.