libb64: Switch to github fork and upgrade to 2.0.0.1+git

Many of the patches floating around has been applied to github fork and
seems to be having recent releases.

Drop patches which are either applied or fixed differently in this
version

Signed-off-by: Khem Raj <raj.khem@gmail.com>
This commit is contained in:
Khem Raj 2022-08-24 14:53:12 -07:00
parent 517c9dab9e
commit a54a6b3823
9 changed files with 82 additions and 282 deletions

View File

@ -0,0 +1,46 @@
From cbe8bd2948f522062c6170f581e1e265692a9a55 Mon Sep 17 00:00:00 2001
From: Sergei Trofimovich <slyich@gmail.com>
Date: Sun, 24 Oct 2021 18:53:04 +0100
Subject: [PATCH] Makefile: fix parallel build of examples
Without the change examples fails to build as:
$ LANG=C make -j
make -C src
make -C examples
make[1]: Entering directory 'libb64/src'
cc -O3 -Werror -pedantic -I../include -c -o cencode.o cencode.c
make[1]: Entering directory 'libb64/examples'
make[1]: *** No rule to make target 'libb64.a', needed by 'c-example1'. Stop.
make[1]: Leaving directory 'libb64/examples'
make: *** [Makefile:8: all_examples] Error 2
make: *** Waiting for unfinished jobs....
cc -O3 -Werror -pedantic -I../include -c -o cdecode.o cdecode.c
ar rv libb64.a cencode.o cdecode.o
ar: creating libb64.a
a - cencode.o
a - cdecode.o
make[1]: Leaving directory 'libb64/src'
Upstream-Status: Submitted [https://github.com/libb64/libb64/pull/9]
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index db40356..aa48c76 100644
--- a/Makefile
+++ b/Makefile
@@ -4,7 +4,7 @@ all_src:
$(MAKE) -C src
all_base64: all_src
$(MAKE) -C base64
-all_examples:
+all_examples: all_src
$(MAKE) -C examples
clean: clean_src clean_base64 clean_include clean_examples
--
2.37.2

View File

@ -0,0 +1,27 @@
From 98eaf510f40e384b32c01ad4bd5c3a697fdd8560 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Wed, 24 Aug 2022 14:34:38 -0700
Subject: [PATCH] examples: Use proper function prototype for main
Upstream-Status: Submitted [https://github.com/libb64/libb64/pull/10]
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
examples/c-example1.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/examples/c-example1.c b/examples/c-example1.c
index a0001df..34585dd 100644
--- a/examples/c-example1.c
+++ b/examples/c-example1.c
@@ -83,7 +83,7 @@ char* decode(const char* input)
}
-int main()
+int main(int argc, char** argv)
{
const char* input = "hello world";
char* encoded;
--
2.37.2

View File

@ -1,57 +0,0 @@
From ee03e265804a07a0da5028b86960031bd7ab86b2 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Sat, 27 Mar 2021 22:01:13 -0700
Subject: [PATCH] use BUFSIZ as buffer size
Author: Jakub Wilk <jwilk@debian.org>
Bug: http://sourceforge.net/tracker/?func=detail&atid=785907&aid=3591336&group_id=152942
Upstream-Status: Pending
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
include/b64/decode.h | 3 ++-
include/b64/encode.h | 3 ++-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/include/b64/decode.h b/include/b64/decode.h
index 12b16ea..e9019f3 100644
--- a/include/b64/decode.h
+++ b/include/b64/decode.h
@@ -8,6 +8,7 @@ For details, see http://sourceforge.net/projects/libb64
#ifndef BASE64_DECODE_H
#define BASE64_DECODE_H
+#include <cstdio>
#include <iostream>
namespace base64
@@ -22,7 +23,7 @@ namespace base64
base64_decodestate _state;
int _buffersize;
- decoder(int buffersize_in = BUFFERSIZE)
+ decoder(int buffersize_in = BUFSIZ)
: _buffersize(buffersize_in)
{}
diff --git a/include/b64/encode.h b/include/b64/encode.h
index 5d807d9..e7a7035 100644
--- a/include/b64/encode.h
+++ b/include/b64/encode.h
@@ -8,6 +8,7 @@ For details, see http://sourceforge.net/projects/libb64
#ifndef BASE64_ENCODE_H
#define BASE64_ENCODE_H
+#include <cstdio>
#include <iostream>
namespace base64
@@ -22,7 +23,7 @@ namespace base64
base64_encodestate _state;
int _buffersize;
- encoder(int buffersize_in = BUFFERSIZE)
+ encoder(int buffersize_in = BUFSIZ)
: _buffersize(buffersize_in)
{}

View File

@ -1,77 +0,0 @@
From 7b30fbc3d47dfaf38d8ce8b8949a69d2984dac76 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Sat, 27 Mar 2021 22:06:03 -0700
Subject: [PATCH] fix integer overflows
Author: Jakub Wilk <jwilk@debian.org>
Bug: http://sourceforge.net/tracker/?func=detail&aid=3591129&group_id=152942&atid=785907
Upstream-Status: Pending
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
src/cdecode.c | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/src/cdecode.c b/src/cdecode.c
index a6c0a42..4e47e9f 100644
--- a/src/cdecode.c
+++ b/src/cdecode.c
@@ -9,10 +9,11 @@ For details, see http://sourceforge.net/projects/libb64
int base64_decode_value(char value_in)
{
- static const char decoding[] = {62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,-2,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51};
+ static const signed char decoding[] = {62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,-2,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51};
static const char decoding_size = sizeof(decoding);
+ if (value_in < 43) return -1;
value_in -= 43;
- if (value_in < 0 || value_in >= decoding_size) return -1;
+ if (value_in > decoding_size) return -1;
return decoding[(int)value_in];
}
@@ -26,7 +27,7 @@ int base64_decode_block(const char* code_in, const int length_in, char* plaintex
{
const char* codechar = code_in;
char* plainchar = plaintext_out;
- char fragment;
+ int fragment;
*plainchar = state_in->plainchar;
@@ -42,7 +43,7 @@ int base64_decode_block(const char* code_in, const int length_in, char* plaintex
state_in->plainchar = *plainchar;
return plainchar - plaintext_out;
}
- fragment = (char)base64_decode_value(*codechar++);
+ fragment = base64_decode_value(*codechar++);
} while (fragment < 0);
*plainchar = (fragment & 0x03f) << 2;
case step_b:
@@ -53,7 +54,7 @@ int base64_decode_block(const char* code_in, const int length_in, char* plaintex
state_in->plainchar = *plainchar;
return plainchar - plaintext_out;
}
- fragment = (char)base64_decode_value(*codechar++);
+ fragment = base64_decode_value(*codechar++);
} while (fragment < 0);
*plainchar++ |= (fragment & 0x030) >> 4;
*plainchar = (fragment & 0x00f) << 4;
@@ -65,7 +66,7 @@ int base64_decode_block(const char* code_in, const int length_in, char* plaintex
state_in->plainchar = *plainchar;
return plainchar - plaintext_out;
}
- fragment = (char)base64_decode_value(*codechar++);
+ fragment = base64_decode_value(*codechar++);
} while (fragment < 0);
*plainchar++ |= (fragment & 0x03c) >> 2;
*plainchar = (fragment & 0x003) << 6;
@@ -77,7 +78,7 @@ int base64_decode_block(const char* code_in, const int length_in, char* plaintex
state_in->plainchar = *plainchar;
return plainchar - plaintext_out;
}
- fragment = (char)base64_decode_value(*codechar++);
+ fragment = base64_decode_value(*codechar++);
} while (fragment < 0);
*plainchar++ |= (fragment & 0x03f);
}

