summaryrefslogtreecommitdiff
path: root/lib/base64.c
Commit message (Collapse)AuthorAgeFilesLines
* version-etc: new yearPaul Eggert2014-12-311-1/+1
| | | | | | * doc/gnulib.texi: * lib/version-etc.c (COPYRIGHT_YEAR): Update copyright date. * all files: Run 'make update-copyright'.
* maint: update copyrightEric Blake2014-01-011-1/+1
| | | | | | I ran 'make update-copyright'. Signed-off-by: Eric Blake <eblake@redhat.com>
* base64: fix recent compilation regression on some compilersRV9712013-11-291-1/+4
| | | | | | | | | | This fixes a compile failure with "Sun C 5.8 Patch 121015-05 2007/08/01" which returns: "base64.c", line 99: void function cannot return value * lib/base64.c: Don't return the void function, instead split to a separate return statement.
* base64: provide a fast path for encoding well sized buffersPádraig Brady2013-11-111-6/+34
| | | | | | | | | | | | | | | | | | Avoid conditionals in the base64 encoding loop, which was seen to give a 60% throughput improvement with the base64 utility from coreutils: $ truncate -s100MiB file.in $ time base64-old -w0 < file.in >/dev/null real 0m0.302s $ time base64-new -w0 < file.in >/dev/null real 0m0.182s * lib/base64.c (base64_encode_fast): A new function to be called when we don't want to NUL terminate, and we have enough space in the output to encode the given input. (base64_encode): Call the _fast() version when appropriate. Also remove a redundant mask with 0x3F on the first encoded byte.
* maint: update all copyright year number rangesEric Blake2013-01-011-1/+1
| | | | | | Run "make update-copyright". Compare to commit 1602f0a from last year. Signed-off-by: Eric Blake <eblake@redhat.com>
* base32, base64: no need for 'inline'Paul Eggert2012-11-291-3/+3
| | | | | | | | | * lib/base32.c (to_uchar, get_8, decode_8): * lib/base64.c (to_uchar, get_4, decode_4): Change 'static inline' to 'inline'. * m4/base32.m4 (gl_PREREQ_BASE32): * m4/base64.m4 (gl_PREREQ_BASE64): Do not require AC_C_INLINE.
* maint: replace FSF snail-mail addresses with URLsPaul Eggert2012-02-091-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * config/argz.mk, lib/accept4.c, lib/alignof.h, lib/alloca.in.h: * lib/alphasort.c, lib/arcfour.c, lib/arcfour.h, lib/arctwo.c: * lib/arctwo.h, lib/argz.c, lib/arpa_inet.in.h, lib/asnprintf.c: * lib/asprintf.c, lib/assert.in.h, lib/base32.c, lib/base32.h: * lib/base64.c, lib/base64.h, lib/c-ctype.c, lib/c-ctype.h: * lib/c-strcase.h, lib/c-strcasecmp.c, lib/c-strncasecmp.c: * lib/check-version.c, lib/check-version.h, lib/config.charset: * lib/ctype.in.h, lib/des.c, lib/des.h, lib/dup3.c, lib/errno.in.h: * lib/float+.h, lib/fnmatch.c, lib/fnmatch.in.h, lib/fnmatch_loop.c: * lib/fseeko.c, lib/gai_strerror.c, lib/gc-gnulib.c: * lib/gc-libgcrypt.c, lib/gc-pbkdf2-sha1.c, lib/gc.h: * lib/getaddrinfo.c, lib/getdelim.c, lib/getfilecon.c, lib/getline.c: * lib/getlogin_r.c, lib/getpass.c, lib/getpass.h, lib/gettext.h: * lib/gettimeofday.c, lib/glob.in.h, lib/glthread/cond.c: * lib/glthread/cond.h, lib/glthread/lock.c, lib/glthread/lock.h: * lib/glthread/thread.c, lib/glthread/thread.h: * lib/glthread/threadlib.c, lib/glthread/yield.h, lib/hmac-md5.c: * lib/hmac-sha1.c, lib/hmac.h, lib/iconv.c, lib/iconv.in.h: * lib/iconv_close.c, lib/iconv_open.c, lib/inet_ntop.c, lib/isfinite.c: * lib/isinf.c, lib/iswblank.c, lib/langinfo.in.h, lib/link.c: * lib/localcharset.c, lib/localcharset.h, lib/lseek.c, lib/malloc.c: * lib/malloca.c, lib/malloca.h, lib/md2.c, lib/md2.h, lib/md4.c: * lib/md4.h, lib/md5.c, lib/md5.h, lib/memmem.c, lib/mempcpy.c: * lib/memset.c, lib/memxor.c, lib/memxor.h, lib/minmax.h, lib/mktime.c: * lib/msvc-inval.c, lib/msvc-inval.h, lib/msvc-nothrow.c: * lib/msvc-nothrow.h, lib/netdb.in.h, lib/netinet_in.in.h, lib/nproc.c: * lib/nproc.h, lib/obstack_printf.c, lib/pathmax.h, lib/pipe.c: * lib/pipe2.c, lib/poll.c, lib/poll.in.h, lib/printf-args.c: * lib/printf-args.h, lib/printf-parse.c, lib/printf-parse.h: * lib/pselect.c, lib/pthread.in.h, lib/pty-private.h, lib/pty.in.h: * lib/read-file.c, lib/read-file.h, lib/ref-add.sin, lib/ref-del.sin: * lib/regcomp.c, lib/regex.c, lib/regex.h, lib/regex_internal.c: * lib/regex_internal.h, lib/regexec.c, lib/rijndael-alg-fst.c: * lib/rijndael-alg-fst.h, lib/rijndael-api-fst.c: * lib/rijndael-api-fst.h, lib/rint.c, lib/rintf.c, lib/rintl.c: * lib/round.c, lib/roundf.c, lib/roundl.c, lib/scandir.c, lib/select.c: * lib/sha1.c, lib/sha1.h, lib/size_max.h, lib/snprintf.c: * lib/stdalign.in.h, lib/stdarg.in.h, lib/stdbool.in.h: * lib/stddef.in.h, lib/stdint.in.h, lib/stdio.in.h, lib/str-kmp.h: * lib/str-two-way.h, lib/strcasecmp.c, lib/strcasestr.c, lib/strdup.c: * lib/striconv.c, lib/striconv.h, lib/string.in.h, lib/strings.in.h: * lib/strncasecmp.c, lib/strndup.c, lib/strnlen.c, lib/strpbrk.c: * lib/strptime.c, lib/strsep.c, lib/strstr.c, lib/strverscmp.c: * lib/sys_file.in.h, lib/sys_ioctl.in.h, lib/sys_select.in.h: * lib/sys_socket.in.h, lib/sys_stat.in.h, lib/sys_time.in.h: * lib/sys_times.in.h, lib/sys_types.in.h, lib/sys_uio.in.h: * lib/sys_utsname.in.h, lib/sys_wait.in.h, lib/tcgetsid.c: * lib/termios.in.h, lib/time.in.h, lib/time_r.c, lib/timegm.c: * lib/times.c, lib/unictype/3level.h, lib/unictype/3levelbit.h: * lib/unistd.in.h, lib/vasnprintf.c, lib/vasnprintf.h, lib/vasprintf.c: * lib/vsnprintf.c, lib/waitpid.c, lib/wchar.in.h, lib/wctype.in.h: * lib/xsize.h, tests/test-closein.c, tests/test-des.c: * tests/test-fclose.c, tests/test-fgetc.c, tests/test-filevercmp.c: * tests/test-fputc.c, tests/test-fread.c, tests/test-fwrite.c: * tests/test-gc-arcfour.c, tests/test-gc-arctwo.c, tests/test-gc-des.c: * tests/test-gc-hmac-md5.c, tests/test-gc-hmac-sha1.c: * tests/test-gc-md2.c, tests/test-gc-md4.c, tests/test-gc-md5.c: * tests/test-gc-pbkdf2-sha1.c, tests/test-gc-rijndael.c: * tests/test-gc-sha1.c, tests/test-gc.c, tests/test-getdelim.c: * tests/test-getline.c, tests/test-getndelim2.c, tests/test-md2.c: * tests/test-md4.c, tests/test-parse-datetime.c, tests/test-perror.c: * tests/test-perror2.c, tests/test-pipe.c, tests/test-pipe2.c: * tests/test-poll.c, tests/test-quotearg-simple.c: * tests/test-quotearg.c, tests/test-quotearg.h: * tests/test-round-ieee.c, tests/test-round1.c: * tests/test-roundf-ieee.c, tests/test-roundf1.c: * tests/test-roundl-ieee.c, tests/test-roundl.c: * tests/test-safe-alloc.c, tests/test-sigpipe.c: * tests/test-spawn-pipe-child.c, tests/test-spawn-pipe-main.c: * tests/test-strerror.c, tests/test-strerror_r.c: * tests/test-strsignal.c, tests/test-strverscmp.c: * tests/test-xmemdup0.c: Replace FSF snail mail addresses with URLs, as per GNU coding standards. See glibc bug <http://sourceware.org/bugzilla/show_bug.cgi?id=13673>.
* maint: update all copyright year number rangesJim Meyering2012-01-011-1/+1
| | | | Run "make update-copyright".
* base64: Reference latest RFC.Simon Josefsson2011-08-121-1/+1
| | | | | | * lib/base64.c: Fix comment to reference RFC 4648. Suggested by Bruno Haible <bruno@clisp.org> and Gijs van Tulder <gvtulder@gmail.com>.
* base64: fix off-by-one buffer size bugPaul Eggert2011-08-101-3/+3
| | | | | | | Problem and (trivial) fix reported by Gijs van Tulder in <http://lists.gnu.org/archive/html/bug-gnulib/2011-08/msg00083.html>. * lib/base64.c (base64_decode_alloc_ctx): Allocate one more byte. * tests/test-base64.c (main): Catch the bug.
* Revert "use _GL_ATTRIBUTE_CONST and _GL_ATTRIBUTE_PURE"Jim Meyering2011-04-251-9/+1
| | | | | This reverts commit 349d7fe0e307d59d508b3579317ee8d4eacfeb9c. Revert accidentally-pushed patch. Not yet ready.
* use _GL_ATTRIBUTE_CONST and _GL_ATTRIBUTE_PUREJim Meyering2011-04-251-1/+9
|
* maint: update almost all copyright ranges to include 2011Jim Meyering2011-01-011-2/+1
| | | | Run the new "make update-copyright" rule.
* update nearly all FSF copyright year lists to include 2010Jim Meyering2010-01-011-1/+1
| | | | | Use the same procedure as for 2009, outlined in http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/20081
* update nearly all FSF copyright year lists to include 2009Jim Meyering2009-12-291-1/+1
| | | | | | | | | | | | | | | | | | The files named by the following are exempted: grep -v '^#' config/srclist.txt|grep -v '^$' \ | while read src dst; do test -f "$dst" && { echo "$dst"; continue; } test -d "$dst" || continue echo "$dst"/$(basename "$src") done > exempt git ls-files tests/unictype >> exempt In the remaining files, convert to all-interval notation if - there is already at least one year interval like 2000-2003 - the file is maintained by me - the file is in lib/uni*/, where that style already prevails Otherwise, use update-copyright's default.
* Use spaces for indentation, not tabs.Bruno Haible2009-12-101-168/+168
|
* Sync gnulib base64 with coreutils base64.Simon Josefsson2008-05-191-61/+212
| | | | | | | | | | | | | | | | | | | * lib/base64.c (base64_decode_ctx): If a decode context structure was passed in use it to ignore newlines. If a context structure was _not_ passed in, continue to treat newlines as garbage (this is the historical behavior). Formerly base64_decode. (base64_decode_alloc_ctx): Formerly base64_decode_alloc. Now takes a decode context structure. * lib/base64.h (base64_decode): Macro for four-argument calls. (base64_decode_alloc): Likewise. * lib/base64.c (base64_decode_ctx): If a decode context structure was passed in use it to ignore newlines. If a context structure was _not_ passed in, continue to treat newlines as garbage (this is the historical behavior). Formerly base64_decode. (base64_decode_alloc_ctx): Formerly base64_decode_alloc. Now takes a decode context structure. * lib/base64.h (base64_decode): Macro for four-argument calls. (base64_decode_alloc): Likewise.
* * lib/arcfour.c: Assume config.h.Eric Blake2006-10-291-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | * lib/arctwo.c: Likewise. * lib/base64.c: Likewise. * lib/check-version.c: Likewise. * lib/crc.c: Likewise. * lib/des.c: Likewise. * lib/gc-gnulib.c: Likewise. * lib/gc-libgcrypt.c: Likewise. * lib/gc-pbkdf2-sha1.c: Likewise. * lib/getaddrinfo.c: Likewise. * lib/getdelim.c: Likewise. * lib/getline.c: Likewise. * lib/hmac-md5.c: Likewise. * lib/hmac-sha1.c: Likewise. * lib/iconvme.c: Likewise. * lib/md2.c: Likewise. * lib/md4.c: Likewise. * lib/memxor.c: Likewise. * lib/read-file.c: Likewise. * lib/readline.c: Likewise. * lib/rijndael-alg-fst.c: Likewise. * lib/rijndael-api-fst.c: Likewise. * lib/xgetdomainname.c: Likewise.
* * base64.c (B64): Use _ as the formal parameter, not x, to avoidPaul Eggert2006-06-261-66/+69
| | | | bug in IBM C V6 for AIX.
* Doc fix.Simon Josefsson2006-04-191-2/+2
|
* Doc fix.Simon Josefsson2006-04-181-1/+3
|
* Doc fix.Simon Josefsson2006-03-241-1/+2
|
* 2006-03-24 Simon Josefsson <jas@extundo.com>Simon Josefsson2006-03-241-7/+11
| | | | | | * base64.c: Fix problems reported by Eric Blake <ebb9@byu.net>, including some doc fixes. (base64_encode_alloc): Fix +1 bug on allocation failures.
* 2006-03-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>Simon Josefsson2006-03-241-1/+1
| | | | | * base64.c (base64_encode): Do not read past end of array with unsanitized input on systems with CHAR_BIT > 8.
* Line wrap.Simon Josefsson2006-03-241-1/+2
|
* Fix warning, reported by Bruno Haible <bruno@clisp.org> and patch bySimon Josefsson2006-01-121-2/+11
| | | | Paul Eggert <eggert@CS.UCLA.EDU>.
* 2005-09-12 Ralf Wildenhues <Ralf.Wildenhues@gmx.de> (tiny change)Simon Josefsson2005-09-131-2/+2
| | | | | * lib/base64.c: Typo. (base64_encode): Put b64str in initialized data section.
* 2005-06-28 Simon Josefsson <jas@extundo.com>Simon Josefsson2005-06-271-11/+15
| | | | | | | | | * base64.c (base64_encode): Indent. Rename 'b64' to avoid collision with global variable. Better indentation. Don't increment buffer pointer beyond buffer end. Based on comments from Paul Eggert <eggert@cs.ucla.edu>. * base64.h: Indent.
* *** empty log message ***Paul Eggert2005-05-141-1/+1
|
* * base64.h (isbase64): Add.Simon Josefsson2005-01-201-6/+6
| | | | | | * base64.c (isb64): Rename to isbase64, use to_uchar instead of using a unsigned prototype, don't inline. (base64_decode): Use it.
* Add base64.Simon Josefsson2004-11-301-0/+403