1 /**************************************************************************/
2 /*                                                                        */
3 /*       Copyright (c) Microsoft Corporation. All rights reserved.        */
4 /*                                                                        */
5 /*       This software is licensed under the Microsoft Software License   */
6 /*       Terms for Microsoft Azure RTOS. Full text of the license can be  */
7 /*       found in the LICENSE file at https://aka.ms/AzureRTOS_EULA       */
8 /*       and in the root directory of this software.                      */
9 /*                                                                        */
10 /**************************************************************************/
11 
12 
13 /**************************************************************************/
14 /**************************************************************************/
15 /**                                                                       */
16 /** USBX Component                                                        */
17 /**                                                                       */
18 /**   Pictbridge Application                                              */
19 /**                                                                       */
20 /**************************************************************************/
21 /**************************************************************************/
22 
23 
24 /* Include necessary system files.  */
25 
26 #define UX_SOURCE_CODE
27 
28 #include "ux_api.h"
29 #include "ux_pictbridge.h"
30 
31 
32 /**************************************************************************/
33 /*                                                                        */
34 /*  FUNCTION                                               RELEASE        */
35 /*                                                                        */
36 /*    _ux_pictbridge_xml_function_input_startjob_printinfo_filepath       */
37 /*                                                        PORTABLE C      */
38 /*                                                           6.1          */
39 /*                                                                        */
40 /*                                                                        */
41 /*  AUTHOR                                                                */
42 /*                                                                        */
43 /*    Chaoqiong Xiao, Microsoft Corporation                               */
44 /*                                                                        */
45 /*  DESCRIPTION                                                           */
46 /*                                                                        */
47 /*    This function decodes the "filepath" tag                            */
48 /*                                                                        */
49 /*  INPUT                                                                 */
50 /*                                                                        */
51 /*    pictbridge                             Pictbridge instance          */
52 /*    input_variable                         Pointer to variable          */
53 /*    input_string                           Pointer to string            */
54 /*    xml_parameter                          XML parameter                */
55 /*                                                                        */
56 /*  OUTPUT                                                                */
57 /*                                                                        */
58 /*    Completion Status                                                   */
59 /*                                                                        */
60 /*  CALLS                                                                 */
61 /*                                                                        */
62 /*                                                                        */
63 /*  CALLED BY                                                             */
64 /*                                                                        */
65 /*    _ux_pictbridge_object_parse                                         */
66 /*                                                                        */
67 /*  RELEASE HISTORY                                                       */
68 /*                                                                        */
69 /*    DATE              NAME                      DESCRIPTION             */
70 /*                                                                        */
71 /*  05-19-2020     Chaoqiong Xiao           Initial Version 6.0           */
72 /*  09-30-2020     Chaoqiong Xiao           Modified comment(s),          */
73 /*                                            verified memset and memcpy  */
74 /*                                            cases,                      */
75 /*                                            resulting in version 6.1    */
76 /*                                                                        */
77 /**************************************************************************/
_ux_pictbridge_xml_function_input_startjob_printinfo_filepath(UX_PICTBRIDGE * pictbridge,UCHAR * input_variable,UCHAR * input_string,UCHAR * xml_parameter)78 UINT  _ux_pictbridge_xml_function_input_startjob_printinfo_filepath(UX_PICTBRIDGE *pictbridge,
79                             UCHAR *input_variable, UCHAR *input_string, UCHAR *xml_parameter)
80 {
81 UINT    status;
82 UINT    length = 0;
83 
84     UX_PARAMETER_NOT_USED(input_string);
85     UX_PARAMETER_NOT_USED(input_variable);
86 
87     /* Get the length of the parameter. */
88     status = _ux_utility_string_length_check(xml_parameter, &length, UX_PICTBRIDGE_MAX_STRING_SIZE);
89     if (status != UX_SUCCESS)
90         return(status);
91 
92     /* Ensure the length is non zero, otherwise that means the tag has no parameter.  */
93     if (length == 0)
94 
95         /* That's a syntax error.  */
96         return(UX_PICTBRIDGE_ERROR_SCRIPT_SYNTAX_ERROR);
97 
98     /* We need to copy the filepath.  */
99     _ux_utility_memory_copy(pictbridge -> ux_pictbridge_jobinfo.ux_pictbridge_jobinfo_printinfo_current -> ux_pictbridge_printinfo_filepath,
100                             xml_parameter, length); /* Use case of memcpy is verified. */
101 
102     /* Operation is successful.  */
103     return(UX_SUCCESS);
104 
105 }
106 
107 
108