[INTERPRETER]

* NEW: Do not raise an error when a file path cannot be converted to the 
  local charset. Just do not make the conversion.
* BUG: Freeing any Stream object now automatically closes it.
* BUG: Stream.ReadLine() with no second argument does not crash anymore.


git-svn-id: svn://localhost/gambas/trunk@4664 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
Benoît Minisini 2012-04-23 16:02:35 +00:00
parent d75c29e41b
commit 79c16878be
4 changed files with 17 additions and 5 deletions

View File

@ -141,6 +141,7 @@ static void load_exported_class(ARCHIVE *arch)
FREE(&buffer, "load_exported_class");
}
#if 0
static void load_component(char *name)
{
COMPONENT *comp;
@ -148,6 +149,7 @@ static void load_component(char *name)
comp = COMPONENT_create(name);
COMPONENT_load(comp);
}
#endif
/*static void load_dependencies(ARCHIVE *arch)
{

View File

@ -731,6 +731,7 @@ END_METHOD
BEGIN_METHOD_VOID(Stream_free)
STREAM_close(CSTREAM_stream(THIS_STREAM));
GB_StoreVariant(NULL, POINTER(&(THIS_STREAM->tag)));
END_METHOD
@ -740,9 +741,14 @@ BEGIN_METHOD(Stream_ReadLine, GB_STRING escape)
char *escape;
char *str;
escape = GB_ToZeroString(ARG(escape));
if (!*escape)
if (MISSING(escape))
escape = NULL;
else
{
escape = GB_ToZeroString(ARG(escape));
if (!*escape)
escape = NULL;
}
str = STREAM_line_input(CSTREAM_stream(THIS_STREAM), escape);
STRING_free_later(str);

View File

@ -191,7 +191,7 @@ COMPONENT *COMPONENT_create(const char *name)
can_archive = !same_name_as_project;
// System wide component, located in /usr/local/lib/gambas2 (by default)
// System wide component
path = FILE_buffer();
sprintf(path, LIB_PATTERN, COMPONENT_path, name);

View File

@ -1186,6 +1186,7 @@ char *STRING_conv_file_name(const char *name, int len)
struct passwd *info;
char *dir;
char *user;
int err;
if (!name)
return "";
@ -1227,8 +1228,11 @@ char *STRING_conv_file_name(const char *name, int len)
if (LOCAL_is_UTF8)
result = STRING_new_temp(name, len);
else
STRING_conv(&result, name, len, SC_UTF8, LOCAL_encoding, TRUE);
{
err = STRING_conv(&result, name, len, SC_UTF8, LOCAL_encoding, FALSE);
if (err)
result = STRING_new_temp(name, len);
}
//fprintf(stderr, "STRING_conv_file_name: %s\n", result);
if (result)