Description: Fix examples in documentation Author: Jose G. López Use properly variable type and free() when needed. --- a/docs/manual.htm +++ b/docs/manual.htm @@ -522,7 +522,6 @@ //always remember to clean up leftovers... grg_key_free (context, keyholder); - grg_free (context, plaintext, txtlen); //also here, txtlen could be -1 grg_context_free (context); } @@ -548,7 +547,7 @@ //here the library will put the decoded data unsigned char *plaintext; - unsigned int txtlen; + long int txtlen; //we are ready to perform the decryption grg_decrypt_file (context, keyholder, filepath, &plaintext, &txtlen); @@ -580,7 +579,7 @@ GRG_CTX gctx = grg_context_initialize_defaults ("tRy"); GRG_TMPFILE tf = grg_tmpfile_gen (gctx); unsigned char *try; - long dim; + long int dim; //writes some stupid data grg_tmpfile_write (gctx, tf, "S0M3 S7UP1D DA7A", 16); @@ -588,14 +587,14 @@ [...] //then reads it. Simple... - grg_tmpfile_read (gctx, tf, &tyr, NULL); + grg_tmpfile_read (gctx, tf, &try, &dim); //Freedom... freedom... freedom... ;-) grg_tmpfile_close (gctx, tf); grg_context_free (gctx); //Use those data! - printf("Data were %s, of length %u\n", tyr, dim); + printf("Data were %s, of length %ld\n", try, dim); } [...]