[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Ayttm-commits] CVS: ayttm/src/gtk gtk_eb_html.c,1.4,1.5 gtkspell.c,1.1
From: |
Colin Leroy <address@hidden> |
Subject: |
[Ayttm-commits] CVS: ayttm/src/gtk gtk_eb_html.c,1.4,1.5 gtkspell.c,1.1,1.2 |
Date: |
Tue, 25 Mar 2003 17:06:15 -0500 |
Update of /cvsroot/ayttm/ayttm/src/gtk
In directory subversions:/tmp/cvs-serv19967/src/gtk
Modified Files:
gtk_eb_html.c gtkspell.c
Log Message:
sprintf => snprintf
strcat => strncat
Index: gtk_eb_html.c
===================================================================
RCS file: /cvsroot/ayttm/ayttm/src/gtk/gtk_eb_html.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- gtk_eb_html.c 30 Jan 2003 14:41:47 -0000 1.4
+++ gtk_eb_html.c 25 Mar 2003 22:06:13 -0000 1.5
@@ -138,23 +138,29 @@
if(strlen(font))
{
- strcat( font_name, font );
+ strncat( font_name, font,
+ (size_t)(sizeof(font_name)-strlen(font_name)));
}
else
{
- strcat( font_name, "*" );
+ strncat( font_name, "*",
+ (size_t)(sizeof(font_name)-strlen(font_name)) );
}
- strcat( font_name, "-" );
+ strncat( font_name, "-",
+ (size_t)(sizeof(font_name)-strlen(font_name)) );
if(bold)
{
- strcat( font_name, "bold");
+ strncat( font_name, "bold",
+ (size_t)(sizeof(font_name)-strlen(font_name)));
}
else
{
- strcat( font_name, "medium");
+ strncat( font_name, "medium",
+ (size_t)(sizeof(font_name)-strlen(font_name)));
}
- strcat( font_name, "-" );
+ strncat( font_name, "-",
+ (size_t)(sizeof(font_name)-strlen(font_name)) );
/*
* here is the deal, some fonts have oblique but not italics
@@ -164,31 +170,36 @@
if( italic == 1 )
{
- strcat( font_name, "i");
+ strncat( font_name, "i",
+ (size_t)(sizeof(font_name)-strlen(font_name)));
}
else if( italic == 2 )
{
- strcat( font_name, "o" );
+ strncat( font_name, "o",
+ (size_t)(sizeof(font_name)-strlen(font_name)) );
}
else
{
- strcat( font_name, "r");
+ strncat( font_name, "r",
+ (size_t)(sizeof(font_name)-strlen(font_name)));
}
- strcat( font_name, "-*-*-");
+ strncat( font_name, "-*-*-",
+ (size_t)(sizeof(font_name)-strlen(font_name)));
{
char buff[256];
if(size != -1)
{
int size2 = 0;
size2 = _adjust_font_metrics(size);
- sprintf(buff, "%d-*-*-*-*-*-*-*", size2);
+ snprintf(buff, sizeof(buff), "%d-*-*-*-*-*-*-*", size2);
}
else
{
- sprintf(buff, "*-%d-*-*-*-*-*-*", (ptsize+
iGetLocalPref("FontSize") -6)*10);
+ snprintf(buff, sizeof(buff), "*-%d-*-*-*-*-*-*",
(ptsize+ iGetLocalPref("FontSize") -6)*10);
}
- strcat( font_name, buff );
+ strncat( font_name, buff,
+ (size_t)(sizeof(font_name)-strlen(font_name)) );
}
eb_debug(DBG_HTML, "Wanting font %s\n", font_name);
@@ -235,7 +246,7 @@
}
- sprintf(font_name, "%s,helvetica,arial", font);
+ snprintf(font_name, sizeof(font_name), "%s,helvetica,arial", font);
if(size != -1)
{
int size2 = 0;
@@ -244,23 +255,27 @@
eb_debug(DBG_HTML, "Size param = %d\n", size);
eb_debug(DBG_HTML, "fontsize adjust = %d\n",
iGetLocalPref("FontSize"));
size2 = _adjust_font_metrics(size);
- sprintf(buff, "-%d", size2);
- strcat(font_name, buff);
+ snprintf(buff, sizeof(buff), "-%d", size2);
+ strncat(font_name, buff,
+ (size_t)(sizeof(font_name)-strlen(font_name)));
}
else
{
int size2 = ptsize+(iGetLocalPref("FontSize")-3);
char buff[256] = "";
- sprintf(buff, "-%d", size2);
- strcat(font_name, buff);
+ snprintf(buff, sizeof(buff), "-%d", size2);
+ strncat(font_name, buff,
+ (size_t)(sizeof(font_name)-strlen(font_name)));
}
if(bold)
{
- strcat(font_name, ":bold");
+ strncat(font_name, ":bold",
+ (size_t)(sizeof(font_name)-strlen(font_name)));
}
if(italic)
{
- strcat(font_name, ":slant=italic,oblique");
+ strncat(font_name, ":slant=italic,oblique",
+ (size_t)(sizeof(font_name)-strlen(font_name)));
}
if(( xftfont =
g_datalist_id_get_data(&font_cache, g_quark_from_string(font_name))
))
@@ -680,7 +695,7 @@
_adjust_colors(&fg_r,
&fg_g, &fg_b,
r, g,
b);
- sprintf(color2,
"#%02x%02x%02x",fg_r, fg_g,fg_b);
+ snprintf(color2,
sizeof(color2), "#%02x%02x%02x",fg_r, fg_g,fg_b);
//fprintf(stderr,
"Result: %s\n", color2);
fs->fore =
_getcolor(gdk_window_get_colormap(GTK_WIDGET(widget)->window), color2);
}
@@ -831,7 +846,7 @@
bg_b = (bg->blue >> 8)&0xFF;
_adjust_colors(&r, &g, &b, bg_r, bg_g,
bg_b);
- sprintf(color, "#%02x%02x%02x", r, g,
b);
+ snprintf(color, sizeof(color),
"#%02x%02x%02x", r, g, b);
fs->fore =
_getcolor(gdk_window_get_colormap(GTK_WIDGET(widget)->window), color);
parm += strlen("href=");
Index: gtkspell.c
===================================================================
RCS file: /cvsroot/ayttm/ayttm/src/gtk/gtkspell.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- gtkspell.c 28 Jan 2003 08:08:55 -0000 1.1
+++ gtkspell.c 25 Mar 2003 22:06:13 -0000 1.2
@@ -214,7 +214,7 @@
/* put ispell into terse mode.
* this makes it not respond on correctly spelled words. */
- sprintf(buf, "!\n");
+ snprintf(buf, sizeof(buf), "!\n");
writetext(buf);
#endif
return 0;
@@ -226,7 +226,7 @@
GList *l = NULL;
int count;
- sprintf(buf, "^%s\n", word); /* guard against ispell control chars */
+ snprintf(buf, sizeof(buf), "^%s\n", word); /* guard against ispell
control chars */
writetext(buf);
readresponse(buf);
@@ -272,7 +272,7 @@
static int misspelled_test(char *word) {
char buf[BUFSIZE];
- sprintf(buf, "^%s\n", word); /* guard against ispell control chars */
+ snprintf(buf, sizeof(buf), "^%s\n", word); /* guard against ispell
control chars */
writetext(buf);
readresponse(buf);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Ayttm-commits] CVS: ayttm/src/gtk gtk_eb_html.c,1.4,1.5 gtkspell.c,1.1,1.2,
Colin Leroy <address@hidden> <=
- Prev by Date:
[Ayttm-commits] CVS: ayttm ChangeLog,1.426,1.427 configure.in,1.423,1.424
- Next by Date:
[Ayttm-commits] CVS: ayttm ChangeLog,1.427,1.428 configure.in,1.424,1.425
- Previous by thread:
[Ayttm-commits] CVS: ayttm ChangeLog,1.426,1.427 configure.in,1.423,1.424
- Next by thread:
[Ayttm-commits] CVS: ayttm ChangeLog,1.427,1.428 configure.in,1.424,1.425
- Index(es):