Skip to content

Commit

Permalink
Fix compilation of LIRC client with updated clang.
Browse files Browse the repository at this point in the history
It refuses to compile arrays of variable length. Using malloc instead
  • Loading branch information
jyavenard committed Feb 16, 2013
1 parent c22bdae commit b966c2b
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions mythtv/libs/libmythui/lirc_client.c
Expand Up @@ -1679,7 +1679,9 @@ int lirc_code2char(const struct lirc_state *state, struct lirc_config *config,ch
{
if(config->sockfd!=-1)
{
char command[10+strlen(code)+1+1];
char* command = malloc((10+strlen(code)+1+1) * sizeof(char));
if (command == NULL)
return LIRC_RET_ERROR;
static char buf[LIRC_PACKET_SIZE];
size_t buf_len = LIRC_PACKET_SIZE;
int success;
Expand All @@ -1699,8 +1701,10 @@ int lirc_code2char(const struct lirc_state *state, struct lirc_config *config,ch
{
*string = NULL;
}
free(command);
return LIRC_RET_SUCCESS;
}
free(command);
return LIRC_RET_ERROR;
}
return lirc_code2char_internal(state, config, code, string, NULL);
Expand Down Expand Up @@ -2179,11 +2183,14 @@ int lirc_send_command(const struct lirc_state *lstate, int sockfd, const char *c

int lirc_identify(const struct lirc_state *state, int sockfd)
{
char command[10+strlen(state->lirc_prog)+1+1];
char* command = malloc((10+strlen(state->lirc_prog)+1+1) * sizeof(char));
if (command == NULL)
return LIRC_RET_ERROR;
int success;

sprintf(command, "IDENT %s\n", state->lirc_prog);

(void) lirc_send_command(state, sockfd, command, NULL, NULL, &success);
free(command);
return success;
}

0 comments on commit b966c2b

Please sign in to comment.