Changeset e65e406 in mainline for uspace/srv/fs/fat/fat_dentry.c
- Timestamp:
- 2011-06-12T14:45:38Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- c6aca755
- Parents:
- 17fa0280
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/fs/fat/fat_dentry.c
r17fa0280 re65e406 40 40 #include <str.h> 41 41 #include <errno.h> 42 #include <byteorder.h> 42 43 43 44 static bool is_d_char(const char ch) … … 307 308 } 308 309 309 void fat_lfn_copy_part(const uint8_t *src, size_t src_size, uint8_t *dst, size_t *offset)310 size_t fat_lfn_copy_part(const uint8_t *src, size_t src_size, uint8_t *dst, size_t offset) 310 311 { 311 312 int i; 312 for (i=src_size-1; i>0 && (*offset)>1; i-=2) {313 for (i=src_size-1; i>0 && offset>1; i-=2) { 313 314 if ((src[i] == 0x00 && src[i-1] == 0x00) || 314 315 (src[i] == 0xff && src[i-1] == 0xff)) 315 316 continue; 316 dst[(*offset)-1] = src[i]; 317 dst[(*offset)-2] = src[i-1]; 318 (*offset)-=2; 319 } 320 } 321 322 void fat_lfn_copy_entry(const fat_dentry_t *d, uint8_t *dst, size_t *offset) 323 { 324 fat_lfn_copy_part(FAT_LFN_PART3(d), FAT_LFN_PART3_SIZE, dst, offset); 325 fat_lfn_copy_part(FAT_LFN_PART2(d), FAT_LFN_PART2_SIZE, dst, offset); 326 fat_lfn_copy_part(FAT_LFN_PART1(d), FAT_LFN_PART1_SIZE, dst, offset); 317 dst[offset-1] = src[i]; 318 dst[offset-2] = src[i-1]; 319 offset-=2; 320 } 321 return offset; 322 } 323 324 size_t fat_lfn_copy_entry(const fat_dentry_t *d, uint8_t *dst, size_t offset) 325 { 326 offset = fat_lfn_copy_part(FAT_LFN_PART3(d), 327 FAT_LFN_PART3_SIZE, dst, offset); 328 offset = fat_lfn_copy_part(FAT_LFN_PART2(d), 329 FAT_LFN_PART2_SIZE, dst, offset); 330 offset = fat_lfn_copy_part(FAT_LFN_PART1(d), 331 FAT_LFN_PART1_SIZE, dst, offset); 332 333 return offset; 327 334 } 328 335 … … 339 346 return EOVERFLOW; 340 347 } else { 341 c = (src[i] << 8) | src[i+1];348 c = uint16_t_le2host((src[i] << 8) | src[i+1]); 342 349 rc = chr_encode(c, (char*)dst, &offset, dst_size); 343 350 if (rc!=EOK) {
Note:
See TracChangeset
for help on using the changeset viewer.