Browse Source

fix bug no. 362, reported by Bohdan Tkhir

replace size_of by sizeof
pre-master-46
Holger Vogt 8 years ago
parent
commit
ef5747905f
  1. 8
      src/frontend/aspice.c
  2. 18
      src/frontend/com_ghelp.c
  3. 4
      src/frontend/com_hardcopy.c
  4. 2
      src/frontend/display.c

8
src/frontend/aspice.c

@ -79,7 +79,7 @@ com_aspice(wordlist *wl)
bool saveout = FALSE; bool saveout = FALSE;
deck = wl->wl_word; deck = wl->wl_word;
if (!cp_getvar("spicepath", CP_STRING, spicepath, size_of(spicepath))) {
if (!cp_getvar("spicepath", CP_STRING, spicepath, sizeof(spicepath))) {
if (!Spice_Path || !*Spice_Path) { if (!Spice_Path || !*Spice_Path) {
fprintf(cp_err, fprintf(cp_err,
"No spice-3 binary is available for the aspice command.\n"); "No spice-3 binary is available for the aspice command.\n");
@ -282,11 +282,11 @@ com_rspice(wordlist *wl)
char *p; char *p;
/* Figure out where the spicedaemon is and connect to it. */ /* Figure out where the spicedaemon is and connect to it. */
if (!cp_getvar("rhost", CP_STRING, rhost, size_of(rhost)))
if (!cp_getvar("rhost", CP_STRING, rhost, sizeof(rhost)))
(void) strcpy(rhost, Spice_Host); (void) strcpy(rhost, Spice_Host);
if (!cp_getvar("rprogram", CP_STRING, program, size_of(program)))
if (!cp_getvar("rprogram", CP_STRING, program, sizeof(program)))
*program = '\0'; *program = '\0';
if (!cp_getvar("remote_shell", CP_STRING, remote_shell, size_of(remote_shell)))
if (!cp_getvar("remote_shell", CP_STRING, remote_shell, sizeof(remote_shell)))
strcpy(remote_shell, "rsh"); strcpy(remote_shell, "rsh");
if (*rhost == '\0') { if (*rhost == '\0') {

18
src/frontend/com_ghelp.c

@ -34,7 +34,7 @@ com_ghelp(wordlist *wl)
int i; int i;
#endif /* X_DISPLAY_MISSING 1 */ #endif /* X_DISPLAY_MISSING 1 */
if (cp_getvar("helppath", CP_STRING, , size_of(buf)))
if (cp_getvar("helppath", CP_STRING, , sizeof(buf)))
path = copy(buf); path = copy(buf);
if (!path) { if (!path) {
fprintf(cp_err, "Note: defaulting to old help.\n\n"); fprintf(cp_err, "Note: defaulting to old help.\n\n");
@ -50,21 +50,21 @@ com_ghelp(wordlist *wl)
#ifndef X_DISPLAY_MISSING /* 1 */ #ifndef X_DISPLAY_MISSING /* 1 */
path = npath; path = npath;
if (cp_getvar("helpregfont", CP_STRING, buf, size_of(buf)))
if (cp_getvar("helpregfont", CP_STRING, buf, sizeof(buf)))
hlp_regfontname = copy(buf); hlp_regfontname = copy(buf);
if (cp_getvar("helpboldfont", CP_STRING, buf, size_of(buf)))
if (cp_getvar("helpboldfont", CP_STRING, buf, sizeof(buf)))
hlp_boldfontname = copy(buf); hlp_boldfontname = copy(buf);
if (cp_getvar("helpitalicfont", CP_STRING, buf, size_of(buf)))
if (cp_getvar("helpitalicfont", CP_STRING, buf, sizeof(buf)))
hlp_italicfontname = copy(buf); hlp_italicfontname = copy(buf);
if (cp_getvar("helptitlefont", CP_STRING, buf, size_of(buf)))
if (cp_getvar("helptitlefont", CP_STRING, buf, sizeof(buf)))
hlp_titlefontname = copy(buf); hlp_titlefontname = copy(buf);
if (cp_getvar("helpbuttonfont", CP_STRING, buf, size_of(buf)))
if (cp_getvar("helpbuttonfont", CP_STRING, buf, sizeof(buf)))
hlp_buttonfontname = copy(buf); hlp_buttonfontname = copy(buf);
if (cp_getvar("helpinitxpos", CP_NUM, &i, 0)) if (cp_getvar("helpinitxpos", CP_NUM, &i, 0))
hlp_initxpos = i; hlp_initxpos = i;
if (cp_getvar("helpinitypos", CP_NUM, &i, 0)) if (cp_getvar("helpinitypos", CP_NUM, &i, 0))
hlp_initypos = i; hlp_initypos = i;
if (cp_getvar("helpbuttonstyle", CP_STRING, buf, size_of(buf))) {
if (cp_getvar("helpbuttonstyle", CP_STRING, buf, sizeof(buf))) {
if (cieq(buf, "left")) if (cieq(buf, "left"))
hlp_buttonstyle = BS_LEFT; hlp_buttonstyle = BS_LEFT;
else if (cieq(buf, "center")) else if (cieq(buf, "center"))
@ -77,9 +77,9 @@ com_ghelp(wordlist *wl)
} }
if (cp_getvar("width", CP_NUM, &i)) if (cp_getvar("width", CP_NUM, &i))
hlp_width = i; hlp_width = i;
if (cp_getvar("display", CP_STRING, buf, size_of(buf)))
if (cp_getvar("display", CP_STRING, buf, sizeof(buf)))
hlp_displayname = copy(buf); hlp_displayname = copy(buf);
else if (cp_getvar("device", CP_STRING, buf, size_of(buf)))
else if (cp_getvar("device", CP_STRING, buf, sizeof(buf)))
hlp_displayname = copy(buf); hlp_displayname = copy(buf);
else else
hlp_displayname = NULL; hlp_displayname = NULL;

4
src/frontend/com_hardcopy.c

@ -161,7 +161,7 @@ com_hardcopy(wordlist *wl)
if (*device) { if (*device) {
#ifdef SYSTEM_PLOT5LPR #ifdef SYSTEM_PLOT5LPR
if (!strcmp(devtype, "plot5") || !strcmp(devtype, "MFB")) { if (!strcmp(devtype, "plot5") || !strcmp(devtype, "MFB")) {
if (!cp_getvar("lprplot5", CP_STRING, format, size_of(format)))
if (!cp_getvar("lprplot5", CP_STRING, format, sizeof(format)))
strcpy(format, SYSTEM_PLOT5LPR); strcpy(format, SYSTEM_PLOT5LPR);
(void) sprintf(buf, format, device, fname); (void) sprintf(buf, format, device, fname);
fprintf(cp_out, "Printing %s on the %s printer.\n", fname, device); fprintf(cp_out, "Printing %s on the %s printer.\n", fname, device);
@ -172,7 +172,7 @@ com_hardcopy(wordlist *wl)
#ifdef SYSTEM_PSLPR #ifdef SYSTEM_PSLPR
if (!printed && !strcmp(devtype, "postscript")) { if (!printed && !strcmp(devtype, "postscript")) {
/* note: check if that was a postscript printer XXX */ /* note: check if that was a postscript printer XXX */
if (!cp_getvar("lprps", CP_STRING, format, size_of(format)))
if (!cp_getvar("lprps", CP_STRING, format, sizeof(format)))
strcpy(format, SYSTEM_PSLPR); strcpy(format, SYSTEM_PSLPR);
(void) sprintf(buf, format, device, fname); (void) sprintf(buf, format, device, fname);
fprintf(cp_out, "Printing %s on the %s printer.\n", fname, device); fprintf(cp_out, "Printing %s on the %s printer.\n", fname, device);

2
src/frontend/display.c

@ -169,7 +169,7 @@ DevInit(void)
#ifndef X_DISPLAY_MISSING #ifndef X_DISPLAY_MISSING
/* determine display type */ /* determine display type */
if (getenv("DISPLAY") || cp_getvar("display", CP_STRING, buf, size_of(buf)))
if (getenv("DISPLAY") || cp_getvar("display", CP_STRING, buf, sizeof(buf)))
dispdev = FindDev("X11"); dispdev = FindDev("X11");
#endif #endif

Loading…
Cancel
Save