Commit 86a34f3a authored by Kipp Cannon's avatar Kipp Cannon

lalinference: fix numerous format-truncate warnings

- lalinference is uncompilable with current gcc because of these
- refs #5730
Original: 546cbc2df4e161ef1e5599c4b60a84e612bb3179
parent b8806205
......@@ -47,7 +47,7 @@
#include <gsl/gsl_errno.h>
#include <gsl/gsl_spline.h>
#define VARNAME_MAX 128
#define VARNAME_MAX 320
#define VARVALSTRINGSIZE_MAX 128
#include <lal/LALStdlib.h>
......
......@@ -610,7 +610,7 @@ void PrintCEtoFile(REAL8* Acoeffs,REAL8* Pcoeffs,LALInferenceIFOData* IFOdata, P
char *outfile=ppt_order->value;
FILE *calibout;
char caliboutname[100];
char caliboutname[2048];
sprintf(caliboutname,"%s_CE_%s.dat",outfile, IFOdata->name);
calibout=fopen(caliboutname,"w");
......
......@@ -571,7 +571,7 @@ void LALInferenceInitCalibrationVariables(LALInferenceRunState *runState, LALInf
REAL8 zero=0.0;
dataPtr = runState->data;
while (dataPtr != NULL){
char CA_A[10]="";
char CA_A[320];
sprintf(CA_A,"%s_%s","calamp",dataPtr->name);
LALInferenceRegisterUniformVariableREAL8(runState, currentParams, CA_A, zero, camp_min_A, camp_max_A, LALINFERENCE_PARAM_LINEAR);
dataPtr = dataPtr->next;
......@@ -594,7 +594,7 @@ void LALInferenceInitCalibrationVariables(LALInferenceRunState *runState, LALInf
dataPtr = runState->data;
while (dataPtr != NULL)
{
char CP_A[10]="";
char CP_A[320];
sprintf(CP_A,"%s_%s","calpha",dataPtr->name);
LALInferenceRegisterUniformVariableREAL8(runState, currentParams, CP_A, zero, cpha_min_A, cpha_max_A, LALINFERENCE_PARAM_LINEAR);
dataPtr = dataPtr->next;
......
......@@ -584,7 +584,7 @@ static REAL8 LALInferenceFusedFreqDomainLogLikelihood(LALInferenceVariables *cur
if(marginalisationflags==STUDENTT)
{
/* extract the element from the "df" vector that carries the current Ifo's name: */
CHAR df_variable_name[64];
CHAR df_variable_name[320];
snprintf(df_variable_name,sizeof(df_variable_name),"df_%s",dataPtr->name);
if(LALInferenceCheckVariable(currentParams,df_variable_name)){
printf("Found variable %s\n",df_variable_name);
......@@ -680,13 +680,13 @@ static REAL8 LALInferenceFusedFreqDomainLogLikelihood(LALInferenceVariables *cur
}
/*constant*/
if (constantcal_active){
char CA_A[10]="";
char CA_A[320];
sprintf(CA_A,"%s_%s","calamp",dataPtr->name);
if (LALInferenceCheckVariable(currentParams, CA_A))
calamp=(*(REAL8*) LALInferenceGetVariable(currentParams, CA_A));
else
calamp=0.0;
char CP_A[10]="";
char CP_A[320];
sprintf(CP_A,"%s_%s","calpha",dataPtr->name);
if (LALInferenceCheckVariable(currentParams, CP_A))
calpha=(*(REAL8*) LALInferenceGetVariable(currentParams, CP_A));
......
......@@ -1157,11 +1157,11 @@ void LALInferenceNestedSamplingAlgorithm(LALInferenceRunState *runState)
LALH5File *h5file=XLALH5FileOpen(outfile, "w");
// Create group heirarchy
char runID[256]="";
char runID[2048];
if((ppt=LALInferenceGetProcParamVal(runState->commandLine,"--runid")))
snprintf(runID,255,"%s_%s","lalinference_nest",ppt->value);
snprintf(runID,sizeof(runID),"%s_%s","lalinference_nest",ppt->value);
else
snprintf(runID,255,"lalinference_nest");
snprintf(runID,sizeof(runID),"lalinference_nest");
LALH5File *groupPtr = LALInferenceH5CreateGroupStructure(h5file, "lalinference", runID);
/* Create run identifier group */
......@@ -1204,8 +1204,8 @@ LALInferenceVariables *LALInferenceComputeAutoCorrelation(LALInferenceRunState *
/* Single threaded here */
LALInferenceThreadState *threadState = runState->threads[0];
ProcessParamsTable *ppt=NULL;
char chainfilename[128]="";
char acf_file_name[128]="";
char chainfilename[2048]="";
char acf_file_name[2048]="";
FILE *chainfile=NULL;
FILE *acffile=NULL;
UINT4 i,j;
......@@ -1534,7 +1534,7 @@ INT4 LALInferenceNestedSamplingSloppySample(LALInferenceRunState *runState)
LALInferenceIFOData *data=runState->data;
REAL8 tmp;
REAL8 Target=0.3;
char tmpName[32];
char tmpName[320];
REAL8 logLold=*(REAL8 *)LALInferenceGetVariable(threadState->currentParams,"logL");
memset(&oldParams,0,sizeof(oldParams));
LALInferenceCopyVariables(threadState->currentParams,&oldParams);
......
......@@ -313,8 +313,8 @@ static REAL8 LALInferenceGlitchPrior(LALInferenceRunState *runState, LALInferenc
REAL8 component_max=0.0;
REAL8 val=0.0;
char priormin[100];
char priormax[100];
char priormin[512];
char priormax[512];
REAL8 Anorm = *(REAL8 *)LALInferenceGetVariable(priorParams,"glitch_norm");
......
......@@ -156,7 +156,7 @@ void LALInferenceInjectBurstSignal(LALInferenceIFOData *IFOdata, ProcessParamsTa
memcpy(&bufferStart,&thisData->timeData->epoch,sizeof(LIGOTimeGPS));
XLALGPSAdd(&bufferStart,(REAL8) thisData->timeData->data->length * thisData->timeData->deltaT);
XLALGPSAdd(&bufferStart,-bufferLength);
char series_name[256];
char series_name[320];
sprintf(series_name,"%s:injection",thisData->name);
REAL8TimeSeries *inj8Wave=(REAL8TimeSeries *)XLALCreateREAL8TimeSeries(series_name,
&thisData->timeData->epoch,
......@@ -214,7 +214,7 @@ void LALInferenceInjectBurstSignal(LALInferenceIFOData *IFOdata, ProcessParamsTa
/* Actually inject the waveform */
for(j=0;j<inj8Wave->data->length;j++) thisData->timeData->data->data[j]+=inj8Wave->data->data[j];
fprintf(stdout,"Injected SNR in detector %s = %.1f\n",thisData->name,thisData->SNR);
char filename[256];
char filename[320];
sprintf(filename,"%s_timeInjection.dat",thisData->name);
FILE* file=fopen(filename, "w");
for(j=0;j<inj8Wave->data->length;j++){
......@@ -406,7 +406,7 @@ void InjectBurstFD(LALInferenceIFOData *IFOdata, SimBurst *inj_table, ProcessPar
dataPtr->fCross = Fcross;
dataPtr->timeshift = timeshift;
char InjFileName[50];
char InjFileName[320];
sprintf(InjFileName,"injection_%s.dat",dataPtr->name);
FILE *outInj=fopen(InjFileName,"w");
......
......@@ -1687,7 +1687,7 @@ void LALInferenceInjectInspiralSignal(LALInferenceIFOData *IFOdata, ProcessParam
/* Actually inject the waveform */
for(j=0;j<inj8Wave->data->length;j++) thisData->timeData->data->data[j]+=inj8Wave->data->data[j];
fprintf(stdout,"Injected SNR in detector %s = %g\n",thisData->name,thisData->SNR);
char filename[256];
char filename[320];
sprintf(filename,"%s_timeInjection.dat",thisData->name);
FILE* file=fopen(filename, "w");
for(j=0;j<inj8Wave->data->length;j++){
......@@ -1909,7 +1909,7 @@ void InjectFD(LALInferenceIFOData *IFOdata, SimInspiralTable *inj_table, Process
dataPtr->fCross = Fcross;
dataPtr->timeshift = timeshift;
char InjFileName[50];
char InjFileName[320];
sprintf(InjFileName,"injection_%s.dat",dataPtr->name);
FILE *outInj=fopen(InjFileName,"w");
......@@ -2164,7 +2164,7 @@ void LALInferencePrintInjectionSample(LALInferenceRunState *runState) {
}
LALInferenceIFOData *data=runState->data;
while(data) {
char tmpName[50];
char tmpName[320];
REAL8 tmp=model->loglikelihood - data->nullloglikelihood;
sprintf(tmpName,"deltalogl%s",data->name);
LALInferenceAddVariable(injparams, tmpName, &tmp, LALINFERENCE_REAL8_t, LALINFERENCE_PARAM_OUTPUT);
......@@ -2338,7 +2338,7 @@ void LALInferenceSetupROQdata(LALInferenceIFOData *IFOdata, ProcessParamsTable *
float dt=0.1;
//REAL8 timeMin=0.0,timeMax=0.0;
FILE *tempfp;
char tmp[128];
char tmp[320];
procparam=LALInferenceGetProcParamVal(commandLine,"--inj");
if(procparam){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment