Just popping in
Joined: 2007/6/5 14:51 Last Login
: 9/4 22:03
From Brisbane, AUSTRALIA
Group:
Registered Users
|
@xenic The problem is that "standards" are a constantly moving target. We try to be consistent, but sometimes people just do what they want without understanding the ramifications. Other times, things are imposed on us.
Back in V1x and V2x, people used 256 byte buffers for paths and 32 byte names, and when someone made a filesystem that could handle larger names, the old software broke.
Then later on in V3x, software started to max out the data structures that were in use at the time, like a FIB (FileInfoBlock) and it could hold 107 byte names, so software started making their name buffers 108 bytes and 256 bytes for paths, that worked until someone decided to use ExAll().
Exall() could effectively provide limitless length names, but due to the usual short-sightedness of the time, they left file sizes unexpandable past 4 gig. Now people tended to limit buffers to 256 byte names and paths in their software.
Then I came along and messed up the party by creating a non-broken API and allowing effectively limitless names, but kept them to 255 bytes, a length only imposed on me by legacy BSTR (BCPL strings) interoperability when using older filesystems, but paths are now effectively limitless too.
This is where, decades ago, I decided to finally add defines to the DOS includes to try and limit the number of people "doing their own thing"(tm) by actually having some sort of "official" definition to reference, hopefully to limit the amount of pre-broken software being written. Those set names to 255 bytes and paths to 1024, this worked quiet well until the target moved again.
The discrepancy between the relatively common 1K and the 4K lengths defined in dos.h is because I have since added UTF-8 compatibility and new filesystems can and do store UTF-8 encoded names, the problem with UTF-8 is that the number of bytes that represent a "character" can be between 1 and 4 for some languages.
So, the old 1K is now bumped to 4K to handle a UTF-8 worst-case situation and the growing availability of resources. So as long as you are not a Klingon, it probably won't matter.
However, I would implore everyone to simply define all your buffers with the DOS include values, as CLIB/NewLib just uses the DOS calls internally, and the CLIB/NewLib legacy includes should just reference the DOS include values too.
Though this is of little help to the getcwd() bug..
|