[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemacs-commit] qemacs buffer.c configure dired.c image.c qe.c ...
From: |
Charlie Gordon |
Subject: |
[Qemacs-commit] qemacs buffer.c configure dired.c image.c qe.c ... |
Date: |
Tue, 15 Apr 2008 23:24:04 +0000 |
CVSROOT: /cvsroot/qemacs
Module name: qemacs
Changes by: Charlie Gordon <chqrlie> 08/04/15 23:24:04
Modified files:
. : buffer.c configure dired.c image.c qe.c shell.c
tty.c util.c variables.c win32.c x11.c
libqhtml : css.c cssparse.c xmlparse.c
Log message:
fixed OpenBSD compile issues:
- check OpenBSD as uname output
- no longer use strcpy, strcat, sprintf
- added CONFIG_PTSNAME to disable Unix98 API under BSD
- fixed crash bug in tty.c on empty window
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/qemacs/buffer.c?cvsroot=qemacs&r1=1.39&r2=1.40
http://cvs.savannah.gnu.org/viewcvs/qemacs/configure?cvsroot=qemacs&r1=1.13&r2=1.14
http://cvs.savannah.gnu.org/viewcvs/qemacs/dired.c?cvsroot=qemacs&r1=1.26&r2=1.27
http://cvs.savannah.gnu.org/viewcvs/qemacs/image.c?cvsroot=qemacs&r1=1.19&r2=1.20
http://cvs.savannah.gnu.org/viewcvs/qemacs/qe.c?cvsroot=qemacs&r1=1.82&r2=1.83
http://cvs.savannah.gnu.org/viewcvs/qemacs/shell.c?cvsroot=qemacs&r1=1.59&r2=1.60
http://cvs.savannah.gnu.org/viewcvs/qemacs/tty.c?cvsroot=qemacs&r1=1.47&r2=1.48
http://cvs.savannah.gnu.org/viewcvs/qemacs/util.c?cvsroot=qemacs&r1=1.47&r2=1.48
http://cvs.savannah.gnu.org/viewcvs/qemacs/variables.c?cvsroot=qemacs&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/qemacs/win32.c?cvsroot=qemacs&r1=1.13&r2=1.14
http://cvs.savannah.gnu.org/viewcvs/qemacs/x11.c?cvsroot=qemacs&r1=1.27&r2=1.28
http://cvs.savannah.gnu.org/viewcvs/qemacs/libqhtml/css.c?cvsroot=qemacs&r1=1.19&r2=1.20
http://cvs.savannah.gnu.org/viewcvs/qemacs/libqhtml/cssparse.c?cvsroot=qemacs&r1=1.16&r2=1.17
http://cvs.savannah.gnu.org/viewcvs/qemacs/libqhtml/xmlparse.c?cvsroot=qemacs&r1=1.19&r2=1.20
Patches:
Index: buffer.c
===================================================================
RCS file: /cvsroot/qemacs/qemacs/buffer.c,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -b -r1.39 -r1.40
--- buffer.c 8 Apr 2008 06:54:44 -0000 1.39
+++ buffer.c 15 Apr 2008 23:24:03 -0000 1.40
@@ -1754,8 +1754,7 @@
/* backup old file if present */
if (strlen(filename) < MAX_FILENAME_SIZE - 1) {
- strcpy(buf1, filename);
- strcat(buf1, "~");
+ snprintf(buf1, sizeof(buf1), "%s~", filename);
// should check error code
rename(filename, buf1);
}
Index: configure
===================================================================
RCS file: /cvsroot/qemacs/qemacs/configure,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -b -r1.13 -r1.14
--- configure 13 Apr 2008 23:44:39 -0000 1.13
+++ configure 15 Apr 2008 23:24:03 -0000 1.14
@@ -42,6 +42,7 @@
esac
unlockio="no"
+ptsname="yes"
gprof="no"
network="yes"
win32="no"
@@ -89,6 +90,14 @@
make="gmake"
doc="no"
plugins="no"
+ ptsname="no"
+ ;;
+ OpenBSD)
+ extralibs="-lm"
+ make="gmake"
+ doc="no"
+ plugins="no"
+ ptsname="no"
;;
CYGWIN*)
cygwin="yes"
@@ -417,6 +426,10 @@
echo "CONFIG_UNLOCKIO=yes" >> config.mak
echo "#define CONFIG_UNLOCKIO 1" >> $TMPH
fi
+if test "$ptsname" = "yes" ; then
+ echo "CONFIG_PTSNAME=yes" >> config.mak
+ echo "#define CONFIG_PTSNAME 1" >> $TMPH
+fi
if test "$gprof" = "yes" ; then
echo "TARGET_GPROF=yes" >> config.mak
echo "#define HAVE_GPROF 1" >> $TMPH
Index: dired.c
===================================================================
RCS file: /cvsroot/qemacs/qemacs/dired.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -b -r1.26 -r1.27
--- dired.c 9 Apr 2008 16:15:45 -0000 1.26
+++ dired.c 15 Apr 2008 23:24:03 -0000 1.27
@@ -347,14 +347,15 @@
item = add_string(&hs->items, line);
if (item) {
DiredItem *dip;
+ int plen = strlen(p);
- dip = qe_malloc_hack(DiredItem, strlen(p));
+ dip = qe_malloc_hack(DiredItem, plen);
dip->state = hs;
dip->mode = st.st_mode;
dip->size = st.st_size;
dip->mtime = st.st_mtime;
dip->mark = ' ';
- strcpy(dip->name, p);
+ memcpy(dip->name, p, plen + 1);
item->opaque = dip;
}
}
Index: image.c
===================================================================
RCS file: /cvsroot/qemacs/qemacs/image.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -b -r1.19 -r1.20
--- image.c 18 Jan 2008 17:03:35 -0000 1.19
+++ image.c 15 Apr 2008 23:24:03 -0000 1.20
@@ -741,17 +741,17 @@
if (loss != 0) {
buf[0] = '\0';
if (loss & FF_LOSS_RESOLUTION)
- strcat(buf, " res");
+ pstrcat(buf, sizeof(buf), " res");
if (loss & FF_LOSS_DEPTH)
- strcat(buf, " depth");
+ pstrcat(buf, sizeof(buf), " depth");
if (loss & FF_LOSS_COLORSPACE)
- strcat(buf, " colorspace");
+ pstrcat(buf, sizeof(buf), " colorspace");
if (loss & FF_LOSS_ALPHA)
- strcat(buf, " alpha");
+ pstrcat(buf, sizeof(buf), " alpha");
if (loss & FF_LOSS_COLORQUANT)
- strcat(buf, " colorquant");
+ pstrcat(buf, sizeof(buf), " colorquant");
if (loss & FF_LOSS_CHROMA)
- strcat(buf, " chroma");
+ pstrcat(buf, sizeof(buf), " chroma");
put_status(e, "Warning: data loss:%s", buf);
}
}
Index: qe.c
===================================================================
RCS file: /cvsroot/qemacs/qemacs/qe.c,v
retrieving revision 1.82
retrieving revision 1.83
diff -u -b -r1.82 -r1.83
--- qe.c 12 Apr 2008 12:40:23 -0000 1.82
+++ qe.c 15 Apr 2008 23:24:03 -0000 1.83
@@ -2080,7 +2080,7 @@
s->width,
s->qe_state->mode_line_height,
buf, QE_STYLE_MODE_LINE);
- strcpy(s->modeline_shadow, buf);
+ pstrcpy(s->modeline_shadow, sizeof(s->modeline_shadow), buf);
}
}
}
@@ -4378,7 +4378,7 @@
0, qs->screen->height - qs->status_height,
qs->screen->width, qs->status_height,
p, QE_STYLE_STATUS);
- strcpy(qs->status_shadow, p);
+ pstrcpy(qs->status_shadow, sizeof(qs->status_shadow), p);
skip_spaces(&p);
if (*p && *buf != '~')
eb_format_message(qs, "*messages*", buf);
@@ -4953,7 +4953,7 @@
qs->active_window = minibuffer_saved_active;
/* force status update */
- //strcpy(qs->status_shadow, " ");
+ //pstrcpy(qs->status_shadow, sizeof(qs->status_shadow), " ");
if (do_abort)
put_status(NULL, "Canceled.");
else
Index: shell.c
===================================================================
RCS file: /cvsroot/qemacs/qemacs/shell.c,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -b -r1.59 -r1.60
--- shell.c 14 Apr 2008 00:42:32 -0000 1.59
+++ shell.c 15 Apr 2008 23:24:03 -0000 1.60
@@ -95,6 +95,7 @@
int len = strlen(ttydev);
const char *c1, *c2;
+#ifdef CONFIG_PTSNAME
/* First try Unix98 pseudo tty master */
if ((fd = open("/dev/ptmx", O_RDWR)) >= 0) {
#if 0
@@ -115,6 +116,7 @@
#endif
close(fd);
}
+#endif
/* then try BSD pseudo tty pre-created pairs */
for (c1 = PTYCHAR1; *c1; c1++) {
ptydev[len-2] = ttydev[len-2] = *c1;
@@ -122,7 +124,7 @@
ptydev[len-1] = ttydev[len-1] = *c2;
if ((fd = open(ptydev, O_RDWR)) >= 0) {
if (access(ttydev, R_OK|W_OK) == 0) {
- strcpy(tty_str, ttydev);
+ pstrcpy(tty_str, size, ttydev);
return fd;
}
close(fd);
Index: tty.c
===================================================================
RCS file: /cvsroot/qemacs/qemacs/tty.c,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -b -r1.47 -r1.48
--- tty.c 14 Apr 2008 00:42:32 -0000 1.47
+++ tty.c 15 Apr 2008 23:24:03 -0000 1.48
@@ -1099,7 +1099,8 @@
* space, use the generic loop to synchronize that
* space because the color change is non trivial
*/
- if (TTYCHAR_GETBG(*ptr3) != TTYCHAR_GETBG(ptr3[-1]))
+ if (ptr3 == ptr1
+ || TTYCHAR_GETBG(*ptr3) != TTYCHAR_GETBG(ptr3[-1]))
ptr4++;
}
}
Index: util.c
===================================================================
RCS file: /cvsroot/qemacs/qemacs/util.c,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -b -r1.47 -r1.48
--- util.c 15 Apr 2008 08:14:07 -0000 1.47
+++ util.c 15 Apr 2008 23:24:04 -0000 1.48
@@ -1246,15 +1246,17 @@
StringItem *set_string(StringArray *cs, int index, const char *str)
{
StringItem *v;
+ int len;
if (index >= cs->nb_items)
return NULL;
- v = qe_malloc_hack(StringItem, strlen(str));
+ len = strlen(str);
+ v = qe_malloc_hack(StringItem, len);
if (!v)
return NULL;
v->selected = 0;
- strcpy(v->str, str);
+ memcpy(v->str, str, len + 1);
if (cs->items[index])
qe_free(&cs->items[index]);
cs->items[index] = v;
Index: variables.c
===================================================================
RCS file: /cvsroot/qemacs/qemacs/variables.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- variables.c 5 Apr 2008 23:04:57 -0000 1.4
+++ variables.c 15 Apr 2008 23:24:04 -0000 1.5
@@ -246,7 +246,7 @@
switch (vp->type) {
case VAR_STRING:
if (!value) {
- sprintf(buf, "%d", num);
+ snprintf(buf, sizeof(buf), "%d", num);
value = buf;
}
pstr = (char **)ptr;
@@ -256,7 +256,7 @@
break;
case VAR_CHARS:
if (!value) {
- sprintf(buf, "%d", num);
+ snprintf(buf, sizeof(buf), "%d", num);
value = buf;
}
pstrcpy(ptr, vp->size, value);
Index: win32.c
===================================================================
RCS file: /cvsroot/qemacs/qemacs/win32.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -b -r1.13 -r1.14
--- win32.c 5 Apr 2008 23:04:57 -0000 1.13
+++ win32.c 15 Apr 2008 23:24:04 -0000 1.14
@@ -58,8 +58,8 @@
strlen(lpszCmdLine) + 1);
if (!command_line)
return 0;
- strcpy(command_line, PROG_NAME " ");
- strcat(command_line, lpszCmdLine);
+ pstrcpy(command_linem sizeof(command_line), PROG_NAME " ");
+ pstrcat(command_linem sizeof(command_line), lpszCmdLine);
_hPrev = hPrevInst;
_hInstance = hInstance;
Index: x11.c
===================================================================
RCS file: /cvsroot/qemacs/qemacs/x11.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -b -r1.27 -r1.28
--- x11.c 31 Mar 2008 09:44:27 -0000 1.27
+++ x11.c 15 Apr 2008 23:24:04 -0000 1.28
@@ -700,7 +700,7 @@
if (i == 0)
snprintf(buf1, sizeof(buf1), "%d", size * 10);
else
- strcpy(buf1, "*");
+ pstrcpy(buf1, sizeof(buf1), "*");
snprintf(buf, sizeof(buf),
"-*-%s-*-*-*-*-*-%s-*-*-*-*-*-*",
family, buf1);
Index: libqhtml/css.c
===================================================================
RCS file: /cvsroot/qemacs/qemacs/libqhtml/css.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -b -r1.19 -r1.20
--- libqhtml/css.c 9 Apr 2008 16:27:15 -0000 1.19
+++ libqhtml/css.c 15 Apr 2008 23:24:04 -0000 1.20
@@ -301,7 +301,7 @@
CSSIdent css_new_ident(const char *str)
{
CSSIdentEntry **pp, *p;
- int n;
+ int n, len;
pp = &hash_ident[hash_str(str, CSS_IDENT_HASH_SIZE)];
p = *pp;
@@ -311,11 +311,12 @@
}
p = p->hash_next;
}
- p = qe_malloc_hack(CSSIdentEntry, strlen(str));
+ len = strlen(str);
+ p = qe_malloc_hack(CSSIdentEntry, len);
if (!p)
return CSS_ID_NIL;
p->id = table_ident_nb;
- strcpy(p->str, str);
+ memcpy(p->str, str, len + 1);
p->hash_next = *pp;
*pp = p;
Index: libqhtml/cssparse.c
===================================================================
RCS file: /cvsroot/qemacs/qemacs/libqhtml/cssparse.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -b -r1.16 -r1.17
--- libqhtml/cssparse.c 8 Jan 2008 16:37:55 -0000 1.16
+++ libqhtml/cssparse.c 15 Apr 2008 23:24:04 -0000 1.17
@@ -755,11 +755,12 @@
CSSIdent attr, int op, const char *value)
{
CSSStyleSheetAttributeEntry *ae;
+ int len = strlen(value);
- ae = qe_malloc_hack(CSSStyleSheetAttributeEntry, strlen(value));
+ ae = qe_malloc_hack(CSSStyleSheetAttributeEntry, len);
ae->attr = attr;
ae->op = op;
- strcpy(ae->value, value);
+ memcpy(ae->value, value, len + 1);
ae->next = NULL;
**last_attr = ae;
*last_attr = &ae->next;
Index: libqhtml/xmlparse.c
===================================================================
RCS file: /cvsroot/qemacs/qemacs/libqhtml/xmlparse.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -b -r1.19 -r1.20
--- libqhtml/xmlparse.c 8 Apr 2008 06:54:45 -0000 1.19
+++ libqhtml/xmlparse.c 15 Apr 2008 23:24:04 -0000 1.20
@@ -299,13 +299,14 @@
static CSSAttribute *box_new_attr(CSSIdent attr_id, const char *value)
{
CSSAttribute *attr;
+ int len = strlen(value);
- attr = qe_malloc_hack(CSSAttribute, strlen(value));
+ attr = qe_malloc_hack(CSSAttribute, len);
if (!attr)
return NULL;
attr->attr = attr_id;
attr->next = NULL;
- strcpy(attr->value, value);
+ memcpy(attr->value, value, len + 1);
return attr;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Qemacs-commit] qemacs buffer.c configure dired.c image.c qe.c ...,
Charlie Gordon <=