3b2: Fix coverity issues
This commit is contained in:
parent
0de9b62850
commit
0f72a160fe
2 changed files with 14 additions and 11 deletions
|
@ -264,7 +264,7 @@ static void ctc_cmd(uint8 cid,
|
|||
uint32 vtoc_addr, pdinfo_addr, ctjob_addr;
|
||||
uint32 maxpass, blkno, delay, last_byte;
|
||||
uint8 dev, c;
|
||||
uint8 sec_buf[512];
|
||||
uint8 sec_buf[VTOC_SECSZ];
|
||||
int32 b, i, j;
|
||||
int32 block_count, read_bytes, remainder, dest;
|
||||
t_seccnt secrw = 0;
|
||||
|
@ -497,11 +497,11 @@ static void ctc_cmd(uint8 cid,
|
|||
|
||||
blkno = ATOW(rapp_data, 0);
|
||||
|
||||
for (b = 0; b < rqe->byte_count / 512; b++) {
|
||||
for (b = 0; b < rqe->byte_count / VTOC_SECSZ; b++) {
|
||||
ctc_state[dev].time += 10;
|
||||
for (j = 0; j < 512; j++) {
|
||||
for (j = 0; j < VTOC_SECSZ; j++) {
|
||||
/* Fill the buffer */
|
||||
sec_buf[j] = pread_b(rqe->address + (b * 512) + j);
|
||||
sec_buf[j] = pread_b(rqe->address + (b * VTOC_SECSZ) + j);
|
||||
}
|
||||
lba = blkno + b;
|
||||
result = sim_disk_wrsect(&ctc_unit, lba, sec_buf, &secrw, 1);
|
||||
|
@ -559,13 +559,13 @@ static void ctc_cmd(uint8 cid,
|
|||
* to be read, and use that to figure out how many bytes will
|
||||
* be left over to read from an "extra" block */
|
||||
last_byte = ctc_state[dev].bytnum + rqe->byte_count;
|
||||
remainder = last_byte % 512;
|
||||
remainder = last_byte % VTOC_SECSZ;
|
||||
|
||||
/* The number of blocks we have to read in total is computed
|
||||
* by looking at the byte count, PLUS any remainder that will
|
||||
* be left after crossing a block boundary */
|
||||
block_count = rqe->byte_count / 512;
|
||||
if (((rqe->byte_count % 512) > 0 || remainder > 0)) {
|
||||
block_count = rqe->byte_count / VTOC_SECSZ;
|
||||
if (((rqe->byte_count % VTOC_SECSZ) > 0 || remainder > 0)) {
|
||||
block_count++;
|
||||
}
|
||||
|
||||
|
@ -575,7 +575,7 @@ static void ctc_cmd(uint8 cid,
|
|||
uint32 start_byte;
|
||||
/* Add some read time to the read time counter */
|
||||
ctc_state[dev].time += 10;
|
||||
start_byte = ctc_state[dev].bytnum % 512;
|
||||
start_byte = ctc_state[dev].bytnum % VTOC_SECSZ;
|
||||
lba = blkno + b;
|
||||
result = sim_disk_rdsect(&ctc_unit, lba, sec_buf, &secrw, 1);
|
||||
if (result == SCPE_OK) {
|
||||
|
@ -585,12 +585,14 @@ static void ctc_cmd(uint8 cid,
|
|||
if (b == (block_count - 1) && remainder > 0) {
|
||||
read_bytes = remainder;
|
||||
} else {
|
||||
read_bytes = 512 - start_byte;
|
||||
read_bytes = VTOC_SECSZ - start_byte;
|
||||
}
|
||||
for (j = 0; j < read_bytes; j++) {
|
||||
uint32 offset;
|
||||
/* Drain the buffer */
|
||||
if (b == 0 && start_byte != 0) {
|
||||
if (b == 0 &&
|
||||
start_byte > 0 &&
|
||||
(j + start_byte) < VTOC_SECSZ) {
|
||||
/* This is a partial read of the first block,
|
||||
* continuing to read from a previous partial
|
||||
* block read. */
|
||||
|
@ -783,7 +785,7 @@ t_stat ctc_svc(UNIT *uptr)
|
|||
|
||||
t_stat ctc_attach(UNIT *uptr, CONST char *cptr)
|
||||
{
|
||||
return sim_disk_attach(uptr, cptr, 512, 1, TRUE, 0, "CIPHER23", 0, 0);
|
||||
return sim_disk_attach(uptr, cptr, VTOC_SECSZ, 1, TRUE, 0, "CIPHER23", 0, 0);
|
||||
}
|
||||
|
||||
t_stat ctc_detach(UNIT *uptr)
|
||||
|
|
|
@ -215,6 +215,7 @@
|
|||
#define PACK_XFP(SIGN,EXP,FRAC,V) do { \
|
||||
(V)->frac = (FRAC); \
|
||||
(V)->sign_exp = ((uint16)(SIGN) << 15) + (EXP); \
|
||||
(V)->s = FALSE; \
|
||||
} while (0)
|
||||
|
||||
#define PACK_XFP_S(SIGN,EXP,FRAC,S,V) do { \
|
||||
|
|
Loading…
Add table
Reference in a new issue