If #PB_Default is used as this parameter then the new buffer size will apply to all newly opened files with OpenFile(), CreateFile() or ReadFile().
Then that text must be fixed to read:
#1
If #PB_Default is used as this parameter then the new buffer size will only apply to existing files opened/created with OpenFile(), CreateFile() or ReadFile().
The way I read the current texts meaning it should be this:
#2
If #PB_Default is used as this parameter then the new buffer size will apply to all future files opened/created with OpenFile(), CreateFile() or ReadFile().
One of those two are correct, the other not.
You say #1 is the interpretation, and I say #2 is.
I guess Fred or Freak will clarify what the original intent is.
Personally I see no point in FileBuffersSize(#PB_Default, something) being used after you have opened all files, what about files you are about to open, do you need to use FileBuffersSize(#PB_Default, something) again?
If #PB_Default do not set an actual default then what is the point of a "default"?
With it like how you described it working this is what must be done, which is no different from FileBuffersSize(file, something)
OpenFile()
FileBuffersSize(#PB_Default, something)
CloseFile()
OpenFile()
FileBuffersSize(#PB_Default, something)
CloseFile()
OpenFile()
FileBuffersSize(#PB_Default, something)
CloseFile()
OpenFile()
FileBuffersSize(#PB_Default, something)
CloseFile()
While with a default like I describe it this can be done.
FileBuffersSize(#PB_Default, something)
OpenFile()
CloseFile()
OpenFile()
CloseFile()
OpenFile()
CloseFile()
OpenFile()
CloseFile()
Now if you say that ¤PB_Default sets it on the filehandle as a default then that is different, but that makes it useless if you open files with #PB_Any for example.
Right now I got code that looks like this:
Code: Select all
handle=ReadFile(#PB_Any, "blah")
FileBuffersSize(handle, 0)
...code...
CloseFile(handle)
handle=ReadFile(#PB_Any, "blah")
FileBuffersSize(handle, 0)
...code...
CloseFile(handle)
handle=ReadFile(#PB_Any, "blah")
FileBuffersSize(handle, 0)
...code...
CloseFile(handle)
handle=ReadFile(#PB_Any, "blah")
FileBuffersSize(handle, 0)
...code...
CloseFile(handle)
A lot of extra code is needed and allocation of memory for filebuffers that need to be freed again (I assume that using 0 causes them to be freed 0 do they still take up memory?)
With #PB_Default working as intended (as I interpret it):
Right now I got code that looks like this:
Code: Select all
FileBuffersSize(#PB_Default, 0)
handle=ReadFile(#PB_Any, "blah")
...code...
CloseFile(handle)
handle=ReadFile(#PB_Any, "blah")
...code...
CloseFile(handle)
handle=ReadFile(#PB_Any, "blah")
...code...
CloseFile(handle)
handle=ReadFile(#PB_Any, "blah")
...code...
CloseFile(handle)
A lot less code is needed and no need to allocate memory for filebuffers that need to be freed again.
Your interpretation is more like a #PB_All to set the buffersize for all existing filehandles, now that is a valid feature as well, but #PG_Default should do that as well to existing files as well as future files opened.