Skip to content

Commit 0e81f7d

Browse files
committed
Fix compiler warings
1 parent 1937815 commit 0e81f7d

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

src/user/xvcServer.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ static int verbose = 0;
4242
#define XVC_PORT 2542
4343

4444
static int sread(int fd, void *target, int len) {
45-
unsigned char *t = target;
45+
unsigned char *t = (unsigned char*)target;
4646
while (len) {
4747
int r = read(fd, t, len);
4848
if (r <= 0)
@@ -72,10 +72,11 @@ int handle_data(int fd, int fd_ioctl) {
7272
return 1;
7373

7474
if (memcmp(cmd, "ge", 2) == 0) {
75+
int len = strlen(xvcInfo);
7576
if (sread(fd, cmd, 6) != 1)
7677
return 1;
77-
memcpy(result, xvcInfo, strlen(xvcInfo));
78-
if (write(fd, result, strlen(xvcInfo)) != strlen(xvcInfo)) {
78+
memcpy(result, xvcInfo, len);
79+
if (write(fd, result, len) != len) {
7980
perror("write");
8081
return 1;
8182
}
@@ -114,7 +115,7 @@ int handle_data(int fd, int fd_ioctl) {
114115
return 1;
115116
}
116117

117-
int nr_bytes = (len + 7) / 8;
118+
unsigned int nr_bytes = (len + 7) / 8;
118119
if (nr_bytes * 2 > sizeof(buffer)) {
119120
fprintf(stderr, "buffer size exceeded\n");
120121
return 1;

0 commit comments

Comments
 (0)