diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2011-06-14 11:57:19 -0700 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2011-06-14 11:57:19 -0700 |
commit | f66c7cf8f794d6f7fd9ccb8794ffc519e4e89795 (patch) | |
tree | 0de26b21c827049c7fa2485204ecf0e2d632b849 /src/dbusbind.c | |
parent | a1759b76246a21c7c07dc2ee00b8db792715104c (diff) | |
download | emacs-f66c7cf8f794d6f7fd9ccb8794ffc519e4e89795.tar.gz |
Variadic C functions now count arguments with ptrdiff_t.
This partly undoes my 2011-03-30 change, which replaced int with size_t.
Back then I didn't know that the Emacs coding style prefers signed int.
Also, in the meantime I found a few more instances where arguments
were being counted with int, which may truncate counts on 64-bit
machines, or EMACS_INT, which may be unnecessarily wide.
* lisp.h (struct Lisp_Subr.function.aMANY)
(DEFUN_ARGS_MANY, internal_condition_case_n, safe_call):
Arg counts are now ptrdiff_t, not size_t.
All variadic functions and their callers changed accordingly.
(struct gcpro.nvars): Now size_t, not size_t. All uses changed.
* bytecode.c (exec_byte_code): Check maxdepth for overflow,
to avoid potential buffer overrun. Don't assume arg counts fit in 'int'.
* callint.c (Fcall_interactively): Check arg count for overflow,
to avoid potential buffer overrun. Use signed char, not 'int',
for 'varies' array, so that we needn't bother to check its size
calculation for overflow.
* editfns.c (Fformat): Use ptrdiff_t, not EMACS_INT, to count args.
* eval.c (apply_lambda):
* fns.c (Fmapconcat): Use XFASTINT, not XINT, to get args length.
(struct textprop_rec.argnum): Now ptrdiff_t, not int. All uses changed.
(mapconcat): Use ptrdiff_t, not int and EMACS_INT, to count args.
Diffstat (limited to 'src/dbusbind.c')
-rw-r--r-- | src/dbusbind.c | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/src/dbusbind.c b/src/dbusbind.c index d8d0c7c2ef0..f662d5b38a2 100644 --- a/src/dbusbind.c +++ b/src/dbusbind.c @@ -1078,7 +1078,7 @@ object is returned instead of a list containing this single Lisp object. => "i686" usage: (dbus-call-method BUS SERVICE PATH INTERFACE METHOD &optional :timeout TIMEOUT &rest ARGS) */) - (size_t nargs, register Lisp_Object *args) + (ptrdiff_t nargs, Lisp_Object *args) { Lisp_Object bus, service, path, interface, method; Lisp_Object result; @@ -1090,7 +1090,7 @@ usage: (dbus-call-method BUS SERVICE PATH INTERFACE METHOD &optional :timeout TI DBusError derror; unsigned int dtype; int timeout = -1; - size_t i = 5; + ptrdiff_t i = 5; char signature[DBUS_MAXIMUM_SIGNATURE_LENGTH]; /* Check parameters. */ @@ -1143,7 +1143,7 @@ usage: (dbus-call-method BUS SERVICE PATH INTERFACE METHOD &optional :timeout TI { XD_DEBUG_VALID_LISP_OBJECT_P (args[i]); XD_DEBUG_VALID_LISP_OBJECT_P (args[i+1]); - XD_DEBUG_MESSAGE ("Parameter%lu %s %s", (unsigned long) (i-4), + XD_DEBUG_MESSAGE ("Parameter%"pD"d %s %s", i - 4, SDATA (format2 ("%s", args[i], Qnil)), SDATA (format2 ("%s", args[i+1], Qnil))); ++i; @@ -1151,7 +1151,7 @@ usage: (dbus-call-method BUS SERVICE PATH INTERFACE METHOD &optional :timeout TI else { XD_DEBUG_VALID_LISP_OBJECT_P (args[i]); - XD_DEBUG_MESSAGE ("Parameter%lu %s", (unsigned long) (i-4), + XD_DEBUG_MESSAGE ("Parameter%"pD"d %s", i - 4, SDATA (format2 ("%s", args[i], Qnil))); } @@ -1260,7 +1260,7 @@ Example: -| i686 usage: (dbus-call-method-asynchronously BUS SERVICE PATH INTERFACE METHOD HANDLER &optional :timeout TIMEOUT &rest ARGS) */) - (size_t nargs, register Lisp_Object *args) + (ptrdiff_t nargs, Lisp_Object *args) { Lisp_Object bus, service, path, interface, method, handler; Lisp_Object result; @@ -1271,7 +1271,7 @@ usage: (dbus-call-method-asynchronously BUS SERVICE PATH INTERFACE METHOD HANDLE unsigned int dtype; dbus_uint32_t serial; int timeout = -1; - size_t i = 6; + ptrdiff_t i = 6; char signature[DBUS_MAXIMUM_SIGNATURE_LENGTH]; /* Check parameters. */ @@ -1326,7 +1326,7 @@ usage: (dbus-call-method-asynchronously BUS SERVICE PATH INTERFACE METHOD HANDLE { XD_DEBUG_VALID_LISP_OBJECT_P (args[i]); XD_DEBUG_VALID_LISP_OBJECT_P (args[i+1]); - XD_DEBUG_MESSAGE ("Parameter%lu %s %s", (unsigned long) (i-4), + XD_DEBUG_MESSAGE ("Parameter%"pD"d %s %s", i - 4, SDATA (format2 ("%s", args[i], Qnil)), SDATA (format2 ("%s", args[i+1], Qnil))); ++i; @@ -1334,7 +1334,7 @@ usage: (dbus-call-method-asynchronously BUS SERVICE PATH INTERFACE METHOD HANDLE else { XD_DEBUG_VALID_LISP_OBJECT_P (args[i]); - XD_DEBUG_MESSAGE ("Parameter%lu %s", (unsigned long) (i - 4), + XD_DEBUG_MESSAGE ("Parameter%"pD"d %s", i - 4, SDATA (format2 ("%s", args[i], Qnil))); } @@ -1386,7 +1386,7 @@ DEFUN ("dbus-method-return-internal", Fdbus_method_return_internal, This is an internal function, it shall not be used outside dbus.el. usage: (dbus-method-return-internal BUS SERIAL SERVICE &rest ARGS) */) - (size_t nargs, register Lisp_Object *args) + (ptrdiff_t nargs, Lisp_Object *args) { Lisp_Object bus, service; struct gcpro gcpro1, gcpro2; @@ -1395,7 +1395,7 @@ usage: (dbus-method-return-internal BUS SERIAL SERVICE &rest ARGS) */) DBusMessageIter iter; dbus_uint32_t serial; unsigned int ui_serial, dtype; - size_t i; + ptrdiff_t i; char signature[DBUS_MAXIMUM_SIGNATURE_LENGTH]; /* Check parameters. */ @@ -1435,7 +1435,7 @@ usage: (dbus-method-return-internal BUS SERIAL SERVICE &rest ARGS) */) { XD_DEBUG_VALID_LISP_OBJECT_P (args[i]); XD_DEBUG_VALID_LISP_OBJECT_P (args[i+1]); - XD_DEBUG_MESSAGE ("Parameter%lu %s %s", (unsigned long) (i-2), + XD_DEBUG_MESSAGE ("Parameter%"pD"d %s %s", i - 2, SDATA (format2 ("%s", args[i], Qnil)), SDATA (format2 ("%s", args[i+1], Qnil))); ++i; @@ -1443,7 +1443,7 @@ usage: (dbus-method-return-internal BUS SERIAL SERVICE &rest ARGS) */) else { XD_DEBUG_VALID_LISP_OBJECT_P (args[i]); - XD_DEBUG_MESSAGE ("Parameter%lu %s", (unsigned long) (i-2), + XD_DEBUG_MESSAGE ("Parameter%"pD"d %s", i - 2, SDATA (format2 ("%s", args[i], Qnil))); } @@ -1475,7 +1475,7 @@ DEFUN ("dbus-method-error-internal", Fdbus_method_error_internal, This is an internal function, it shall not be used outside dbus.el. usage: (dbus-method-error-internal BUS SERIAL SERVICE &rest ARGS) */) - (size_t nargs, register Lisp_Object *args) + (ptrdiff_t nargs, Lisp_Object *args) { Lisp_Object bus, service; struct gcpro gcpro1, gcpro2; @@ -1484,7 +1484,7 @@ usage: (dbus-method-error-internal BUS SERIAL SERVICE &rest ARGS) */) DBusMessageIter iter; dbus_uint32_t serial; unsigned int ui_serial, dtype; - size_t i; + ptrdiff_t i; char signature[DBUS_MAXIMUM_SIGNATURE_LENGTH]; /* Check parameters. */ @@ -1525,7 +1525,7 @@ usage: (dbus-method-error-internal BUS SERIAL SERVICE &rest ARGS) */) { XD_DEBUG_VALID_LISP_OBJECT_P (args[i]); XD_DEBUG_VALID_LISP_OBJECT_P (args[i+1]); - XD_DEBUG_MESSAGE ("Parameter%lu %s %s", (unsigned long) (i-2), + XD_DEBUG_MESSAGE ("Parameter%"pD"d %s %s", i - 2, SDATA (format2 ("%s", args[i], Qnil)), SDATA (format2 ("%s", args[i+1], Qnil))); ++i; @@ -1533,7 +1533,7 @@ usage: (dbus-method-error-internal BUS SERIAL SERVICE &rest ARGS) */) else { XD_DEBUG_VALID_LISP_OBJECT_P (args[i]); - XD_DEBUG_MESSAGE ("Parameter%lu %s", (unsigned long) (i-2), + XD_DEBUG_MESSAGE ("Parameter%"pD"d %s", i - 2, SDATA (format2 ("%s", args[i], Qnil))); } @@ -1588,7 +1588,7 @@ Example: "org.gnu.Emacs.FileManager" "FileModified" "/home/albinus/.emacs") usage: (dbus-send-signal BUS SERVICE PATH INTERFACE SIGNAL &rest ARGS) */) - (size_t nargs, register Lisp_Object *args) + (ptrdiff_t nargs, Lisp_Object *args) { Lisp_Object bus, service, path, interface, signal; struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5; @@ -1596,7 +1596,7 @@ usage: (dbus-send-signal BUS SERVICE PATH INTERFACE SIGNAL &rest ARGS) */) DBusMessage *dmessage; DBusMessageIter iter; unsigned int dtype; - size_t i; + ptrdiff_t i; char signature[DBUS_MAXIMUM_SIGNATURE_LENGTH]; /* Check parameters. */ @@ -1640,7 +1640,7 @@ usage: (dbus-send-signal BUS SERVICE PATH INTERFACE SIGNAL &rest ARGS) */) { XD_DEBUG_VALID_LISP_OBJECT_P (args[i]); XD_DEBUG_VALID_LISP_OBJECT_P (args[i+1]); - XD_DEBUG_MESSAGE ("Parameter%lu %s %s", (unsigned long) (i-4), + XD_DEBUG_MESSAGE ("Parameter%"pD"d %s %s", i - 4, SDATA (format2 ("%s", args[i], Qnil)), SDATA (format2 ("%s", args[i+1], Qnil))); ++i; @@ -1648,7 +1648,7 @@ usage: (dbus-send-signal BUS SERVICE PATH INTERFACE SIGNAL &rest ARGS) */) else { XD_DEBUG_VALID_LISP_OBJECT_P (args[i]); - XD_DEBUG_MESSAGE ("Parameter%lu %s", (unsigned long) (i-4), + XD_DEBUG_MESSAGE ("Parameter%"pD"d %s", i - 4, SDATA (format2 ("%s", args[i], Qnil))); } @@ -1919,11 +1919,11 @@ Example: => :already-owner. usage: (dbus-register-service BUS SERVICE &rest FLAGS) */) - (size_t nargs, register Lisp_Object *args) + (ptrdiff_t nargs, Lisp_Object *args) { Lisp_Object bus, service; DBusConnection *connection; - size_t i; + ptrdiff_t i; unsigned int value; unsigned int flags = 0; int result; @@ -2019,13 +2019,13 @@ INTERFACE, SIGNAL and HANDLER must not be nil. Example: `dbus-unregister-object' for removing the registration. usage: (dbus-register-signal BUS SERVICE PATH INTERFACE SIGNAL HANDLER &rest ARGS) */) - (size_t nargs, register Lisp_Object *args) + (ptrdiff_t nargs, Lisp_Object *args) { Lisp_Object bus, service, path, interface, signal, handler; struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5, gcpro6; Lisp_Object uname, key, key1, value; DBusConnection *connection; - size_t i; + ptrdiff_t i; char rule[DBUS_MAXIMUM_MATCH_RULE_LENGTH]; char x[DBUS_MAXIMUM_MATCH_RULE_LENGTH]; DBusError derror; @@ -2095,7 +2095,7 @@ usage: (dbus-register-signal BUS SERVICE PATH INTERFACE SIGNAL HANDLER &rest ARG if (!NILP (args[i])) { CHECK_STRING (args[i]); - sprintf (x, ",arg%lu='%s'", (unsigned long) (i-6), + sprintf (x, ",arg%"pD"d='%s'", i - 6, SDATA (args[i])); strcat (rule, x); } |