NOAA-EMC / NCEPLIBS-g2c

This library contains C decoder/encoder routines for GRIB edition 2.
Other
18 stars 11 forks source link

Should png, jpeg and aec pack/unpack functions be public? #514

Closed DusanJovic-NOAA closed 1 week ago

DusanJovic-NOAA commented 1 month ago

Currently, theses 6 functions are public (declared in grib2.h):


/* Compression. */
void pngpack(float *fld, g2int width, g2int height, g2int *idrstmpl,
             unsigned char *cpack, g2int *lcpack);
g2int pngunpack(unsigned char *cpack, g2int len, g2int *idrstmpl, g2int ndpts,
                float *fld);
void jpcpack(float *fld, g2int width, g2int height, g2int *idrstmpl,
             unsigned char *cpack, g2int *lcpack);
g2int jpcunpack(unsigned char *cpack, g2int len, g2int *idrstmpl, g2int ndpts,
                float *fld);
void aecpack(float *fld, g2int width, g2int height, g2int *idrstmpl,
             unsigned char *cpack, g2int *lcpack);
g2int aecunpack(unsigned char *cpack, g2int len, g2int *idrstmpl, g2int ndpts,
                float *fld);

Why are they public? How are users supposed to use them? And why would they need to use them?

I think these should be made private. They are internal implementation, and we should be allowed to change the signature without breaking the user's code. If they are public, we are basically promising to never change them, for whatever reason.

DusanJovic-NOAA commented 1 month ago

Other pack/unpack functions, like simpack/simunpack, specpack/specunpack etc, are private.

edwardhartnett commented 1 month ago

Agreed.