fix warnings: mostly sign-compare

This commit is contained in:
Matthias Ringwald 2017-08-08 18:03:40 +02:00
parent 5e3d4d2bb3
commit 249d94cf77
10 changed files with 17 additions and 18 deletions

View File

@ -92,7 +92,7 @@ static const int16_t sine_int16[] = {
-19260, -17557, -15786, -13952, -12062, -10126, -8149, -6140, -4107, -2057,
};
static char * device_name = "A2DP Source BTstack";
static const char * device_name = "A2DP Source BTstack";
#ifdef HAVE_BTSTACK_STDIN
// mac 2011: static const char * device_addr_string = "04:0C:CE:E4:85:D3";
@ -216,7 +216,7 @@ static void produce_audio(int16_t * pcm_buffer, int num_samples){
static int a2dp_demo_fill_sbc_audio_buffer(a2dp_media_sending_context_t * context){
// perform sbc encodin
int total_num_bytes_read = 0;
int num_audio_samples_per_sbc_buffer = btstack_sbc_encoder_num_audio_frames();
unsigned int num_audio_samples_per_sbc_buffer = btstack_sbc_encoder_num_audio_frames();
while (context->samples_ready >= num_audio_samples_per_sbc_buffer
&& (context->max_media_payload_size - context->sbc_storage_count) >= btstack_sbc_encoder_sbc_buffer_length()){

View File

@ -109,7 +109,7 @@ enum STATE {INIT, W4_INQUIRY_MODE_COMPLETE, ACTIVE} ;
enum STATE state = INIT;
static void dump_supported_codecs(void){
int i;
unsigned int i;
int mSBC_skipped = 0;
printf("Supported codecs: ");
for (i = 0; i < sizeof(codecs); i++){

View File

@ -90,7 +90,7 @@ static btstack_packet_callback_registration_t hci_event_callback_registration;
char cmd;
static void dump_supported_codecs(void){
int i;
unsigned int i;
int mSBC_skipped = 0;
printf("Supported codecs: ");
for (i = 0; i < sizeof(codecs); i++){

View File

@ -235,8 +235,8 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t * even
break;
case HSP_SUBEVENT_HS_COMMAND:{
memset(hs_cmd_buffer, 0, sizeof(hs_cmd_buffer));
int cmd_length = hsp_subevent_hs_command_get_value_length(event);
int size = cmd_length <= sizeof(hs_cmd_buffer)? cmd_length : sizeof(hs_cmd_buffer);
unsigned int cmd_length = hsp_subevent_hs_command_get_value_length(event);
unsigned int size = cmd_length <= sizeof(hs_cmd_buffer)? cmd_length : sizeof(hs_cmd_buffer);
memcpy(hs_cmd_buffer, hsp_subevent_hs_command_get_value(event), size - 1);
printf("Received custom command: \"%s\". \nExit code or call hsp_ag_send_result.\n", hs_cmd_buffer);
break;

View File

@ -236,7 +236,7 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t * even
break;
case HSP_SUBEVENT_AG_INDICATION: {
memset(hs_cmd_buffer, 0, sizeof(hs_cmd_buffer));
int size = hsp_subevent_ag_indication_get_value_length(event);
unsigned int size = hsp_subevent_ag_indication_get_value_length(event);
if (size >= sizeof(hs_cmd_buffer)-1){
size = sizeof(hs_cmd_buffer)-1;
}

View File

@ -142,7 +142,7 @@ FILE * msbc_file_out;
int num_samples_to_write;
int num_audio_frames;
int phase;
unsigned int phase;
#if SCO_DEMO_MODE == SCO_DEMO_MODE_SINE
@ -161,8 +161,8 @@ static const int16_t sine_int16_at_16000hz[] = {
};
// 8 kHz samples for CVSD/SCO packets in little endian
static void sco_demo_sine_wave_int16_at_8000_hz_little_endian(int num_samples, int16_t * data){
int i;
static void sco_demo_sine_wave_int16_at_8000_hz_little_endian(unsigned int num_samples, int16_t * data){
unsigned int i;
for (i=0; i < num_samples; i++){
int16_t sample = sine_int16_at_16000hz[phase];
little_endian_store_16((uint8_t *) data, i * 2, sample);
@ -176,8 +176,8 @@ static void sco_demo_sine_wave_int16_at_8000_hz_little_endian(int num_samples, i
// 16 kHz samples for mSBC encoder in host endianess
#ifdef ENABLE_HFP_WIDE_BAND_SPEECH
static void sco_demo_sine_wave_int16_at_16000_hz_host_endian(int num_samples, int16_t * data){
int i;
static void sco_demo_sine_wave_int16_at_16000_hz_host_endian(unsigned int num_samples, int16_t * data){
unsigned int i;
for (i=0; i < num_samples; i++){
data[i] = sine_int16_at_16000hz[phase++];
if (phase >= (sizeof(sine_int16_at_16000hz) / sizeof(int16_t))){

View File

@ -8,7 +8,7 @@ COMMON += hci_transport_h2_libusb.c btstack_run_loop_posix.c le_device_db_fs.c
include ${BTSTACK_ROOT}/example/Makefile.inc
# CC = gcc-fsf-4.9
CFLAGS += -g -Wall -Wmissing-prototypes -Wstrict-prototypes -Wshadow -Werror -Wunused-parameter
CFLAGS += -g -Wall -Wmissing-prototypes -Wstrict-prototypes -Wshadow -Werror -Wunused-parameter -Wredundant-decls -Wsign-compare
# CFLAGS += -Werror
CFLAGS += -I${BTSTACK_ROOT}/platform/posix \

View File

@ -66,7 +66,6 @@ static inline uint8_t avdtp_header(uint8_t tr_label, avdtp_packet_type_t packet_
return (tr_label<<4) | ((uint8_t)packet_type<<2) | (uint8_t)msg_type;
}
uint8_t avdtp_header(uint8_t tr_label, avdtp_packet_type_t packet_type, avdtp_message_type_t msg_type);
int avdtp_read_signaling_header(avdtp_signaling_packet_t * signaling_header, uint8_t * packet, uint16_t size);
uint8_t store_bit16(uint16_t bitmap, int position, uint8_t value);

View File

@ -490,7 +490,7 @@ static void avrcp_handle_l2cap_data_packet_for_signaling_connection(avrcp_connec
case AVRCP_PDU_ID_GET_ELEMENT_ATTRIBUTES:{
uint8_t num_attributes = packet[pos++];
int i;
unsigned int i;
struct item {
uint16_t len;
uint8_t * value;

View File

@ -127,7 +127,7 @@ void btstack_sbc_decoder_test_simulate_corrupt_frames(int period){
static int find_sequence_of_zeros(const OI_BYTE *frame_data, OI_UINT32 frame_bytes, int seq_length){
int zero_seq_count = 0;
int i;
unsigned int i;
for (i=0; i<frame_bytes; i++){
if (frame_data[i] == 0) {
zero_seq_count++;
@ -144,7 +144,7 @@ static int find_h2_syncword(const OI_BYTE *frame_data, OI_UINT32 frame_bytes){
uint8_t h2_first_byte = 0;
uint8_t h2_second_byte = 0;
int i;
unsigned int i;
for (i=0; i<frame_bytes; i++){
if (frame_data[i] == syncword) {
break;
@ -340,7 +340,7 @@ static void btstack_sbc_decoder_process_msbc_data(btstack_sbc_decoder_state_t *
bludroid_decoder_state_t * decoder_state = (bludroid_decoder_state_t*)state->decoder_state;
int input_bytes_to_process = size;
int msbc_frame_size = 57;
unsigned int msbc_frame_size = 57;
// printf("<<-- enter -->>\n");
// printf("Process data: in buffer %u, new %u\n", decoder_state->bytes_in_frame_buffer, size);