Description: Fix some compiler warnings.
Author: Yavor Doganov <yavor@gnu.org>
Forwarded: no
Last-Update: 2022-02-22
---

--- amide.orig/amide-current/src/amitk_point.c
+++ amide/amide-current/src/amitk_point.c
@@ -49,7 +49,7 @@
 }
 
 AmitkPoint * amitk_point_copy(const AmitkPoint * point) {
-  return (AmitkPoint *)g_memdup(point, sizeof(AmitkPoint));
+  return (AmitkPoint *)g_memdup2(point, sizeof(AmitkPoint));
 }
 
 void amitk_point_free (AmitkPoint * point) {
@@ -145,7 +145,7 @@
 }
 
 AmitkVoxel * amitk_voxel_copy(const AmitkVoxel * voxel) {
-  return (AmitkVoxel *)g_memdup(voxel, sizeof(AmitkVoxel));
+  return (AmitkVoxel *)g_memdup2(voxel, sizeof(AmitkVoxel));
 }
 
 void amitk_voxel_free (AmitkVoxel * voxel) {
@@ -223,7 +223,7 @@
 }
 
 AmitkPixel * amitk_pixel_copy(const AmitkPixel * pixel) {
-  return (AmitkPixel *)g_memdup(pixel, sizeof(AmitkPixel));
+  return (AmitkPixel *)g_memdup2(pixel, sizeof(AmitkPixel));
 }
 
 void amitk_pixel_free (AmitkPixel * pixel) {
@@ -242,7 +242,7 @@
 }
 
 AmitkCanvasPoint * amitk_canvas_point_copy(const AmitkCanvasPoint * point) {
-  return (AmitkCanvasPoint *)g_memdup(point, sizeof(AmitkCanvasPoint));
+  return (AmitkCanvasPoint *)g_memdup2(point, sizeof(AmitkCanvasPoint));
 }
 
 void amitk_canvas_point_free (AmitkCanvasPoint * point) {
@@ -265,7 +265,7 @@
 }
 
 AmitkAxes * amitk_axes_copy(const AmitkAxes * axes) {
-  return (AmitkAxes *)g_memdup(axes, sizeof(AmitkAxes));
+  return (AmitkAxes *)g_memdup2(axes, sizeof(AmitkAxes));
 }
 
 void amitk_axes_free (AmitkAxes * axes) {
@@ -503,7 +503,7 @@
 }
 
 AmitkCorners * amitk_corners_copy(const AmitkCorners * corners) {
-  return (AmitkCorners *)g_memdup(corners, sizeof(AmitkCorners));
+  return (AmitkCorners *)g_memdup2(corners, sizeof(AmitkCorners));
 }
 
 void amitk_corners_free (AmitkCorners * corners) {
--- amide.orig/amide-current/src/fads.c
+++ amide/amide-current/src/fads.c
@@ -484,6 +484,7 @@
   return;
 }
 
+#if AMIDE_DEBUG
 static gdouble calc_magnitude(AmitkDataSet * ds, gdouble * weight) {
 
   gdouble magnitude;
@@ -506,6 +507,7 @@
 
   return sqrt(magnitude);
 }
+#endif
 
 
 /* returned array needs to be free'd */
@@ -909,7 +911,6 @@
   gdouble alpha, factor;
   amide_time_t frame_midpoint, frame_duration;
   gdouble init_value;
-  gdouble magnitude;
   AmitkDataSet * new_ds;
   AmitkVoxel i_voxel;
   gdouble current_beta=0.0;
@@ -917,6 +918,7 @@
   GTimer * timer=NULL;
   gboolean new_outer;
 #if AMIDE_DEBUG
+  gdouble magnitude;
   div_t x;
 #endif
 
@@ -977,7 +979,9 @@
     g_warning(_("failed weight malloc"));
     goto ending;
   }
+#if AMIDE_DEBUG
   magnitude = calc_magnitude(p.data_set, p.weight);
