ploticus: fix zlib file handle type (#396651)

This commit is contained in:
Aleksana
2025-04-20 09:11:31 +08:00
committed by GitHub
2 changed files with 40 additions and 5 deletions
@@ -0,0 +1,28 @@
Index: src/svg.c
===================================================================
--- a/src/svg.c
+++ b/src/svg.c
@@ -676,9 +676,9 @@
double x1, y1, x2, y2;
{
char *buf;
#ifdef WZ
- FILE *outfp;
+ gzFile outfp;
#endif
if (svg_style_in_prog) fprintf( svg_fp, "</g>");
fprintf( svg_fp, "</g>\n" ); /* close default style */
@@ -731,10 +731,10 @@
svg_fp = fopen( svg_tmpfilename, "r" );
if( svg_fp == NULL ) return( Eerr( 2487, "cannot reopen temp file", svg_tmpfilename ) );
#ifdef WZ
if( svg_compress ) {
- if( svg_stdout ) outfp = (FILE *) gzdopen( 1, svg_compressmode ); /* stdout = 1 */
- else outfp = (FILE *) gzopen( svg_filename, svg_compressmode );
+ if( svg_stdout ) outfp = gzdopen( 1, svg_compressmode ); /* stdout = 1 */
+ else outfp = gzopen( svg_filename, svg_compressmode );
if( outfp == NULL ) return( Eerr( 2488, "cannot open output file", svg_filename ) );
}
#endif
buf = svg_style; /* reuse */
+12 -5
View File
@@ -19,7 +19,7 @@ stdenv.mkDerivation (finalAttrs: {
url = "mirror://sourceforge/ploticus/ploticus/${finalAttrs.version}/ploticus${
lib.replaceStrings [ "." ] [ "" ] finalAttrs.version
}_src.tar.gz";
sha256 = "PynkufQFIDqT7+yQDlgW2eG0OBghiB4kHAjKt91m4LA=";
hash = "sha256-PynkufQFIDqT7+yQDlgW2eG0OBghiB4kHAjKt91m4LA=";
};
patches = [
@@ -33,6 +33,11 @@ stdenv.mkDerivation (finalAttrs: {
# This is required for non-ASCII fonts to work:
# https://ploticus.sourceforge.net/doc/fonts.html
./use-gd-package.patch
# svg.c:752:26: error: passing argument 1 of 'gzclose' from incompatible pointer type []
# 752 | gzclose( outfp );
# note: expected 'gzFile' {aka 'struct gzFile_s *'} but argument is of type 'FILE *'
./fix-zlib-file-type.patch
];
buildInputs = [
@@ -56,6 +61,8 @@ stdenv.mkDerivation (finalAttrs: {
makeFlags = [ "CC:=$(CC)" ];
enableParallelBuilding = true;
preInstall = ''
mkdir -p "$out/bin"
'';
@@ -84,7 +91,7 @@ stdenv.mkDerivation (finalAttrs: {
'';
};
meta = with lib; {
meta = {
description = "Non-interactive software package for producing plots and charts";
longDescription = ''
Ploticus is a free, GPL'd, non-interactive
@@ -94,9 +101,9 @@ stdenv.mkDerivation (finalAttrs: {
statistical capabilities. It allows significant user control
over colors, styles, options and details.
'';
license = licenses.gpl2Plus;
maintainers = with maintainers; [ pSub ];
license = lib.licenses.gpl2Plus;
maintainers = with lib.maintainers; [ pSub ];
homepage = "https://ploticus.sourceforge.net/";
platforms = with platforms; linux ++ darwin;
platforms = with lib.platforms; linux ++ darwin;
};
})