ToME: the Tales of Maj'Eyal

Everything about ToME
It is currently Tue Jan 23, 2018 4:12 pm

All times are UTC




Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Thu Nov 28, 2013 1:15 pm 
Offline
Thalore

Joined: Tue Feb 28, 2012 6:36 am
Posts: 148
PhysFS's PHYSFS_close() function was changed to have the same error code style as fclose and many other standard C functions (return an error code, zero indicates no error). However, src/physfs/physfsrwops.c was never updated to reflect this change. The result? Every file opened by T-Engine never gets closed / garbage collected correctly.

Relevant commit: abe424d

Simple fix:
Code:
diff --git a/src/physfs/physfsrwops.c b/src/physfs/physfsrwops.c
index a661c1a..a5a0bbd 100644
--- a/src/physfs/physfsrwops.c
+++ b/src/physfs/physfsrwops.c
@@ -126,7 +126,8 @@ static size_t physfsrwops_write(SDL_RWops *rw, const void *ptr, size_t size, siz
 static int physfsrwops_close(SDL_RWops *rw)
 {
     PHYSFS_File *handle = (PHYSFS_File *) rw->hidden.unknown.data1;
-    if (!PHYSFS_close(handle))
+    /* Note: PHYSFS_close was modified to return zero on success */
+    if (PHYSFS_close(handle))
     {
         SDL_SetError("PhysicsFS error: %s", PHYSFS_getLastError());
         return(-1);


Top
 Profile  
 
PostPosted: Fri Nov 29, 2013 11:46 am 
Offline
Thalore

Joined: Tue Feb 28, 2012 6:36 am
Posts: 148
Update: patch accepted into trunk.
Code:
commit b163842339205b74d077ee83c2a7de152d40bb08
Author: DarkGod <darkgod@net-core.org>
Date:   Thu Nov 28 20:04:40 2013 +0100

    fix rwops close


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group