zsync icon indicating copy to clipboard operation
zsync copied to clipboard

Build error with GCC-14

Open talau opened this issue 6 months ago • 1 comments

Hi there,

Using GCC-14 the program fails to build.

I fixed this on zsync-0.6.2. I tried to make a fork and merge, but I checked that the git version is not the 0.6.2. Anyway, I have attached the end of this message.

Regards, mt

Index: zsync-0.6.2/client.c

--- zsync-0.6.2.orig/client.c +++ zsync-0.6.2/client.c @@ -392,7 +392,7 @@ int fetch_remaining_blocks_http(struct z */ int fetch_remaining_blocks(struct zsync_state *zs) { int n, utype;

  • const char *const *url = zsync_get_urls(zs, &n, &utype);
  • char **url = zsync_get_urls(zs, &n, &utype); int status; / keep status for each URL - 0 means no error */ int ok_urls = n;

@@ -452,7 +452,7 @@ extern long global_offset; int main(int argc, char **argv) { struct zsync_state *zs; char *temp_file = NULL;

  • char **seedfiles = NULL;
  • void **seedfiles = NULL; int nseedfiles = 0; char filename = NULL; long long local_used; Index: zsync-0.6.2/libzsync/zmap.c =================================================================== --- zsync-0.6.2.orig/libzsync/zmap.c +++ zsync-0.6.2/libzsync/zmap.c @@ -333,7 +333,7 @@ int zmap_search(const struct zmap zm, l
  • and in the order that it returned them, this condition is satisfied. */ void configure_zstream_for_zdata(const struct zmap *zm, z_stream * zs,
  •                             long zoffset, long long *poutoffset) {
    
  •                             long zoffset, off_t *poutoffset) {
    
    /* Find the zmap entry corresponding to this offset */ int i = zmap_search(zm, zoffset);

Index: zsync-0.6.2/libzsync/zmap.h

--- zsync-0.6.2.orig/libzsync/zmap.h +++ zsync-0.6.2/libzsync/zmap.h @@ -29,7 +29,7 @@ struct zmap* zmap_make(const struct gzbl void zmap_free(struct zmap*);

off_t* zmap_to_compressed_ranges(const struct zmap* zm, off_t* byterange, int nrange, int* num); -void configure_zstream_for_zdata(const struct zmap* zm, struct z_stream_s* zs, long zoffset, long long* poutoffset); +void configure_zstream_for_zdata(const struct zmap* zm, struct z_stream_s* zs, long zoffset, off_t* poutoffset);

/* gzip flag byte / #define GZ_ASCII_FLAG 0x01 / bit 0 set: file probably ascii text */ Index: zsync-0.6.2/libzsync/zsync.c

--- zsync-0.6.2.orig/libzsync/zsync.c +++ zsync-0.6.2/libzsync/zsync.c @@ -436,7 +436,7 @@ void zsync_progress(const struct zsync_s

  • Note that these URLs could be for encoded versions of the target; a 'type'
  • is returned in *type which tells libzsync in later calls what version of the
  • target is being retrieved. */ -const char *const *zsync_get_urls(struct zsync_state *zs, int *n, int *t) { +char **zsync_get_urls(struct zsync_state *zs, int *n, int *t) { if (zs->zmap && zs->nzurl) { *n = zs->nzurl; *t = 1; @@ -768,7 +768,7 @@ char *zsync_end(struct zsync_state *zs) */ void zsync_configure_zstream_for_zdata(const struct zsync_state *zs, struct z_stream_s *zstrm,
  •                                   long zoffset, long long *poutoffset) {
    
  •                                   long zoffset, off_t *poutoffset) {
    
    configure_zstream_for_zdata(zs->zmap, zstrm, zoffset, poutoffset); { /* Load in prev 32k sliding window for backreferences */ long long pos = *poutoffset; Index: zsync-0.6.2/libzsync/zsync.h =================================================================== --- zsync-0.6.2.orig/libzsync/zsync.h +++ zsync-0.6.2/libzsync/zsync.h @@ -58,7 +58,7 @@ int zsync_submit_source_file(struct zsyn
    • (the URL pointers are still referenced by the library, and are valid only until zsync_end). */

-const char * const * zsync_get_urls(struct zsync_state* zs, int* n, int* t); +char ** zsync_get_urls(struct zsync_state* zs, int* n, int* t);

/* zsync_needed_byte_ranges - get the byte ranges needed from a URL.

  • Returns the number of ranges in *num, and a malloc'd array (to be freed

talau avatar Aug 16 '24 02:08 talau