fx_directory_long_name_get.c
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | /*************************************************************************** | ||
| 2 | * Copyright (c) 2024 Microsoft Corporation | ||
| 3 | * Copyright (c) 2026-present Eclipse ThreadX contributors | ||
| 4 | * | ||
| 5 | * This program and the accompanying materials are made available under the | ||
| 6 | * terms of the MIT License which is available at | ||
| 7 | * https://opensource.org/licenses/MIT. | ||
| 8 | * | ||
| 9 | * SPDX-License-Identifier: MIT | ||
| 10 | **************************************************************************/ | ||
| 11 | |||
| 12 | // Portions of this file were generated with AI assistance. | ||
| 13 | |||
| 14 | |||
| 15 | /**************************************************************************/ | ||
| 16 | /**************************************************************************/ | ||
| 17 | /** */ | ||
| 18 | /** FileX Component */ | ||
| 19 | /** */ | ||
| 20 | /** Directory */ | ||
| 21 | /** */ | ||
| 22 | /**************************************************************************/ | ||
| 23 | /**************************************************************************/ | ||
| 24 | |||
| 25 | #define FX_SOURCE_CODE | ||
| 26 | |||
| 27 | |||
| 28 | /* Include necessary system files. */ | ||
| 29 | |||
| 30 | #include "fx_api.h" | ||
| 31 | #include "fx_directory.h" | ||
| 32 | |||
| 33 | |||
| 34 | /* DEPRECATION NOTICE | ||
| 35 | * fx_directory_long_name_get() is deprecated. Do not use it in new code. | ||
| 36 | * | ||
| 37 | * WHY: Does not accept a destination buffer length; writes up to FX_MAX_LONG_NAME_LEN bytes regardless of the caller's buffer size, risking a buffer overrun. | ||
| 38 | * | ||
| 39 | * WHAT TO DO: replace calls with fx_directory_long_name_get_extended(), passing the actual | ||
| 40 | * destination buffer size as an additional argument. | ||
| 41 | */ | ||
| 42 | #pragma message("fx_directory_long_name_get() is deprecated. " \ | ||
| 43 | "Use fx_directory_long_name_get_extended() and pass the actual buffer size.") | ||
| 44 | |||
| 45 | /**************************************************************************/ | ||
| 46 | /* */ | ||
| 47 | /* FUNCTION RELEASE */ | ||
| 48 | /* */ | ||
| 49 | /* _fx_directory_long_name_get PORTABLE C */ | ||
| 50 | /* 6.1 */ | ||
| 51 | /* AUTHOR */ | ||
| 52 | /* */ | ||
| 53 | /* William E. Lamie, Microsoft Corporation */ | ||
| 54 | /* */ | ||
| 55 | /* DESCRIPTION */ | ||
| 56 | /* */ | ||
| 57 | /* This function gets the long file name via the supplied short file */ | ||
| 58 | /* name. If there is no long file name, the short file name will be */ | ||
| 59 | /* returned. */ | ||
| 60 | /* */ | ||
| 61 | /* DEPRECATED. Use fx_directory_long_name_get_extended() instead, */ | ||
| 62 | /* passing the actual destination buffer length. It takes no buffer */ | ||
| 63 | /* length and writes up to FX_MAX_LONG_NAME_LEN bytes whatever the size*/ | ||
| 64 | /* of the caller's buffer, risking an overrun. */ | ||
| 65 | /* */ | ||
| 66 | /* INPUT */ | ||
| 67 | /* */ | ||
| 68 | /* media_ptr Media control block pointer */ | ||
| 69 | /* short_file_name Pointer to short (8.3) name */ | ||
| 70 | /* long_file_name Pointer to long (max 255) name*/ | ||
| 71 | /* */ | ||
| 72 | /* OUTPUT */ | ||
| 73 | /* */ | ||
| 74 | /* return status */ | ||
| 75 | /* */ | ||
| 76 | /* CALLS */ | ||
| 77 | /* */ | ||
| 78 | /* _fx_directory_long_name_get_extended Actual long name get service */ | ||
| 79 | /* */ | ||
| 80 | /* CALLED BY */ | ||
| 81 | /* */ | ||
| 82 | /* Application Code */ | ||
| 83 | /* */ | ||
| 84 | /**************************************************************************/ | ||
| 85 | 63 | UINT _fx_directory_long_name_get(FX_MEDIA *media_ptr, CHAR *short_file_name, CHAR *long_file_name) | |
| 86 | { | ||
| 87 | |||
| 88 | /* Call the extended version with maximum long name length. */ | ||
| 89 | 63 | return(_fx_directory_long_name_get_extended(media_ptr, short_file_name, long_file_name, FX_MAX_LONG_NAME_LEN)); | |
| 90 | } | ||
| 91 | |||
| 92 |