Skip to content

Commit

Permalink
Address clang-tidy warnings in src/apps/relay/dbdrivers/sqlite.c
Browse files Browse the repository at this point in the history
  • Loading branch information
jonesmz committed Jan 25, 2024
1 parent 1683054 commit 2a0a9c3
Show file tree
Hide file tree
Showing 9 changed files with 785 additions and 748 deletions.
7 changes: 2 additions & 5 deletions src/apps/relay/dbdrivers/dbd_mongo.c
Original file line number Diff line number Diff line change
Expand Up @@ -220,11 +220,8 @@ static int mongo_get_user_key(uint8_t *usname, uint8_t *realm, hmackey_t key) {
char kval[sizeof(hmackey_t) + sizeof(hmackey_t) + 1];
memcpy(kval, value, sz);
kval[sz] = 0;
if (convert_string_key_to_binary(kval, key, sz / 2) < 0) {
TURN_LOG_FUNC(TURN_LOG_LEVEL_ERROR, "Wrong key: %s, user %s\n", kval, usname);
} else {
ret = 0;
}
convert_string_key_to_binary(kval, key, sz / 2);
ret = 0;
}
}
}
Expand Down
7 changes: 2 additions & 5 deletions src/apps/relay/dbdrivers/dbd_mysql.c
Original file line number Diff line number Diff line change
Expand Up @@ -385,11 +385,8 @@ static int mysql_get_user_key(uint8_t *usname, uint8_t *realm, hmackey_t key) {
char kval[sizeof(hmackey_t) + sizeof(hmackey_t) + 1];
memcpy(kval, row[0], sz);
kval[sz] = 0;
if (convert_string_key_to_binary(kval, key, sz / 2) < 0) {
TURN_LOG_FUNC(TURN_LOG_LEVEL_ERROR, "Wrong key: %s, user %s\n", kval, usname);
} else {
ret = 0;
}
convert_string_key_to_binary(kval, key, sz / 2);
ret = 0;
}
}
}
Expand Down
3 changes: 1 addition & 2 deletions src/apps/relay/dbdrivers/dbd_pgsql.c
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,8 @@ static int pgsql_get_user_key(uint8_t *usname, uint8_t *realm, hmackey_t key) {
size_t sz = get_hmackey_size(SHATYPE_DEFAULT);
if (((size_t)len < sz * 2) || (strlen(kval) < sz * 2)) {
TURN_LOG_FUNC(TURN_LOG_LEVEL_ERROR, "Wrong key format: %s, user %s\n", kval, usname);
} else if (convert_string_key_to_binary(kval, key, sz) < 0) {
TURN_LOG_FUNC(TURN_LOG_LEVEL_ERROR, "Wrong key: %s, user %s\n", kval, usname);
} else {
convert_string_key_to_binary(kval, key, sz);
ret = 0;
}
} else {
Expand Down
3 changes: 1 addition & 2 deletions src/apps/relay/dbdrivers/dbd_redis.c
Original file line number Diff line number Diff line change
Expand Up @@ -455,9 +455,8 @@ static int redis_get_user_key(uint8_t *usname, uint8_t *realm, hmackey_t key) {
size_t sz = get_hmackey_size(SHATYPE_DEFAULT);
if (strlen(rget->str) < sz * 2) {
TURN_LOG_FUNC(TURN_LOG_LEVEL_ERROR, "Wrong key format: %s, user %s\n", rget->str, usname);
} else if (convert_string_key_to_binary(rget->str, key, sz) < 0) {
TURN_LOG_FUNC(TURN_LOG_LEVEL_ERROR, "Wrong key: %s, user %s\n", rget->str, usname);
} else {
convert_string_key_to_binary(rget->str, key, sz);
ret = 0;
}
}
Expand Down
Loading

0 comments on commit 2a0a9c3

Please sign in to comment.