Page 1 of 1

MD5FileFingerprint not working?

Posted: Thu Aug 05, 2004 12:00 am
by GeoTrail
When I try to compile this code in Linux

Code: Select all

FileName$ = OpenFileRequester("Check file MD5 checksum", DefaultFile$, "ISO files (*.iso)|*.iso|All files (*.*)|*.*", 0)
If FileName$
  Result$ = MD5FileFingerprint(FileName$)

  FileSize.l = FileSize(FileName$)
  If FileSize <> -1 And FileSize <> -2 ; Check that file isn't a folder and that it exist.
    FileSize_msg.s = "Filesize: " + Str(FileSize) + " bytes."
    FileSize_msg.s + " ("
    FileSize_msg.s + Str(FileSize/1024) + " KB. "
    FileSize_msg.s + Str(FileSize/1024/1024) + " MB. "
    FileSize_msg.s + Str(FileSize/1024/1024/1024) + " GB."
    FileSize_msg.s + ")"

    MessageRequester("Result", "Filename: " + Chr(13) + Chr(10) + FileName$ + Chr(13) + Chr(10) + FileSize_msg.s + Chr(13) + Chr(10) + "MD5 checksum: " + Result$)
  EndIf
EndIf

End
I get this error message from the shell:
Gtk-CRITICAL **: file gtkfilesel.c: line 622 (gtk_file_selection_set_filename): assertion `filename != NULL' failed.
Does anyone know why this happens?

Posted: Tue Aug 31, 2004 1:04 pm
by Fred
Could you try to put something in the DefaultFile$ variable to see if it happens ? This bug doesn't seem to be related with the MD5 command:

Code: Select all

DefaultFile$ = "Test"

FileName$ = OpenFileRequester("Check file MD5 checksum", DefaultFile$, "ISO files (*.iso)|*.iso|All files (*.*)|*.*", 0)
If FileName$
  Result$ = MD5FileFingerprint(FileName$)

  FileSize.l = FileSize(FileName$)
  If FileSize <> -1 And FileSize <> -2 ; Check that file isn't a folder and that it exist.
    FileSize_msg.s = "Filesize: " + Str(FileSize) + " bytes."
    FileSize_msg.s + " ("
    FileSize_msg.s + Str(FileSize/1024) + " KB. "
    FileSize_msg.s + Str(FileSize/1024/1024) + " MB. "
    FileSize_msg.s + Str(FileSize/1024/1024/1024) + " GB."
    FileSize_msg.s + ")"

    MessageRequester("Result", "Filename: " + Chr(13) + Chr(10) + FileName$ + Chr(13) + Chr(10) + FileSize_msg.s + Chr(13) + Chr(10) + "MD5 checksum: " + Result$)
  EndIf
EndIf

End

Posted: Tue Aug 31, 2004 1:14 pm
by GeoTrail
Hi Fred.
Sorry, I don't have Linux installed right now.

Think I was using Mandarake 10.1b when that happened.
I'll try again soon and install Mandrake again. Might be something there that did it :)

Posted: Tue Aug 31, 2004 4:28 pm
by Henrik
Hi
With Mandarake 9.1
I get the error if i "Cancel the requester" and have not set DefautlFile$ =""
if i on the other hand sets DefautlFile$ ="" as Fred said, it workes allso when i Cancel the filedialog.

Best regards
Henrik

Posted: Tue Aug 31, 2004 4:42 pm
by Max.²
MD5FileFingerprint definitly worked for me on Linux; what I had troubles with was the return value of the Directory functions when the file was only mounted read-only.

Posted: Tue Aug 31, 2004 5:06 pm
by Fred
Thank for testing, I will fix the OpenFileRequester() command.