Skip to main content
  • Home
  • login
  • Browse the archive

    swh mirror partner logo
swh logo
SoftwareHeritage
Software
Heritage
Mirror
Features
  • Search

  • Downloads

  • Save code now

  • Add forge now

  • Help

Revision 6bd61198fb28b454090890f8efd3f86adf8773cc authored by Dr. Stephen Henson on 20 November 2012, 00:29:09 UTC, committed by Dr. Stephen Henson on 20 November 2012, 00:29:09 UTC
fix leaks
1 parent 23b5e47
  • Files
  • Changes
  • c70b32c
  • /
  • demos
  • /
  • eay
  • /
  • base64.c
Raw File
Cook and download a directory from the Software Heritage Vault

You have requested the cooking of the directory with identifier None into a standard tar.gz archive.

Are you sure you want to continue ?

Download a directory from the Software Heritage Vault

You have requested the download of the directory with identifier None as a standard tar.gz archive.

Are you sure you want to continue ?

Cook and download a revision from the Software Heritage Vault

You have requested the cooking of the history heading to revision with identifier swh:1:rev:6bd61198fb28b454090890f8efd3f86adf8773cc into a bare git archive.

Are you sure you want to continue ?

Download a revision from the Software Heritage Vault

You have requested the download of the history heading to revision with identifier swh:1:rev:6bd61198fb28b454090890f8efd3f86adf8773cc as a bare git archive.

Are you sure you want to continue ?

Invalid Email !

The provided email is not well-formed.

Download link has expired

The requested archive is no longer available for download from the Software Heritage Vault.

Do you want to cook it again ?

Permalinks

To reference or cite the objects present in the Software Heritage archive, permalinks based on SoftWare Hash IDentifiers (SWHIDs) must be used.
Select below a type of object currently browsed in order to display its associated SWHID and permalink.

  • revision
  • content
revision badge
swh:1:rev:6bd61198fb28b454090890f8efd3f86adf8773cc
content badge Iframe embedding
swh:1:cnt:4b8b0627d19f332f5cf8aa0ee035c55e034d200f
base64.c
/* This is a simple example of using the base64 BIO to a memory BIO and then
 * getting the data.
 */
#include <stdio.h>
#include <openssl/bio.h>
#include <openssl/evp.h>

main()
	{
	int i;
	BIO *mbio,*b64bio,*bio;
	char buf[512];
	char *p;

	mbio=BIO_new(BIO_s_mem());
	b64bio=BIO_new(BIO_f_base64());

	bio=BIO_push(b64bio,mbio);
	/* We now have bio pointing at b64->mem, the base64 bio encodes on
	 * write and decodes on read */

	for (;;)
		{
		i=fread(buf,1,512,stdin);
		if (i <= 0) break;
		BIO_write(bio,buf,i);
		}
	/* We need to 'flush' things to push out the encoding of the
	 * last few bytes.  There is special encoding if it is not a
	 * multiple of 3
	 */
	BIO_flush(bio);

	printf("We have %d bytes available\n",BIO_pending(mbio));

	/* We will now get a pointer to the data and the number of elements. */
	/* hmm... this one was not defined by a macro in bio.h, it will be for
	 * 0.9.1.  The other option is too just read from the memory bio.
	 */
	i=(int)BIO_ctrl(mbio,BIO_CTRL_INFO,0,(char *)&p);

	printf("%d\n",i);
	fwrite("---\n",1,4,stdout);
	fwrite(p,1,i,stdout);
	fwrite("---\n",1,4,stdout);

	/* This call will walk the chain freeing all the BIOs */
	BIO_free_all(bio);
	}
The diff you're trying to view is too large. Only the first 1000 changed files have been loaded.
Showing with 0 additions and 0 deletions (0 / 0 diffs computed)
swh spinner

Computing file changes ...

ENEA — Copyright (C), ENEA. License: GNU AGPLv3+.
Legal notes  ::  JavaScript license information ::  Web API

back to top