diff options
| author | Michael Albinus | 2008-08-28 20:28:12 +0000 |
|---|---|---|
| committer | Michael Albinus | 2008-08-28 20:28:12 +0000 |
| commit | 4baa2377ae6a9846963facee83ee56e692b55bff (patch) | |
| tree | 829b60664d3db4e99865175895fe3268faab9436 /src | |
| parent | 7712319db8db97391059925b27ae71f304eee7d2 (diff) | |
| download | emacs-4baa2377ae6a9846963facee83ee56e692b55bff.tar.gz emacs-4baa2377ae6a9846963facee83ee56e692b55bff.zip | |
* dbusbind.c (XD_ERROR, XD_DEBUG_MESSAGE): Use strncpy and
snprintf, respectively.
(xd_append_arg): Convert strings with Fstring_make_unibyte.
Diffstat (limited to 'src')
| -rw-r--r-- | src/dbusbind.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/dbusbind.c b/src/dbusbind.c index c0c2a8bd719..22e64bf0042 100644 --- a/src/dbusbind.c +++ b/src/dbusbind.c | |||
| @@ -71,7 +71,7 @@ Lisp_Object Vdbus_debug; | |||
| 71 | #define XD_ERROR(error) \ | 71 | #define XD_ERROR(error) \ |
| 72 | do { \ | 72 | do { \ |
| 73 | char s[1024]; \ | 73 | char s[1024]; \ |
| 74 | strcpy (s, error.message); \ | 74 | strncpy (s, error.message, 1023); \ |
| 75 | dbus_error_free (&error); \ | 75 | dbus_error_free (&error); \ |
| 76 | /* Remove the trailing newline. */ \ | 76 | /* Remove the trailing newline. */ \ |
| 77 | if (strchr (s, '\n') != NULL) \ | 77 | if (strchr (s, '\n') != NULL) \ |
| @@ -85,7 +85,7 @@ Lisp_Object Vdbus_debug; | |||
| 85 | #define XD_DEBUG_MESSAGE(...) \ | 85 | #define XD_DEBUG_MESSAGE(...) \ |
| 86 | do { \ | 86 | do { \ |
| 87 | char s[1024]; \ | 87 | char s[1024]; \ |
| 88 | sprintf (s, __VA_ARGS__); \ | 88 | snprintf (s, 1023, __VA_ARGS__); \ |
| 89 | printf ("%s: %s\n", __func__, s); \ | 89 | printf ("%s: %s\n", __func__, s); \ |
| 90 | message ("%s: %s", __func__, s); \ | 90 | message ("%s: %s", __func__, s); \ |
| 91 | } while (0) | 91 | } while (0) |
| @@ -104,7 +104,7 @@ Lisp_Object Vdbus_debug; | |||
| 104 | if (!NILP (Vdbus_debug)) \ | 104 | if (!NILP (Vdbus_debug)) \ |
| 105 | { \ | 105 | { \ |
| 106 | char s[1024]; \ | 106 | char s[1024]; \ |
| 107 | sprintf (s, __VA_ARGS__); \ | 107 | snprintf (s, 1023, __VA_ARGS__); \ |
| 108 | message ("%s: %s", __func__, s); \ | 108 | message ("%s: %s", __func__, s); \ |
| 109 | } \ | 109 | } \ |
| 110 | } while (0) | 110 | } while (0) |
| @@ -179,7 +179,7 @@ Lisp_Object Vdbus_debug; | |||
| 179 | signature is embedded, or DBUS_TYPE_INVALID. It is needed for the | 179 | signature is embedded, or DBUS_TYPE_INVALID. It is needed for the |
| 180 | check that DBUS_TYPE_DICT_ENTRY occurs only as array element. */ | 180 | check that DBUS_TYPE_DICT_ENTRY occurs only as array element. */ |
| 181 | void | 181 | void |
| 182 | xd_signature(signature, dtype, parent_type, object) | 182 | xd_signature (signature, dtype, parent_type, object) |
| 183 | char *signature; | 183 | char *signature; |
| 184 | unsigned int dtype, parent_type; | 184 | unsigned int dtype, parent_type; |
| 185 | Lisp_Object object; | 185 | Lisp_Object object; |
| @@ -454,7 +454,7 @@ xd_append_arg (dtype, object, iter) | |||
| 454 | case DBUS_TYPE_OBJECT_PATH: | 454 | case DBUS_TYPE_OBJECT_PATH: |
| 455 | case DBUS_TYPE_SIGNATURE: | 455 | case DBUS_TYPE_SIGNATURE: |
| 456 | { | 456 | { |
| 457 | char *val = SDATA (object); | 457 | char *val = SDATA (Fstring_make_unibyte (object)); |
| 458 | XD_DEBUG_MESSAGE ("%c %s", dtype, val); | 458 | XD_DEBUG_MESSAGE ("%c %s", dtype, val); |
| 459 | if (!dbus_message_iter_append_basic (iter, dtype, &val)) | 459 | if (!dbus_message_iter_append_basic (iter, dtype, &val)) |
| 460 | xsignal2 (Qdbus_error, | 460 | xsignal2 (Qdbus_error, |