Changeset d4b63fa in mainline
- Timestamp:
- 2014-08-04T18:23:13Z (10 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 0003e0f5
- Parents:
- 8e77b12f
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/fs/cdfs/cdfs_ops.c
r8e77b12f rd4b63fa 396 396 } 397 397 398 /** Decode file name. 399 * 400 * @param data File name buffer 401 * @param dsize Fine name buffer size 402 * @param dtype Directory entry type 403 * @return Decoded file name (allocated string) 404 */ 405 static char *cdfs_decode_name(void *data, size_t dsize, 406 cdfs_dentry_type_t dtype) 407 { 408 char *name; 409 char *dot; 410 char *scolon; 411 412 name = malloc(dsize + 1); 413 if (name == NULL) 414 return NULL; 415 memcpy(name, data, dsize); 416 name[dsize] = '\0'; 417 418 if (dtype == CDFS_DIRECTORY) 419 return name; 420 421 dot = str_chr(name, '.'); 422 if (dot == NULL) 423 return NULL; 424 scolon = str_chr(dot, ';'); 425 if (scolon == NULL) 426 return NULL; 427 428 /* Trim version part */ 429 *scolon = '\0'; 430 431 /* If the extension is an empty string, trim the dot separator. */ 432 if (dot[1] == '\0') 433 *dot = '\0'; 434 435 return name; 436 } 437 398 438 static bool cdfs_readdir(service_id_t service_id, fs_node_t *fs_node) 399 439 { … … 453 493 cur->size = uint32_lb(dir->size); 454 494 455 char *name = (char *) malloc(dir->name_length + 1); 495 char *name = cdfs_decode_name(dir->name, 496 dir->name_length, dentry_type); 456 497 if (name == NULL) 457 498 return false; 458 459 memcpy(name, dir->name, dir->name_length);460 name[dir->name_length] = 0;461 499 462 500 // FIXME: check return value
Note:
See TracChangeset
for help on using the changeset viewer.