projects
/
u
/
mdw
/
putty
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Turn 'Filename' into a dynamically allocated type with no arbitrary
[u/mdw/putty]
/
unix
/
gtkwin.c
diff --git
a/unix/gtkwin.c
b/unix/gtkwin.c
index
c9455a5
..
334decb
100644
(file)
--- a/
unix/gtkwin.c
+++ b/
unix/gtkwin.c
@@
-151,24
+151,20
@@
void connection_fatal(void *frontend, char *p, ...)
/*
* Default settings that are specific to pterm.
*/
/*
* Default settings that are specific to pterm.
*/
-FontSpec platform_default_fontspec(const char *name)
+FontSpec
*
platform_default_fontspec(const char *name)
{
{
- FontSpec ret;
if (!strcmp(name, "Font"))
if (!strcmp(name, "Font"))
-
strcpy(ret.name,
"server:fixed");
+
return fontspec_new(
"server:fixed");
else
else
- *ret.name = '\0';
- return ret;
+ return fontspec_new("");
}
}
-Filename platform_default_filename(const char *name)
+Filename
*
platform_default_filename(const char *name)
{
{
- Filename ret;
if (!strcmp(name, "LogFileName"))
if (!strcmp(name, "LogFileName"))
-
strcpy(ret.path,
"putty.log");
+
return filename_from_str(
"putty.log");
else
else
- *ret.path = '\0';
- return ret;
+ return filename_from_str("");
}
char *platform_default_s(const char *name)
}
char *platform_default_s(const char *name)
@@
-2541,36
+2537,36
@@
int do_cmdline(int argc, char **argv, int do_everything, int *allow_launch,
}
if (!strcmp(p, "-fn") || !strcmp(p, "-font")) {
}
if (!strcmp(p, "-fn") || !strcmp(p, "-font")) {
- FontSpec fs;
+ FontSpec
*
fs;
EXPECTS_ARG;
SECOND_PASS_ONLY;
EXPECTS_ARG;
SECOND_PASS_ONLY;
-
strncpy(fs.name, val, sizeof(fs.name)
);
-
fs.name[sizeof(fs.name)-1] = '\0'
;
-
conf_set_fontspec(conf, CONF_font, &
fs);
+
fs = fontspec_new(val
);
+
conf_set_fontspec(conf, CONF_font, fs)
;
+
fontspec_free(
fs);
} else if (!strcmp(p, "-fb")) {
} else if (!strcmp(p, "-fb")) {
- FontSpec fs;
+ FontSpec
*
fs;
EXPECTS_ARG;
SECOND_PASS_ONLY;
EXPECTS_ARG;
SECOND_PASS_ONLY;
-
strncpy(fs.name, val, sizeof(fs.name)
);
-
fs.name[sizeof(fs.name)-1] = '\0'
;
-
conf_set_fontspec(conf, CONF_boldfont, &
fs);
+
fs = fontspec_new(val
);
+
conf_set_fontspec(conf, CONF_boldfont, fs)
;
+
fontspec_free(
fs);
} else if (!strcmp(p, "-fw")) {
} else if (!strcmp(p, "-fw")) {
- FontSpec fs;
+ FontSpec
*
fs;
EXPECTS_ARG;
SECOND_PASS_ONLY;
EXPECTS_ARG;
SECOND_PASS_ONLY;
-
strncpy(fs.name, val, sizeof(fs.name)
);
-
fs.name[sizeof(fs.name)-1] = '\0'
;
-
conf_set_fontspec(conf, CONF_widefont, &
fs);
+
fs = fontspec_new(val
);
+
conf_set_fontspec(conf, CONF_widefont, fs)
;
+
fontspec_free(
fs);
} else if (!strcmp(p, "-fwb")) {
} else if (!strcmp(p, "-fwb")) {
- FontSpec fs;
+ FontSpec
*
fs;
EXPECTS_ARG;
SECOND_PASS_ONLY;
EXPECTS_ARG;
SECOND_PASS_ONLY;
-
strncpy(fs.name, val, sizeof(fs.name)
);
-
fs.name[sizeof(fs.name)-1] = '\0'
;
-
conf_set_fontspec(conf, CONF_wideboldfont, &
fs);
+
fs = fontspec_new(val
);
+
conf_set_fontspec(conf, CONF_wideboldfont, fs)
;
+
fontspec_free(
fs);
} else if (!strcmp(p, "-cs")) {
EXPECTS_ARG;
} else if (!strcmp(p, "-cs")) {
EXPECTS_ARG;
@@
-2650,13
+2646,13
@@
int do_cmdline(int argc, char **argv, int do_everything, int *allow_launch,
conf_set_str(conf, CONF_wintitle, val);
} else if (!strcmp(p, "-log")) {
conf_set_str(conf, CONF_wintitle, val);
} else if (!strcmp(p, "-log")) {
- Filename fn;
+ Filename
*
fn;
EXPECTS_ARG;
SECOND_PASS_ONLY;
EXPECTS_ARG;
SECOND_PASS_ONLY;
- strncpy(fn.path, val, sizeof(fn.path));
- fn.path[sizeof(fn.path)-1] = '\0';
- conf_set_filename(conf, CONF_logfilename, &fn);
+ fn = filename_from_str(val);
+ conf_set_filename(conf, CONF_logfilename, fn);
conf_set_int(conf, CONF_logtype, LGTYP_DEBUG);
conf_set_int(conf, CONF_logtype, LGTYP_DEBUG);
+ filename_free(fn);
} else if (!strcmp(p, "-ut-") || !strcmp(p, "+ut")) {
SECOND_PASS_ONLY;
} else if (!strcmp(p, "-ut-") || !strcmp(p, "+ut")) {
SECOND_PASS_ONLY;