summaryrefslogtreecommitdiffstats
path: root/compat
diff options
context:
space:
mode:
authorJose Bollo <jose.bollo@iot.bzh>2019-10-09 14:10:22 +0200
committerJosé Bollo <jose.bollo@iot.bzh>2019-10-10 15:25:50 +0200
commit172fa1a0994bc6f0986d17a8ee981ea931e8ff15 (patch)
tree2d27948d03f0ddf8814f299362856edb7b5d4bee /compat
parent4c52ca4ea2c7b2d9f50fcc867d40e5b2170d4f3c (diff)
Fix signed/unsigned types
Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
Diffstat (limited to 'compat')
-rw-r--r--compat/src/main-test-old-cynara.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/compat/src/main-test-old-cynara.c b/compat/src/main-test-old-cynara.c
index ccc3baa..f5f58ba 100644
--- a/compat/src/main-test-old-cynara.c
+++ b/compat/src/main-test-old-cynara.c
@@ -43,7 +43,7 @@ struct cynara_async *aclient;
struct cynara_configuration *conf;
struct cynara *client;
char buffer[4000];
-int bufill;
+size_t bufill;
char *str[40];
int nstr;
int pollfd;
@@ -124,10 +124,10 @@ void adm_check(char *cli, char *usr, char *perm)
void adm_set()
{
struct cynara_admin_policy **policies, *p;
- int n, i;
+ unsigned n, i;
- n = (nstr - 2) / 4;
- policies = malloc((1 + n) * sizeof *policies + n * sizeof **policies);
+ n = (unsigned)((nstr - 2) / 4);
+ policies = malloc((1 + n) * (sizeof *policies) + n * sizeof **policies);
policies[n] = NULL;
p = (struct cynara_admin_policy*)(&policies[n + 1]);
for (i = 0 ; i < n ; i++, p++) {
@@ -275,12 +275,11 @@ int main(int ac, char **av)
if (ev.data.fd == 0) {
if (ev.events & EPOLLIN) {
- rc = (int)sizeof buffer - bufill;
- rc = (int)read(0, buffer, rc);
+ rc = (int)read(0, buffer, sizeof buffer - bufill);
if (rc == 0)
break;
if (rc > 0) {
- bufill += rc;
+ bufill += (size_t)rc;
while((p = memchr(buffer, '\n', bufill))) {
/* process one line */
*p++ = 0;
@@ -290,7 +289,7 @@ int main(int ac, char **av)
if (action())
goto terminate;
/* next line if any */
- bufill -= (int)(p - buffer);
+ bufill -= (size_t)(p - buffer);
if (!bufill)
break;
memmove(buffer, p, bufill);