From 84d5053da5f09e03c58803269db3c425caa8b925 Mon Sep 17 00:00:00 2001
From: Florian Eder <h.eder@campus.lmu.de>
Date: Mon, 11 Apr 2022 10:50:18 +0000
Subject: [PATCH] Added missing flag parameter to fread_file

Signed-off-by: Florian Eder <h.eder@campus.lmu.de>
---
 src/boilerplate.c    | 2 +-
 src/comment.c        | 4 ++--
 src/copyright.c      | 6 +++---
 src/detect.c         | 6 +++---
 src/extra.c          | 4 ++--
 src/png-apply.c      | 2 +-
 src/prepend.c        | 6 +++---
 src/preview.c        | 4 ++--
 src/project.c        | 2 +-
 src/styles.c         | 2 +-
 src/top.c            | 2 +-
 src/url-downloader.c | 4 ++--
 src/util.c           | 8 ++++----
 13 files changed, 26 insertions(+), 26 deletions(-)

diff --git a/src/boilerplate.c b/src/boilerplate.c
index 133685c..dff8676 100644
--- a/src/boilerplate.c
+++ b/src/boilerplate.c
@@ -357,7 +357,7 @@ remove_lu_boilerplate (struct lu_state_t *state, struct lu_boilerplate_options_t

   free (argz);
   size_t data_len;
-  char *data = fread_file (fp, &data_len);
+  char *data = fread_file (fp, 0, &data_len);
   fclose (fp);

   int s, e;
diff --git a/src/comment.c b/src/comment.c
index 530d55a..ea4a1da 100644
--- a/src/comment.c
+++ b/src/comment.c
@@ -101,7 +101,7 @@ create_comment_from_file (struct lu_state_t *state, struct lu_comment_options_t
   if (!fp)
     return -1;
   size_t data_len = 0;
-  char *data = fread_file (fp, &data_len);
+  char *data = fread_file (fp, 0, &data_len);
   char *comment = lu_create_comment (state, options, data);
   luprintf (state, "%s", comment);
   free (comment);
@@ -168,7 +168,7 @@ create_comment_from_files (struct lu_state_t *state, struct lu_comment_options_t
       if (fp)
         {
           size_t data_len = 0;
-          char *data = fread_file (fp, &data_len);
+          char *data = fread_file (fp, 0, &data_len);
           fprintf (out, "%s", data);
           free (data);
           if (fp != stdin)
diff --git a/src/copyright.c b/src/copyright.c
index 7362c06..b18e779 100644
--- a/src/copyright.c
+++ b/src/copyright.c
@@ -111,7 +111,7 @@ display_copyright(char *file)
       if (fp)
         {
           size_t data_len = 0;
-          char *data = fread_file (fp, &data_len);
+          char *data = fread_file (fp, 0, &data_len);
           fclose (fp);
           fprintf (stdout, "%s", data);
           free (data);
@@ -243,7 +243,7 @@ max_copyright_lines()
       if (fp)
         {
           size_t data_len = 0;
-          char *data = fread_file (fp, &data_len);
+          char *data = fread_file (fp, 0, &data_len);
           if (data)
             {
               char *ptr = data;
@@ -528,7 +528,7 @@ lu_copyright (struct lu_state_t *state, struct lu_copyright_options_t *options)
       if (ch)
         {
           size_t data_len = 0;
-          char *data = fread_file (ch, &data_len);
+          char *data = fread_file (ch, 0, &data_len);
           fprintf (fp, "%s", data);
           fclose (ch);
           free (data);
diff --git a/src/detect.c b/src/detect.c
index f87357f..29cdd71 100644
--- a/src/detect.c
+++ b/src/detect.c
@@ -594,7 +594,7 @@ process_boilerplate_blocks (struct lu_state_t *state, struct lu_detect_options_t
       if (fp)
         {
           size_t len = 0;
-          char *s = fread_file (fp, &len);
+          char *s = fread_file (fp, 0, &len);
           if (s)
             {
               char *squeezed_license = squeeze (s);
@@ -640,7 +640,7 @@ process_boilerplate_blocks (struct lu_state_t *state, struct lu_detect_options_t
             {
               size_t len;
               FILE *fp = fopen (file, "r");
-              char *s = fread_file (fp, &len);
+              char *s = fread_file (fp, 0, &len);
               fclose (fp);
               remove (file);
               free (file);
@@ -686,7 +686,7 @@ process_boilerplate_blocks (struct lu_state_t *state, struct lu_detect_options_t
             {
               size_t len;
               FILE *fp = fopen (file, "r");
-              char *s = fread_file (fp, &len);
+              char *s = fread_file (fp, 0, &len);
               fclose (fp);
               remove (file);
               free (file);
diff --git a/src/extra.c b/src/extra.c
index b1756d6..e2c2e49 100644
--- a/src/extra.c
+++ b/src/extra.c
@@ -48,7 +48,7 @@ parse_opt (int key, char *arg, struct argp_state *state)
         {
           FILE *fp = fopen (arg, "r");
           size_t data_len = 0;
-          char *data = fread_file (fp, &data_len);
+          char *data = fread_file (fp, 0, &data_len);
           fclose (fp);
           char *file = get_config_file ("extra-line");
           FILE *out = fopen (file, "w");
@@ -150,7 +150,7 @@ lu_extra (struct lu_state_t *state, struct lu_extra_options_t *options)
           if (fp)
             {
               size_t data_len;
-              char *data = fread_file (fp, &data_len);
+              char *data = fread_file (fp, 0, &data_len);
               if (data)
                 {
                   luprintf (state, "%s", data);
diff --git a/src/png-apply.c b/src/png-apply.c
index 963940d..a40ac73 100644
--- a/src/png-apply.c
+++ b/src/png-apply.c
@@ -283,7 +283,7 @@ lu_png_apply (struct lu_state_t *state, struct lu_png_apply_options_t *options)

   FILE *fileptr = fopen (boilerplate, "r");
   size_t data_len = 0;
-  char *data = fread_file (fileptr, &data_len);
+  char *data = fread_file (fileptr, 0, &data_len);
   fclose (fileptr);

   char *f = NULL;
diff --git a/src/prepend.c b/src/prepend.c
index 5632812..15fbe6c 100644
--- a/src/prepend.c
+++ b/src/prepend.c
@@ -144,7 +144,7 @@ lu_prepend (struct lu_state_t *state, struct lu_prepend_options_t *options)
   char *source = NULL;

   if (src)
-    source = fread_file (src, &source_len);
+    source = fread_file (src, 0, &source_len);

   if (src != stdin && src != NULL)
     fclose (src);
@@ -178,7 +178,7 @@ lu_prepend (struct lu_state_t *state, struct lu_prepend_options_t *options)
   if (comments_len != 0)
     {
       //the rest
-      dest = fread_file (dst, &dest_len);
+      dest = fread_file (dst, 0, &dest_len);
       int s = 0, e = 0;
       lu_get_byte_offsets (dest, dest_len, sr, sc, dr, dc, &s, &e);
       memmove (&dest[s], &dest[e], strlen (&dest[e]) + 1);
@@ -186,7 +186,7 @@ lu_prepend (struct lu_state_t *state, struct lu_prepend_options_t *options)
     }
   else
     {
-      dest = fread_file (dst, &dest_len);
+      dest = fread_file (dst, 0, &dest_len);
       if (hashbang)
         {
           char *start = 0;
diff --git a/src/preview.c b/src/preview.c
index 9a888f1..a856043 100644
--- a/src/preview.c
+++ b/src/preview.c
@@ -191,7 +191,7 @@ generate_boilerplate (struct lu_state_t *state, struct lu_preview_options_t *opt
       if (uncommented_boilerplate)
         {
           size_t data_len = 0;
-          char *data = fread_file (uncommented_boilerplate, &data_len);
+          char *data = fread_file (uncommented_boilerplate, 0, &data_len);
           if (data)
             {
               fprintf (out, "%s", data);
@@ -207,7 +207,7 @@ generate_boilerplate (struct lu_state_t *state, struct lu_preview_options_t *opt
       if (uncommented_boilerplate)
         {
           size_t data_len = 0;
-          char *data = fread_file (uncommented_boilerplate, &data_len);
+          char *data = fread_file (uncommented_boilerplate, 0, &data_len);
           if (data)
             {
               struct lu_comment_options_t comment_options;
diff --git a/src/project.c b/src/project.c
index c9f6ab9..68e32a5 100644
--- a/src/project.c
+++ b/src/project.c
@@ -124,7 +124,7 @@ lu_project (struct lu_state_t *state, struct lu_project_options_t *options)
           if (fp)
             {
               size_t data_len;
-              char *data = fread_file (fp, &data_len);
+              char *data = fread_file (fp, 0, &data_len);
               if (data)
                 {
                   printf("%s", data);
diff --git a/src/styles.c b/src/styles.c
index bcd86c5..4bfbe08 100644
--- a/src/styles.c
+++ b/src/styles.c
@@ -405,7 +405,7 @@ lu_get_current_commenting_style()
       if (fp)
         {
           size_t data_len = 0;
-          char *data = fread_file (fp, &data_len);
+          char *data = fread_file (fp, 0, &data_len);
           if (data)
             {
               style = lu_lookup_comment_style (data);
diff --git a/src/top.c b/src/top.c
index 3e90a69..afa7362 100644
--- a/src/top.c
+++ b/src/top.c
@@ -111,7 +111,7 @@ lu_top (struct lu_state_t *state, struct lu_top_options_t *options)
           if (fp)
             {
               size_t data_len;
-              char *data = fread_file (fp, &data_len);
+              char *data = fread_file (fp, 0, &data_len);
               if (data)
                 {
                   luprintf (state, "%s", data);
diff --git a/src/url-downloader.c b/src/url-downloader.c
index d842c6a..d30772c 100644
--- a/src/url-downloader.c
+++ b/src/url-downloader.c
@@ -73,7 +73,7 @@ download (struct lu_state_t *state, char *url, char **data)
   FILE *fileptr = fopen (filename, "r");
   if (fileptr)
     {
-      *data = fread_file (fileptr, &data_len);
+      *data = fread_file (fileptr, 0, &data_len);
       fclose (fileptr);
       return 0;
     }
@@ -96,7 +96,7 @@ download (struct lu_state_t *state, char *url, char **data)
       return err;
     }
   fileptr = fopen (filename, "r");
-  *data = fread_file (fileptr, &data_len);
+  *data = fread_file (fileptr, 0, &data_len);
   fclose (fileptr);
   return err;
 }
diff --git a/src/util.c b/src/util.c
index 60aba0e..f09dd50 100644
--- a/src/util.c
+++ b/src/util.c
@@ -418,7 +418,7 @@ get_comment_blocks (FILE *fp, char **argz, size_t *len, char **hashbang, char *r
 {
   long startpos = ftell (fp);
   size_t data_len;
-  char *data = fread_file (fp, &data_len);
+  char *data = fread_file (fp, 0, &data_len);
   size_t length = 0;
   char *c;
   size_t whitespace = strspn (&data[length], "\r\n\t \v");
@@ -473,7 +473,7 @@ lu_load_selected_comment_style ()
       if (fp)
         {
           size_t data_len = 0;
-          data = fread_file (fp, &data_len);
+          data = fread_file (fp, 0, &data_len);
           fclose (fp);
         }
       free (f);
@@ -492,7 +492,7 @@ lu_load_selected_licenses ()
       if (fp)
         {
           size_t data_len = 0;
-          data = fread_file (fp, &data_len);
+          data = fread_file (fp, 0, &data_len);
           fclose (fp);
         }
       free (f);
@@ -507,7 +507,7 @@ lu_dump_file (char *file, FILE *out)
   if (!fp)
     return -1;
   size_t data_len = 0;
-  char *data = fread_file (fp, &data_len);
+  char *data = fread_file (fp, 0, &data_len);
   if (data)
     {
       fprintf (out, "%s", data);
--
2.35.1