From b89d15ca060d6806352a0db97f501f52c2ba3215 Mon Sep 17 00:00:00 2001 From: Robert Izzard <r.izzard@surrey.ac.uk> Date: Sat, 7 Sep 2019 15:30:32 +0100 Subject: [PATCH] fix further issues with casting of size_t by forcing various lengths to be of type size_t --- src/binary_c_code_options.h | 10 +++++----- src/binary_c_macros.h | 2 +- src/stellar_colours/stellar_colour_macros.h | 2 +- src/supernovae/sn.h | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/binary_c_code_options.h b/src/binary_c_code_options.h index 2f95efa1d..a73001370 100644 --- a/src/binary_c_code_options.h +++ b/src/binary_c_code_options.h @@ -746,7 +746,7 @@ void Print_trace(void); * Note : all strings stored in stardata->preferneces should be of length * STRING_LENGTH (if they are set by command-line options). */ -#define STRING_LENGTH 4096 +#define STRING_LENGTH ((size_t)4096) #define BATCHMODE_STRING_LENGTH STRING_LENGTH /* @@ -756,7 +756,7 @@ void Print_trace(void); * At the time of writing, this requires just over 100KByte of RAM, * so I have set the length to 250KByte. */ -#define MAX_BUFFERED_STRING_LENGTH (1024*250) +#define MAX_BUFFERED_STRING_LENGTH ((size_t)(1024*250)) /* * Buffer increase ratio: this is the amount @@ -778,8 +778,8 @@ void Print_trace(void); * to allow error strings to be printed even when the * buffer is full. */ -#define BUFFERED_PRINTF_MAX_BUFFER_SIZE (1024*1024*250) -#define BUFFERED_PRINTF_ERROR_BUFFER_SIZE (1024) +#define BUFFERED_PRINTF_MAX_BUFFER_SIZE ((size_t)(1024*1024*250)) +#define BUFFERED_PRINTF_ERROR_BUFFER_SIZE ((size_t)(1024)) /* * Enable BUFFER_MEMORY_DEBUGGING to output @@ -864,7 +864,7 @@ void Print_trace(void); "Unknown" \ ) -#define GSL_INTEGRATOR_WORKSPACE_SIZE 1000 +#define GSL_INTEGRATOR_WORKSPACE_SIZE ((size_t)1000) #define GSL_INTEGRATOR_QAG 1 #define GSL_INTEGRATOR_QNG 2 #define GSL_INTEGRATOR_QAGS 3 diff --git a/src/binary_c_macros.h b/src/binary_c_macros.h index 44a278bea..c63056d94 100644 --- a/src/binary_c_macros.h +++ b/src/binary_c_macros.h @@ -98,7 +98,7 @@ #define BIGLOG_LINES (BIGLOG_SIZE/MEMMAP_STRING_LENGTH) /* Note that MEMMAP_STRING_LENGTH must be <= STRING_LENGTH */ -#define MEMMAP_STRING_LENGTH 82 +#define MEMMAP_STRING_LENGTH ((size_t)82) #endif /* MEMMAP */ #define HRDIAG_FILENAME "/tmp/c_binary_hrdiag.dat" diff --git a/src/stellar_colours/stellar_colour_macros.h b/src/stellar_colours/stellar_colour_macros.h index 9f0a9788b..bb53bf73a 100644 --- a/src/stellar_colours/stellar_colour_macros.h +++ b/src/stellar_colours/stellar_colour_macros.h @@ -38,7 +38,7 @@ #define STELLAR_COLOUR_STRINGS {"U","B","V","R","I","J","H","K","u","g","r","i","z","f300w","f336w","f435w","f450w","f555w","f606w","f814w","G","GBP","GRP","GRVS"} -#define STELLAR_COLOUR_STRING_LENGTH 6 +#define STELLAR_COLOUR_STRING_LENGTH ((size_t)6) #define NUMBER_OF_STELLAR_MAGNITUDES 24 diff --git a/src/supernovae/sn.h b/src/supernovae/sn.h index a9a531377..5b5522e95 100644 --- a/src/supernovae/sn.h +++ b/src/supernovae/sn.h @@ -45,7 +45,7 @@ #define NUM_SN_TYPES 21 #define NUM_SN_STRINGS NUM_SN_TYPES -#define SN_STRING_LENGTH 30 +#define SN_STRING_LENGTH ((size_t)30) #define SN_STRINGS { \ "None",/*0*/ \ "HeIa", \ -- GitLab