Mail Archives: djgpp-workers/1997/05/08/08:23:42
Eli Zaretskii wrote:
> Thanks, but I think the call to the __FSEXT function should be *before*
> the conversion,
I too. But it's quite anti-intuitive. After all, text files are DOS
specific, right ?
I wrote a 'portable' locker for a database and a friend told me that in
Linux O_BINARY and O_TEXT aren't defined.
> for two reasons:
> 1) The hook might not need the conversion at all, in which
> case you are just waisting cycles.
Right. But if I don't want conversion, I open it in binary format...
> 2) It is usually a bad idea to call a function after data has
> been put into the transfer buffer, but *before* you call DOS. That's
> because many library functions overwrite the transfer buffer; if the
> __FSEXT hook uses any of them and then returns zero (meaning it didn't
> handle the call), you will write garbage to the file.
This could be a quite hard trouble. Calling __FSEXT_write without
converting the buffer could be really easy (just 2 lines to add to the
original code...). Or we could call a user-defined function to handle
text conversion (__FSEXT_txt_conv ?)...
> I also think that the code is incorrect:
[...]
> That `else' clause shouldn't be there: you need also call DOS if
> `func' is non-NULL, i.e. a handler *was* installed, but calling it
> returned zero, meaning that it didn't handle this particular call.
You're right. I didn't notice that because I handle all the calls...
Well, if it's right for all to call __FSEXT_write BEFORE converting the
buffer, I'll post the new source tomorrow...
- Raw text -