aboutsummaryrefslogtreecommitdiff
path: root/backends
diff options
context:
space:
mode:
Diffstat (limited to 'backends')
-rw-r--r--backends/keymapper/action.cpp2
-rw-r--r--backends/keymapper/hardware-key.h2
-rw-r--r--backends/midi/timidity.cpp7
3 files changed, 5 insertions, 6 deletions
diff --git a/backends/keymapper/action.cpp b/backends/keymapper/action.cpp
index 03c5933580..aee4d80356 100644
--- a/backends/keymapper/action.cpp
+++ b/backends/keymapper/action.cpp
@@ -38,7 +38,7 @@ Action::Action(Keymap *boss, const char *i, String des, ActionType typ,
assert(i);
assert(_boss);
- strncpy(id, i, ACTION_ID_SIZE);
+ Common::strlcpy(id, i, ACTION_ID_SIZE);
_boss->addAction(this);
}
diff --git a/backends/keymapper/hardware-key.h b/backends/keymapper/hardware-key.h
index dc83462de8..7c608a53fc 100644
--- a/backends/keymapper/hardware-key.h
+++ b/backends/keymapper/hardware-key.h
@@ -60,7 +60,7 @@ struct HardwareKey {
KeyType typ = kGenericKeyType, ActionType prefAct = kGenericActionType)
: key(ky), description(desc), type(typ), preferredAction(prefAct) {
assert(i);
- strncpy(hwKeyId, i, HWKEY_ID_SIZE);
+ Common::strlcpy(hwKeyId, i, HWKEY_ID_SIZE);
}
};
diff --git a/backends/midi/timidity.cpp b/backends/midi/timidity.cpp
index 36d437414f..1a44e62b16 100644
--- a/backends/midi/timidity.cpp
+++ b/backends/midi/timidity.cpp
@@ -38,6 +38,7 @@
#include "common/util.h"
#include "common/endian.h"
+#include "common/str.h"
#include "sound/musicplugin.h"
#include "sound/mpu401.h"
@@ -154,11 +155,9 @@ int MidiDriver_TIMIDITY::open() {
/* get server hostname; if not specified in env, use default */
if ((res = getenv("TIMIDITY_HOST")) == NULL)
- strncpy(timidity_host, DEFAULT_TIMIDITY_HOST, MAXHOSTNAMELEN);
+ Common::strlcpy(timidity_host, DEFAULT_TIMIDITY_HOST, sizeof(timidity_host));
else
- strncpy(timidity_host, res, sizeof(timidity_host));
-
- timidity_host[sizeof(timidity_host) - 1] = '\0';
+ Common::strlcpy(timidity_host, res, sizeof(timidity_host));
/* extract control port */
if ((res = strrchr(timidity_host, ':')) != NULL) {