Changeset 5d95f02 in mainline for uspace/srv/fs/fat/fat_dentry.c
- Timestamp:
- 2011-08-26T23:04:07Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 4bf6895
- Parents:
- 0dbe5ac
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/fs/fat/fat_dentry.c
r0dbe5ac r5d95f02 221 221 uint8_t fat_dentry_chksum(uint8_t *name) 222 222 { 223 uint8_t i, sum=0; 224 for (i=0; i<(FAT_NAME_LEN+FAT_EXT_LEN); i++) { 223 uint8_t i, sum = 0; 224 225 for (i = 0; i < (FAT_NAME_LEN + FAT_EXT_LEN); i++) 225 226 sum = ((sum & 1) ? 0x80 : 0) + (sum >> 1) + name[i]; 226 } 227 227 228 return sum; 228 229 } … … 269 270 { 270 271 int i; 271 for (i =FAT_LFN_PART3_SIZE-1; i>=0 && *offset>0; i--) {272 for (i = FAT_LFN_PART3_SIZE - 1; i >= 0 && *offset > 0; i--) { 272 273 if (d->lfn.part3[i] == 0 || d->lfn.part3[i] == FAT_LFN_PAD) 273 274 continue; … … 275 276 dst[(*offset)] = uint16_t_le2host(d->lfn.part3[i]); 276 277 } 277 for (i =FAT_LFN_PART2_SIZE-1; i>=0 && *offset>0; i--) {278 for (i = FAT_LFN_PART2_SIZE - 1; i >= 0 && *offset > 0; i--) { 278 279 if (d->lfn.part2[i] == 0 || d->lfn.part2[i] == FAT_LFN_PAD) 279 280 continue; … … 281 282 dst[(*offset)] = uint16_t_le2host(d->lfn.part2[i]); 282 283 } 283 for (i =FAT_LFN_PART1_SIZE-1; i>=0 && *offset>0; i--) {284 for (i = FAT_LFN_PART1_SIZE - 1; i >= 0 && *offset > 0; i--) { 284 285 if (d->lfn.part1[i] == 0 || d->lfn.part1[i] == FAT_LFN_PAD) 285 286 continue; … … 290 291 } 291 292 292 size_t fat_lfn_set_entry(const uint16_t *src, size_t *offset, size_t size, fat_dentry_t *d) 293 size_t fat_lfn_set_entry(const uint16_t *src, size_t *offset, size_t size, 294 fat_dentry_t *d) 293 295 { 294 296 size_t idx; 295 for (idx =0; idx < FAT_LFN_PART1_SIZE; idx++) {297 for (idx = 0; idx < FAT_LFN_PART1_SIZE; idx++) { 296 298 if (*offset < size) { 297 299 d->lfn.part1[idx] = host2uint16_t_le(src[*offset]); 298 300 (*offset)++; 299 } 300 else 301 } else 301 302 d->lfn.part1[idx] = FAT_LFN_PAD; 302 303 } 303 for (idx =0; idx < FAT_LFN_PART2_SIZE; idx++) {304 for (idx = 0; idx < FAT_LFN_PART2_SIZE; idx++) { 304 305 if (*offset < size) { 305 306 d->lfn.part2[idx] = host2uint16_t_le(src[*offset]); 306 307 (*offset)++; 307 } 308 else 308 } else 309 309 d->lfn.part2[idx] = FAT_LFN_PAD; 310 310 } 311 for (idx =0; idx < FAT_LFN_PART3_SIZE; idx++) {311 for (idx = 0; idx < FAT_LFN_PART3_SIZE; idx++) { 312 312 if (*offset < size) { 313 313 d->lfn.part3[idx] = host2uint16_t_le(src[*offset]); 314 314 (*offset)++; 315 } 316 else 315 } else 317 316 d->lfn.part3[idx] = FAT_LFN_PAD; 318 317 } … … 339 338 else 340 339 *dst = pad; 341 } 342 else 340 } else 343 341 break; 344 342
Note:
See TracChangeset
for help on using the changeset viewer.