GCC Code Coverage Report


Directory: common/src/
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 100.0% 6 / 0 / 6
Functions: 100.0% 1 / 0 / 1
Branches: 100.0% 12 / 0 / 12

fxe_file_read.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
13 /**************************************************************************/
14 /**************************************************************************/
15 /** */
16 /** FileX Component */
17 /** */
18 /** File */
19 /** */
20 /**************************************************************************/
21 /**************************************************************************/
22
23 #define FX_SOURCE_CODE
24
25
26 /* Include necessary system files. */
27
28 #include "fx_api.h"
29 #include "fx_file.h"
30
31 FX_CALLER_CHECKING_EXTERNS
32
33
34 /**************************************************************************/
35 /* */
36 /* FUNCTION RELEASE */
37 /* */
38 /* _fxe_file_read PORTABLE C */
39 /* 6.1 */
40 /* AUTHOR */
41 /* */
42 /* William E. Lamie, Microsoft Corporation */
43 /* */
44 /* DESCRIPTION */
45 /* */
46 /* This function checks for errors in the read file call. */
47 /* */
48 /* INPUT */
49 /* */
50 /* file_ptr File control block pointer */
51 /* buffer_ptr Buffer pointer */
52 /* request_size Number of bytes requested */
53 /* actual_size Pointer to variable for the */
54 /* number of bytes read */
55 /* */
56 /* OUTPUT */
57 /* */
58 /* return status */
59 /* */
60 /* CALLS */
61 /* */
62 /* _fx_file_read Actual file read service */
63 /* */
64 /* CALLED BY */
65 /* */
66 /* Application Code */
67 /* */
68 /**************************************************************************/
69 158349312 UINT _fxe_file_read(FX_FILE *file_ptr, VOID *buffer_ptr, ULONG request_size, ULONG *actual_size)
70 {
71
72 UINT status;
73
74
75 /* Check for a null file or buffer pointer. */
76
6/6
✓ Branch 2 → 3 taken 158349304 times.
✓ Branch 2 → 5 taken 8 times.
✓ Branch 3 → 4 taken 158348614 times.
✓ Branch 3 → 5 taken 690 times.
✓ Branch 4 → 5 taken 690 times.
✓ Branch 4 → 6 taken 158347924 times.
158349312 if ((file_ptr == FX_NULL) || (buffer_ptr == FX_NULL) || (actual_size == FX_NULL))
77 {
78 1388 return(FX_PTR_ERROR);
79 }
80
81 /* Check for a valid caller. */
82
6/6
✓ Branch 6 → 7 taken 80874800 times.
✓ Branch 6 → 9 taken 690 times.
✓ Branch 7 → 8 taken 80874110 times.
✓ Branch 7 → 9 taken 690 times.
✓ Branch 8 → 9 taken 690 times.
✓ Branch 8 → 10 taken 80873420 times.
80875490 FX_CALLER_CHECKING_CODE
83
84 /* Call actual file read service. */
85 158345854 status = _fx_file_read(file_ptr, buffer_ptr, request_size, actual_size);
86
87 /* Return status to the caller. */
88 158345851 return(status);
89 }
90
91