View File

@ -1,26 +0,0 @@
From 8144fd9e02bd5ccd1e080297b19a1e9eb4d3ff96 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Sat, 27 Mar 2021 22:07:15 -0700
Subject: [PATCH] Fix off by one error
Launchpad bug #1501176 reported by William McCall on 2015-09-30
Upstream-Status: Pending
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
src/cdecode.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/cdecode.c b/src/cdecode.c
index 4e47e9f..45da4e1 100644
--- a/src/cdecode.c
+++ b/src/cdecode.c
@@ -13,7 +13,7 @@ int base64_decode_value(char value_in)
static const char decoding_size = sizeof(decoding);
if (value_in < 43) return -1;
value_in -= 43;
- if (value_in > decoding_size) return -1;
+ if (value_in >= decoding_size) return -1;
return decoding[(int)value_in];
}

View File

@ -1,40 +0,0 @@
From a7914d5ffee6ffdfb3f2b8ebcc22c8367d078301 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Sat, 27 Mar 2021 22:08:43 -0700
Subject: [PATCH] make overriding CFLAGS possible
Author: Jakub Wilk <jwilk@debian.org>
Upstream-Status: Pending
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
base64/Makefile | 2 +-
src/Makefile | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/base64/Makefile b/base64/Makefile
index 30a2c5c..783a248 100644
--- a/base64/Makefile
+++ b/base64/Makefile
@@ -3,7 +3,7 @@ BINARIES = base64
# Build flags (uncomment one)
#############################
# Release build flags
-CFLAGS += -O3
+CFLAGS ?= -O3
#############################
# Debug build flags
#CFLAGS += -g
diff --git a/src/Makefile b/src/Makefile
index 28b2382..48801fc 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -3,7 +3,7 @@ LIBRARIES = libb64.a
# Build flags (uncomment one)
#############################
# Release build flags
-CFLAGS += -O3
+CFLAGS ?= -O3
#############################
# Debug build flags
#CFLAGS += -g

