1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-07-04 21:12:47 -05:00

Turn 'Filename' into a dynamically allocated type with no arbitrary

length limit, just as I did to FontSpec yesterday.

[originally from svn r9316]
This commit is contained in:
Simon Tatham
2011-10-02 11:01:57 +00:00
parent 342690f7cb
commit 62cbc7dc0b
29 changed files with 289 additions and 234 deletions

View File

@ -395,16 +395,15 @@ FontSpec *read_setting_fontspec(void *handle, const char *name)
return NULL;
}
}
int read_setting_filename(void *handle, const char *name, Filename *result)
Filename *read_setting_filename(void *handle, const char *name)
{
char *tmp = read_setting_s(handle, name);
if (tmp) {
strncpy(result->path, tmp, sizeof(result->path)-1);
result->path[sizeof(result->path)-1] = '\0';
Filename *ret = filename_from_str(tmp);
sfree(tmp);
return TRUE;
return ret;
} else
return FALSE;
return NULL;
}
void write_setting_fontspec(void *handle, const char *name, FontSpec *fs)
@ -418,9 +417,9 @@ void write_setting_fontspec(void *handle, const char *name, FontSpec *fs)
write_setting_s(handle, suffname, fs->name);
sfree(suffname);
}
void write_setting_filename(void *handle, const char *name, Filename result)
void write_setting_filename(void *handle, const char *name, Filename *result)
{
write_setting_s(handle, name, result.path);
write_setting_s(handle, name, result->path);
}
void close_settings_r(void *handle)