Hello, I just have a question regarding the size of the HFS Plus - Catalog Thread Record specified in the Apple Universal Interfaces headers -
typedef UInt16 UniChar;
/* HFSUniStr255 is the Unicode equivalent of Str255 */ struct HFSUniStr255 { UInt16 length; /* number of unicode characters */ UniChar unicode[255]; /* unicode characters */ };
/* HFS Plus catalog thread record -- 264 bytes */ struct HFSPlusCatalogThread { UInt16 recordType; /* record type */ UInt16 reserved; /* reserved - set to zero */ HFSCatalogNodeID parentID; /* parent ID for this catalog node */ HFSUniStr255 nodeName; /* name of this catalog node (variable length) */ }; typedef struct HFSPlusCatalogThread HFSPlusCatalogThread;
Based on the above declarations shouldn't the size for the HFSPlus catalog thread record be 2+2+4 (since CNID's are 4 bytes long ) + 256*2 = 264+256 instead of 264 as mentioned above ? I think someone probably forgot to multiply the 256 by 2 but I just wanted to make sure that is an error.
I'd be happy to hear some feedback from the list wrt this.
Best Regards, Nandini Hengen
Why would you want to multiply 256 by 2? a byte is 1, a char is 1, therefore 256 chars are 256.
Entwicklung wrote:
Hello, I just have a question regarding the size of the HFS Plus - Catalog Thread Record specified in the Apple Universal Interfaces headers - typedef UInt16 UniChar; /* HFSUniStr255 is the Unicode equivalent of Str255 */ struct HFSUniStr255 { UInt16 length; /* number of unicode characters */ UniChar unicode[255]; /* unicode characters */
}; /* HFS Plus catalog thread record -- 264 bytes */ struct HFSPlusCatalogThread { UInt16 recordType; /* record type */ UInt16 reserved; /* reserved - set to zero */ HFSCatalogNodeID parentID; /* parent ID for this catalog node */ HFSUniStr255 nodeName; /* name of this catalog node (variable length) */ }; typedef struct HFSPlusCatalogThread HFSPlusCatalogThread; Based on the above declarations shouldn't the size for the HFSPlus catalog thread record be 2+2+4 (since CNID's are 4 bytes long ) + 256*2 = 264+256 instead of 264 as mentioned above ? I think someone probably forgot to multiply the 256 by 2 but I just wanted to make sure that is an error. I'd be happy to hear some feedback from the list wrt this. Best Regards,Nandini Hengen
Yes, but if you look at the definitions below : UniChar has been defined as UInt16 - since Multibyte Unicode is being used for HFS+ - So every character takes up 2 Bytes in BigEndian format .
So the HFSUniStr255 structure has actually 256 units of 2 Bytes each -including the length - please correct me if I'm wrong or you think otherwise.
Regards, Nandini
----- Original Message ----- From: "Simon Bazley" sibaz@sibaz.com To: "Entwicklung" entwicklung@whengenibk.de Cc: hfs-user@lists.mars.org Sent: Tuesday, April 16, 2002 10:57 AM Subject: Re: [hfs-user] Catalog Thread record size ?
Why would you want to multiply 256 by 2? a byte is 1, a char is 1, therefore 256 chars are 256.
Entwicklung wrote:
Hello, I just have a question regarding the size of the HFS Plus - Catalog Thread Record specified in the Apple Universal Interfaces headers - typedef UInt16 UniChar; /* HFSUniStr255 is the Unicode equivalent of Str255 */ struct HFSUniStr255 { UInt16 length; /* number of unicode characters */ UniChar unicode[255]; /* unicode characters */
}; /* HFS Plus catalog thread record -- 264 bytes */ struct HFSPlusCatalogThread { UInt16 recordType; /* record type */ UInt16 reserved; /* reserved - set to zero */ HFSCatalogNodeID parentID; /* parent ID for this catalog node */ HFSUniStr255 nodeName; /* name of this catalog node (variable length) */ }; typedef struct HFSPlusCatalogThread HFSPlusCatalogThread; Based on the above declarations shouldn't the size for the HFSPlus catalog thread record be 2+2+4 (since CNID's are 4 bytes long ) + 256*2 = 264+256 instead of 264 as mentioned above ? I think someone probably forgot to multiply the 256 by 2 but I just wanted to make sure that is an error. I'd be happy to hear some feedback from the list wrt this. Best Regards,Nandini Hengen
I think we're confusing hfs and hfs+, hfs has a fixed name size, thats lots less that 256 (I should have noticed your 256 wasn't 20 something). On hfs+ file names are variable, so while it may say something in the book, thats a maximum size.
The figure they quote as a minimum size for lots of things (due to maximum name lengths) is 4k.
This is all discussed in detail in the hfs+ tech doc
Entwicklung wrote:
Yes, but if you look at the definitions below : UniChar has been defined as UInt16 - since Multibyte Unicode is being used for HFS+ - So every character takes up 2 Bytes in BigEndian format .
So the HFSUniStr255 structure has actually 256 units of 2 Bytes each -including the length - please correct me if I'm wrong or you think otherwise.
Regards, Nandini
----- Original Message ----- From: "Simon Bazley" sibaz@sibaz.com To: "Entwicklung" entwicklung@whengenibk.de Cc: hfs-user@lists.mars.org Sent: Tuesday, April 16, 2002 10:57 AM Subject: Re: [hfs-user] Catalog Thread record size ?
Why would you want to multiply 256 by 2? a byte is 1, a char is 1, therefore 256 chars are 256.
Entwicklung wrote:
Hello, I just have a question regarding the size of the HFS Plus - Catalog Thread Record specified in the Apple Universal Interfaces headers - typedef UInt16 UniChar; /* HFSUniStr255 is the Unicode equivalent of Str255 */ struct HFSUniStr255 { UInt16 length; /* number of unicode characters */ UniChar unicode[255]; /* unicode characters */
}; /* HFS Plus catalog thread record -- 264 bytes */ struct HFSPlusCatalogThread { UInt16 recordType; /* record type */ UInt16 reserved; /* reserved - set to zero */ HFSCatalogNodeID parentID; /* parent ID for this catalog node */ HFSUniStr255 nodeName; /* name of this catalog node (variable length) */ }; typedef struct HFSPlusCatalogThread HFSPlusCatalogThread; Based on the above declarations shouldn't the size for the HFSPlus catalog thread record be 2+2+4 (since CNID's are 4 bytes long ) + 256*2 = 264+256 instead of 264 as mentioned above ? I think someone probably forgot to multiply the 256 by 2 but I just wanted to make sure that is an error. I'd be happy to hear some feedback from the list wrt this. Best Regards,Nandini Hengen
I think we're confusing hfs and hfs+, hfs has a fixed name size, thats
lots less
that 256 (I should have noticed your 256 wasn't 20 something).
Yes, HFS has 31 Bytes for the node-name. I was referring only to HFS+ as previously mentioned. Besides HFS uses MacRoman encoding so I couldn't have been refering to HFS anyway.
On hfs+ file names are variable, so while it may say something in the
book,
thats a maximum size.
The 'maximum size' you're referring to is exactly what I wanted to know. And which book are you referring to ? (the technical notes I presume)
The figure they quote as a minimum size for lots of things (due to maximum
name
lengths) is 4k.
This is all discussed in detail in the hfs+ tech doc
Yes - 4k is the minimum catalog node size but not the thread record size.
My question restated: ---------------------- What is this '264' referring to ? It couldn't possibly be Maximum length of the thread since Maximum length=520 Bytes (when the space requirements of the individual fields are added up). It couldn't be minimum length either for the simple reason that if the name has just one character there's no reason why it should occupy 255 Bytes considering that the HFS+ names can be of variable size as you mentioned. Any idea what this 264 refers to then ? I think it is just an error - should have been 520 instead (max size)... that's what my question was all about... the technical notes doesn't make a mention of 264 anywhere though the headers provided by Apple (Universal Interfaces) mention this.
Maybe someone from Apple could help ?
Regards, Nandini
Entwicklung wrote:
Yes, but if you look at the definitions below : UniChar has been
defined as
UInt16 - since Multibyte Unicode is being used for HFS+ - So every character takes up 2 Bytes in BigEndian format .
So the HFSUniStr255 structure has actually 256 units of 2 Bytes each -including the length - please correct me if I'm wrong or you think otherwise.
Regards, Nandini
----- Original Message ----- From: "Simon Bazley" sibaz@sibaz.com To: "Entwicklung" entwicklung@whengenibk.de Cc: hfs-user@lists.mars.org Sent: Tuesday, April 16, 2002 10:57 AM Subject: Re: [hfs-user] Catalog Thread record size ?
Why would you want to multiply 256 by 2? a byte is 1, a char is 1, therefore 256 chars are 256.
Entwicklung wrote:
Hello, I just have a question regarding the size of the HFS Plus - Catalog Thread Record specified in the Apple Universal Interfaces headers - typedef UInt16 UniChar; /* HFSUniStr255 is the Unicode equivalent of Str255 */ struct HFSUniStr255 { UInt16 length; /* number of unicode characters */ UniChar unicode[255]; /* unicode characters
*/
}; /* HFS Plus catalog thread record -- 264 bytes */ struct HFSPlusCatalogThread { UInt16 recordType; /* record type */ UInt16 reserved; /* reserved - set to zero */ HFSCatalogNodeID parentID; /* parent ID for this catalog node */ HFSUniStr255 nodeName; /* name of this catalog node (variable length) */ }; typedef struct HFSPlusCatalogThread HFSPlusCatalogThread; Based
on
the above declarations shouldn't the size for the HFSPlus catalog thread record be 2+2+4 (since CNID's are 4 bytes long ) + 256*2 = 264+256 instead of 264 as mentioned above ? I think someone probably forgot to multiply the 256 by 2 but I just wanted to make sure that
is
an error. I'd be happy to hear some feedback from the list wrt this. Best Regards,Nandini Hengen
I'm pretty sure this is covered in the tech notes, as you say. I haven't got time to look at it right now, but I'm pretty sure its discussed, I'll mail the list when I have a chance to look at it.
Simon
Entwicklung wrote:
I think we're confusing hfs and hfs+, hfs has a fixed name size, thats
lots less
that 256 (I should have noticed your 256 wasn't 20 something).
Yes, HFS has 31 Bytes for the node-name. I was referring only to HFS+ as previously mentioned. Besides HFS uses MacRoman encoding so I couldn't have been refering to HFS anyway.
On hfs+ file names are variable, so while it may say something in the
book,
thats a maximum size.
The 'maximum size' you're referring to is exactly what I wanted to know. And which book are you referring to ? (the technical notes I presume)
The figure they quote as a minimum size for lots of things (due to maximum
name
lengths) is 4k.
This is all discussed in detail in the hfs+ tech doc
Yes - 4k is the minimum catalog node size but not the thread record size.
My question restated:
What is this '264' referring to ? It couldn't possibly be Maximum length of the thread since Maximum length=520 Bytes (when the space requirements of the individual fields are added up). It couldn't be minimum length either for the simple reason that if the name has just one character there's no reason why it should occupy 255 Bytes considering that the HFS+ names can be of variable size as you mentioned. Any idea what this 264 refers to then ? I think it is just an error - should have been 520 instead (max size)... that's what my question was all about... the technical notes doesn't make a mention of 264 anywhere though the headers provided by Apple (Universal Interfaces) mention this.
Maybe someone from Apple could help ?
Regards, Nandini
Entwicklung wrote:
Yes, but if you look at the definitions below : UniChar has been
defined as
UInt16 - since Multibyte Unicode is being used for HFS+ - So every character takes up 2 Bytes in BigEndian format .
So the HFSUniStr255 structure has actually 256 units of 2 Bytes each -including the length - please correct me if I'm wrong or you think otherwise.
Regards, Nandini
----- Original Message ----- From: "Simon Bazley" sibaz@sibaz.com To: "Entwicklung" entwicklung@whengenibk.de Cc: hfs-user@lists.mars.org Sent: Tuesday, April 16, 2002 10:57 AM Subject: Re: [hfs-user] Catalog Thread record size ?
Why would you want to multiply 256 by 2? a byte is 1, a char is 1, therefore 256 chars are 256.
Entwicklung wrote:
Hello, I just have a question regarding the size of the HFS Plus - Catalog Thread Record specified in the Apple Universal Interfaces headers - typedef UInt16 UniChar; /* HFSUniStr255 is the Unicode equivalent of Str255 */ struct HFSUniStr255 { UInt16 length; /* number of unicode characters */ UniChar unicode[255]; /* unicode characters
*/
}; /* HFS Plus catalog thread record -- 264 bytes */ struct HFSPlusCatalogThread { UInt16 recordType; /* record type */ UInt16 reserved; /* reserved - set to zero */ HFSCatalogNodeID parentID; /* parent ID for this catalog node */ HFSUniStr255 nodeName; /* name of this catalog node (variable length) */ }; typedef struct HFSPlusCatalogThread HFSPlusCatalogThread; Based
on
the above declarations shouldn't the size for the HFSPlus catalog thread record be 2+2+4 (since CNID's are 4 bytes long ) + 256*2 = 264+256 instead of 264 as mentioned above ? I think someone probably forgot to multiply the 256 by 2 but I just wanted to make sure that
is
an error. I'd be happy to hear some feedback from the list wrt this. Best Regards,Nandini Hengen
On Tuesday, April 16, 2002, at 12:39 AM, Entwicklung wrote:
Based on the above declarations shouldn't the size for the HFSPlus catalog thread record be 2+2+4 (since CNID's are 4 bytes long ) + 256*2 = 264+256 instead of 264 as mentioned above ? I think someone probably forgot to multiply the 256 by 2 but I just wanted to make sure that is an error.
You're right, it's an error. The correct (maximum) size is 520. The minimum size would be 10 + 2 * nodeName.length.
-Mark