summaryrefslogtreecommitdiffstats
path: root/src/local.c
diff options
context:
space:
mode:
authorPali Rohár <pali.rohar@gmail.com>2014-10-19 20:23:21 +0200
committerPali Rohár <pali.rohar@gmail.com>2014-10-19 20:23:21 +0200
commitf0712d5b23073fcb7d73085132ef72748fa31ae8 (patch)
tree72a59e871377ba5694e47d7920005b1011959ad4 /src/local.c
parent8d52950ede71561d1f266833f06e747b7d6e0768 (diff)
download0xFFFF-f0712d5b23073fcb7d73085132ef72748fa31ae8.tar.bz2
all: Replace strlen() call on const string with sizeof()-1
Diffstat (limited to 'src/local.c')
-rw-r--r--src/local.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/local.c b/src/local.c
index 86d3b78..c7f3ad1 100644
--- a/src/local.c
+++ b/src/local.c
@@ -127,9 +127,9 @@ int local_init(void) {
while ( fgets(buf, sizeof(buf), file) ) {
- if ( strncmp(buf, "Hardware", strlen("Hardware")) == 0 ) {
+ if ( strncmp(buf, "Hardware", sizeof("Hardware")-1) == 0 ) {
- ptr = buf + strlen("Hardware");
+ ptr = buf + sizeof("Hardware")-1;
while ( ptr < buf + sizeof(buf) && *ptr > 0 && *ptr <= 32 )
++ptr;
@@ -328,7 +328,7 @@ int local_dump_image(enum image_type image, const char * file) {
buf[0] = 0;
close(fd);
- if ( strncmp(buf, "internal", strlen("internal")) != 0 )
+ if ( strncmp(buf, "internal", sizeof("internal")-1) != 0 )
continue;
if ( snprintf(buf, sizeof(buf), "/sys/class/mmc_host/%s/%s:0001/", dirent->d_name, dirent->d_name) <= 0 )
@@ -340,7 +340,7 @@ int local_dump_image(enum image_type image, const char * file) {
while ( ( dirent2 = readdir(dir2) ) ) {
- if ( strncmp(dirent2->d_name, "block:mmcblk", strlen("block:mmcblk")) != 0 )
+ if ( strncmp(dirent2->d_name, "block:mmcblk", sizeof("block:mmcblk")-1) != 0 )
continue;
if ( snprintf(buf, sizeof(buf), "/sys/class/mmc_host/%s/%s:0001/%s/dev", dirent->d_name, dirent->d_name, dirent2->d_name) <= 0 )
@@ -540,7 +540,7 @@ int local_set_usb_host_mode(int enable) {
int local_get_rd_mode(void) {
- if ( strncmp(rd_mode, "master", strlen("master")) == 0 )
+ if ( strncmp(rd_mode, "master", sizeof("master")-1) == 0 )
return 1;
else
return 0;
@@ -559,8 +559,8 @@ int local_get_rd_flags(char * flags, size_t size) {
const char * ptr;
- if ( strncmp(rd_mode, "master", strlen("master")) == 0 )
- ptr = rd_mode + strlen("master");
+ if ( strncmp(rd_mode, "master", sizeof("master")-1) == 0 )
+ ptr = rd_mode + sizeof("master")-1;
else
ptr = rd_mode;