+#endif
 
   if (p.sum_factors_equal_one) {
     p.ec_a = g_try_new(gdouble, p.num_voxels);
@@ -1942,12 +1946,13 @@
   amide_time_t time_start;
   AmitkDataSet * new_ds;
   AmitkVoxel i_voxel;
-  gdouble magnitude, k12, k21;
+  gdouble k12, k21;
   gdouble init_value, alpha;
   AmitkViewMode i_view_mode;
   GTimer * timer=NULL;
   gboolean new_outer;
 #if AMIDE_DEBUG
+  gdouble magnitude;
   div_t x;
 #endif
 
@@ -2100,7 +2105,9 @@
   /* calculate the weights and magnitude */
   p.weight = calc_weights(p.data_set);
   g_return_if_fail(p.weight != NULL); /* make sure we've malloc'd it */
+#if AMIDE_DEBUG
   magnitude = calc_magnitude(p.data_set, p.weight);
+#endif
 
   
   /* set up gsl */
--- amide.orig/amide-current/src/libmdc_interface.c
+++ amide/amide-current/src/libmdc_interface.c
@@ -933,12 +933,12 @@
 
   /* set what we can */
   if (AMITK_DATA_SET_SUBJECT_NAME(ds) != NULL) 
-    strncpy(fi.patient_name,AMITK_DATA_SET_SUBJECT_NAME(ds), MDC_MAXSTR);
+    strncpy(fi.patient_name,AMITK_DATA_SET_SUBJECT_NAME(ds), MDC_MAXSTR - 1);
   if (AMITK_DATA_SET_SUBJECT_ID(ds) != NULL) 
-    strncpy(fi.patient_id,AMITK_DATA_SET_SUBJECT_ID(ds), MDC_MAXSTR);
+    strncpy(fi.patient_id,AMITK_DATA_SET_SUBJECT_ID(ds), MDC_MAXSTR - 1);
   if (AMITK_DATA_SET_SUBJECT_DOB(ds) != NULL) 
-    strncpy(fi.patient_dob,AMITK_DATA_SET_SUBJECT_DOB(ds), MDC_MAXSTR);
-  strncpy(fi.patient_sex, amitk_subject_sex_get_name(AMITK_DATA_SET_SUBJECT_SEX(ds)), MDC_MAXSTR);
+    strncpy(fi.patient_dob,AMITK_DATA_SET_SUBJECT_DOB(ds), MDC_MAXSTR - 1);
+  strncpy(fi.patient_sex, amitk_subject_sex_get_name(AMITK_DATA_SET_SUBJECT_SEX(ds)), MDC_MAXSTR - 1);
 
   fi.injected_dose = AMITK_DATA_SET_INJECTED_DOSE(ds);
   fi.patient_weight= AMITK_DATA_SET_SUBJECT_WEIGHT(ds);
--- amide.orig/amide-current/src/mpeg_encode.c
+++ amide/amide-current/src/mpeg_encode.c
@@ -151,7 +151,7 @@
 
 
 typedef struct {
-  AVCodec *codec;
+  const AVCodec *codec;
   AVCodecContext *context;
   AVFrame *picture;
   yuv_t * yuv; 
--- amide.orig/amide-current/src/vistaio_interface.c
+++ amide/amide-current/src/vistaio_interface.c
@@ -37,7 +37,7 @@
 #include <locale.h>
 
 
-gboolean vistaio_test_vista(gchar *filename)
+gboolean vistaio_test_vista(const gchar *filename)
 {
   return VistaIOIsVistaFile(filename); 
 }
--- amide.orig/amide-current/src/vistaio_interface.h
+++ amide/amide-current/src/vistaio_interface.h
@@ -33,7 +33,7 @@
 /* includes always needed with this file */
 #include "amitk_data_set.h"
 
-gboolean vistaio_test_vista(gchar *filename); 
+gboolean vistaio_test_vista(const gchar *filename);
 
 
 /* external functions */
--- amide.orig/amide-current/configure.ac
+++ amide/amide-current/configure.ac
@@ -366,9 +366,9 @@
 ##############################
 
 PKG_CHECK_MODULES(AMIDE_GTK,[
-	glib-2.0	>= 2.44.0
-	gio-2.0         >= 2.44.0
-	gobject-2.0	>= 2.44.0
+	glib-2.0	>= 2.68.0
+	gio-2.0         >= 2.68.0
+	gobject-2.0	>= 2.68.0
 	gtk+-3.0	>= 3.21.5
 	libxml-2.0	>= 2.4.12
 	goocanvas-2.0   >= 2.0.2
