|
23 | 23 | #define MAX_ARRAY_RANK 16 |
24 | 24 | #define NLOG_HEADER_ID 101 |
25 | 25 |
|
26 | | -static bool uint8_array_try_string(const struct telemetry_log *tl, |
27 | | - uint64_t offset_bit, uint32_t size_bit, |
28 | | - uint32_t array_size, |
29 | | - struct json_object **str_obj) |
30 | | -{ |
31 | | - uint32_t offset_byte = (uint32_t)offset_bit / NUM_BITS_IN_BYTE; |
32 | | - |
33 | | - if (size_bit != 8) { |
34 | | - *str_obj = json_object_new_string( |
35 | | - "Error: Only UINT8 arrays can be converted to strings"); |
36 | | - return false; |
37 | | - } |
38 | | - |
39 | | - if (offset_byte > (tl->log_size - array_size)) { |
40 | | - char err_msg[MAX_WARNING_SIZE]; |
41 | | - |
42 | | - snprintf(err_msg, MAX_WARNING_SIZE, |
43 | | - "String offset greater than binary size (%u > %zu).", |
44 | | - offset_byte, tl->log_size); |
45 | | - *str_obj = json_object_new_string(err_msg); |
46 | | - return false; |
47 | | - } |
48 | | - |
49 | | - // Get direct pointer to the UINT8 array in the telemetry log |
50 | | - const uint8_t *data_ptr = (const uint8_t *)tl->log + offset_byte; |
51 | | - |
52 | | - // Use the generic converter function |
53 | | - return sldm_uint8_array_to_string(data_ptr, array_size, str_obj); |
54 | | -} |
55 | | - |
56 | 26 | static void reverse_string(char *buff, size_t len) |
57 | 27 | { |
58 | 28 | char *start = buff; |
@@ -298,23 +268,6 @@ int sldm_telemetry_structure_parse(const struct telemetry_log *tl, |
298 | 268 | sub_output = output; |
299 | 269 |
|
300 | 270 | if (array_size_dimension[0] > 1 || force_array) { |
301 | | - // Check if this is a UINT8 array that should be treated as a string |
302 | | - if (json_object_is_type(output, json_type_object) && |
303 | | - (strcmp(type, "UINT8") == 0 || strcmp(type, "uint8_t") == 0) && !force_array) { |
304 | | - // Handle UINT8 arrays as strings |
305 | | - struct json_object *str_obj = NULL; |
306 | | - uint64_t offset = parent_offset_bit + offset_bit; |
307 | | - |
308 | | - if (uint8_array_try_string(tl, offset, size_bit, |
309 | | - array_size_dimension[0], &str_obj)) { |
310 | | - json_object_object_add(output, name, str_obj); |
311 | | - return 0; |
312 | | - } |
313 | | - |
314 | | - // If string conversion failed, fall back to normal array processing |
315 | | - json_object_put(str_obj); |
316 | | - } |
317 | | - |
318 | 271 | /* |
319 | 272 | * When output is already an array (from an outer |
320 | 273 | * multi-dim call), fill it directly to avoid extra wrap. |
|
0 commit comments