I have a problem with CTLG2CT, in specific into the OS4 binary only
CTLG2CT is a program that takes a catalog (IFF CTLG) file and a catalog descriptor file as an input, and generates its corresponding .catalog file
The OS4-only issue might be a little bug in OS4.
When generate the file AmigaOS4 seems to be thinking that the file is not actually a file (eg. that it is a directory).
The code was checked and rechecked many time and seems to be OK, so might be a bug in the OS4 GetFileSize() function, please betatester can you check it ?
http://os4depot.net/index.php?function= ... tlg2ct.lha
(Source is included)
GetFileSize() function issue in OS4 [Solved]
Re: GetFileSize() function issue in OS4
A new 1.04 is on the upload section, please grab that version 

- salass00
- AmigaOS Core Developer
- Posts: 534
- Joined: Sat Jun 18, 2011 4:12 pm
- Location: Finland
- Contact:
Re: GetFileSize() function issue in OS4
It isn't. The usage of GetFileSize() in your getsize() function is broken however.samo79 wrote:The OS4-only issue might be a little bug in OS4.
As the name of the GetFileSize() function suggests and as is written in the autodocs it takes a BPTR to an open filehandle (as obtained from Open() or FOpen()). Instead you are passing a BPTR to a lock which is an entirely different thing.
- colinw
- AmigaOS Core Developer
- Posts: 218
- Joined: Mon Aug 15, 2011 10:20 am
- Location: Brisbane, QLD. Australia.
Re: GetFileSize() function issue in OS4
Yes, you must pass only an open filehandle to GetFileSize().
The IoErr() code [ERROR_OBJECT_WRONG_TYPE] should have indicated this.
What you need in your situation is something like the following pseudocode;
====================================================
BPTR BHandle = IDOS->Lock(passedfilename,SHARED_LOCK);
if( ! BHandle ) [do error handling]
....
struct ExamineData *exd = IDOS->ExamineObjectTags(EX_LockInput,BHandle,TAG_END);
if( exd && EXD_IS_FILE(exd) )
localsize64 = exd->FileSize;
else
[do error handling]
IDOS->FreeDosObject(DOS_EXMINEDATA,exd);
IDOS->UnLock(BHandle);
====================================================
However, seeing that you are conditionally compiling, and you don't use the lock elsewhere,
you don't need the BHandle Lock() call at all for the OS4 code, it's built into ExamineObject()
when you use EX_StringNameInput tag, you probably should move the Lock() code just for
the "#else" version and use the following method for the OS4 version.
This is basically all you need;
====================================================
struct ExamineData *
exd = IDOS->ExamineObjectTags(EX_StringNameInput,passedfilename,TAG_END);
if( exd && EXD_IS_FILE(exd) )
localsize64 = exd->FileSize;
else
[error handling here]
IDOS->FreeDosObject(DOS_EXMINEDATA,exd);
====================================================
The IoErr() code [ERROR_OBJECT_WRONG_TYPE] should have indicated this.
What you need in your situation is something like the following pseudocode;
====================================================
BPTR BHandle = IDOS->Lock(passedfilename,SHARED_LOCK);
if( ! BHandle ) [do error handling]
....
struct ExamineData *exd = IDOS->ExamineObjectTags(EX_LockInput,BHandle,TAG_END);
if( exd && EXD_IS_FILE(exd) )
localsize64 = exd->FileSize;
else
[do error handling]
IDOS->FreeDosObject(DOS_EXMINEDATA,exd);
IDOS->UnLock(BHandle);
====================================================
However, seeing that you are conditionally compiling, and you don't use the lock elsewhere,
you don't need the BHandle Lock() call at all for the OS4 code, it's built into ExamineObject()
when you use EX_StringNameInput tag, you probably should move the Lock() code just for
the "#else" version and use the following method for the OS4 version.
This is basically all you need;
====================================================
struct ExamineData *
exd = IDOS->ExamineObjectTags(EX_StringNameInput,passedfilename,TAG_END);
if( exd && EXD_IS_FILE(exd) )
localsize64 = exd->FileSize;
else
[error handling here]
IDOS->FreeDosObject(DOS_EXMINEDATA,exd);
====================================================
Re: GetFileSize() function issue in OS4
Thanks you guys, your help was essential !
Version 1.05 released and should fix all reported issues, you can also use the OS2 binary in AmigaOS4

Version 1.05 released and should fix all reported issues, you can also use the OS2 binary in AmigaOS4
