summary | 
shortlog | 
log | 
commit | commitdiff | 
tree
raw | 
patch | 
inline | side by side (from parent 1: 
e53eb5d)
 
  We were passing unsigned char * as the parameter to all of the
  character fetching/putting functions. Use void * instead so that
  we can pass other types of data without needlessly having to cast.
        int curoctet;
        int count;
        long crc24;
        int curoctet;
        int count;
        long crc24;
-       int (*putchar_func)(void *ctx, size_t count, unsigned char *c);
+       int (*putchar_func)(void *ctx, size_t count, void *c);
-static int armor_putchar(void *ctx, size_t count, unsigned char *c)
+static int armor_putchar(void *ctx, size_t count, void *c)
 {
        int i;
 
        log_assert(c != NULL);
 
        for (i = 0; i < count; i++) {
 {
        int i;
 
        log_assert(c != NULL);
 
        for (i = 0; i < count; i++) {
-               armor_putchar_int(ctx, c[i]);
+               armor_putchar_int(ctx, ((char *) c)[i]);
        int curoctet;
        int count;
        long crc24;
        int curoctet;
        int count;
        long crc24;
-       int (*getchar_func)(void *ctx, size_t count, unsigned char *c);
+       int (*getchar_func)(void *ctx, size_t count, void *c);
-static int dearmor_getchar_c(void *ctx, size_t count, unsigned char *c)
+static int dearmor_getchar_c(void *ctx, size_t count, void *c)
 {
        int i, rc = 0;
 
        for (i = 0; i < count && rc == 0; i++) {
 {
        int i, rc = 0;
 
        for (i = 0; i < count && rc == 0; i++) {
-               rc = dearmor_getchar(ctx, &c[i]);
+               rc = dearmor_getchar(ctx, &((unsigned char *) c)[i]);
  *     using putchar_func.
  */
 int armor_openpgp_stream(int (*putchar_func)(void *ctx, size_t count,
  *     using putchar_func.
  */
 int armor_openpgp_stream(int (*putchar_func)(void *ctx, size_t count,
                                void *ctx,
                                struct openpgp_packet_list *packets)
 {
                                void *ctx,
                                struct openpgp_packet_list *packets)
 {
  *     packets.
  */
 int dearmor_openpgp_stream(int (*getchar_func)(void *ctx, size_t count,
  *     packets.
  */
 int dearmor_openpgp_stream(int (*getchar_func)(void *ctx, size_t count,
                                void *ctx,
                                struct openpgp_packet_list **packets)
 {
                                void *ctx,
                                struct openpgp_packet_list **packets)
 {
 
  *     using putchar_func.
  */
 int armor_openpgp_stream(int (*putchar_func)(void *ctx, size_t count,
  *     using putchar_func.
  */
 int armor_openpgp_stream(int (*putchar_func)(void *ctx, size_t count,
                                void *ctx,
                                struct openpgp_packet_list *packets);
 
                                void *ctx,
                                struct openpgp_packet_list *packets);
 
  *     packets.
  */
 int dearmor_openpgp_stream(int (*getchar_func)(void *ctx, size_t count,
  *     packets.
  */
 int dearmor_openpgp_stream(int (*getchar_func)(void *ctx, size_t count,
                                void *ctx,
                                struct openpgp_packet_list **packets);
 
                                void *ctx,
                                struct openpgp_packet_list **packets);
 
 
  *     @count: The number of characters to get from the buffer.
  *     @c: Where to put the characters retrieved.
  */
  *     @count: The number of characters to get from the buffer.
  *     @c: Where to put the characters retrieved.
  */
-int buffer_fetchchar(void *ctx, size_t count, unsigned char *c)
+int buffer_fetchchar(void *ctx, size_t count, void *c)
 {
        struct buffer_ctx *buf = NULL;
        
 {
        struct buffer_ctx *buf = NULL;
        
  *     fill it then we double the size of the current buffer and then add the
  *     rest.
  */
  *     fill it then we double the size of the current buffer and then add the
  *     rest.
  */
-int buffer_putchar(void *ctx, size_t count, unsigned char *c)
+int buffer_putchar(void *ctx, size_t count, void *c)
 {
        struct buffer_ctx *buf = NULL;
        size_t newsize = 0;
 {
        struct buffer_ctx *buf = NULL;
        size_t newsize = 0;
 /**
  *     file_fetchchar - Fetches a char from a file.
  */
 /**
  *     file_fetchchar - Fetches a char from a file.
  */
-int file_fetchchar(void *fd, size_t count, unsigned char *c)
+int file_fetchchar(void *fd, size_t count, void *c)
 {
        return !(read( *(int *) fd, c, count));
 }
 {
        return !(read( *(int *) fd, c, count));
 }
 /**
  *     file_putchar - Puts a char to a file.
  */
 /**
  *     file_putchar - Puts a char to a file.
  */
-int file_putchar(void *fd, size_t count, unsigned char *c)
+int file_putchar(void *fd, size_t count, void *c)
 {
        return !(write( *(int *) fd, c, count));
 }
 {
        return !(write( *(int *) fd, c, count));
 }
 /**
  *     stdin_getchar - Gets a char from stdin.
  */
 /**
  *     stdin_getchar - Gets a char from stdin.
  */
-int stdin_getchar(void *ctx, size_t count, unsigned char *c)
+int stdin_getchar(void *ctx, size_t count, void *c)
 {
        return (fread(c, 1, count, stdin) != count);
 }
 {
        return (fread(c, 1, count, stdin) != count);
 }
 /**
  *     stdout_putchar - Puts a char to stdout.
  */
 /**
  *     stdout_putchar - Puts a char to stdout.
  */
-int stdout_putchar(void *ctx, size_t count, unsigned char *c)
+int stdout_putchar(void *ctx, size_t count, void *c)
 {
        return (fwrite(c, 1, count, stdout) != count);
 }
 {
        return (fwrite(c, 1, count, stdout) != count);
 }
 
  *     @count: The number of characters to get from the buffer.
  *     @c: Where to put the characters retrieved.
  */
  *     @count: The number of characters to get from the buffer.
  *     @c: Where to put the characters retrieved.
  */
-int buffer_fetchchar(void *ctx, size_t count, unsigned char *c);
+int buffer_fetchchar(void *ctx, size_t count, void *c);
 
 /**
  *     buffer_putchar - Puts a char to a buffer.
 
 /**
  *     buffer_putchar - Puts a char to a buffer.
  *     fill it then we double the size of the current buffer and then add the
  *     rest.
  */
  *     fill it then we double the size of the current buffer and then add the
  *     rest.
  */
-int buffer_putchar(void *ctx, size_t count, unsigned char *c);
+int buffer_putchar(void *ctx, size_t count, void *c);
 
 /**
  *     file_fetchchar - Fetches a char from a file.
  */
 
 /**
  *     file_fetchchar - Fetches a char from a file.
  */
-int file_fetchchar(void *fd, size_t count, unsigned char *c);
+int file_fetchchar(void *fd, size_t count, void *c);
 
 /**
  *     file_putchar - Puts a char to a file.
  */
 
 /**
  *     file_putchar - Puts a char to a file.
  */
-int file_putchar(void *fd, size_t count, unsigned char *c);
+int file_putchar(void *fd, size_t count, void *c);
 
 /**
  *     stdin_getchar - Gets a char from stdin.
  */
 
 /**
  *     stdin_getchar - Gets a char from stdin.
  */
-int stdin_getchar(void *ctx, size_t count, unsigned char *c);
+int stdin_getchar(void *ctx, size_t count, void *c);
 
 /**
  *     stdout_putchar - Puts a char to stdout.
  */
 
 /**
  *     stdout_putchar - Puts a char to stdout.
  */
-int stdout_putchar(void *ctx, size_t count, unsigned char *c);
+int stdout_putchar(void *ctx, size_t count, void *c);
 
 #endif /* __CHARFUNCS_H__ */
 
 #endif /* __CHARFUNCS_H__ */
 
 /**
  *     keydb_fetchchar - Fetches a char from a file.
  */
 /**
  *     keydb_fetchchar - Fetches a char from a file.
  */
-static int keydb_fetchchar(void *fd, size_t count, unsigned char *c)
+static int keydb_fetchchar(void *fd, size_t count, void *c)
 {
        return (!lo_read(dbconn, *(int *) fd, (char *) c, count));
 }
 {
        return (!lo_read(dbconn, *(int *) fd, (char *) c, count));
 }
 /**
  *     keydb_putchar - Puts a char to a file.
  */
 /**
  *     keydb_putchar - Puts a char to a file.
  */
-static int keydb_putchar(void *fd, size_t count, unsigned char *c)
+static int keydb_putchar(void *fd, size_t count, void *c)
 {
        return !(lo_write(dbconn, *(int *) fd, (char *) c, count));
 }
 {
        return !(lo_write(dbconn, *(int *) fd, (char *) c, count));
 }
 
  *     ready for parsing as a public key or whatever.
  */
 int read_openpgp_stream(int (*getchar_func)(void *ctx, size_t count,
  *     ready for parsing as a public key or whatever.
  */
 int read_openpgp_stream(int (*getchar_func)(void *ctx, size_t count,
                                void *ctx,
                                struct openpgp_packet_list **packets,
                                int maxnum)
                                void *ctx,
                                struct openpgp_packet_list **packets,
                                int maxnum)
  *     packet stream from a linked list of packets.
  */
 int write_openpgp_stream(int (*putchar_func)(void *ctx, size_t count,
  *     packet stream from a linked list of packets.
  */
 int write_openpgp_stream(int (*putchar_func)(void *ctx, size_t count,
                                void *ctx,
                                struct openpgp_packet_list *packets)
 {
                                void *ctx,
                                struct openpgp_packet_list *packets)
 {
 
  *     none of the other packets of the key will be read.
  */
 int read_openpgp_stream(int (*getchar_func)(void *ctx, size_t count,
  *     none of the other packets of the key will be read.
  */
 int read_openpgp_stream(int (*getchar_func)(void *ctx, size_t count,
                                void *ctx,
                                struct openpgp_packet_list **packets,
                                int maxnum);
                                void *ctx,
                                struct openpgp_packet_list **packets,
                                int maxnum);
  *     packet stream from a linked list of packets.
  */
 int write_openpgp_stream(int (*putchar_func)(void *ctx, size_t count,
  *     packet stream from a linked list of packets.
  */
 int write_openpgp_stream(int (*putchar_func)(void *ctx, size_t count,
                                void *ctx,
                                struct openpgp_packet_list *packets);
 
                                void *ctx,
                                struct openpgp_packet_list *packets);
 
 
 #include "parsekey.h"
 #include "sendsync.h"
 
 #include "parsekey.h"
 #include "sendsync.h"
 
-int fd_putchar(void *ctx, size_t count, unsigned char *c)
+int fd_putchar(void *ctx, size_t count, void *c)
 {
        int i;
 
        for (i = 0; i < count; i++) {
 {
        int i;
 
        for (i = 0; i < count; i++) {
+               fputc(((char *) c )[i], ctx);