forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

GifLib does not free image?

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
Pirata Nervo



Joined: 09 Oct 2007
Posts: 409

PostPosted: Tue Sep 09, 2008 11:00 pm    Post subject: GifLib does not free image? Reply with quote

I am pulling my hairs off.
I already did more than 20 tests in different ways and this function:
Code:

int
DGifCloseFile(GifFileType * GifFile) {
   
    GifFilePrivateType *Private;
    FILE *File;

    if (GifFile == NULL)
        return GIF_ERROR;

    Private = (GifFilePrivateType *) GifFile->Private;

    if (!IS_READABLE(Private)) {
        /* This file was NOT open for reading: */
        _GifError = D_GIF_ERR_NOT_READABLE;
        return GIF_ERROR;
    }

    File = Private->File;

    if (GifFile->Image.ColorMap) {
        FreeMapObject(GifFile->Image.ColorMap);
        GifFile->Image.ColorMap = NULL;
    }

    if (GifFile->SColorMap) {
        FreeMapObject(GifFile->SColorMap);
        GifFile->SColorMap = NULL;
    }

    if (Private) {
        free((char *)Private);
        Private = NULL;
    }

    if (GifFile->SavedImages) {
        FreeSavedImages(GifFile);
        GifFile->SavedImages = NULL;
    }

    free(GifFile);

    if (File && (fclose(File) != 0)) {
        _GifError = D_GIF_ERR_CLOSE_FAILED;
        return GIF_ERROR;
    }
    return GIF_OK;
}


I don't know what's wrong.

Edit:
this is the original giflib code and not the giflib im using. I am using the one that J.F. posted. I am currently fixing some errors in the original one so I can use it and try it

Edit2:
J.F. if you see this please answer me, in the compiled version of gif lib, did you include the close function?
_________________

Upgrade your PSP
Back to top
View user's profile Send private message
Pirata Nervo



Joined: 09 Oct 2007
Posts: 409

PostPosted: Wed Sep 10, 2008 12:09 am    Post subject: Reply with quote

Sorry for the double post, I just want to say it is fixed :)
_________________

Upgrade your PSP
Back to top
View user's profile Send private message
J.F.



Joined: 22 Feb 2004
Posts: 2906

PostPosted: Wed Sep 10, 2008 1:44 am    Post subject: Reply with quote

Pirata Nervo wrote:
Sorry for the double post, I just want to say it is fixed :)


It would help others if people would post the "fixes" they discover to problems, even if it's only to say they spelled a function wrong or passed the wrong pointer.
Back to top
View user's profile Send private message AIM Address
Pirata Nervo



Joined: 09 Oct 2007
Posts: 409

PostPosted: Wed Sep 10, 2008 2:56 am    Post subject: Reply with quote

I was just doing it wrong, I had an if that would never be true.
And inside that if I called the function I posted.

But it works now because the if can be true now :P
_________________

Upgrade your PSP
Back to top
View user's profile Send private message
J.F.



Joined: 22 Feb 2004
Posts: 2906

PostPosted: Wed Sep 10, 2008 7:44 am    Post subject: Reply with quote

See? Now the next person that has trouble freeing a gif won't bug you asking if their problem isn't the same as yours. :D
Back to top
View user's profile Send private message AIM Address
Pirata Nervo



Joined: 09 Oct 2007
Posts: 409

PostPosted: Wed Sep 10, 2008 7:53 am    Post subject: Reply with quote

lol ok I will start doing this
_________________

Upgrade your PSP
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
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 vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group