forked from len0rd/rockbox
Minor bug when writing files; files weren't truncated to 0, so when
writing a file smaller than the previous one, it adds garbage to the end. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6147 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
fabdf1de6f
commit
e5b4913d19
3 changed files with 7 additions and 6 deletions
|
@ -949,7 +949,7 @@ next:
|
|||
int fd;
|
||||
blockcount++;
|
||||
snprintf(meow,499,"/dyna_0x%x_run.rb",PC);
|
||||
fd=open(meow,O_WRONLY|O_CREAT);
|
||||
fd=open(meow,O_WRONLY|O_CREAT|O_TRUNC);
|
||||
if(fd>=0) {
|
||||
fdprintf(fd,"Block 0x%x Blockcount: %d\n",PC,blockcount);
|
||||
fdprintf(fd,"before: 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x\n",
|
||||
|
|
|
@ -384,7 +384,7 @@ void dynamic_recompile (struct dynarec_block *newblock) {
|
|||
newblock->block=dynapointer;
|
||||
#ifdef DYNA_DEBUG
|
||||
snprintf(meow,499,"/dyna_0x%x_asm.rb",PC);
|
||||
fd=open(meow,O_WRONLY|O_CREAT);
|
||||
fd=open(meow,O_WRONLY|O_CREAT|O_TRUNC);
|
||||
if(fd<0) {
|
||||
die("couldn't open dyna debug file");
|
||||
return;
|
||||
|
@ -915,6 +915,7 @@ void dynamic_recompile (struct dynarec_block *newblock) {
|
|||
DYNA_BTST_l_r(8,7); /* btst #8,d7 */
|
||||
DYNA_DUMMYBRANCH(2,0);
|
||||
DYNA_MOVEA_l_i_to_r(&blockclen,3);
|
||||
DYNA_MOVE_l_i_to_m(tclen,3);
|
||||
DYNA_MOVEA_l_i_to_r(readw(PC),1);
|
||||
DYNA_RET();
|
||||
DYNA_BCC_c(0x6,2,0); /* jump here if bit is not zero */
|
||||
|
@ -974,7 +975,7 @@ void dynamic_recompile (struct dynarec_block *newblock) {
|
|||
newblock->length=dynapointer-newblock->block;
|
||||
invalidate_icache();
|
||||
snprintf(meow,499,"/dyna_0x%x_code.rb",PC);
|
||||
fd=open(meow,O_WRONLY|O_CREAT);
|
||||
fd=open(meow,O_WRONLY|O_CREAT|O_TRUNC);
|
||||
if(fd>=0) {
|
||||
write(fd,newblock->block,newblock->length);
|
||||
close(fd);
|
||||
|
|
|
@ -218,7 +218,7 @@ int sram_save(void)
|
|||
/* If we crash before we ever loaded sram, DO NOT SAVE! */
|
||||
if (!mbc.batt || !sramfile || !ram.loaded || !mbc.ramsize)
|
||||
return -1;
|
||||
fd = open(sramfile, O_WRONLY|O_CREAT);
|
||||
fd = open(sramfile, O_WRONLY|O_CREAT|O_TRUNC);
|
||||
// snprintf(meow,499,"Opening %s %d",sramfile,fd);
|
||||
// rb->splash(HZ*2, true, meow);
|
||||
if (fd<0) return -1;
|
||||
|
@ -240,7 +240,7 @@ void state_save(int n)
|
|||
if (n < 0) n = 0;
|
||||
snprintf(name, 499,"%s.%03d", saveprefix, n);
|
||||
|
||||
if ((fd = open(name, O_WRONLY|O_CREAT)>=0))
|
||||
if ((fd = open(name, O_WRONLY|O_CREAT|O_TRUNC)>=0))
|
||||
{
|
||||
savestate(fd);
|
||||
close(fd);
|
||||
|
@ -272,7 +272,7 @@ void rtc_save(void)
|
|||
{
|
||||
int fd;
|
||||
if (!rtc.batt) return;
|
||||
if ((fd = open(rtcfile, O_WRONLY|O_CREAT))<0) return;
|
||||
if ((fd = open(rtcfile, O_WRONLY|O_CREAT|O_TRUNC))<0) return;
|
||||
rtc_save_internal(fd);
|
||||
close(fd);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue