diff --git a/swad_changelog.h b/swad_changelog.h index 5e72edc27..709fa6a36 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -138,13 +138,14 @@ /****************************** Public constants *****************************/ /*****************************************************************************/ -#define Log_PLATFORM_VERSION "SWAD 15.169.5 (2016-03-31)" +#define Log_PLATFORM_VERSION "SWAD 15.169.6 (2016-03-31)" #define CSS_FILE "swad15.165.5.css" #define JS_FILE "swad15.131.3.js" // Number of lines (includes comments but not blank lines) has been got with the following command: // nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*.h sql/swad*.sql | tail -1 /* + Version 15.169.6: Mar 31, 2016 Code refactoring in function to get a parameter. (197313 lines) Version 15.169.5: Mar 31, 2016 Code refactoring in function to get a parameter. (197292 lines) Version 15.169.4: Mar 31, 2016 Code refactoring in list of parameters. (197280 lines) Version 15.169.3: Mar 31, 2016 Code refactoring in list of parameters. (197271 lines) diff --git a/swad_file.c b/swad_file.c index 4a5223819..053d9e9d5 100644 --- a/swad_file.c +++ b/swad_file.c @@ -236,8 +236,13 @@ etc, etc. void Fil_StartReceptionOfFile (char *SrcFileName,char *MIMEType) { char *Ptr; - int Ch,i; - + int Ch; + int i; +/* + struct Param *Param; + Par_GetParameter (Par_PARAM_SINGLE,Fil_NAME_OF_PARAM_FILENAME_ORG,SrcFileName, + PATH_MAX,Param); +*/ /* At this point, a heading has been read from Gbl.F.Tmp with all the variables passed by form */ rewind (Gbl.F.Tmp); diff --git a/swad_parameter.c b/swad_parameter.c index df456291c..635df8b75 100644 --- a/swad_parameter.c +++ b/swad_parameter.c @@ -534,6 +534,7 @@ unsigned Par_GetParameter (tParamType ParamType,const char *ParamName, unsigned NumTimes; bool ParamFound = false; unsigned ParamNameLength; + struct StartLength CopyValueFrom; /***** Default values returned *****/ ParamValue[0] = '\0'; // By default, the value of the parameter will be an empty string @@ -623,9 +624,23 @@ unsigned Par_GetParameter (tParamType ParamType,const char *ParamName, Param->Value.Length); break; case Act_CONTENT_DATA: - fseek (Gbl.F.Tmp,Param->Value.Start,SEEK_SET); - if (fread (PtrDst,sizeof (char),Param->Value.Length,Gbl.F.Tmp) != Param->Value.Length) + if (Param->Filename.Start) // It's a file + { + /* Copy filename in ParamValue */ + CopyValueFrom.Start = Param->Filename.Start; + CopyValueFrom.Length = Param->Filename.Length; + } + else // It's a normal parameter + { + /* Copy value in ParamValue */ + CopyValueFrom.Start = Param->Value.Start; + CopyValueFrom.Length = Param->Value.Length; + } + fseek (Gbl.F.Tmp,CopyValueFrom.Start,SEEK_SET); + if (fread (PtrDst,sizeof (char),CopyValueFrom.Length,Gbl.F.Tmp) != + CopyValueFrom.Length) Lay_ShowErrorAndExit ("Error while getting value of parameter."); + break; } BytesAlreadyCopied += Param->Value.Length;