Changed parser function signature

This commit is contained in:
Pünkösd Marcell 2020-11-06 03:42:48 +01:00
parent 07d311628f
commit 45f1705168
2 changed files with 7 additions and 6 deletions

View File

@ -62,14 +62,14 @@ uint8_t validate_ciff(const uint8_t* data, uint64_t data_len) {
return CIFF_PARSE_SUCCESS; return CIFF_PARSE_SUCCESS;
} }
uint8_t get_pixel_data_from_ciff(const uint8_t* data, uint64_t data_len, uint64_t* width, uint64_t* height, uint64_t* pixel_data_starts) { uint8_t parse_ciff_get_pixel_data(const uint8_t* data, uint64_t data_len, uint8_t** pixel_data_ptr, uint64_t *pixel_data_len, uint64_t* width, uint64_t* height) {
/** /**
* Ez csak visszad egy pointert, hogy honnan kezdődik a pixel data, miután validálta a képet * Ez csak visszad egy pointert, hogy honnan kezdődik a pixel data, miután validálta a képet
*/ */
uint8_t validate_result = validate_ciff(data, data_len); uint8_t result = validate_ciff(data, data_len);
if (validate_result != CIFF_PARSE_SUCCESS) { if (result != CIFF_PARSE_SUCCESS) {
return validate_result; return result;
} }
ciff_static_header_t* header_info = (ciff_static_header_t*)data; // This is just a pointer with different type information ciff_static_header_t* header_info = (ciff_static_header_t*)data; // This is just a pointer with different type information
@ -77,7 +77,8 @@ uint8_t get_pixel_data_from_ciff(const uint8_t* data, uint64_t data_len, uint64_
// Set return data // Set return data
*width = header_info->width; *width = header_info->width;
*height = header_info->height; *height = header_info->height;
*pixel_data_starts = header_info->header_size; *pixel_data_ptr = ((uint8_t*)data) + (header_info->header_size);
*pixel_data_len = header_info->content_size;
return CIFF_PARSE_SUCCESS; return CIFF_PARSE_SUCCESS;
} }

View File

@ -25,6 +25,6 @@ typedef struct __attribute__ ((packed)) ciff_static_header_t {
} ciff_static_header_t; } ciff_static_header_t;
uint8_t validate_ciff(const uint8_t* data, uint64_t data_len); uint8_t validate_ciff(const uint8_t* data, uint64_t data_len);
uint8_t get_pixel_data_from_ciff(const uint8_t* data, uint64_t data_len, uint64_t* width, uint64_t* height, uint64_t* pixel_data_starts); uint8_t parse_ciff_get_pixel_data(const uint8_t* data, uint64_t data_len, uint8_t** pixel_data_ptr, uint64_t *pixel_data_len, uint64_t* width, uint64_t* height);
#endif //CAFF_PREVIEWER_CIFF_TOOLS_H #endif //CAFF_PREVIEWER_CIFF_TOOLS_H