diff options
| author | Paul Eggert | 2011-06-14 11:57:19 -0700 |
|---|---|---|
| committer | Paul Eggert | 2011-06-14 11:57:19 -0700 |
| commit | f66c7cf8f794d6f7fd9ccb8794ffc519e4e89795 (patch) | |
| tree | 0de26b21c827049c7fa2485204ecf0e2d632b849 /src/dbusbind.c | |
| parent | a1759b76246a21c7c07dc2ee00b8db792715104c (diff) | |
| download | emacs-f66c7cf8f794d6f7fd9ccb8794ffc519e4e89795.tar.gz emacs-f66c7cf8f794d6f7fd9ccb8794ffc519e4e89795.zip | |
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. | |||
| 1078 | => "i686" | 1078 | => "i686" |
| 1079 | 1079 | ||
| 1080 | usage: (dbus-call-method BUS SERVICE PATH INTERFACE METHOD &optional :timeout TIMEOUT &rest ARGS) */) | 1080 | usage: (dbus-call-method BUS SERVICE PATH INTERFACE METHOD &optional :timeout TIMEOUT &rest ARGS) */) |
| 1081 | (size_t nargs, register Lisp_Object *args) | 1081 | (ptrdiff_t nargs, Lisp_Object *args) |
| 1082 | { | 1082 | { |
| 1083 | Lisp_Object bus, service, path, interface, method; | 1083 | Lisp_Object bus, service, path, interface, method; |
| 1084 | Lisp_Object result; | 1084 | Lisp_Object result; |
| @@ -1090,7 +1090,7 @@ usage: (dbus-call-method BUS SERVICE PATH INTERFACE METHOD &optional :timeout TI | |||
| 1090 | DBusError derror; | 1090 | DBusError derror; |
| 1091 | unsigned int dtype; | 1091 | unsigned int dtype; |
| 1092 | int timeout = -1; | 1092 | int timeout = -1; |
| 1093 | size_t i = 5; | 1093 | ptrdiff_t i = 5; |
| 1094 | char signature[DBUS_MAXIMUM_SIGNATURE_LENGTH]; | 1094 | char signature[DBUS_MAXIMUM_SIGNATURE_LENGTH]; |
| 1095 | 1095 | ||
| 1096 | /* Check parameters. */ | 1096 | /* Check parameters. */ |
| @@ -1143,7 +1143,7 @@ usage: (dbus-call-method BUS SERVICE PATH INTERFACE METHOD &optional :timeout TI | |||
| 1143 | { | 1143 | { |
| 1144 | XD_DEBUG_VALID_LISP_OBJECT_P (args[i]); | 1144 | XD_DEBUG_VALID_LISP_OBJECT_P (args[i]); |
| 1145 | XD_DEBUG_VALID_LISP_OBJECT_P (args[i+1]); | 1145 | XD_DEBUG_VALID_LISP_OBJECT_P (args[i+1]); |
| 1146 | XD_DEBUG_MESSAGE ("Parameter%lu %s %s", (unsigned long) (i-4), | 1146 | XD_DEBUG_MESSAGE ("Parameter%"pD"d %s %s", i - 4, |
| 1147 | SDATA (format2 ("%s", args[i], Qnil)), | 1147 | SDATA (format2 ("%s", args[i], Qnil)), |
| 1148 | SDATA (format2 ("%s", args[i+1], Qnil))); | 1148 | SDATA (format2 ("%s", args[i+1], Qnil))); |
| 1149 | ++i; | 1149 | ++i; |
| @@ -1151,7 +1151,7 @@ usage: (dbus-call-method BUS SERVICE PATH INTERFACE METHOD &optional :timeout TI | |||
| 1151 | else | 1151 | else |
| 1152 | { | 1152 | { |
| 1153 | XD_DEBUG_VALID_LISP_OBJECT_P (args[i]); | 1153 | XD_DEBUG_VALID_LISP_OBJECT_P (args[i]); |
| 1154 | XD_DEBUG_MESSAGE ("Parameter%lu %s", (unsigned long) (i-4), | 1154 | XD_DEBUG_MESSAGE ("Parameter%"pD"d %s", i - 4, |
| 1155 | SDATA (format2 ("%s", args[i], Qnil))); | 1155 | SDATA (format2 ("%s", args[i], Qnil))); |
| 1156 | } | 1156 | } |
| 1157 | 1157 | ||
| @@ -1260,7 +1260,7 @@ Example: | |||
| 1260 | -| i686 | 1260 | -| i686 |
| 1261 | 1261 | ||
| 1262 | usage: (dbus-call-method-asynchronously BUS SERVICE PATH INTERFACE METHOD HANDLER &optional :timeout TIMEOUT &rest ARGS) */) | 1262 | usage: (dbus-call-method-asynchronously BUS SERVICE PATH INTERFACE METHOD HANDLER &optional :timeout TIMEOUT &rest ARGS) */) |
| 1263 | (size_t nargs, register Lisp_Object *args) | 1263 | (ptrdiff_t nargs, Lisp_Object *args) |
| 1264 | { | 1264 | { |
| 1265 | Lisp_Object bus, service, path, interface, method, handler; | 1265 | Lisp_Object bus, service, path, interface, method, handler; |
| 1266 | Lisp_Object result; | 1266 | Lisp_Object result; |
| @@ -1271,7 +1271,7 @@ usage: (dbus-call-method-asynchronously BUS SERVICE PATH INTERFACE METHOD HANDLE | |||
| 1271 | unsigned int dtype; | 1271 | unsigned int dtype; |
| 1272 | dbus_uint32_t serial; | 1272 | dbus_uint32_t serial; |
| 1273 | int timeout = -1; | 1273 | int timeout = -1; |
| 1274 | size_t i = 6; | 1274 | ptrdiff_t i = 6; |
| 1275 | char signature[DBUS_MAXIMUM_SIGNATURE_LENGTH]; | 1275 | char signature[DBUS_MAXIMUM_SIGNATURE_LENGTH]; |
| 1276 | 1276 | ||
| 1277 | /* Check parameters. */ | 1277 | /* Check parameters. */ |
| @@ -1326,7 +1326,7 @@ usage: (dbus-call-method-asynchronously BUS SERVICE PATH INTERFACE METHOD HANDLE | |||
| 1326 | { | 1326 | { |
| 1327 | XD_DEBUG_VALID_LISP_OBJECT_P (args[i]); | 1327 | XD_DEBUG_VALID_LISP_OBJECT_P (args[i]); |
| 1328 | XD_DEBUG_VALID_LISP_OBJECT_P (args[i+1]); | 1328 | XD_DEBUG_VALID_LISP_OBJECT_P (args[i+1]); |
| 1329 | XD_DEBUG_MESSAGE ("Parameter%lu %s %s", (unsigned long) (i-4), | 1329 | XD_DEBUG_MESSAGE ("Parameter%"pD"d %s %s", i - 4, |
| 1330 | SDATA (format2 ("%s", args[i], Qnil)), | 1330 | SDATA (format2 ("%s", args[i], Qnil)), |
| 1331 | SDATA (format2 ("%s", args[i+1], Qnil))); | 1331 | SDATA (format2 ("%s", args[i+1], Qnil))); |
| 1332 | ++i; | 1332 | ++i; |
| @@ -1334,7 +1334,7 @@ usage: (dbus-call-method-asynchronously BUS SERVICE PATH INTERFACE METHOD HANDLE | |||
| 1334 | else | 1334 | else |
| 1335 | { | 1335 | { |
| 1336 | XD_DEBUG_VALID_LISP_OBJECT_P (args[i]); | 1336 | XD_DEBUG_VALID_LISP_OBJECT_P (args[i]); |
| 1337 | XD_DEBUG_MESSAGE ("Parameter%lu %s", (unsigned long) (i - 4), | 1337 | XD_DEBUG_MESSAGE ("Parameter%"pD"d %s", i - 4, |
| 1338 | SDATA (format2 ("%s", args[i], Qnil))); | 1338 | SDATA (format2 ("%s", args[i], Qnil))); |
| 1339 | } | 1339 | } |
| 1340 | 1340 | ||
| @@ -1386,7 +1386,7 @@ DEFUN ("dbus-method-return-internal", Fdbus_method_return_internal, | |||
| 1386 | This is an internal function, it shall not be used outside dbus.el. | 1386 | This is an internal function, it shall not be used outside dbus.el. |
| 1387 | 1387 | ||
| 1388 | usage: (dbus-method-return-internal BUS SERIAL SERVICE &rest ARGS) */) | 1388 | usage: (dbus-method-return-internal BUS SERIAL SERVICE &rest ARGS) */) |
| 1389 | (size_t nargs, register Lisp_Object *args) | 1389 | (ptrdiff_t nargs, Lisp_Object *args) |
| 1390 | { | 1390 | { |
| 1391 | Lisp_Object bus, service; | 1391 | Lisp_Object bus, service; |
| 1392 | struct gcpro gcpro1, gcpro2; | 1392 | struct gcpro gcpro1, gcpro2; |
| @@ -1395,7 +1395,7 @@ usage: (dbus-method-return-internal BUS SERIAL SERVICE &rest ARGS) */) | |||
| 1395 | DBusMessageIter iter; | 1395 | DBusMessageIter iter; |
| 1396 | dbus_uint32_t serial; | 1396 | dbus_uint32_t serial; |
| 1397 | unsigned int ui_serial, dtype; | 1397 | unsigned int ui_serial, dtype; |
| 1398 | size_t i; | 1398 | ptrdiff_t i; |
| 1399 | char signature[DBUS_MAXIMUM_SIGNATURE_LENGTH]; | 1399 | char signature[DBUS_MAXIMUM_SIGNATURE_LENGTH]; |
| 1400 | 1400 | ||
| 1401 | /* Check parameters. */ | 1401 | /* Check parameters. */ |
| @@ -1435,7 +1435,7 @@ usage: (dbus-method-return-internal BUS SERIAL SERVICE &rest ARGS) */) | |||
| 1435 | { | 1435 | { |
| 1436 | XD_DEBUG_VALID_LISP_OBJECT_P (args[i]); | 1436 | XD_DEBUG_VALID_LISP_OBJECT_P (args[i]); |
| 1437 | XD_DEBUG_VALID_LISP_OBJECT_P (args[i+1]); | 1437 | XD_DEBUG_VALID_LISP_OBJECT_P (args[i+1]); |
| 1438 | XD_DEBUG_MESSAGE ("Parameter%lu %s %s", (unsigned long) (i-2), | 1438 | XD_DEBUG_MESSAGE ("Parameter%"pD"d %s %s", i - 2, |
| 1439 | SDATA (format2 ("%s", args[i], Qnil)), | 1439 | SDATA (format2 ("%s", args[i], Qnil)), |
| 1440 | SDATA (format2 ("%s", args[i+1], Qnil))); | 1440 | SDATA (format2 ("%s", args[i+1], Qnil))); |
| 1441 | ++i; | 1441 | ++i; |
| @@ -1443,7 +1443,7 @@ usage: (dbus-method-return-internal BUS SERIAL SERVICE &rest ARGS) */) | |||
| 1443 | else | 1443 | else |
| 1444 | { | 1444 | { |
| 1445 | XD_DEBUG_VALID_LISP_OBJECT_P (args[i]); | 1445 | XD_DEBUG_VALID_LISP_OBJECT_P (args[i]); |
| 1446 | XD_DEBUG_MESSAGE ("Parameter%lu %s", (unsigned long) (i-2), | 1446 | XD_DEBUG_MESSAGE ("Parameter%"pD"d %s", i - 2, |
| 1447 | SDATA (format2 ("%s", args[i], Qnil))); | 1447 | SDATA (format2 ("%s", args[i], Qnil))); |
| 1448 | } | 1448 | } |
| 1449 | 1449 | ||
| @@ -1475,7 +1475,7 @@ DEFUN ("dbus-method-error-internal", Fdbus_method_error_internal, | |||
| 1475 | This is an internal function, it shall not be used outside dbus.el. | 1475 | This is an internal function, it shall not be used outside dbus.el. |
| 1476 | 1476 | ||
| 1477 | usage: (dbus-method-error-internal BUS SERIAL SERVICE &rest ARGS) */) | 1477 | usage: (dbus-method-error-internal BUS SERIAL SERVICE &rest ARGS) */) |
| 1478 | (size_t nargs, register Lisp_Object *args) | 1478 | (ptrdiff_t nargs, Lisp_Object *args) |
| 1479 | { | 1479 | { |
| 1480 | Lisp_Object bus, service; | 1480 | Lisp_Object bus, service; |
| 1481 | struct gcpro gcpro1, gcpro2; | 1481 | struct gcpro gcpro1, gcpro2; |
| @@ -1484,7 +1484,7 @@ usage: (dbus-method-error-internal BUS SERIAL SERVICE &rest ARGS) */) | |||
| 1484 | DBusMessageIter iter; | 1484 | DBusMessageIter iter; |
| 1485 | dbus_uint32_t serial; | 1485 | dbus_uint32_t serial; |
| 1486 | unsigned int ui_serial, dtype; | 1486 | unsigned int ui_serial, dtype; |
| 1487 | size_t i; | 1487 | ptrdiff_t i; |
| 1488 | char signature[DBUS_MAXIMUM_SIGNATURE_LENGTH]; | 1488 | char signature[DBUS_MAXIMUM_SIGNATURE_LENGTH]; |
| 1489 | 1489 | ||
| 1490 | /* Check parameters. */ | 1490 | /* Check parameters. */ |
| @@ -1525,7 +1525,7 @@ usage: (dbus-method-error-internal BUS SERIAL SERVICE &rest ARGS) */) | |||
| 1525 | { | 1525 | { |
| 1526 | XD_DEBUG_VALID_LISP_OBJECT_P (args[i]); | 1526 | XD_DEBUG_VALID_LISP_OBJECT_P (args[i]); |
| 1527 | XD_DEBUG_VALID_LISP_OBJECT_P (args[i+1]); | 1527 | XD_DEBUG_VALID_LISP_OBJECT_P (args[i+1]); |
| 1528 | XD_DEBUG_MESSAGE ("Parameter%lu %s %s", (unsigned long) (i-2), | 1528 | XD_DEBUG_MESSAGE ("Parameter%"pD"d %s %s", i - 2, |
| 1529 | SDATA (format2 ("%s", args[i], Qnil)), | 1529 | SDATA (format2 ("%s", args[i], Qnil)), |
| 1530 | SDATA (format2 ("%s", args[i+1], Qnil))); | 1530 | SDATA (format2 ("%s", args[i+1], Qnil))); |
| 1531 | ++i; | 1531 | ++i; |
| @@ -1533,7 +1533,7 @@ usage: (dbus-method-error-internal BUS SERIAL SERVICE &rest ARGS) */) | |||
| 1533 | else | 1533 | else |
| 1534 | { | 1534 | { |
| 1535 | XD_DEBUG_VALID_LISP_OBJECT_P (args[i]); | 1535 | XD_DEBUG_VALID_LISP_OBJECT_P (args[i]); |
| 1536 | XD_DEBUG_MESSAGE ("Parameter%lu %s", (unsigned long) (i-2), | 1536 | XD_DEBUG_MESSAGE ("Parameter%"pD"d %s", i - 2, |
| 1537 | SDATA (format2 ("%s", args[i], Qnil))); | 1537 | SDATA (format2 ("%s", args[i], Qnil))); |
| 1538 | } | 1538 | } |
| 1539 | 1539 | ||
| @@ -1588,7 +1588,7 @@ Example: | |||
| 1588 | "org.gnu.Emacs.FileManager" "FileModified" "/home/albinus/.emacs") | 1588 | "org.gnu.Emacs.FileManager" "FileModified" "/home/albinus/.emacs") |
| 1589 | 1589 | ||
| 1590 | usage: (dbus-send-signal BUS SERVICE PATH INTERFACE SIGNAL &rest ARGS) */) | 1590 | usage: (dbus-send-signal BUS SERVICE PATH INTERFACE SIGNAL &rest ARGS) */) |
| 1591 | (size_t nargs, register Lisp_Object *args) | 1591 | (ptrdiff_t nargs, Lisp_Object *args) |
| 1592 | { | 1592 | { |
| 1593 | Lisp_Object bus, service, path, interface, signal; | 1593 | Lisp_Object bus, service, path, interface, signal; |
| 1594 | struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5; | 1594 | struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5; |
| @@ -1596,7 +1596,7 @@ usage: (dbus-send-signal BUS SERVICE PATH INTERFACE SIGNAL &rest ARGS) */) | |||
| 1596 | DBusMessage *dmessage; | 1596 | DBusMessage *dmessage; |
| 1597 | DBusMessageIter iter; | 1597 | DBusMessageIter iter; |
| 1598 | unsigned int dtype; | 1598 | unsigned int dtype; |
| 1599 | size_t i; | 1599 | ptrdiff_t i; |
| 1600 | char signature[DBUS_MAXIMUM_SIGNATURE_LENGTH]; | 1600 | char signature[DBUS_MAXIMUM_SIGNATURE_LENGTH]; |
| 1601 | 1601 | ||
| 1602 | /* Check parameters. */ | 1602 | /* Check parameters. */ |
| @@ -1640,7 +1640,7 @@ usage: (dbus-send-signal BUS SERVICE PATH INTERFACE SIGNAL &rest ARGS) */) | |||
| 1640 | { | 1640 | { |
| 1641 | XD_DEBUG_VALID_LISP_OBJECT_P (args[i]); | 1641 | XD_DEBUG_VALID_LISP_OBJECT_P (args[i]); |
| 1642 | XD_DEBUG_VALID_LISP_OBJECT_P (args[i+1]); | 1642 | XD_DEBUG_VALID_LISP_OBJECT_P (args[i+1]); |
| 1643 | XD_DEBUG_MESSAGE ("Parameter%lu %s %s", (unsigned long) (i-4), | 1643 | XD_DEBUG_MESSAGE ("Parameter%"pD"d %s %s", i - 4, |
| 1644 | SDATA (format2 ("%s", args[i], Qnil)), | 1644 | SDATA (format2 ("%s", args[i], Qnil)), |
| 1645 | SDATA (format2 ("%s", args[i+1], Qnil))); | 1645 | SDATA (format2 ("%s", args[i+1], Qnil))); |
| 1646 | ++i; | 1646 | ++i; |
| @@ -1648,7 +1648,7 @@ usage: (dbus-send-signal BUS SERVICE PATH INTERFACE SIGNAL &rest ARGS) */) | |||
| 1648 | else | 1648 | else |
| 1649 | { | 1649 | { |
| 1650 | XD_DEBUG_VALID_LISP_OBJECT_P (args[i]); | 1650 | XD_DEBUG_VALID_LISP_OBJECT_P (args[i]); |
| 1651 | XD_DEBUG_MESSAGE ("Parameter%lu %s", (unsigned long) (i-4), | 1651 | XD_DEBUG_MESSAGE ("Parameter%"pD"d %s", i - 4, |
| 1652 | SDATA (format2 ("%s", args[i], Qnil))); | 1652 | SDATA (format2 ("%s", args[i], Qnil))); |
| 1653 | } | 1653 | } |
| 1654 | 1654 | ||
| @@ -1919,11 +1919,11 @@ Example: | |||
| 1919 | => :already-owner. | 1919 | => :already-owner. |
| 1920 | 1920 | ||
| 1921 | usage: (dbus-register-service BUS SERVICE &rest FLAGS) */) | 1921 | usage: (dbus-register-service BUS SERVICE &rest FLAGS) */) |
| 1922 | (size_t nargs, register Lisp_Object *args) | 1922 | (ptrdiff_t nargs, Lisp_Object *args) |
| 1923 | { | 1923 | { |
| 1924 | Lisp_Object bus, service; | 1924 | Lisp_Object bus, service; |
| 1925 | DBusConnection *connection; | 1925 | DBusConnection *connection; |
| 1926 | size_t i; | 1926 | ptrdiff_t i; |
| 1927 | unsigned int value; | 1927 | unsigned int value; |
| 1928 | unsigned int flags = 0; | 1928 | unsigned int flags = 0; |
| 1929 | int result; | 1929 | int result; |
| @@ -2019,13 +2019,13 @@ INTERFACE, SIGNAL and HANDLER must not be nil. Example: | |||
| 2019 | `dbus-unregister-object' for removing the registration. | 2019 | `dbus-unregister-object' for removing the registration. |
| 2020 | 2020 | ||
| 2021 | usage: (dbus-register-signal BUS SERVICE PATH INTERFACE SIGNAL HANDLER &rest ARGS) */) | 2021 | usage: (dbus-register-signal BUS SERVICE PATH INTERFACE SIGNAL HANDLER &rest ARGS) */) |
| 2022 | (size_t nargs, register Lisp_Object *args) | 2022 | (ptrdiff_t nargs, Lisp_Object *args) |
| 2023 | { | 2023 | { |
| 2024 | Lisp_Object bus, service, path, interface, signal, handler; | 2024 | Lisp_Object bus, service, path, interface, signal, handler; |
| 2025 | struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5, gcpro6; | 2025 | struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5, gcpro6; |
| 2026 | Lisp_Object uname, key, key1, value; | 2026 | Lisp_Object uname, key, key1, value; |
| 2027 | DBusConnection *connection; | 2027 | DBusConnection *connection; |
| 2028 | size_t i; | 2028 | ptrdiff_t i; |
| 2029 | char rule[DBUS_MAXIMUM_MATCH_RULE_LENGTH]; | 2029 | char rule[DBUS_MAXIMUM_MATCH_RULE_LENGTH]; |
| 2030 | char x[DBUS_MAXIMUM_MATCH_RULE_LENGTH]; | 2030 | char x[DBUS_MAXIMUM_MATCH_RULE_LENGTH]; |
| 2031 | DBusError derror; | 2031 | DBusError derror; |
| @@ -2095,7 +2095,7 @@ usage: (dbus-register-signal BUS SERVICE PATH INTERFACE SIGNAL HANDLER &rest ARG | |||
| 2095 | if (!NILP (args[i])) | 2095 | if (!NILP (args[i])) |
| 2096 | { | 2096 | { |
| 2097 | CHECK_STRING (args[i]); | 2097 | CHECK_STRING (args[i]); |
| 2098 | sprintf (x, ",arg%lu='%s'", (unsigned long) (i-6), | 2098 | sprintf (x, ",arg%"pD"d='%s'", i - 6, |
| 2099 | SDATA (args[i])); | 2099 | SDATA (args[i])); |
| 2100 | strcat (rule, x); | 2100 | strcat (rule, x); |
| 2101 | } | 2101 | } |