On Wed, Apr 10, 2013 at 6:01 PM, <
johnalan...@polylabs.ca> wrote:
> I have the following C code embeded in my Go code
>
> int Base64Encode(const char* message, int length, char** buffer) { //Encodes
> a string to base64
> BIO *bio, *b64;
> //size_t size;
> FILE* stream;
> int encodedSize = 4*ceil((double)length/3);
> *buffer = (char *)malloc(encodedSize+1);
>
> stream = fmemopen(*buffer, encodedSize+1, "w");
> b64 = BIO_new(BIO_f_base64());
> bio = BIO_new_fp(stream, BIO_NOCLOSE);
> bio = BIO_push(b64, bio); //<--- LINE 35
> BIO_set_flags(bio, BIO_FLAGS_BASE64_NO_NL); //Ignore newlines - write
> everything in one line
> BIO_write(bio, message, length);
> BIO_flush(bio);
> BIO_free_all(bio);
> fclose(stream);
>
> return (0); //success
> }
>
> when I run go run xxx.go, it returns with the error xxx.go:35 error: Value
> computed is not used [-Werror=unused-value]
> Basically it is saying I have computed some value on line 35 (marked in the
> code) assign it to the variable bio, and then not use it,
> However I use on the next 4 lines after that, so I am a little confused.
>
> Any help would be greatly appreciated
Probably BIO_push is a macro. Put your C code in a .c file and run
gcc -E to see what BIO_push expands to.
Ian