From b6e72ef8e1d5cfa6f6074172709b6e5f56b28c9d Mon Sep 17 00:00:00 2001 From: Peter Veenstra Date: Fri, 23 Mar 2007 08:27:39 +0000 Subject: [PATCH] Zero pad the correct buffer. Fixes cyrus chess. Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@2833 --- src/dos/dos_files.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/dos/dos_files.cpp b/src/dos/dos_files.cpp index 86d449f8..746b0b03 100644 --- a/src/dos/dos_files.cpp +++ b/src/dos/dos_files.cpp @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: dos_files.cpp,v 1.81 2007-01-08 21:20:23 qbix79 Exp $ */ +/* $Id: dos_files.cpp,v 1.82 2007-03-23 08:27:39 qbix79 Exp $ */ #include #include @@ -878,10 +878,9 @@ Bit8u DOS_FCBRead(Bit16u seg,Bit16u offset,Bit16u recno) { Bit16u toread=rec_size; if (!DOS_ReadFile(fhandle,dos_copybuf,&toread)) return FCB_READ_NODATA; if (toread==0) return FCB_READ_NODATA; - if (toread0;i--) mem_writeb(fill++,0); + if (toread < rec_size) { //Zero pad copybuffer to rec_size + Bitu i = toread; + while(i < rec_size) dos_copybuf[i++] = 0; } MEM_BlockWrite(Real2Phys(dos.dta())+recno*rec_size,dos_copybuf,rec_size); if (++cur_rec>127) { cur_block++;cur_rec=0; } @@ -927,6 +926,10 @@ Bit8u DOS_FCBRandomRead(Bit16u seg,Bit16u offset,Bit16u numRec,bool restore) { * random read updates old block and old record to reflect the random data * before the read!!!!!!!!! and the random data is not updated! (user must do this) * Random block read updates these fields to reflect the state after the read! + */ + +/* BUG: numRec should return the amount of records read! + * Not implemented yet as I'm unsure how to count on error states (partial/failed) */ DOS_FCB fcb(seg,offset);