View File

@ -1,27 +0,0 @@
From a1b9bb4af819ed389675f16e4a521efeda4cc3f3 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Sat, 27 Mar 2021 22:10:48 -0700
Subject: [PATCH] do not export the CHARS_PER_LINE variable
The library exports a variable named "CHARS_PER_LINE". This is a generic name that could conflict with a name in user's code.
Please either rename the variable or make it static.
Upstream-Status: Submitted [http://sourceforge.net/tracker/?func=detail&aid=3591420&group_id=152942&atid=785907]
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
src/cencode.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/cencode.c b/src/cencode.c
index 03ba5b6..3df62a8 100644
--- a/src/cencode.c
+++ b/src/cencode.c
@@ -7,7 +7,7 @@ For details, see http://sourceforge.net/projects/libb64
#include <b64/cencode.h>
-const int CHARS_PER_LINE = 72;
+static const int CHARS_PER_LINE = 72;
void base64_init_encodestate(base64_encodestate* state_in)
{

View File

@ -1,44 +0,0 @@
From c1ba44d83cc7d9d756cfb063717852eae9d03328 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Sat, 27 Mar 2021 22:12:41 -0700
Subject: [PATCH] initialize encoder/decoder state in the constructors
Author: Jakub Wilk <jwilk@debian.org>
Upstream-Status: Pending
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
include/b64/decode.h | 4 +++-
include/b64/encode.h | 4 +++-
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/include/b64/decode.h b/include/b64/decode.h
index e9019f3..aefb7bc 100644
--- a/include/b64/decode.h
+++ b/include/b64/decode.h
@@ -25,7 +25,9 @@ namespace base64
decoder(int buffersize_in = BUFSIZ)
: _buffersize(buffersize_in)
- {}
+ {
+ base64_init_decodestate(&_state);
+ }
int decode(char value_in)
{
diff --git a/include/b64/encode.h b/include/b64/encode.h
index e7a7035..33848b3 100644
--- a/include/b64/encode.h
+++ b/include/b64/encode.h
@@ -25,7 +25,9 @@ namespace base64
encoder(int buffersize_in = BUFSIZ)
: _buffersize(buffersize_in)
- {}
+ {
+ base64_init_encodestate(&_state);
+ }
int encode(char value_in)
{

View File

@ -2,22 +2,20 @@ SUMMARY = "Base64 Encoding/Decoding Routines"
DESCRIPTION = "base64 encoding/decoding library - runtime library \
libb64 is a library of ANSI C routines for fast encoding/decoding data into \
and from a base64-encoded format"
HOMEPAGE = "http://libb64.sourceforge.net/"
HOMEPAGE = "https://github.com/libb64"
LICENSE = "PD"
LIC_FILES_CHKSUM = "file://LICENSE;md5=ce551aad762074c7ab618a0e07a8dca3"
LIC_FILES_CHKSUM = "file://LICENSE.md;md5=81296a564fa0621472714aae7c763d96"
SRC_URI = "${SOURCEFORGE_MIRROR}/${BPN}/${BPN}/${BP}.zip \
PV .= "+2.0.0.2+git${SRCPV}"
SRCREV = "ce864b17ea0e24a91e77c7dd3eb2d1ac4175b3f0"
SRC_URI = "git://github.com/libb64/libb64;protocol=https;branch=master \
file://0001-example-Do-not-run-the-tests.patch \
file://0002-use-BUFSIZ-as-buffer-size.patch \
file://0003-fix-integer-overflows.patch \
file://0004-Fix-off-by-one-error.patch \
file://0005-make-overriding-CFLAGS-possible.patch \
file://0006-do-not-export-the-CHARS_PER_LINE-variable.patch \
file://0007-initialize-encoder-decoder-state-in-the-constructors.patch \
file://0001-Makefile-fix-parallel-build-of-examples.patch \
file://0001-examples-Use-proper-function-prototype-for-main.patch \
"
SRC_URI[sha256sum] = "20106f0ba95cfd9c35a13c71206643e3fb3e46512df3e2efb2fdbf87116314b2"
PARALLEL_MAKE = ""
S = "${WORKDIR}/git"
CFLAGS += "-fPIC"