common: rename getc() to getchar()

The sandbox is built with the SDL2 library with invokes the X11 library
which in turn calls getc(). But getc() in glibc is defined as

    int getc(FILE *)

This does not match our definition.

    int getc(void)

The sandbox crashes when called with parameter -l.

Rename our library symbol getc() to getchar().

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Heinrich Schuchardt
2020-10-07 18:11:48 +02:00
committed by Tom Rini
parent 8d5d97cb28
commit c670aeee3d
17 changed files with 58 additions and 58 deletions

View File

@@ -81,7 +81,7 @@ static int do_load_serial(struct cmd_tbl *cmdtp, int flag, int argc,
serial_setbrg();
udelay(50000);
for (;;) {
if (getc() == '\r')
if (getchar() == '\r')
break;
}
}
@@ -102,7 +102,7 @@ static int do_load_serial(struct cmd_tbl *cmdtp, int flag, int argc,
*/
for (i=0; i<100; ++i) {
if (tstc()) {
(void) getc();
getchar();
}
udelay(1000);
}
@@ -124,7 +124,7 @@ static int do_load_serial(struct cmd_tbl *cmdtp, int flag, int argc,
serial_setbrg();
udelay(50000);
for (;;) {
if (getc() == 0x1B) /* ESC */
if (getchar() == 0x1B) /* ESC */
break;
}
}
@@ -212,7 +212,7 @@ static int read_record(char *buf, ulong len)
--len; /* always leave room for terminating '\0' byte */
for (p=buf; p < buf+len; ++p) {
c = getc(); /* read character */
c = getchar(); /* read character */
if (do_echo)
putc(c); /* ... and echo it */
@@ -229,7 +229,7 @@ static int read_record(char *buf, ulong len)
}
/* Check for the console hangup (if any different from serial) */
if (gd->jt->getc != getc) {
if (gd->jt->getc != getchar) {
if (ctrlc()) {
return (-1);
}
@@ -276,7 +276,7 @@ int do_save_serial(struct cmd_tbl *cmdtp, int flag, int argc,
serial_setbrg();
udelay(50000);
for (;;) {
if (getc() == '\r')
if (getchar() == '\r')
break;
}
}
@@ -288,7 +288,7 @@ int do_save_serial(struct cmd_tbl *cmdtp, int flag, int argc,
printf("## Ready for S-Record upload, press ENTER to proceed ...\n");
for (;;) {
if (getc() == '\r')
if (getchar() == '\r')
break;
}
if (save_serial(offset, size)) {
@@ -305,7 +305,7 @@ int do_save_serial(struct cmd_tbl *cmdtp, int flag, int argc,
serial_setbrg();
udelay(50000);
for (;;) {
if (getc() == 0x1B) /* ESC */
if (getchar() == 0x1B) /* ESC */
break;
}
}
@@ -459,7 +459,7 @@ static int do_load_serial_bin(struct cmd_tbl *cmdtp, int flag, int argc,
serial_setbrg();
udelay(50000);
for (;;) {
if (getc() == '\r')
if (getchar() == '\r')
break;
}
}
@@ -505,7 +505,7 @@ static int do_load_serial_bin(struct cmd_tbl *cmdtp, int flag, int argc,
serial_setbrg();
udelay(50000);
for (;;) {
if (getc() == 0x1B) /* ESC */
if (getchar() == 0x1B) /* ESC */
break;
}
}
@@ -528,7 +528,7 @@ static ulong load_serial_bin(ulong offset)
*/
for (i=0; i<100; ++i) {
if (tstc()) {
(void) getc();
getchar();
}
udelay(1000);
}
@@ -831,7 +831,7 @@ static int k_recv(void)
/* get a packet */
/* wait for the starting character or ^C */
for (;;) {
switch (getc ()) {
switch (getchar()) {
case START_CHAR: /* start packet */
goto START;
case ETX_CHAR: /* ^C waiting for packet */
@@ -843,13 +843,13 @@ static int k_recv(void)
START:
/* get length of packet */
sum = 0;
new_char = getc();
new_char = getchar();
if ((new_char & 0xE0) == 0)
goto packet_error;
sum += new_char & 0xff;
length = untochar(new_char);
/* get sequence number */
new_char = getc();
new_char = getchar();
if ((new_char & 0xE0) == 0)
goto packet_error;
sum += new_char & 0xff;
@@ -876,7 +876,7 @@ START:
/* END NEW CODE */
/* get packet type */
new_char = getc();
new_char = getchar();
if ((new_char & 0xE0) == 0)
goto packet_error;
sum += new_char & 0xff;
@@ -886,19 +886,19 @@ START:
if (length == -2) {
/* (length byte was 0, decremented twice) */
/* get the two length bytes */
new_char = getc();
new_char = getchar();
if ((new_char & 0xE0) == 0)
goto packet_error;
sum += new_char & 0xff;
len_hi = untochar(new_char);
new_char = getc();
new_char = getchar();
if ((new_char & 0xE0) == 0)
goto packet_error;
sum += new_char & 0xff;
len_lo = untochar(new_char);
length = len_hi * 95 + len_lo;
/* check header checksum */
new_char = getc();
new_char = getchar();
if ((new_char & 0xE0) == 0)
goto packet_error;
if (new_char != tochar((sum + ((sum >> 6) & 0x03)) & 0x3f))
@@ -908,7 +908,7 @@ START:
}
/* bring in rest of packet */
while (length > 1) {
new_char = getc();
new_char = getchar();
if ((new_char & 0xE0) == 0)
goto packet_error;
sum += new_char & 0xff;
@@ -925,13 +925,13 @@ START:
}
}
/* get and validate checksum character */
new_char = getc();
new_char = getchar();
if ((new_char & 0xE0) == 0)
goto packet_error;
if (new_char != tochar((sum + ((sum >> 6) & 0x03)) & 0x3f))
goto packet_error;
/* get END_CHAR */
new_char = getc();
new_char = getchar();
if (new_char != END_CHAR) {
packet_error:
/* restore state machines */
@@ -955,7 +955,7 @@ START:
static int getcxmodem(void) {
if (tstc())
return (getc());
return (getchar());
return -1;
}
static ulong load_serial_ymodem(ulong offset, int mode)