Skip to content

Commit

Permalink
Merge pull request #1445 from hjarvard/2023Q4/graphics/jbig2dec
Browse files Browse the repository at this point in the history
graphics/jbig2dec: Regen patches and fix build
  • Loading branch information
tuxillo authored Oct 24, 2023
2 parents 657299d + 00a7432 commit ebdaa47
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 38 deletions.
15 changes: 11 additions & 4 deletions ports/graphics/jbig2dec/diffs/Makefile.diff
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
--- Makefile.orig 2021-02-23 17:51:13 UTC
--- Makefile.orig 2023-10-24 09:16:20 UTC
+++ Makefile
@@ -25,8 +25,4 @@ PNG_CONFIGURE_OFF= --without-libpng
PNG_CONFIGURE_ON= --with-libpng=${LOCALBASE}
@@ -15,7 +15,6 @@ USES= cpe libtool pathfix python:env,te
CONFIGURE_ENV= ac_cv_func_getopt_long=yes
GNU_CONFIGURE= yes
INSTALL_TARGET= install-strip
-LDFLAGS+= -lmd
TEST_TARGET= check
USE_LDCONFIG= yes

@@ -29,7 +28,4 @@ OPTIONS_DEFAULT=PNG
PNG_CONFIGURE_WITH= libpng=${LOCALBASE}
PNG_LIB_DEPENDS= libpng.so:graphics/png

-post-patch:
- @${RM} ${WRKSRC}/getopt* ${WRKSRC}/sha1.h
- @${REINPLACE_CMD} -E 's|SHA1_Final\( *([^,]+), *([^\)]+)\)|SHA1_Final(\2, \1)|' ${WRKSRC}/jbig2dec.c ${WRKSRC}/sha1.c
-
.include <bsd.port.mk>
19 changes: 5 additions & 14 deletions ports/graphics/jbig2dec/dragonfly/patch-jbig2dec.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
--- jbig2dec.c.bak.intermediate 2019-04-22 17:03:22 UTC
--- jbig2dec.c.orig 2023-10-24 09:18:19 UTC
+++ jbig2dec.c
@@ -40,7 +40,7 @@
@@ -33,7 +33,7 @@
#endif

#include "os_types.h"
Expand All @@ -9,16 +9,16 @@
#ifndef SHA1_DIGEST_SIZE
# define SHA1_DIGEST_SIZE 20
#endif
@@ -66,7 +66,7 @@ typedef enum {
@@ -65,7 +65,7 @@ typedef enum {
typedef struct {
jbig2dec_mode mode;
int verbose, hash, embedded;
- SHA1_CTX *hash_ctx;
+ SHA_CTX *hash_ctx;
char *output_filename;
jbig2dec_format output_format;
} jbig2dec_params_t;
@@ -78,7 +78,7 @@ static int print_usage(void);
size_t memory_limit;
@@ -213,7 +213,7 @@ static void *jbig2dec_realloc(Jbig2Alloc
static void
hash_init(jbig2dec_params_t *params)
{
Expand All @@ -27,12 +27,3 @@
if (params->hash_ctx == NULL) {
fprintf(stderr, "unable to allocate hash state\n");
params->hash = 0;
@@ -103,7 +103,7 @@ hash_print(jbig2dec_params_t *params, FI
char digest[2 * SHA1_DIGEST_SIZE + 1];
int i;

- SHA1_Final(params->hash_ctx, md);
+ SHA1_Final(md, params->hash_ctx);
for (i = 0; i < SHA1_DIGEST_SIZE; i++) {
snprintf(&(digest[2 * i]), 3, "%02x", md[i]);
}
22 changes: 2 additions & 20 deletions ports/graphics/jbig2dec/dragonfly/patch-sha1.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
--- sha1.c.intermediate 2019-04-22 17:03:22 UTC
--- sha1.c.orig 2023-10-24 09:27:08 UTC
+++ sha1.c
@@ -87,7 +87,7 @@ A million repetitions of "a"

Expand Down Expand Up @@ -40,7 +40,7 @@

/* Add padding and return the message digest. */
void
-SHA1_Final(SHA1_CTX *context, uint8_t digest[SHA1_DIGEST_SIZE])
-SHA1_Final(uint8_t digest[SHA1_DIGEST_SIZE], SHA1_CTX *context)
+SHA1_Final(uint8_t digest[SHA1_DIGEST_SIZE], SHA_CTX *context)
{
uint32_t i;
Expand All @@ -63,21 +63,3 @@
uint8_t digest[20];
char output[80];

@@ -350,7 +350,7 @@ main(int argc, char **argv)
for (k = 0; k < 2; k++) {
SHA1_Init(&context);
SHA1_Update(&context, (uint8_t *) test_data[k], strlen(test_data[k]));
- SHA1_Final(&context, digest);
+ SHA1_Final(digest, &context);
digest_to_hex(digest, output);

if (strcmp(output, test_results[k])) {
@@ -365,7 +365,7 @@ main(int argc, char **argv)
SHA1_Init(&context);
for (k = 0; k < 1000000; k++)
SHA1_Update(&context, (uint8_t *) "a", 1);
- SHA1_Final(&context, digest);
+ SHA1_Final(digest, &context);
digest_to_hex(digest, output);
if (strcmp(output, test_results[2])) {
fprintf(stdout, "FAIL\n");

0 comments on commit ebdaa47

Please sign in to comment.