Skip to content

Commit

Permalink
a grapics/jasper update made some internal function symbols not
Browse files Browse the repository at this point in the history
show up in the library. Fix the zyGrib build by using the public API
  • Loading branch information
plunky committed Jan 1, 2024
1 parent d6f1d58 commit 7b6ea97
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 6 deletions.
5 changes: 3 additions & 2 deletions misc/zyGrib/distinfo
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
$NetBSD: distinfo,v 1.25 2021/10/26 10:59:39 nia Exp $
$NetBSD: distinfo,v 1.26 2024/01/01 19:01:06 plunky Exp $

BLAKE2s (zyGrib-8.0.1.tgz) = d382684327d2fd8f2191bfee490be2f35ea98946980638d9e5316294a90e7229
SHA512 (zyGrib-8.0.1.tgz) = bb7146289d0966a174e0d888d6edc2830a2399f9cf51eb439371d90656fb9529fb08eebde8ea74f21f3c2aa7e625a258a318b9388523636815c8348269adb73d
Expand All @@ -9,5 +9,6 @@ SHA1 (patch-SkewT.h) = 5318b576bb4eeeb0b0a8bf0130cf9ac9907dac7f
SHA1 (patch-Terrain.cpp) = 98aba88e5704cdf0771c757d86d962ee043cecf4
SHA1 (patch-aa) = 1de327ef2cb5ea601ffbd6e5f3ba760dfe9543b0
SHA1 (patch-ab) = 1da0e837a68b7942ab8d4a829b92eef6b8e359e8
SHA1 (patch-g2clib_enc_jpeg2000.c) = 2119373fe7a0032edb9b9ff31ff79c974c513ce3
SHA1 (patch-g2clib_dec__jpeg2000.c) = 45de487f139a65414f1ca5adea4690008aa33884
SHA1 (patch-g2clib_enc_jpeg2000.c) = ebd6c2cd706462c3ea21310fba269f19684f70c7
SHA1 (patch-util_Util.h) = a7ae101a11de7ca29e8e6e8ccf173c5216ea3ac7
40 changes: 40 additions & 0 deletions misc/zyGrib/patches/patch-g2clib_dec__jpeg2000.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
$NetBSD: patch-g2clib_dec__jpeg2000.c,v 1.1 2024/01/01 19:01:06 plunky Exp $

jpc_decode() is an internal jasper function, use jas_image_decode() instead

--- g2clib/dec_jpeg2000.c.orig 2016-11-09 16:27:38.000000000 +0000
+++ g2clib/dec_jpeg2000.c
@@ -50,7 +50,7 @@
*$$$*/

{
- int ier;
+ int ier,fmt;
g2int i,j,k;
jas_image_t *image=0;
jas_stream_t *jpcstream;
@@ -61,6 +61,12 @@
// jas_init();

ier=0;
+
+ fmt = jas_image_strtofmt("jpc");
+ if (fmt == -1) {
+ printf(" image format 'jpc' unknown\n");
+ return -3;
+ }
//
// Create jas_stream_t containing input JPEG200 codestream in memory.
//
@@ -70,9 +76,9 @@
//
// Decode JPEG200 codestream into jas_image_t structure.
//
- image=jpc_decode(jpcstream,opts);
+ image=jas_image_decode(jpcstream,fmt,opts);
if ( image == 0 ) {
- printf(" jpc_decode return\n");
+ printf(" jas_image_decode return\n");
return -3;
}

44 changes: 40 additions & 4 deletions misc/zyGrib/patches/patch-g2clib_enc_jpeg2000.c
Original file line number Diff line number Diff line change
@@ -1,14 +1,50 @@
$NetBSD: patch-g2clib_enc_jpeg2000.c,v 1.2 2020/06/20 21:34:26 mef Exp $
$NetBSD: patch-g2clib_enc_jpeg2000.c,v 1.3 2024/01/01 19:01:06 plunky Exp $

https://github.com/cloudruninc/wps/issues/5

--- g2clib/enc_jpeg2000.c.orig 2019-10-28 18:40:41.262350843 +0100
+++ g2clib/enc_jpeg2000.c 2019-10-28 18:40:52.446238823 +0100
@@ -121,7 +121,6 @@
jpc_encode() is an internal jasper function, use jas_image_encode() instead

--- g2clib/enc_jpeg2000.c.orig 2016-11-09 16:27:38.000000000 +0000
+++ g2clib/enc_jpeg2000.c
@@ -69,7 +69,7 @@ int enc_jpeg2000(unsigned char *cin,g2in
*
*$$$*/
{
- int ier,rwcnt;
+ int ier,rwcnt,fmt;
jas_image_t image;
jas_stream_t *jpcstream,*istream;
jas_image_cmpt_t cmpt,*pcmpt;
@@ -121,7 +121,6 @@ int enc_jpeg2000(unsigned char *cin,g2in
image.clrspc_=JAS_CLRSPC_SGRAY; /* grayscale Image */
image.cmprof_=0;
#endif
- image.inmem_=1;

cmpt.tlx_=0;
cmpt.tly_=0;
@@ -143,6 +142,12 @@ int enc_jpeg2000(unsigned char *cin,g2in
pcmpt=&cmpt;
image.cmpts_=&pcmpt;

+ fmt = jas_image_strtofmt("jpc");
+ if (fmt == -1) {
+ printf(" image format 'jpc' not found\n");
+ return -3;
+ }
+
//
// Open a JasPer stream containing the input grayscale values
//
@@ -158,9 +163,9 @@ int enc_jpeg2000(unsigned char *cin,g2in
//
// Encode image.
//
- ier=jpc_encode(&image,jpcstream,opts);
+ ier=jas_image_encode(&image,jpcstream,fmt,opts);
if ( ier != 0 ) {
- printf(" jpc_encode return = %d \n",ier);
+ printf(" jas_image_encode return = %d \n",ier);
return -3;
}
//

0 comments on commit 7b6ea97

Please sign in to comment.