power: Fix power hal compiler warnings
Bug: 30432975 Test: compile power hal for walleye without warnings Change-Id: I0d90c26462c662690f8a179250000b9a449a109f Signed-off-by: Arian <arian.kulmer@web.de>
This commit is contained in:
committed by
Michael Bestas
parent
48bfafcf39
commit
d12031bf27
@@ -27,6 +27,9 @@
|
|||||||
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#define LOG_TAG "QTI PowerHAL"
|
||||||
|
#include <log/log.h>
|
||||||
|
|
||||||
#include "hint-data.h"
|
#include "hint-data.h"
|
||||||
|
|
||||||
int hint_compare(struct hint_data* first_hint, struct hint_data* other_hint) {
|
int hint_compare(struct hint_data* first_hint, struct hint_data* other_hint) {
|
||||||
@@ -40,5 +43,5 @@ int hint_compare(struct hint_data* first_hint, struct hint_data* other_hint) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void hint_dump(struct hint_data* hint) {
|
void hint_dump(struct hint_data* hint) {
|
||||||
/*ALOGI("hint_id: %lu", hint->hint_id);*/
|
ALOGV("hint_id: %lu", hint->hint_id);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,8 +46,8 @@ struct video_decode_metadata_t {
|
|||||||
int state;
|
int state;
|
||||||
};
|
};
|
||||||
|
|
||||||
int parse_metadata(char* metadata, char** metadata_saveptr, char* attribute, int attribute_size,
|
int parse_metadata(char* metadata, char** metadata_saveptr, char* attribute,
|
||||||
char* value, int value_size);
|
unsigned int attribute_size, char* value, unsigned int value_size);
|
||||||
int parse_video_encode_metadata(char* metadata,
|
int parse_video_encode_metadata(char* metadata,
|
||||||
struct video_encode_metadata_t* video_encode_metadata);
|
struct video_encode_metadata_t* video_encode_metadata);
|
||||||
int parse_video_decode_metadata(char* metadata,
|
int parse_video_decode_metadata(char* metadata,
|
||||||
|
|||||||
@@ -33,8 +33,8 @@
|
|||||||
|
|
||||||
#include "metadata-defs.h"
|
#include "metadata-defs.h"
|
||||||
|
|
||||||
int parse_metadata(char* metadata, char** metadata_saveptr, char* attribute, int attribute_size,
|
int parse_metadata(char* metadata, char** metadata_saveptr, char* attribute,
|
||||||
char* value, int value_size) {
|
unsigned int attribute_size, char* value, unsigned int value_size) {
|
||||||
char* attribute_string;
|
char* attribute_string;
|
||||||
char* attribute_value_delim;
|
char* attribute_value_delim;
|
||||||
unsigned int bytes_to_copy;
|
unsigned int bytes_to_copy;
|
||||||
@@ -46,15 +46,12 @@ int parse_metadata(char* metadata, char** metadata_saveptr, char* attribute, int
|
|||||||
attribute[0] = value[0] = '\0';
|
attribute[0] = value[0] = '\0';
|
||||||
|
|
||||||
if ((attribute_value_delim = strchr(attribute_string, ATTRIBUTE_VALUE_DELIM)) != NULL) {
|
if ((attribute_value_delim = strchr(attribute_string, ATTRIBUTE_VALUE_DELIM)) != NULL) {
|
||||||
bytes_to_copy = MIN((attribute_value_delim - attribute_string), attribute_size - 1);
|
unsigned int attribute_len = (unsigned int)(attribute_value_delim - attribute_string);
|
||||||
/* Replace strncpy with strlcpy
|
/* copy only attribute len + NUL character, or as much as can be fit */
|
||||||
* Add +1 to bytes_to_copy as strlcpy copies size-1 bytes */
|
bytes_to_copy = MIN(attribute_len + 1, attribute_size);
|
||||||
strlcpy(attribute, attribute_string, bytes_to_copy + 1);
|
|
||||||
|
|
||||||
bytes_to_copy = MIN(strlen(attribute_string) - strlen(attribute) - 1, value_size - 1);
|
strlcpy(attribute, attribute_string, bytes_to_copy);
|
||||||
/* Replace strncpy with strlcpy
|
strlcpy(value, attribute_value_delim + 1, value_size);
|
||||||
* Add +1 to bytes_to_copy as strlcpy copies size-1 bytes */
|
|
||||||
strlcpy(value, attribute_value_delim + 1, bytes_to_copy + 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return METADATA_PARSING_CONTINUE;
|
return METADATA_PARSING_CONTINUE;
|
||||||
|
|||||||
Reference in New Issue
Block a user