mirror of https://github.com/FDOS/kernel.git
Add necessary casts to ? : constructions; cleanup read_line_handle a little.
git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@673 6ac86273-5f31-0410-b378-82cca8765d1b
This commit is contained in:
parent
b88881b8a0
commit
1266a13f7f
|
@ -72,7 +72,7 @@ long BinaryCharIO(struct dhdr FAR * dev, size_t n, void FAR * bp, unsigned comma
|
||||||
CharReqHdr.r_count = n;
|
CharReqHdr.r_count = n;
|
||||||
CharReqHdr.r_trans = bp;
|
CharReqHdr.r_trans = bp;
|
||||||
} while ((err = CharRequest(dev)) == 1);
|
} while ((err = CharRequest(dev)) == 1);
|
||||||
return err == SUCCESS ? CharReqHdr.r_count : err;
|
return err == SUCCESS ? (long)CharReqHdr.r_count : err;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* STATE FUNCTIONS */
|
/* STATE FUNCTIONS */
|
||||||
|
@ -256,7 +256,7 @@ long cooked_write(int sft_idx, size_t n, char FAR *bp)
|
||||||
|
|
||||||
for (xfer = 0; err >= SUCCESS && xfer < n && *bp != CTL_Z; bp++, xfer++)
|
for (xfer = 0; err >= SUCCESS && xfer < n && *bp != CTL_Z; bp++, xfer++)
|
||||||
err = cooked_put_char(sft_idx, *bp);
|
err = cooked_put_char(sft_idx, *bp);
|
||||||
return err < SUCCESS ? err : xfer;
|
return err < SUCCESS ? (long)err : xfer;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* writes character for disk file or device */
|
/* writes character for disk file or device */
|
||||||
|
@ -513,7 +513,7 @@ void read_line(int sft_in, int sft_out, keyboard FAR * kp)
|
||||||
/* called by handle func READ (int21/ah=3f) */
|
/* called by handle func READ (int21/ah=3f) */
|
||||||
size_t read_line_handle(int sft_idx, size_t n, char FAR * bp)
|
size_t read_line_handle(int sft_idx, size_t n, char FAR * bp)
|
||||||
{
|
{
|
||||||
char *bufend = &kb_buf.kb_buf[kb_buf.kb_count + 2];
|
size_t chars_left;
|
||||||
|
|
||||||
if (inputptr == NULL)
|
if (inputptr == NULL)
|
||||||
{
|
{
|
||||||
|
@ -524,8 +524,7 @@ size_t read_line_handle(int sft_idx, size_t n, char FAR * bp)
|
||||||
kb_buf.kb_size = LINEBUFSIZECON;
|
kb_buf.kb_size = LINEBUFSIZECON;
|
||||||
}
|
}
|
||||||
read_line(sft_idx, sft_idx, &kb_buf);
|
read_line(sft_idx, sft_idx, &kb_buf);
|
||||||
bufend = &kb_buf.kb_buf[kb_buf.kb_count + 2];
|
kb_buf.kb_buf[kb_buf.kb_count + 1] = echo_char(LF, sft_idx);
|
||||||
bufend[-1] = echo_char(LF, sft_idx);
|
|
||||||
inputptr = kb_buf.kb_buf;
|
inputptr = kb_buf.kb_buf;
|
||||||
if (*inputptr == CTL_Z)
|
if (*inputptr == CTL_Z)
|
||||||
{
|
{
|
||||||
|
@ -534,12 +533,13 @@ size_t read_line_handle(int sft_idx, size_t n, char FAR * bp)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (n > bufend - inputptr)
|
chars_left = &kb_buf.kb_buf[kb_buf.kb_count + 2] - inputptr;
|
||||||
n = bufend - inputptr;
|
if (n > chars_left)
|
||||||
|
n = chars_left;
|
||||||
|
|
||||||
fmemcpy(bp, inputptr, n);
|
fmemcpy(bp, inputptr, n);
|
||||||
inputptr += n;
|
inputptr += n;
|
||||||
if (inputptr == bufend)
|
if (n == chars_left)
|
||||||
inputptr = NULL;
|
inputptr = NULL;
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
|
@ -224,7 +224,7 @@ long DosRWSft(int sft_idx, size_t n, void FAR * bp, int mode)
|
||||||
dta = bp;
|
dta = bp;
|
||||||
XferCount = (mode == XFR_READ ? remote_read : remote_write)(s, n, &err);
|
XferCount = (mode == XFR_READ ? remote_read : remote_write)(s, n, &err);
|
||||||
dta = save_dta;
|
dta = save_dta;
|
||||||
return err == SUCCESS ? XferCount : err;
|
return err == SUCCESS ? (long)XferCount : err;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Do a device transfer if device */
|
/* Do a device transfer if device */
|
||||||
|
|
Loading…
Reference in New Issue