fx_unicode_length_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 | /** Unicode */ | ||
| 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_unicode.h" | ||
| 32 | |||
| 33 | |||
| 34 | /* DEPRECATION NOTICE | ||
| 35 | * fx_unicode_length_get() is deprecated. Do not use it in new code. | ||
| 36 | * | ||
| 37 | * WHY: Does not accept a buffer length; scans up to 256 bytes regardless of the actual buffer size, risking an overread. | ||
| 38 | * | ||
| 39 | * WHAT TO DO: replace calls with fx_unicode_length_get_extended(), passing the actual | ||
| 40 | * destination buffer size as an additional argument. | ||
| 41 | */ | ||
| 42 | #pragma message("fx_unicode_length_get() is deprecated. " \ | ||
| 43 | "Use fx_unicode_length_get_extended() and pass the actual buffer size.") | ||
| 44 | |||
| 45 | /**************************************************************************/ | ||
| 46 | /* */ | ||
| 47 | /* FUNCTION RELEASE */ | ||
| 48 | /* */ | ||
| 49 | /* _fx_unicode_length_get PORTABLE C */ | ||
| 50 | /* 6.1 */ | ||
| 51 | /* AUTHOR */ | ||
| 52 | /* */ | ||
| 53 | /* William E. Lamie, Microsoft Corporation */ | ||
| 54 | /* */ | ||
| 55 | /* DESCRIPTION */ | ||
| 56 | /* */ | ||
| 57 | /* This function returns the length of the supplied unicode name. */ | ||
| 58 | /* */ | ||
| 59 | /* DEPRECATED. Use fx_unicode_length_get_extended() instead, passing */ | ||
| 60 | /* the actual buffer length. It takes no buffer length and scans */ | ||
| 61 | /* up to 256 bytes whatever the size of the actual buffer, risking an */ | ||
| 62 | /* over-read. */ | ||
| 63 | /* */ | ||
| 64 | /* INPUT */ | ||
| 65 | /* */ | ||
| 66 | /* unicode_name Pointer to unicode name */ | ||
| 67 | /* */ | ||
| 68 | /* OUTPUT */ | ||
| 69 | /* */ | ||
| 70 | /* length */ | ||
| 71 | /* */ | ||
| 72 | /* CALLS */ | ||
| 73 | /* */ | ||
| 74 | /* _fx_unicode_length_get_extended Actual unicode length get */ | ||
| 75 | /* service */ | ||
| 76 | /* */ | ||
| 77 | /* CALLED BY */ | ||
| 78 | /* */ | ||
| 79 | /* Application Code */ | ||
| 80 | /* */ | ||
| 81 | /**************************************************************************/ | ||
| 82 | 5316 | ULONG _fx_unicode_length_get(UCHAR *unicode_name) | |
| 83 | { | ||
| 84 | |||
| 85 | /* Call the extended version with 256 bytes maximum buffer length. */ | ||
| 86 | 5316 | return(_fx_unicode_length_get_extended(unicode_name, 256)); | |
| 87 | } | ||
| 88 | |||
| 89 |