[INTERPRETER]
* BUG: File.Load() now can read special files (like those in /proc) whose size is zero even if they are not void. * BUG: The native method error flag is not incorrectly propagated anymore when an error is raised. git-svn-id: svn://localhost/gambas/trunk@3277 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
parent
1a8c82215c
commit
63eefd927c
2 changed files with 25 additions and 3 deletions
|
@ -597,11 +597,32 @@ BEGIN_METHOD(CFILE_load, GB_STRING path)
|
|||
STREAM_lof(&stream, &len);
|
||||
if (len >> 31)
|
||||
THROW(E_MEMORY);
|
||||
rlen = len;
|
||||
|
||||
if (len == 0)
|
||||
{
|
||||
char buffer[4096];
|
||||
|
||||
str = NULL;
|
||||
|
||||
for(;;)
|
||||
{
|
||||
len = STREAM_read_max(&stream, buffer, sizeof(buffer));
|
||||
if (len) STRING_add(&str, buffer, len);
|
||||
if (len < sizeof(buffer))
|
||||
break;
|
||||
}
|
||||
|
||||
if (str) STRING_free_later(str);
|
||||
}
|
||||
else
|
||||
{
|
||||
rlen = len;
|
||||
|
||||
str = STRING_new_temp(NULL, rlen);
|
||||
str = STRING_new_temp(NULL, rlen);
|
||||
|
||||
STREAM_read(&stream, str, rlen);
|
||||
STREAM_read(&stream, str, rlen);
|
||||
}
|
||||
|
||||
STREAM_close(&stream);
|
||||
|
||||
GB_ReturnString(str);
|
||||
|
|
|
@ -164,6 +164,7 @@ do { \
|
|||
{ \
|
||||
ERROR_reset(&ERROR_current->info); \
|
||||
ERROR_current->info = _prev->info; \
|
||||
ERROR_current->info.native = FALSE; \
|
||||
} \
|
||||
} \
|
||||
else \
|
||||
|
|
Loading…
Reference in a new issue