diff --git a/src/frontend/plotting/x11.c b/src/frontend/plotting/x11.c index 054672170..8e87b5e28 100644 --- a/src/frontend/plotting/x11.c +++ b/src/frontend/plotting/x11.c @@ -133,6 +133,8 @@ static void resize(Widget w, XtPointer client_data, XEvent *ev, Boolean *continu static void hardcopy(Widget w, XtPointer client_data, XtPointer call_data); static void killwin(Widget w, XtPointer client_data, XtPointer call_data); +int X11_GetLenStr(GRAPH* gr, char* instring); + static int errorhandler(Display *display, XErrorEvent *errorev) @@ -739,7 +741,7 @@ X11_Text(const char *text, int x, int y, int angle) if (angle == 0) { XftDrawStringUtf8( DEVDEP(currentgraph).draw, &DEVDEP(currentgraph).color, DEVDEP(currentgraph).font0, - x, currentgraph->absolute.height - y, (FcChar8*)text, strlen(text)); + x, currentgraph->absolute.height - y, (FcChar8*)text, (int)strlen(text)); } else if (angle == 90) { int wlen=0, wheight; @@ -748,7 +750,7 @@ X11_Text(const char *text, int x, int y, int angle) XftDrawStringUtf8( DEVDEP(currentgraph).draw, &DEVDEP(currentgraph).color, DEVDEP(currentgraph).font90, - x + (int)(1.5 * wlen), currentgraph->absolute.height - y + (int)(0.5 * wheight), (FcChar8*)text, strlen(text)); + x + (int)(1.5 * wlen), currentgraph->absolute.height - y + (int)(0.5 * wheight), (FcChar8*)text, (int)strlen(text)); } else fprintf(stderr, " Xft: angles other than 0 or 90 are not supported in ngspice\n"); @@ -1063,7 +1065,7 @@ zoomin(GRAPH *graph) SWAP(double, fy0, fy1); } - strncpy(buf2, graph->plotname, sizeof(buf2)); + strncpy(buf2, graph->plotname, sizeof(buf2) - 1); if ((t = strchr(buf2, ':')) != NULL) *t = '\0'; @@ -1378,7 +1380,7 @@ Xget_str_length(const char *text, int* wlen, int* wheight, XftFont* gfont, char* XftPatternDestroy(ext_pat); } if(gfont) - XftTextExtentsUtf8( display, gfont, (XftChar8 *)text, strlen(text), &extents ); + XftTextExtentsUtf8( display, gfont, (XftChar8 *)text, (int)strlen(text), &extents ); else { return 1; } diff --git a/src/misc/string.c b/src/misc/string.c index 1348f4519..6eea87142 100644 --- a/src/misc/string.c +++ b/src/misc/string.c @@ -76,7 +76,7 @@ char *dup_string(const char *str, size_t n_char) char *p; if ((p = TMALLOC(char, n_char + 1)) != NULL) { - (void) strncpy(p, str, n_char); + (void) strncpy(p, str, n_char + 1); p[n_char] = '\0'; } return p;