base64.* -> guacio.*

This commit is contained in:
Michael Jumper
2010-09-05 13:53:19 -07:00
parent b545688222
commit 0b01aa05c5
4 changed files with 19 additions and 11 deletions

View File

@@ -3,14 +3,14 @@
all: guacd
guacd: daemon.o proxy.o base64.o
$(CC) daemon.o proxy.o base64.o -l png -o guacd
guacd: daemon.o proxy.o guacio.o
$(CC) daemon.o proxy.o guacio.o -l png -o guacd
proxy.o: proxy.c proxy.h base64.h
proxy.o: proxy.c proxy.h guacio.h
$(CC) -c -ansi -pedantic proxy.c
base64.o: base64.c base64.h
$(CC) -c -ansi -pedantic base64.c
guacio.o: guacio.c guacio.h
$(CC) -c -ansi -pedantic guacio.c
daemon.o: daemon.c proxy.h
$(CC) -c -ansi -pedantic daemon.c

View File

@@ -2,6 +2,8 @@
#include <unistd.h>
#include <stdio.h>
#include "guacio.h"
char characters[64] = {
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P',
'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f',
@@ -79,15 +81,16 @@ ssize_t __write_base64_byte(int fd, char buf) {
return 1;
}
ssize_t write_base64(int fd, const char* buf, size_t count) {
ssize_t write_base64(int fd, const void* buf, size_t count) {
int retval;
const char* end = buf + count;
const char* char_buf = (const char*) buf;
const char* end = char_buf + count;
while (buf < end) {
while (char_buf < end) {
retval = __write_base64_byte(fd, *(buf++));
retval = __write_base64_byte(fd, *(char_buf++));
if (retval < 0)
return retval;

View File

@@ -1,6 +1,11 @@
#ifndef _GUACIO_H
#define _GUACIO_H
#include <unistd.h>
ssize_t write_base64(int fd, const void* buf, size_t count);
ssize_t flush_base64(int fd);
#endif

View File

@@ -3,7 +3,7 @@
#include <stdio.h>
#include <png.h>
#include "base64.h"
#include "guacio.h"
#include "proxy.h"
struct guac_write_info {
@@ -61,7 +61,7 @@ void proxy(int client_fd) {
write(client_fd, "name:hello;size:1024,768;", 25);
for (y=0; y<20; y++) {
for (y=0; y<200; y++) {
/* Write image */