Version 16.152

This commit is contained in:
Antonio Cañas Vargas 2017-03-08 01:21:21 +01:00
parent 9dbbd79bbe
commit 45929a7164
15 changed files with 146 additions and 138 deletions

View File

@ -204,13 +204,14 @@
/****************************** Public constants *****************************/ /****************************** Public constants *****************************/
/*****************************************************************************/ /*****************************************************************************/
#define Log_PLATFORM_VERSION "SWAD 16.151 (2017-03-07)" #define Log_PLATFORM_VERSION "SWAD 16.152 (2017-03-07)"
#define CSS_FILE "swad16.147.css" #define CSS_FILE "swad16.147.css"
#define JS_FILE "swad16.144.js" #define JS_FILE "swad16.144.js"
// Number of lines (includes comments but not blank lines) has been got with the following command: // 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 // nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*?.h sql/swad*.sql | tail -1
/* /*
Version 16.152: Mar 07, 2017 Code refactoring related to number of chars and bytes. (216428 lines)
Version 16.151: Mar 07, 2017 Code refactoring related to number of chars and bytes. (216422 lines) Version 16.151: Mar 07, 2017 Code refactoring related to number of chars and bytes. (216422 lines)
Version 16.150: Mar 07, 2017 Code refactoring related to number of chars and bytes. (216409 lines) Version 16.150: Mar 07, 2017 Code refactoring related to number of chars and bytes. (216409 lines)
Version 16.149: Mar 07, 2017 Code refactoring related to number of chars and bytes. (216385 lines) Version 16.149: Mar 07, 2017 Code refactoring related to number of chars and bytes. (216385 lines)

View File

@ -228,19 +228,19 @@ static void Plg_GetListPlugins (void)
/* Get the name of the plugin (row[1]) */ /* Get the name of the plugin (row[1]) */
Str_Copy (Plg->Name,row[1], Str_Copy (Plg->Name,row[1],
Plg_MAX_LENGTH_PLUGIN_NAME); Plg_MAX_BYTES_PLUGIN_NAME);
/* Get the description of the plugin (row[2]) */ /* Get the description of the plugin (row[2]) */
Str_Copy (Plg->Description,row[2], Str_Copy (Plg->Description,row[2],
Plg_MAX_LENGTH_PLUGIN_DESCRIPTION); Plg_MAX_BYTES_PLUGIN_DESCRIPTION);
/* Get the logo of the plugin (row[3]) */ /* Get the logo of the plugin (row[3]) */
Str_Copy (Plg->Logo,row[3], Str_Copy (Plg->Logo,row[3],
Plg_MAX_LENGTH_PLUGIN_LOGO); Plg_MAX_BYTES_PLUGIN_LOGO);
/* Get the application key of the plugin (row[4]) */ /* Get the application key of the plugin (row[4]) */
Str_Copy (Plg->AppKey,row[4], Str_Copy (Plg->AppKey,row[4],
Plg_MAX_LENGTH_PLUGIN_APP_KEY); Plg_MAX_BYTES_PLUGIN_APP_KEY);
/* Get the URL of the plugin (row[5]) */ /* Get the URL of the plugin (row[5]) */
Str_Copy (Plg->URL,row[5], Str_Copy (Plg->URL,row[5],
@ -295,19 +295,19 @@ bool Plg_GetDataOfPluginByCod (struct Plugin *Plg)
/* Get the name of the plugin (row[0]) */ /* Get the name of the plugin (row[0]) */
Str_Copy (Plg->Name,row[0], Str_Copy (Plg->Name,row[0],
Plg_MAX_LENGTH_PLUGIN_NAME); Plg_MAX_BYTES_PLUGIN_NAME);
/* Get the description of the plugin (row[1]) */ /* Get the description of the plugin (row[1]) */
Str_Copy (Plg->Description,row[1], Str_Copy (Plg->Description,row[1],
Plg_MAX_LENGTH_PLUGIN_DESCRIPTION); Plg_MAX_BYTES_PLUGIN_DESCRIPTION);
/* Get the logo of the plugin (row[2]) */ /* Get the logo of the plugin (row[2]) */
Str_Copy (Plg->Logo,row[2], Str_Copy (Plg->Logo,row[2],
Plg_MAX_LENGTH_PLUGIN_LOGO); Plg_MAX_BYTES_PLUGIN_LOGO);
/* Get the application key of the plugin (row[3]) */ /* Get the application key of the plugin (row[3]) */
Str_Copy (Plg->AppKey,row[3], Str_Copy (Plg->AppKey,row[3],
Plg_MAX_LENGTH_PLUGIN_APP_KEY); Plg_MAX_BYTES_PLUGIN_APP_KEY);
/* Get the URL of the plugin (row[4]) */ /* Get the URL of the plugin (row[4]) */
Str_Copy (Plg->URL,row[4], Str_Copy (Plg->URL,row[4],
@ -397,7 +397,7 @@ static void Plg_ListPluginsForEdition (void)
fprintf (Gbl.F.Out,"<input type=\"text\" name=\"Name\"" fprintf (Gbl.F.Out,"<input type=\"text\" name=\"Name\""
" size=\"10\" maxlength=\"%u\" value=\"%s\"" " size=\"10\" maxlength=\"%u\" value=\"%s\""
" onchange=\"document.getElementById('%s').submit();\" />", " onchange=\"document.getElementById('%s').submit();\" />",
Plg_MAX_LENGTH_PLUGIN_NAME,Plg->Name,Gbl.Form.Id); Plg_MAX_CHARS_PLUGIN_NAME,Plg->Name,Gbl.Form.Id);
Act_FormEnd (); Act_FormEnd ();
fprintf (Gbl.F.Out,"</td>"); fprintf (Gbl.F.Out,"</td>");
@ -408,7 +408,7 @@ static void Plg_ListPluginsForEdition (void)
fprintf (Gbl.F.Out,"<input type=\"text\" name=\"Description\"" fprintf (Gbl.F.Out,"<input type=\"text\" name=\"Description\""
" size=\"30\" maxlength=\"%u\" value=\"%s\"" " size=\"30\" maxlength=\"%u\" value=\"%s\""
" onchange=\"document.getElementById('%s').submit();\" />", " onchange=\"document.getElementById('%s').submit();\" />",
Plg_MAX_LENGTH_PLUGIN_DESCRIPTION,Plg->Description,Gbl.Form.Id); Plg_MAX_CHARS_PLUGIN_DESCRIPTION,Plg->Description,Gbl.Form.Id);
Act_FormEnd (); Act_FormEnd ();
fprintf (Gbl.F.Out,"</td>"); fprintf (Gbl.F.Out,"</td>");
@ -419,7 +419,7 @@ static void Plg_ListPluginsForEdition (void)
fprintf (Gbl.F.Out,"<input type=\"text\" name=\"Logo\"" fprintf (Gbl.F.Out,"<input type=\"text\" name=\"Logo\""
" size=\"4\" maxlength=\"%u\" value=\"%s\"" " size=\"4\" maxlength=\"%u\" value=\"%s\""
" onchange=\"document.getElementById('%s').submit();\" />", " onchange=\"document.getElementById('%s').submit();\" />",
Plg_MAX_LENGTH_PLUGIN_LOGO,Plg->Logo,Gbl.Form.Id); Plg_MAX_CHARS_PLUGIN_LOGO,Plg->Logo,Gbl.Form.Id);
Act_FormEnd (); Act_FormEnd ();
fprintf (Gbl.F.Out,"</td>"); fprintf (Gbl.F.Out,"</td>");
@ -430,7 +430,7 @@ static void Plg_ListPluginsForEdition (void)
fprintf (Gbl.F.Out,"<input type=\"text\" name=\"AppKey\"" fprintf (Gbl.F.Out,"<input type=\"text\" name=\"AppKey\""
" size=\"16\" maxlength=\"%u\" value=\"%s\"" " size=\"16\" maxlength=\"%u\" value=\"%s\""
" onchange=\"document.getElementById('%s').submit();\" />", " onchange=\"document.getElementById('%s').submit();\" />",
Plg_MAX_LENGTH_PLUGIN_APP_KEY,Plg->AppKey,Gbl.Form.Id); Plg_MAX_CHARS_PLUGIN_APP_KEY,Plg->AppKey,Gbl.Form.Id);
Act_FormEnd (); Act_FormEnd ();
fprintf (Gbl.F.Out,"</td>"); fprintf (Gbl.F.Out,"</td>");
@ -523,7 +523,7 @@ void Plg_RenamePlugin (void)
extern const char *Txt_The_name_of_the_plugin_X_has_not_changed; extern const char *Txt_The_name_of_the_plugin_X_has_not_changed;
char Query[512]; char Query[512];
struct Plugin *Plg; struct Plugin *Plg;
char NewPlgName[Plg_MAX_LENGTH_PLUGIN_NAME + 1]; char NewPlgName[Plg_MAX_BYTES_PLUGIN_NAME + 1];
Plg = &Gbl.Plugins.EditingPlg; Plg = &Gbl.Plugins.EditingPlg;
@ -533,7 +533,7 @@ void Plg_RenamePlugin (void)
Lay_ShowErrorAndExit ("Code of plugin is missing."); Lay_ShowErrorAndExit ("Code of plugin is missing.");
/* Get the new name for the plugin */ /* Get the new name for the plugin */
Par_GetParToText ("Name",NewPlgName,Plg_MAX_LENGTH_PLUGIN_NAME); Par_GetParToText ("Name",NewPlgName,Plg_MAX_BYTES_PLUGIN_NAME);
/***** Get from the database the old name of the plugin *****/ /***** Get from the database the old name of the plugin *****/
Plg_GetDataOfPluginByCod (Plg); Plg_GetDataOfPluginByCod (Plg);
@ -580,7 +580,7 @@ void Plg_RenamePlugin (void)
/***** Show the form again *****/ /***** Show the form again *****/
Str_Copy (Plg->Name,NewPlgName, Str_Copy (Plg->Name,NewPlgName,
Plg_MAX_LENGTH_PLUGIN_NAME); Plg_MAX_BYTES_PLUGIN_NAME);
Plg_EditPlugins (); Plg_EditPlugins ();
} }
@ -607,8 +607,8 @@ void Plg_ChangePlgDescription (void)
extern const char *Txt_The_new_description_is_X; extern const char *Txt_The_new_description_is_X;
extern const char *Txt_You_can_not_leave_the_description_empty; extern const char *Txt_You_can_not_leave_the_description_empty;
struct Plugin *Plg; struct Plugin *Plg;
char Query[256 + Plg_MAX_LENGTH_PLUGIN_DESCRIPTION]; char Query[256 + Plg_MAX_BYTES_PLUGIN_DESCRIPTION];
char NewDescription[Plg_MAX_LENGTH_PLUGIN_DESCRIPTION + 1]; char NewDescription[Plg_MAX_BYTES_PLUGIN_DESCRIPTION + 1];
Plg = &Gbl.Plugins.EditingPlg; Plg = &Gbl.Plugins.EditingPlg;
@ -618,7 +618,7 @@ void Plg_ChangePlgDescription (void)
Lay_ShowErrorAndExit ("Code of plugin is missing."); Lay_ShowErrorAndExit ("Code of plugin is missing.");
/* Get the new description for the plugin */ /* Get the new description for the plugin */
Par_GetParToText ("Description",NewDescription,Plg_MAX_LENGTH_PLUGIN_DESCRIPTION); Par_GetParToText ("Description",NewDescription,Plg_MAX_BYTES_PLUGIN_DESCRIPTION);
/***** Check if new description is empty *****/ /***** Check if new description is empty *****/
if (NewDescription[0]) if (NewDescription[0])
@ -641,7 +641,7 @@ void Plg_ChangePlgDescription (void)
/***** Show the form again *****/ /***** Show the form again *****/
Str_Copy (Plg->Description,NewDescription, Str_Copy (Plg->Description,NewDescription,
Plg_MAX_LENGTH_PLUGIN_DESCRIPTION); Plg_MAX_BYTES_PLUGIN_DESCRIPTION);
Plg_EditPlugins (); Plg_EditPlugins ();
} }
@ -654,8 +654,8 @@ void Plg_ChangePlgLogo (void)
extern const char *Txt_The_new_logo_is_X; extern const char *Txt_The_new_logo_is_X;
extern const char *Txt_You_can_not_leave_the_logo_empty; extern const char *Txt_You_can_not_leave_the_logo_empty;
struct Plugin *Plg; struct Plugin *Plg;
char Query[256 + Plg_MAX_LENGTH_PLUGIN_LOGO]; char Query[256 + Plg_MAX_BYTES_PLUGIN_LOGO];
char NewLogo[Plg_MAX_LENGTH_PLUGIN_LOGO + 1]; char NewLogo[Plg_MAX_BYTES_PLUGIN_LOGO + 1];
Plg = &Gbl.Plugins.EditingPlg; Plg = &Gbl.Plugins.EditingPlg;
@ -665,7 +665,7 @@ void Plg_ChangePlgLogo (void)
Lay_ShowErrorAndExit ("Code of plugin is missing."); Lay_ShowErrorAndExit ("Code of plugin is missing.");
/* Get the new logo for the plugin */ /* Get the new logo for the plugin */
Par_GetParToText ("Logo",NewLogo,Plg_MAX_LENGTH_PLUGIN_LOGO); Par_GetParToText ("Logo",NewLogo,Plg_MAX_BYTES_PLUGIN_LOGO);
/***** Check if new logo is empty *****/ /***** Check if new logo is empty *****/
if (NewLogo[0]) if (NewLogo[0])
@ -685,7 +685,7 @@ void Plg_ChangePlgLogo (void)
/***** Show the form again *****/ /***** Show the form again *****/
Str_Copy (Plg->Logo,NewLogo, Str_Copy (Plg->Logo,NewLogo,
Plg_MAX_LENGTH_PLUGIN_LOGO); Plg_MAX_BYTES_PLUGIN_LOGO);
Plg_EditPlugins (); Plg_EditPlugins ();
} }
@ -698,8 +698,8 @@ void Plg_ChangePlgAppKey (void)
extern const char *Txt_The_new_logo_is_X; // TODO: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! extern const char *Txt_The_new_logo_is_X; // TODO: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
extern const char *Txt_You_can_not_leave_the_logo_empty;// TODO: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! extern const char *Txt_You_can_not_leave_the_logo_empty;// TODO: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
struct Plugin *Plg; struct Plugin *Plg;
char Query[256 + Plg_MAX_LENGTH_PLUGIN_APP_KEY]; char Query[256 + Plg_MAX_BYTES_PLUGIN_APP_KEY];
char NewAppKey[Plg_MAX_LENGTH_PLUGIN_APP_KEY + 1]; char NewAppKey[Plg_MAX_BYTES_PLUGIN_APP_KEY + 1];
Plg = &Gbl.Plugins.EditingPlg; Plg = &Gbl.Plugins.EditingPlg;
@ -709,7 +709,7 @@ void Plg_ChangePlgAppKey (void)
Lay_ShowErrorAndExit ("Code of plugin is missing."); Lay_ShowErrorAndExit ("Code of plugin is missing.");
/* Get the new logo for the plugin */ /* Get the new logo for the plugin */
Par_GetParToText ("AppKey",NewAppKey,Plg_MAX_LENGTH_PLUGIN_APP_KEY); Par_GetParToText ("AppKey",NewAppKey,Plg_MAX_BYTES_PLUGIN_APP_KEY);
/***** Check if new logo is empty *****/ /***** Check if new logo is empty *****/
if (NewAppKey[0]) if (NewAppKey[0])
@ -729,7 +729,7 @@ void Plg_ChangePlgAppKey (void)
/***** Show the form again *****/ /***** Show the form again *****/
Str_Copy (Plg->AppKey,NewAppKey, Str_Copy (Plg->AppKey,NewAppKey,
Plg_MAX_LENGTH_PLUGIN_APP_KEY); Plg_MAX_BYTES_PLUGIN_APP_KEY);
Plg_EditPlugins (); Plg_EditPlugins ();
} }
@ -879,7 +879,7 @@ static void Plg_PutFormToCreatePlugin (void)
" size=\"10\" maxlength=\"%u\" value=\"%s\"" " size=\"10\" maxlength=\"%u\" value=\"%s\""
" required=\"required\" />" " required=\"required\" />"
"</td>", "</td>",
Plg_MAX_LENGTH_PLUGIN_NAME,Plg->Name); Plg_MAX_CHARS_PLUGIN_NAME,Plg->Name);
/***** Plugin description *****/ /***** Plugin description *****/
fprintf (Gbl.F.Out,"<td class=\"CENTER_MIDDLE\">" fprintf (Gbl.F.Out,"<td class=\"CENTER_MIDDLE\">"
@ -887,7 +887,7 @@ static void Plg_PutFormToCreatePlugin (void)
" size=\"30\" maxlength=\"%u\" value=\"%s\"" " size=\"30\" maxlength=\"%u\" value=\"%s\""
" required=\"required\" />" " required=\"required\" />"
"</td>", "</td>",
Plg_MAX_LENGTH_PLUGIN_DESCRIPTION,Plg->Description); Plg_MAX_CHARS_PLUGIN_DESCRIPTION,Plg->Description);
/***** Plugin logo *****/ /***** Plugin logo *****/
fprintf (Gbl.F.Out,"<td class=\"CENTER_MIDDLE\">" fprintf (Gbl.F.Out,"<td class=\"CENTER_MIDDLE\">"
@ -895,7 +895,7 @@ static void Plg_PutFormToCreatePlugin (void)
" size=\"4\" maxlength=\"%u\" value=\"%s\"" " size=\"4\" maxlength=\"%u\" value=\"%s\""
" required=\"required\" />" " required=\"required\" />"
"</td>", "</td>",
Plg_MAX_LENGTH_PLUGIN_LOGO,Plg->Logo); Plg_MAX_CHARS_PLUGIN_LOGO,Plg->Logo);
/***** Plugin application key *****/ /***** Plugin application key *****/
fprintf (Gbl.F.Out,"<td class=\"CENTER_MIDDLE\">" fprintf (Gbl.F.Out,"<td class=\"CENTER_MIDDLE\">"
@ -903,7 +903,7 @@ static void Plg_PutFormToCreatePlugin (void)
" size=\"16\" maxlength=\"%u\" value=\"%s\"" " size=\"16\" maxlength=\"%u\" value=\"%s\""
" required=\"required\" />" " required=\"required\" />"
"</td>", "</td>",
Plg_MAX_LENGTH_PLUGIN_APP_KEY,Plg->AppKey); Plg_MAX_CHARS_PLUGIN_APP_KEY,Plg->AppKey);
/***** Plugin URL *****/ /***** Plugin URL *****/
fprintf (Gbl.F.Out,"<td class=\"CENTER_MIDDLE\">" fprintf (Gbl.F.Out,"<td class=\"CENTER_MIDDLE\">"
@ -992,16 +992,16 @@ void Plg_RecFormNewPlg (void)
/***** Get parameters from form *****/ /***** Get parameters from form *****/
/* Get plugin name */ /* Get plugin name */
Par_GetParToText ("Name",Plg->Name,Plg_MAX_LENGTH_PLUGIN_NAME); Par_GetParToText ("Name",Plg->Name,Plg_MAX_BYTES_PLUGIN_NAME);
/* Get plugin description */ /* Get plugin description */
Par_GetParToText ("Description",Plg->Description,Plg_MAX_LENGTH_PLUGIN_DESCRIPTION); Par_GetParToText ("Description",Plg->Description,Plg_MAX_BYTES_PLUGIN_DESCRIPTION);
/* Get plugin logo */ /* Get plugin logo */
Par_GetParToText ("Logo",Plg->Logo,Plg_MAX_LENGTH_PLUGIN_LOGO); Par_GetParToText ("Logo",Plg->Logo,Plg_MAX_BYTES_PLUGIN_LOGO);
/* Get plugin application key */ /* Get plugin application key */
Par_GetParToText ("AppKey",Plg->AppKey,Plg_MAX_LENGTH_PLUGIN_APP_KEY); Par_GetParToText ("AppKey",Plg->AppKey,Plg_MAX_BYTES_PLUGIN_APP_KEY);
/* Get plugin URL */ /* Get plugin URL */
Par_GetParToText ("URL",Plg->URL,Cns_MAX_BYTES_WWW); Par_GetParToText ("URL",Plg->URL,Cns_MAX_BYTES_WWW);
@ -1040,10 +1040,10 @@ void Plg_RecFormNewPlg (void)
static void Plg_CreatePlugin (struct Plugin *Plg) static void Plg_CreatePlugin (struct Plugin *Plg)
{ {
extern const char *Txt_Created_new_plugin_X; extern const char *Txt_Created_new_plugin_X;
char Query[512 + Plg_MAX_LENGTH_PLUGIN_NAME + char Query[512 + Plg_MAX_BYTES_PLUGIN_NAME +
Plg_MAX_LENGTH_PLUGIN_DESCRIPTION + Plg_MAX_BYTES_PLUGIN_DESCRIPTION +
Plg_MAX_LENGTH_PLUGIN_LOGO + Plg_MAX_BYTES_PLUGIN_LOGO +
Plg_MAX_LENGTH_PLUGIN_APP_KEY + Plg_MAX_BYTES_PLUGIN_APP_KEY +
Cns_MAX_BYTES_WWW + Cns_MAX_BYTES_WWW +
Cns_MAX_BYTES_IP]; Cns_MAX_BYTES_IP];

View File

@ -31,13 +31,17 @@
/****************************** Public constants *****************************/ /****************************** Public constants *****************************/
/*****************************************************************************/ /*****************************************************************************/
#define Plg_MAX_LENGTH_PLUGIN_NAME (128 - 1) #define Plg_MAX_CHARS_PLUGIN_NAME (128 - 1)
#define Plg_MAX_BYTES_PLUGIN_NAME (Plg_MAX_CHARS_PLUGIN_NAME * Str_MAX_BYTES_PER_CHAR)
#define Plg_MAX_LENGTH_PLUGIN_DESCRIPTION 1023 #define Plg_MAX_CHARS_PLUGIN_DESCRIPTION (128 - 1)
#define Plg_MAX_BYTES_PLUGIN_DESCRIPTION (Plg_MAX_CHARS_PLUGIN_DESCRIPTION * Str_MAX_BYTES_PER_CHAR)
#define Plg_MAX_LENGTH_PLUGIN_LOGO 16 #define Plg_MAX_CHARS_PLUGIN_LOGO 32
#define Plg_MAX_BYTES_PLUGIN_LOGO Plg_MAX_CHARS_PLUGIN_LOGO
#define Plg_MAX_LENGTH_PLUGIN_APP_KEY 16 #define Plg_MAX_CHARS_PLUGIN_APP_KEY 32
#define Plg_MAX_BYTES_PLUGIN_APP_KEY Plg_MAX_CHARS_PLUGIN_APP_KEY
/*****************************************************************************/ /*****************************************************************************/
/******************************* Public types ********************************/ /******************************* Public types ********************************/
@ -46,10 +50,10 @@
struct Plugin struct Plugin
{ {
long PlgCod; long PlgCod;
char Name[Plg_MAX_LENGTH_PLUGIN_NAME + 1]; char Name[Plg_MAX_BYTES_PLUGIN_NAME + 1];
char Description[Plg_MAX_LENGTH_PLUGIN_DESCRIPTION + 1]; char Description[Plg_MAX_BYTES_PLUGIN_DESCRIPTION + 1];
char Logo[Plg_MAX_LENGTH_PLUGIN_LOGO + 1]; char Logo[Plg_MAX_BYTES_PLUGIN_LOGO + 1];
char AppKey[Plg_MAX_LENGTH_PLUGIN_APP_KEY + 1]; char AppKey[Plg_MAX_BYTES_PLUGIN_APP_KEY + 1];
char URL[Cns_MAX_BYTES_WWW + 1]; char URL[Cns_MAX_BYTES_WWW + 1];
char IP[Cns_MAX_BYTES_IP + 1]; char IP[Cns_MAX_BYTES_IP + 1];
}; };

View File

@ -1058,18 +1058,18 @@ static void Prf_ResetUsrFigures (struct UsrFigures *UsrFigures)
/***** Get number of messages sent by a user and store in user's figures *****/ /***** Get number of messages sent by a user and store in user's figures *****/
/*****************************************************************************/ /*****************************************************************************/
#define Prf_MAX_LENGTH_SUBQUERY_FIRST_CLICK_TIME (64 - 1) #define Prf_MAX_BYTES_SUBQUERY_FIRST_CLICK_TIME (64 - 1)
static void Prf_CreateUsrFigures (long UsrCod,const struct UsrFigures *UsrFigures, static void Prf_CreateUsrFigures (long UsrCod,const struct UsrFigures *UsrFigures,
bool CreatingMyOwnAccount) bool CreatingMyOwnAccount)
{ {
char Query[512 + Prf_MAX_LENGTH_SUBQUERY_FIRST_CLICK_TIME]; char Query[512 + Prf_MAX_BYTES_SUBQUERY_FIRST_CLICK_TIME];
char SubQueryFirstClickTime[Prf_MAX_LENGTH_SUBQUERY_FIRST_CLICK_TIME + 1]; char SubQueryFirstClickTime[Prf_MAX_BYTES_SUBQUERY_FIRST_CLICK_TIME + 1];
if (CreatingMyOwnAccount) if (CreatingMyOwnAccount)
// This is the first click // This is the first click
Str_Copy (SubQueryFirstClickTime,"NOW()", Str_Copy (SubQueryFirstClickTime,"NOW()",
Prf_MAX_LENGTH_SUBQUERY_FIRST_CLICK_TIME); Prf_MAX_BYTES_SUBQUERY_FIRST_CLICK_TIME);
else else
sprintf (SubQueryFirstClickTime,"FROM_UNIXTIME('%ld')", sprintf (SubQueryFirstClickTime,"FROM_UNIXTIME('%ld')",
(long) UsrFigures->FirstClickTimeUTC); // 0 ==> unknown first click time or user never logged (long) UsrFigures->FirstClickTimeUTC); // 0 ==> unknown first click time or user never logged

View File

@ -71,7 +71,7 @@ extern struct Globals Gbl;
/*****************************************************************************/ /*****************************************************************************/
static void Rec_WriteHeadingRecordFields (void); static void Rec_WriteHeadingRecordFields (void);
static void Rec_GetFieldByCod (long FieldCod,char Name[Rec_MAX_LENGTH_NAME_FIELD + 1], static void Rec_GetFieldByCod (long FieldCod,char Name[Rec_MAX_BYTES_NAME_FIELD + 1],
unsigned *NumLines,Rec_VisibilityRecordFields_t *Visibility); unsigned *NumLines,Rec_VisibilityRecordFields_t *Visibility);
static void Rec_ShowRecordOneStdCrs (void); static void Rec_ShowRecordOneStdCrs (void);
@ -234,7 +234,7 @@ void Rec_GetListRecordFieldsInCurrentCrs (void)
/* Name of the field (row[1]) */ /* Name of the field (row[1]) */
Str_Copy (Gbl.CurrentCrs.Records.LstFields.Lst[NumRow].Name,row[1], Str_Copy (Gbl.CurrentCrs.Records.LstFields.Lst[NumRow].Name,row[1],
Rec_MAX_LENGTH_NAME_FIELD); Rec_MAX_BYTES_NAME_FIELD);
/* Number of lines (row[2]) */ /* Number of lines (row[2]) */
Gbl.CurrentCrs.Records.LstFields.Lst[NumRow].NumLines = Rec_ConvertToNumLinesField (row[2]); Gbl.CurrentCrs.Records.LstFields.Lst[NumRow].NumLines = Rec_ConvertToNumLinesField (row[2]);
@ -288,7 +288,7 @@ void Rec_ListFieldsRecordsForEdition (void)
fprintf (Gbl.F.Out,"<input type=\"text\" name=\"FieldName\"" fprintf (Gbl.F.Out,"<input type=\"text\" name=\"FieldName\""
" style=\"width:500px;\" maxlength=\"%u\" value=\"%s\"" " style=\"width:500px;\" maxlength=\"%u\" value=\"%s\""
" onchange=\"document.getElementById('%s').submit();\" />", " onchange=\"document.getElementById('%s').submit();\" />",
Rec_MAX_LENGTH_NAME_FIELD, Rec_MAX_CHARS_NAME_FIELD,
Gbl.CurrentCrs.Records.LstFields.Lst[NumField].Name, Gbl.CurrentCrs.Records.LstFields.Lst[NumField].Name,
Gbl.Form.Id); Gbl.Form.Id);
Act_FormEnd (); Act_FormEnd ();
@ -362,7 +362,7 @@ void Rec_ShowFormCreateRecordField (void)
" style=\"width:500px;\" maxlength=\"%u\" value=\"%s\"" " style=\"width:500px;\" maxlength=\"%u\" value=\"%s\""
" required=\"required\" />" " required=\"required\" />"
"</td>", "</td>",
Rec_MAX_LENGTH_NAME_FIELD,Gbl.CurrentCrs.Records.Field.Name); Rec_MAX_CHARS_NAME_FIELD,Gbl.CurrentCrs.Records.Field.Name);
/***** Number of lines in form ******/ /***** Number of lines in form ******/
fprintf (Gbl.F.Out,"<td class=\"CENTER_MIDDLE\">" fprintf (Gbl.F.Out,"<td class=\"CENTER_MIDDLE\">"
@ -435,7 +435,7 @@ void Rec_ReceiveFormField (void)
/***** Get parameters from the form *****/ /***** Get parameters from the form *****/
/* Get the name of the field */ /* Get the name of the field */
Par_GetParToText ("FieldName",Gbl.CurrentCrs.Records.Field.Name,Rec_MAX_LENGTH_NAME_FIELD); Par_GetParToText ("FieldName",Gbl.CurrentCrs.Records.Field.Name,Rec_MAX_BYTES_NAME_FIELD);
/* Get the number of lines */ /* Get the number of lines */
Gbl.CurrentCrs.Records.Field.NumLines = (unsigned) Gbl.CurrentCrs.Records.Field.NumLines = (unsigned)
@ -682,7 +682,7 @@ void Rec_RemoveFieldFromDB (void)
/************** Get the data of a field of records from its code *************/ /************** Get the data of a field of records from its code *************/
/*****************************************************************************/ /*****************************************************************************/
static void Rec_GetFieldByCod (long FieldCod,char Name[Rec_MAX_LENGTH_NAME_FIELD + 1], static void Rec_GetFieldByCod (long FieldCod,char Name[Rec_MAX_BYTES_NAME_FIELD + 1],
unsigned *NumLines,Rec_VisibilityRecordFields_t *Visibility) unsigned *NumLines,Rec_VisibilityRecordFields_t *Visibility)
{ {
char Query[512]; char Query[512];
@ -705,7 +705,7 @@ static void Rec_GetFieldByCod (long FieldCod,char Name[Rec_MAX_LENGTH_NAME_FIELD
/* Name of the field */ /* Name of the field */
Str_Copy (Name,row[0], Str_Copy (Name,row[0],
Rec_MAX_LENGTH_NAME_FIELD); Rec_MAX_BYTES_NAME_FIELD);
/* Number of lines of the field (row[1]) */ /* Number of lines of the field (row[1]) */
*NumLines = Rec_ConvertToNumLinesField (row[1]); *NumLines = Rec_ConvertToNumLinesField (row[1]);
@ -747,7 +747,7 @@ void Rec_RenameField (void)
extern const char *Txt_The_record_field_X_has_been_renamed_as_Y; extern const char *Txt_The_record_field_X_has_been_renamed_as_Y;
extern const char *Txt_The_name_of_the_field_X_has_not_changed; extern const char *Txt_The_name_of_the_field_X_has_not_changed;
char Query[1024]; char Query[1024];
char NewFieldName[Rec_MAX_LENGTH_NAME_FIELD + 1]; char NewFieldName[Rec_MAX_BYTES_NAME_FIELD + 1];
/***** Get parameters of the form *****/ /***** Get parameters of the form *****/
/* Get the code of the field */ /* Get the code of the field */
@ -755,7 +755,7 @@ void Rec_RenameField (void)
Lay_ShowErrorAndExit ("Code of field is missing."); Lay_ShowErrorAndExit ("Code of field is missing.");
/* Get the new group name */ /* Get the new group name */
Par_GetParToText ("FieldName",NewFieldName,Rec_MAX_LENGTH_NAME_FIELD); Par_GetParToText ("FieldName",NewFieldName,Rec_MAX_BYTES_NAME_FIELD);
/***** Get from the database the antiguo group name *****/ /***** Get from the database the antiguo group name *****/
Rec_GetFieldByCod (Gbl.CurrentCrs.Records.Field.FieldCod,Gbl.CurrentCrs.Records.Field.Name,&Gbl.CurrentCrs.Records.Field.NumLines,&Gbl.CurrentCrs.Records.Field.Visibility); Rec_GetFieldByCod (Gbl.CurrentCrs.Records.Field.FieldCod,Gbl.CurrentCrs.Records.Field.Name,&Gbl.CurrentCrs.Records.Field.NumLines,&Gbl.CurrentCrs.Records.Field.Visibility);
@ -803,7 +803,7 @@ void Rec_RenameField (void)
/***** Show the form again *****/ /***** Show the form again *****/
Str_Copy (Gbl.CurrentCrs.Records.Field.Name,NewFieldName, Str_Copy (Gbl.CurrentCrs.Records.Field.Name,NewFieldName,
Rec_MAX_LENGTH_NAME_FIELD); Rec_MAX_BYTES_NAME_FIELD);
Rec_ReqEditRecordFields (); Rec_ReqEditRecordFields ();
} }
@ -3223,7 +3223,7 @@ static void Rec_ShowLocalPhone (struct UsrData *UsrDat,
" id=\"LocalPhone\" name=\"LocalPhone\"" " id=\"LocalPhone\" name=\"LocalPhone\""
" maxlength=\"%u\" value=\"%s\"" " maxlength=\"%u\" value=\"%s\""
" class=\"REC_C2_BOT_INPUT\" />", " class=\"REC_C2_BOT_INPUT\" />",
Usr_MAX_LENGTH_PHONE, Usr_MAX_CHARS_PHONE,
UsrDat->LocalPhone); UsrDat->LocalPhone);
else if (UsrDat->LocalPhone[0]) else if (UsrDat->LocalPhone[0])
fprintf (Gbl.F.Out,"<a href=\"tel:%s\" class=\"REC_DAT_BOLD\">%s</a>", fprintf (Gbl.F.Out,"<a href=\"tel:%s\" class=\"REC_DAT_BOLD\">%s</a>",
@ -3293,7 +3293,7 @@ static void Rec_ShowFamilyPhone (struct UsrData *UsrDat,
" id=\"FamilyPhone\" name=\"FamilyPhone\"" " id=\"FamilyPhone\" name=\"FamilyPhone\""
" maxlength=\"%u\" value=\"%s\"" " maxlength=\"%u\" value=\"%s\""
" class=\"REC_C2_BOT_INPUT\" />", " class=\"REC_C2_BOT_INPUT\" />",
Usr_MAX_LENGTH_PHONE, Usr_MAX_CHARS_PHONE,
UsrDat->FamilyPhone); UsrDat->FamilyPhone);
else if (UsrDat->FamilyPhone[0]) else if (UsrDat->FamilyPhone[0])
fprintf (Gbl.F.Out,"<a href=\"tel:%s\" class=\"REC_DAT_BOLD\">%s</a>", fprintf (Gbl.F.Out,"<a href=\"tel:%s\" class=\"REC_DAT_BOLD\">%s</a>",
@ -3940,7 +3940,7 @@ void Rec_ShowFormMyInsCtrDpt (void)
" maxlength=\"%u\" value=\"%s\"" " maxlength=\"%u\" value=\"%s\""
" style=\"width:500px;\"" " style=\"width:500px;\""
" onchange=\"document.getElementById('%s').submit();\" />", " onchange=\"document.getElementById('%s').submit();\" />",
Usr_MAX_LENGTH_PHONE, Usr_MAX_CHARS_PHONE,
Gbl.Usrs.Me.UsrDat.Tch.OfficePhone, Gbl.Usrs.Me.UsrDat.Tch.OfficePhone,
Gbl.Form.Id); Gbl.Form.Id);
Act_FormEnd (); Act_FormEnd ();

View File

@ -37,7 +37,9 @@
#define Rec_RECORD_WIDTH 560 #define Rec_RECORD_WIDTH 560
#define Rec_MAX_LENGTH_NAME_FIELD 255 #define Rec_MAX_CHARS_NAME_FIELD (128 - 1)
#define Rec_MAX_BYTES_NAME_FIELD (Rec_MAX_CHARS_NAME_FIELD * Str_MAX_BYTES_PER_CHAR)
#define Rec_MIN_LINES_IN_EDITION_FIELD 1 #define Rec_MIN_LINES_IN_EDITION_FIELD 1
#define Rec_MAX_LINES_IN_EDITION_FIELD 50 #define Rec_MAX_LINES_IN_EDITION_FIELD 50
#define Rec_DEF_LINES_IN_EDITION_FIELD Rec_MIN_LINES_IN_EDITION_FIELD #define Rec_DEF_LINES_IN_EDITION_FIELD Rec_MIN_LINES_IN_EDITION_FIELD
@ -96,7 +98,7 @@ typedef enum
struct RecordField struct RecordField
{ {
long FieldCod; // FieldCode long FieldCod; // FieldCode
char Name[Rec_MAX_LENGTH_NAME_FIELD + 1]; // Field name char Name[Rec_MAX_BYTES_NAME_FIELD + 1]; // Field name
unsigned NumLines; // Number of rows of form used to edit the filed (always >= 2) unsigned NumLines; // Number of rows of form used to edit the filed (always >= 2)
Rec_VisibilityRecordFields_t Visibility; // Hidden, visible or editable by students? Rec_VisibilityRecordFields_t Visibility; // Hidden, visible or editable by students?
char *Text; // Filed text char *Text; // Filed text

View File

@ -493,7 +493,7 @@ void Soc_MarkMyNotifAsSeen (void)
/*****************************************************************************/ /*****************************************************************************/
// Query must have space for at least 1024 chars // Query must have space for at least 1024 chars
#define Soc_MAX_LENGTH_SUBQUERY_ALREADY_EXISTS (256 - 1) #define Soc_MAX_BYTES_SUBQUERY_ALREADY_EXISTS (256 - 1)
static void Soc_BuildQueryToGetTimeline (Soc_TimelineUsrOrGbl_t TimelineUsrOrGbl, static void Soc_BuildQueryToGetTimeline (Soc_TimelineUsrOrGbl_t TimelineUsrOrGbl,
Soc_WhatToGetFromTimeline_t WhatToGetFromTimeline, Soc_WhatToGetFromTimeline_t WhatToGetFromTimeline,
@ -502,7 +502,7 @@ static void Soc_BuildQueryToGetTimeline (Soc_TimelineUsrOrGbl_t TimelineUsrOrGbl
char SubQueryPublishers[128]; char SubQueryPublishers[128];
char SubQueryRangeBottom[128]; char SubQueryRangeBottom[128];
char SubQueryRangeTop[128]; char SubQueryRangeTop[128];
char SubQueryAlreadyExists[Soc_MAX_LENGTH_SUBQUERY_ALREADY_EXISTS + 1]; char SubQueryAlreadyExists[Soc_MAX_BYTES_SUBQUERY_ALREADY_EXISTS + 1];
struct struct
{ {
long Top; long Top;
@ -588,13 +588,13 @@ static void Soc_BuildQueryToGetTimeline (Soc_TimelineUsrOrGbl_t TimelineUsrOrGbl
Str_Copy (SubQueryAlreadyExists, Str_Copy (SubQueryAlreadyExists,
" NotCod NOT IN" " NotCod NOT IN"
" (SELECT NotCod FROM not_codes)", " (SELECT NotCod FROM not_codes)",
Soc_MAX_LENGTH_SUBQUERY_ALREADY_EXISTS); Soc_MAX_BYTES_SUBQUERY_ALREADY_EXISTS);
break; break;
case Soc_GET_ONLY_OLD_PUBS: case Soc_GET_ONLY_OLD_PUBS:
Str_Copy (SubQueryAlreadyExists, Str_Copy (SubQueryAlreadyExists,
" NotCod NOT IN" " NotCod NOT IN"
" (SELECT NotCod FROM current_timeline)", " (SELECT NotCod FROM current_timeline)",
Soc_MAX_LENGTH_SUBQUERY_ALREADY_EXISTS); Soc_MAX_BYTES_SUBQUERY_ALREADY_EXISTS);
break; break;
} }
break; break;
@ -606,13 +606,13 @@ static void Soc_BuildQueryToGetTimeline (Soc_TimelineUsrOrGbl_t TimelineUsrOrGbl
Str_Copy (SubQueryAlreadyExists, Str_Copy (SubQueryAlreadyExists,
" social_pubs.NotCod NOT IN" " social_pubs.NotCod NOT IN"
" (SELECT NotCod FROM not_codes)", " (SELECT NotCod FROM not_codes)",
Soc_MAX_LENGTH_SUBQUERY_ALREADY_EXISTS); Soc_MAX_BYTES_SUBQUERY_ALREADY_EXISTS);
break; break;
case Soc_GET_ONLY_OLD_PUBS: case Soc_GET_ONLY_OLD_PUBS:
Str_Copy (SubQueryAlreadyExists, Str_Copy (SubQueryAlreadyExists,
" social_pubs.NotCod NOT IN" " social_pubs.NotCod NOT IN"
" (SELECT NotCod FROM current_timeline)", " (SELECT NotCod FROM current_timeline)",
Soc_MAX_LENGTH_SUBQUERY_ALREADY_EXISTS); Soc_MAX_BYTES_SUBQUERY_ALREADY_EXISTS);
break; break;
} }
break; break;

View File

@ -265,11 +265,12 @@ void Sta_GetRemoteAddr (void)
/**************************** Log access in database *************************/ /**************************** Log access in database *************************/
/*****************************************************************************/ /*****************************************************************************/
#define Sta_MAX_LENGTH_QUERY_LOG (2048 - 1) #define Sta_MAX_BYTES_QUERY_LOG (2048 - 1)
void Sta_LogAccess (const char *Comments) void Sta_LogAccess (const char *Comments)
{ {
extern struct Act_Actions Act_Actions[Act_NUM_ACTIONS]; extern struct Act_Actions Act_Actions[Act_NUM_ACTIONS];
char Query[Sta_MAX_LENGTH_QUERY_LOG + 1]; char Query[Sta_MAX_BYTES_QUERY_LOG + 1];
long LogCod; long LogCod;
Rol_Role_t RoleToStore = (Gbl.Action.Act == ActLogOut) ? Gbl.Usrs.Me.LoggedRoleBeforeCloseSession : Rol_Role_t RoleToStore = (Gbl.Action.Act == ActLogOut) ? Gbl.Usrs.Me.LoggedRoleBeforeCloseSession :
Gbl.Usrs.Me.LoggedRole; Gbl.Usrs.Me.LoggedRole;
@ -336,7 +337,7 @@ void Sta_LogAccess (const char *Comments)
LogCod); LogCod);
Str_AddStrToQuery (Query,Comments,sizeof (Query)); Str_AddStrToQuery (Query,Comments,sizeof (Query));
Str_Concat (Query,"')", Str_Concat (Query,"')",
Sta_MAX_LENGTH_QUERY_LOG); Sta_MAX_BYTES_QUERY_LOG);
if (Gbl.WebService.IsWebService) if (Gbl.WebService.IsWebService)
{ {
@ -355,7 +356,7 @@ void Sta_LogAccess (const char *Comments)
LogCod); LogCod);
Str_AddStrToQuery (Query,Gbl.Search.Str,sizeof (Query)); Str_AddStrToQuery (Query,Gbl.Search.Str,sizeof (Query));
Str_Concat (Query,"')", Str_Concat (Query,"')",
Sta_MAX_LENGTH_QUERY_LOG); Sta_MAX_BYTES_QUERY_LOG);
if (Gbl.WebService.IsWebService) if (Gbl.WebService.IsWebService)
{ {
@ -836,9 +837,9 @@ void Sta_SeeCrsAccesses (void)
/******************** Compute and show access statistics ********************/ /******************** Compute and show access statistics ********************/
/*****************************************************************************/ /*****************************************************************************/
#define Sta_MAX_LENGTH_QUERY_ACCESS (1024 + (10 + ID_MAX_BYTES_USR_ID) * 5000 - 1) #define Sta_MAX_BYTES_QUERY_ACCESS (1024 + (10 + ID_MAX_BYTES_USR_ID) * 5000 - 1)
#define Sta_MAX_LENGTH_COUNT_TYPE (256 - 1) #define Sta_MAX_BYTES_COUNT_TYPE (256 - 1)
static void Sta_ShowHits (Sta_GlobalOrCourseAccesses_t GlobalOrCourse) static void Sta_ShowHits (Sta_GlobalOrCourseAccesses_t GlobalOrCourse)
{ {
@ -850,7 +851,7 @@ static void Sta_ShowHits (Sta_GlobalOrCourseAccesses_t GlobalOrCourse)
extern const char *Txt_List_of_detailed_clicks; extern const char *Txt_List_of_detailed_clicks;
extern const char *Txt_STAT_TYPE_COUNT_CAPS[Sta_NUM_COUNT_TYPES]; extern const char *Txt_STAT_TYPE_COUNT_CAPS[Sta_NUM_COUNT_TYPES];
extern const char *Txt_Time_zone_used_in_the_calculation_of_these_statistics; extern const char *Txt_Time_zone_used_in_the_calculation_of_these_statistics;
char Query[Sta_MAX_LENGTH_QUERY_ACCESS + 1]; char Query[Sta_MAX_BYTES_QUERY_ACCESS + 1];
char QueryAux[512]; char QueryAux[512];
long LengthQuery; long LengthQuery;
MYSQL_RES *mysql_res; MYSQL_RES *mysql_res;
@ -862,7 +863,7 @@ static void Sta_ShowHits (Sta_GlobalOrCourseAccesses_t GlobalOrCourse)
unsigned NumUsr = 0; unsigned NumUsr = 0;
const char *Ptr; const char *Ptr;
char StrRole[256]; char StrRole[256];
char StrQueryCountType[Sta_MAX_LENGTH_COUNT_TYPE + 1]; char StrQueryCountType[Sta_MAX_BYTES_COUNT_TYPE + 1];
unsigned NumDays; unsigned NumDays;
bool ICanQueryWholeRange; bool ICanQueryWholeRange;
@ -1011,7 +1012,7 @@ static void Sta_ShowHits (Sta_GlobalOrCourseAccesses_t GlobalOrCourse)
{ {
case Sta_TOTAL_CLICKS: case Sta_TOTAL_CLICKS:
Str_Copy (StrQueryCountType,"COUNT(*)", Str_Copy (StrQueryCountType,"COUNT(*)",
Sta_MAX_LENGTH_COUNT_TYPE); Sta_MAX_BYTES_COUNT_TYPE);
break; break;
case Sta_DISTINCT_USRS: case Sta_DISTINCT_USRS:
sprintf (StrQueryCountType,"COUNT(DISTINCT(%s.UsrCod))",LogTable); sprintf (StrQueryCountType,"COUNT(DISTINCT(%s.UsrCod))",LogTable);
@ -1140,7 +1141,7 @@ static void Sta_ShowHits (Sta_GlobalOrCourseAccesses_t GlobalOrCourse)
(long) Gbl.DateRange.TimeUTC[0], (long) Gbl.DateRange.TimeUTC[0],
(long) Gbl.DateRange.TimeUTC[1]); (long) Gbl.DateRange.TimeUTC[1]);
Str_Concat (Query,QueryAux, Str_Concat (Query,QueryAux,
Sta_MAX_LENGTH_QUERY_ACCESS); Sta_MAX_BYTES_QUERY_ACCESS);
switch (GlobalOrCourse) switch (GlobalOrCourse)
{ {
@ -1157,7 +1158,7 @@ static void Sta_ShowHits (Sta_GlobalOrCourseAccesses_t GlobalOrCourse)
sprintf (QueryAux," AND %s.CtyCod='%ld'", sprintf (QueryAux," AND %s.CtyCod='%ld'",
LogTable,Gbl.CurrentCty.Cty.CtyCod); LogTable,Gbl.CurrentCty.Cty.CtyCod);
Str_Concat (Query,QueryAux, Str_Concat (Query,QueryAux,
Sta_MAX_LENGTH_QUERY_ACCESS); Sta_MAX_BYTES_QUERY_ACCESS);
} }
break; break;
case Sco_SCOPE_INS: case Sco_SCOPE_INS:
@ -1166,7 +1167,7 @@ static void Sta_ShowHits (Sta_GlobalOrCourseAccesses_t GlobalOrCourse)
sprintf (QueryAux," AND %s.InsCod='%ld'", sprintf (QueryAux," AND %s.InsCod='%ld'",
LogTable,Gbl.CurrentIns.Ins.InsCod); LogTable,Gbl.CurrentIns.Ins.InsCod);
Str_Concat (Query,QueryAux, Str_Concat (Query,QueryAux,
Sta_MAX_LENGTH_QUERY_ACCESS); Sta_MAX_BYTES_QUERY_ACCESS);
} }
break; break;
case Sco_SCOPE_CTR: case Sco_SCOPE_CTR:
@ -1175,7 +1176,7 @@ static void Sta_ShowHits (Sta_GlobalOrCourseAccesses_t GlobalOrCourse)
sprintf (QueryAux," AND %s.CtrCod='%ld'", sprintf (QueryAux," AND %s.CtrCod='%ld'",
LogTable,Gbl.CurrentCtr.Ctr.CtrCod); LogTable,Gbl.CurrentCtr.Ctr.CtrCod);
Str_Concat (Query,QueryAux, Str_Concat (Query,QueryAux,
Sta_MAX_LENGTH_QUERY_ACCESS); Sta_MAX_BYTES_QUERY_ACCESS);
} }
break; break;
case Sco_SCOPE_DEG: case Sco_SCOPE_DEG:
@ -1184,7 +1185,7 @@ static void Sta_ShowHits (Sta_GlobalOrCourseAccesses_t GlobalOrCourse)
sprintf (QueryAux," AND %s.DegCod='%ld'", sprintf (QueryAux," AND %s.DegCod='%ld'",
LogTable,Gbl.CurrentDeg.Deg.DegCod); LogTable,Gbl.CurrentDeg.Deg.DegCod);
Str_Concat (Query,QueryAux, Str_Concat (Query,QueryAux,
Sta_MAX_LENGTH_QUERY_ACCESS); Sta_MAX_BYTES_QUERY_ACCESS);
} }
break; break;
case Sco_SCOPE_CRS: case Sco_SCOPE_CRS:
@ -1193,7 +1194,7 @@ static void Sta_ShowHits (Sta_GlobalOrCourseAccesses_t GlobalOrCourse)
sprintf (QueryAux," AND %s.CrsCod='%ld'", sprintf (QueryAux," AND %s.CrsCod='%ld'",
LogTable,Gbl.CurrentCrs.Crs.CrsCod); LogTable,Gbl.CurrentCrs.Crs.CrsCod);
Str_Concat (Query,QueryAux, Str_Concat (Query,QueryAux,
Sta_MAX_LENGTH_QUERY_ACCESS); Sta_MAX_BYTES_QUERY_ACCESS);
} }
break; break;
} }
@ -1258,7 +1259,7 @@ static void Sta_ShowHits (Sta_GlobalOrCourseAccesses_t GlobalOrCourse)
break; break;
} }
Str_Concat (Query,StrRole, Str_Concat (Query,StrRole,
Sta_MAX_LENGTH_QUERY_ACCESS); Sta_MAX_BYTES_QUERY_ACCESS);
switch (Gbl.Stat.ClicksGroupedBy) switch (Gbl.Stat.ClicksGroupedBy)
{ {
@ -1267,13 +1268,13 @@ static void Sta_ShowHits (Sta_GlobalOrCourseAccesses_t GlobalOrCourse)
sprintf (QueryAux," AND %s.LogCod=log_ws.LogCod", sprintf (QueryAux," AND %s.LogCod=log_ws.LogCod",
LogTable); LogTable);
Str_Concat (Query,QueryAux, Str_Concat (Query,QueryAux,
Sta_MAX_LENGTH_QUERY_ACCESS); Sta_MAX_BYTES_QUERY_ACCESS);
break; break;
case Sta_CLICKS_GBL_PER_BANNER: case Sta_CLICKS_GBL_PER_BANNER:
sprintf (QueryAux," AND %s.LogCod=log_banners.LogCod", sprintf (QueryAux," AND %s.LogCod=log_banners.LogCod",
LogTable); LogTable);
Str_Concat (Query,QueryAux, Str_Concat (Query,QueryAux,
Sta_MAX_LENGTH_QUERY_ACCESS); Sta_MAX_BYTES_QUERY_ACCESS);
break; break;
default: default:
break; break;
@ -1283,7 +1284,7 @@ static void Sta_ShowHits (Sta_GlobalOrCourseAccesses_t GlobalOrCourse)
sprintf (QueryAux," AND %s.CrsCod='%ld'", sprintf (QueryAux," AND %s.CrsCod='%ld'",
LogTable,Gbl.CurrentCrs.Crs.CrsCod); LogTable,Gbl.CurrentCrs.Crs.CrsCod);
Str_Concat (Query,QueryAux, Str_Concat (Query,QueryAux,
Sta_MAX_LENGTH_QUERY_ACCESS); Sta_MAX_BYTES_QUERY_ACCESS);
LengthQuery = strlen (Query); LengthQuery = strlen (Query);
NumUsr = 0; NumUsr = 0;
Ptr = Gbl.Usrs.Select.All; Ptr = Gbl.Usrs.Select.All;
@ -1294,19 +1295,19 @@ static void Sta_ShowHits (Sta_GlobalOrCourseAccesses_t GlobalOrCourse)
if (UsrDat.UsrCod > 0) if (UsrDat.UsrCod > 0)
{ {
LengthQuery = LengthQuery + 25 + 10 + 1; LengthQuery = LengthQuery + 25 + 10 + 1;
if (LengthQuery > Sta_MAX_LENGTH_QUERY_ACCESS - 128) if (LengthQuery > Sta_MAX_BYTES_QUERY_ACCESS - 128)
Lay_ShowErrorAndExit ("Query is too large."); Lay_ShowErrorAndExit ("Query is too large.");
sprintf (QueryAux, sprintf (QueryAux,
NumUsr ? " OR %s.UsrCod='%ld'" : NumUsr ? " OR %s.UsrCod='%ld'" :
" AND (%s.UsrCod='%ld'", " AND (%s.UsrCod='%ld'",
LogTable,UsrDat.UsrCod); LogTable,UsrDat.UsrCod);
Str_Concat (Query,QueryAux, Str_Concat (Query,QueryAux,
Sta_MAX_LENGTH_QUERY_ACCESS); Sta_MAX_BYTES_QUERY_ACCESS);
NumUsr++; NumUsr++;
} }
} }
Str_Concat (Query,")", Str_Concat (Query,")",
Sta_MAX_LENGTH_QUERY_ACCESS); Sta_MAX_BYTES_QUERY_ACCESS);
break; break;
} }
@ -1316,7 +1317,7 @@ static void Sta_ShowHits (Sta_GlobalOrCourseAccesses_t GlobalOrCourse)
sprintf (QueryAux," AND %s.ActCod='%ld'", sprintf (QueryAux," AND %s.ActCod='%ld'",
LogTable,Act_Actions[Gbl.Stat.NumAction].ActCod); LogTable,Act_Actions[Gbl.Stat.NumAction].ActCod);
Str_Concat (Query,QueryAux, Str_Concat (Query,QueryAux,
Sta_MAX_LENGTH_QUERY_ACCESS); Sta_MAX_BYTES_QUERY_ACCESS);
} }
/* End the query */ /* End the query */
@ -1324,85 +1325,85 @@ static void Sta_ShowHits (Sta_GlobalOrCourseAccesses_t GlobalOrCourse)
{ {
case Sta_CLICKS_CRS_DETAILED_LIST: case Sta_CLICKS_CRS_DETAILED_LIST:
Str_Concat (Query," ORDER BY F", Str_Concat (Query," ORDER BY F",
Sta_MAX_LENGTH_QUERY_ACCESS); Sta_MAX_BYTES_QUERY_ACCESS);
break; break;
case Sta_CLICKS_CRS_PER_USR: case Sta_CLICKS_CRS_PER_USR:
sprintf (QueryAux," GROUP BY %s.UsrCod ORDER BY Num DESC",LogTable); sprintf (QueryAux," GROUP BY %s.UsrCod ORDER BY Num DESC",LogTable);
Str_Concat (Query,QueryAux, Str_Concat (Query,QueryAux,
Sta_MAX_LENGTH_QUERY_ACCESS); Sta_MAX_BYTES_QUERY_ACCESS);
break; break;
case Sta_CLICKS_CRS_PER_DAYS: case Sta_CLICKS_CRS_PER_DAYS:
case Sta_CLICKS_GBL_PER_DAYS: case Sta_CLICKS_GBL_PER_DAYS:
Str_Concat (Query," GROUP BY Day DESC", Str_Concat (Query," GROUP BY Day DESC",
Sta_MAX_LENGTH_QUERY_ACCESS); Sta_MAX_BYTES_QUERY_ACCESS);
break; break;
case Sta_CLICKS_CRS_PER_DAYS_AND_HOUR: case Sta_CLICKS_CRS_PER_DAYS_AND_HOUR:
case Sta_CLICKS_GBL_PER_DAYS_AND_HOUR: case Sta_CLICKS_GBL_PER_DAYS_AND_HOUR:
Str_Concat (Query," GROUP BY Day DESC,Hour", Str_Concat (Query," GROUP BY Day DESC,Hour",
Sta_MAX_LENGTH_QUERY_ACCESS); Sta_MAX_BYTES_QUERY_ACCESS);
break; break;
case Sta_CLICKS_CRS_PER_WEEKS: case Sta_CLICKS_CRS_PER_WEEKS:
case Sta_CLICKS_GBL_PER_WEEKS: case Sta_CLICKS_GBL_PER_WEEKS:
Str_Concat (Query," GROUP BY Week DESC", Str_Concat (Query," GROUP BY Week DESC",
Sta_MAX_LENGTH_QUERY_ACCESS); Sta_MAX_BYTES_QUERY_ACCESS);
break; break;
case Sta_CLICKS_CRS_PER_MONTHS: case Sta_CLICKS_CRS_PER_MONTHS:
case Sta_CLICKS_GBL_PER_MONTHS: case Sta_CLICKS_GBL_PER_MONTHS:
Str_Concat (Query," GROUP BY Month DESC", Str_Concat (Query," GROUP BY Month DESC",
Sta_MAX_LENGTH_QUERY_ACCESS); Sta_MAX_BYTES_QUERY_ACCESS);
break; break;
case Sta_CLICKS_CRS_PER_HOUR: case Sta_CLICKS_CRS_PER_HOUR:
case Sta_CLICKS_GBL_PER_HOUR: case Sta_CLICKS_GBL_PER_HOUR:
Str_Concat (Query," GROUP BY Hour", Str_Concat (Query," GROUP BY Hour",
Sta_MAX_LENGTH_QUERY_ACCESS); Sta_MAX_BYTES_QUERY_ACCESS);
break; break;
case Sta_CLICKS_CRS_PER_MINUTE: case Sta_CLICKS_CRS_PER_MINUTE:
case Sta_CLICKS_GBL_PER_MINUTE: case Sta_CLICKS_GBL_PER_MINUTE:
Str_Concat (Query," GROUP BY Minute", Str_Concat (Query," GROUP BY Minute",
Sta_MAX_LENGTH_QUERY_ACCESS); Sta_MAX_BYTES_QUERY_ACCESS);
break; break;
case Sta_CLICKS_CRS_PER_ACTION: case Sta_CLICKS_CRS_PER_ACTION:
case Sta_CLICKS_GBL_PER_ACTION: case Sta_CLICKS_GBL_PER_ACTION:
sprintf (QueryAux," GROUP BY %s.ActCod ORDER BY Num DESC",LogTable); sprintf (QueryAux," GROUP BY %s.ActCod ORDER BY Num DESC",LogTable);
Str_Concat (Query,QueryAux, Str_Concat (Query,QueryAux,
Sta_MAX_LENGTH_QUERY_ACCESS); Sta_MAX_BYTES_QUERY_ACCESS);
break; break;
case Sta_CLICKS_GBL_PER_PLUGIN: case Sta_CLICKS_GBL_PER_PLUGIN:
Str_Concat (Query," GROUP BY log_ws.PlgCod ORDER BY Num DESC", Str_Concat (Query," GROUP BY log_ws.PlgCod ORDER BY Num DESC",
Sta_MAX_LENGTH_QUERY_ACCESS); Sta_MAX_BYTES_QUERY_ACCESS);
break; break;
case Sta_CLICKS_GBL_PER_WEB_SERVICE_FUNCTION: case Sta_CLICKS_GBL_PER_WEB_SERVICE_FUNCTION:
Str_Concat (Query," GROUP BY log_ws.FunCod ORDER BY Num DESC", Str_Concat (Query," GROUP BY log_ws.FunCod ORDER BY Num DESC",
Sta_MAX_LENGTH_QUERY_ACCESS); Sta_MAX_BYTES_QUERY_ACCESS);
break; break;
case Sta_CLICKS_GBL_PER_BANNER: case Sta_CLICKS_GBL_PER_BANNER:
Str_Concat (Query," GROUP BY log_banners.BanCod ORDER BY Num DESC", Str_Concat (Query," GROUP BY log_banners.BanCod ORDER BY Num DESC",
Sta_MAX_LENGTH_QUERY_ACCESS); Sta_MAX_BYTES_QUERY_ACCESS);
break; break;
case Sta_CLICKS_GBL_PER_COUNTRY: case Sta_CLICKS_GBL_PER_COUNTRY:
sprintf (QueryAux," GROUP BY %s.CtyCod ORDER BY Num DESC",LogTable); sprintf (QueryAux," GROUP BY %s.CtyCod ORDER BY Num DESC",LogTable);
Str_Concat (Query,QueryAux, Str_Concat (Query,QueryAux,
Sta_MAX_LENGTH_QUERY_ACCESS); Sta_MAX_BYTES_QUERY_ACCESS);
break; break;
case Sta_CLICKS_GBL_PER_INSTITUTION: case Sta_CLICKS_GBL_PER_INSTITUTION:
sprintf (QueryAux," GROUP BY %s.InsCod ORDER BY Num DESC",LogTable); sprintf (QueryAux," GROUP BY %s.InsCod ORDER BY Num DESC",LogTable);
Str_Concat (Query,QueryAux, Str_Concat (Query,QueryAux,
Sta_MAX_LENGTH_QUERY_ACCESS); Sta_MAX_BYTES_QUERY_ACCESS);
break; break;
case Sta_CLICKS_GBL_PER_CENTRE: case Sta_CLICKS_GBL_PER_CENTRE:
sprintf (QueryAux," GROUP BY %s.CtrCod ORDER BY Num DESC",LogTable); sprintf (QueryAux," GROUP BY %s.CtrCod ORDER BY Num DESC",LogTable);
Str_Concat (Query,QueryAux, Str_Concat (Query,QueryAux,
Sta_MAX_LENGTH_QUERY_ACCESS); Sta_MAX_BYTES_QUERY_ACCESS);
break; break;
case Sta_CLICKS_GBL_PER_DEGREE: case Sta_CLICKS_GBL_PER_DEGREE:
sprintf (QueryAux," GROUP BY %s.DegCod ORDER BY Num DESC",LogTable); sprintf (QueryAux," GROUP BY %s.DegCod ORDER BY Num DESC",LogTable);
Str_Concat (Query,QueryAux, Str_Concat (Query,QueryAux,
Sta_MAX_LENGTH_QUERY_ACCESS); Sta_MAX_BYTES_QUERY_ACCESS);
break; break;
case Sta_CLICKS_GBL_PER_COURSE: case Sta_CLICKS_GBL_PER_COURSE:
sprintf (QueryAux," GROUP BY %s.CrsCod ORDER BY Num DESC",LogTable); sprintf (QueryAux," GROUP BY %s.CrsCod ORDER BY Num DESC",LogTable);
Str_Concat (Query,QueryAux, Str_Concat (Query,QueryAux,
Sta_MAX_LENGTH_QUERY_ACCESS); Sta_MAX_BYTES_QUERY_ACCESS);
break; break;
} }
/***** Write query for debug *****/ /***** Write query for debug *****/

View File

@ -1012,7 +1012,7 @@ For example the string "Nueva++de+San+Ant%F3n"
"Nueva de San Antón" if ChangeTo == Str_TO_HTML "Nueva de San Antón" if ChangeTo == Str_TO_HTML
"Nueva de San Antón" if ChangeTo == Str_TO_TEXT "Nueva de San Antón" if ChangeTo == Str_TO_TEXT
*/ */
#define Str_MAX_LENGTH_SPECIAL_CHAR (256 - 1) #define Str_MAX_BYTES_SPECIAL_CHAR (256 - 1)
void Str_ChangeFormat (Str_ChangeFrom_t ChangeFrom,Str_ChangeTo_t ChangeTo, void Str_ChangeFormat (Str_ChangeFrom_t ChangeFrom,Str_ChangeTo_t ChangeTo,
char *Str,size_t MaxLengthStr,bool RemoveLeadingAndTrailingSpaces) char *Str,size_t MaxLengthStr,bool RemoveLeadingAndTrailingSpaces)
@ -1030,7 +1030,7 @@ void Str_ChangeFormat (Str_ChangeFrom_t ChangeFrom,Str_ChangeTo_t ChangeTo,
unsigned NumPrintableCharsFromReturn = 0; // To substitute tabs for spaces unsigned NumPrintableCharsFromReturn = 0; // To substitute tabs for spaces
bool IsSpecialChar = false; bool IsSpecialChar = false;
bool ThereIsSpaceChar = true; // Indicates if the character before was a space. Set to true to respect the initial spaces. bool ThereIsSpaceChar = true; // Indicates if the character before was a space. Set to true to respect the initial spaces.
char StrSpecialChar[Str_MAX_LENGTH_SPECIAL_CHAR + 1]; char StrSpecialChar[Str_MAX_BYTES_SPECIAL_CHAR + 1];
/* /*
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM) if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM)
@ -1163,12 +1163,12 @@ void Str_ChangeFormat (Str_ChangeFrom_t ChangeFrom,Str_ChangeTo_t ChangeTo,
Str_Concat (StrSpecialChar, Str_Concat (StrSpecialChar,
ThereIsSpaceChar ? "&nbsp;" : ThereIsSpaceChar ? "&nbsp;" :
" ", // The first space " ", // The first space
Str_MAX_LENGTH_SPECIAL_CHAR); Str_MAX_BYTES_SPECIAL_CHAR);
for (i = 1; for (i = 1;
i < NumSpacesTab; i < NumSpacesTab;
i++) // Rest of spaces, except the first i++) // Rest of spaces, except the first
Str_Concat (StrSpecialChar,"&nbsp;", // Add a space Str_Concat (StrSpecialChar,"&nbsp;", // Add a space
Str_MAX_LENGTH_SPECIAL_CHAR); Str_MAX_BYTES_SPECIAL_CHAR);
NumPrintableCharsFromReturn += NumSpacesTab; NumPrintableCharsFromReturn += NumSpacesTab;
} }
else else
@ -1181,7 +1181,7 @@ void Str_ChangeFormat (Str_ChangeFrom_t ChangeFrom,Str_ChangeTo_t ChangeTo,
case 0x0A: /* \n */ case 0x0A: /* \n */
if (ChangeTo == Str_TO_RIGOROUS_HTML) if (ChangeTo == Str_TO_RIGOROUS_HTML)
Str_Copy (StrSpecialChar,"<br />", Str_Copy (StrSpecialChar,"<br />",
Str_MAX_LENGTH_SPECIAL_CHAR); Str_MAX_BYTES_SPECIAL_CHAR);
else else
{ {
StrSpecialChar[0] = Str_LF[0]; StrSpecialChar[0] = Str_LF[0];
@ -1204,7 +1204,7 @@ void Str_ChangeFormat (Str_ChangeFrom_t ChangeFrom,Str_ChangeTo_t ChangeTo,
case 0x20: /* Space */ case 0x20: /* Space */
if (ChangeTo == Str_TO_RIGOROUS_HTML && ThereIsSpaceChar) if (ChangeTo == Str_TO_RIGOROUS_HTML && ThereIsSpaceChar)
Str_Copy (StrSpecialChar,"&nbsp;", Str_Copy (StrSpecialChar,"&nbsp;",
Str_MAX_LENGTH_SPECIAL_CHAR); Str_MAX_BYTES_SPECIAL_CHAR);
else else
{ {
StrSpecialChar[0] = ' '; StrSpecialChar[0] = ' ';
@ -1281,7 +1281,7 @@ void Str_ChangeFormat (Str_ChangeFrom_t ChangeFrom,Str_ChangeTo_t ChangeTo,
} }
else else
Str_Copy (StrSpecialChar,"&#60;", // "<" is stored as HTML code to avoid problems when displaying it Str_Copy (StrSpecialChar,"&#60;", // "<" is stored as HTML code to avoid problems when displaying it
Str_MAX_LENGTH_SPECIAL_CHAR); Str_MAX_BYTES_SPECIAL_CHAR);
NumPrintableCharsFromReturn++; NumPrintableCharsFromReturn++;
ThereIsSpaceChar = false; ThereIsSpaceChar = false;
break; break;
@ -1293,7 +1293,7 @@ void Str_ChangeFormat (Str_ChangeFrom_t ChangeFrom,Str_ChangeTo_t ChangeTo,
} }
else else
Str_Copy (StrSpecialChar,"&#62;", // ">" is stored as HTML code to avoid problems when displaying it Str_Copy (StrSpecialChar,"&#62;", // ">" is stored as HTML code to avoid problems when displaying it
Str_MAX_LENGTH_SPECIAL_CHAR); Str_MAX_BYTES_SPECIAL_CHAR);
NumPrintableCharsFromReturn++; NumPrintableCharsFromReturn++;
ThereIsSpaceChar = false; ThereIsSpaceChar = false;
break; break;
@ -1318,7 +1318,7 @@ void Str_ChangeFormat (Str_ChangeFrom_t ChangeFrom,Str_ChangeTo_t ChangeTo,
} }
else else
Str_Copy (StrSpecialChar,"&#92;", // "\" is stored as HTML code to avoid problems when displaying it Str_Copy (StrSpecialChar,"&#92;", // "\" is stored as HTML code to avoid problems when displaying it
Str_MAX_LENGTH_SPECIAL_CHAR); Str_MAX_BYTES_SPECIAL_CHAR);
NumPrintableCharsFromReturn++; NumPrintableCharsFromReturn++;
ThereIsSpaceChar = false; ThereIsSpaceChar = false;
break; break;
@ -2588,7 +2588,7 @@ If what is read exceed MaxLength, abort and return 0.
If StrDelimit is not found, return -1. If StrDelimit is not found, return -1.
*/ */
#define Str_MAX_LENGTH_BOUNDARY_STR 100 #define Str_MAX_BYTES_BOUNDARY_STR 100
int Str_ReadFileUntilBoundaryStr (FILE *FileSrc,char *StrDst, int Str_ReadFileUntilBoundaryStr (FILE *FileSrc,char *StrDst,
const char *BoundaryStr, const char *BoundaryStr,
@ -2598,7 +2598,7 @@ int Str_ReadFileUntilBoundaryStr (FILE *FileSrc,char *StrDst,
unsigned NumBytesIdentical; // Number of characters identical in each iteration of the loop unsigned NumBytesIdentical; // Number of characters identical in each iteration of the loop
unsigned NumBytesReadButNotDiscarded; // Number of characters read from the source file... unsigned NumBytesReadButNotDiscarded; // Number of characters read from the source file...
// ...and not fully discarded in search // ...and not fully discarded in search
int Buffer[Str_MAX_LENGTH_BOUNDARY_STR + 1]; int Buffer[Str_MAX_BYTES_BOUNDARY_STR + 1];
unsigned StartIndex; unsigned StartIndex;
unsigned i; unsigned i;
char *Ptr; // Pointer used to go through StrDst writing characters char *Ptr; // Pointer used to go through StrDst writing characters
@ -2611,7 +2611,7 @@ int Str_ReadFileUntilBoundaryStr (FILE *FileSrc,char *StrDst,
*StrDst = '\0'; *StrDst = '\0';
return 1; return 1;
} }
if (LengthBoundaryStr > Str_MAX_LENGTH_BOUNDARY_STR) if (LengthBoundaryStr > Str_MAX_BYTES_BOUNDARY_STR)
Lay_ShowErrorAndExit ("Delimiter string too large."); Lay_ShowErrorAndExit ("Delimiter string too large.");
Ptr = StrDst; Ptr = StrDst;

View File

@ -35,10 +35,10 @@
/***************************** Public constants *****************************/ /***************************** Public constants *****************************/
/*****************************************************************************/ /*****************************************************************************/
#define Str_LENGTH_STR_HEX 3 // Length of the string #XX #define Str_BYTES_STR_HEX 3 // Number of bytes of the string %XX
#define Str_MAX_LENGTH_SPEC_CHAR_HTML 8 // Length of the string &#ddddd; #define Str_MAX_BYTES_SPEC_CHAR_HTML 10 // Number of bytes of the string from &#0; to max UTF8 &#1114111; (= &#x10FFFF;)
#define Str_MAX_BYTES_PER_CHAR 8 // max (Str_LENGTH_STR_HEX,Str_MAX_LENGTH_SPEC_CHAR_HTML) #define Str_MAX_BYTES_PER_CHAR 10 // max (Str_BYTES_STR_HEX,Str_MAX_BYTES_SPEC_CHAR_HTML)
/*****************************************************************************/ /*****************************************************************************/
/******************************* Public types *******************************/ /******************************* Public types *******************************/

View File

@ -3319,7 +3319,7 @@ static void Svy_WriteQstStem (const char *Stem)
size_t Length; size_t Length;
/* Convert the stem, that is in HTML, to rigorous HTML */ /* Convert the stem, that is in HTML, to rigorous HTML */
Length = strlen (Stem) * Str_MAX_LENGTH_SPEC_CHAR_HTML; Length = strlen (Stem) * Str_MAX_BYTES_SPEC_CHAR_HTML;
if ((HeadingRigorousHTML = malloc (Length + 1)) == NULL) if ((HeadingRigorousHTML = malloc (Length + 1)) == NULL)
Lay_ShowErrorAndExit ("Not enough memory to store stem of question."); Lay_ShowErrorAndExit ("Not enough memory to store stem of question.");
Str_Copy (HeadingRigorousHTML,Stem, Str_Copy (HeadingRigorousHTML,Stem,

View File

@ -1020,7 +1020,7 @@ void Tst_WriteQstStem (const char *Stem,const char *ClassStem)
char *StemRigorousHTML; char *StemRigorousHTML;
/***** Convert the stem, that is in HTML, to rigorous HTML *****/ /***** Convert the stem, that is in HTML, to rigorous HTML *****/
StemLength = strlen (Stem) * Str_MAX_LENGTH_SPEC_CHAR_HTML; StemLength = strlen (Stem) * Str_MAX_BYTES_SPEC_CHAR_HTML;
if ((StemRigorousHTML = malloc (StemLength + 1)) == NULL) if ((StemRigorousHTML = malloc (StemLength + 1)) == NULL)
Lay_ShowErrorAndExit ("Not enough memory to store stem of question."); Lay_ShowErrorAndExit ("Not enough memory to store stem of question.");
Str_Copy (StemRigorousHTML,Stem, Str_Copy (StemRigorousHTML,Stem,
@ -1150,7 +1150,7 @@ void Tst_WriteQstFeedback (const char *Feedback,const char *ClassFeedback)
if (Feedback[0]) if (Feedback[0])
{ {
/***** Convert the feedback, that is in HTML, to rigorous HTML *****/ /***** Convert the feedback, that is in HTML, to rigorous HTML *****/
FeedbackLength = strlen (Feedback) * Str_MAX_LENGTH_SPEC_CHAR_HTML; FeedbackLength = strlen (Feedback) * Str_MAX_BYTES_SPEC_CHAR_HTML;
if ((FeedbackRigorousHTML = malloc (FeedbackLength + 1)) == NULL) if ((FeedbackRigorousHTML = malloc (FeedbackLength + 1)) == NULL)
Lay_ShowErrorAndExit ("Not enough memory to store stem of question."); Lay_ShowErrorAndExit ("Not enough memory to store stem of question.");
Str_Copy (FeedbackRigorousHTML,Feedback, Str_Copy (FeedbackRigorousHTML,Feedback,
@ -3062,7 +3062,7 @@ static void Tst_WriteAnswersOfAQstEdit (long QstCod)
row = mysql_fetch_row (mysql_res); row = mysql_fetch_row (mysql_res);
/* Convert the answer (row[1]), that is in HTML, to rigorous HTML */ /* Convert the answer (row[1]), that is in HTML, to rigorous HTML */
LengthAnswer = strlen (row[1]) * Str_MAX_LENGTH_SPEC_CHAR_HTML; LengthAnswer = strlen (row[1]) * Str_MAX_BYTES_SPEC_CHAR_HTML;
if ((Answer = malloc (LengthAnswer + 1)) == NULL) if ((Answer = malloc (LengthAnswer + 1)) == NULL)
Lay_ShowErrorAndExit ("Not enough memory to store answer."); Lay_ShowErrorAndExit ("Not enough memory to store answer.");
Str_Copy (Answer,row[1], Str_Copy (Answer,row[1],
@ -3076,7 +3076,7 @@ static void Tst_WriteAnswersOfAQstEdit (long QstCod)
if (row[2]) if (row[2])
if (row[2][0]) if (row[2][0])
{ {
LengthFeedback = strlen (row[2]) * Str_MAX_LENGTH_SPEC_CHAR_HTML; LengthFeedback = strlen (row[2]) * Str_MAX_BYTES_SPEC_CHAR_HTML;
if ((Feedback = malloc (LengthFeedback + 1)) == NULL) if ((Feedback = malloc (LengthFeedback + 1)) == NULL)
Lay_ShowErrorAndExit ("Not enough memory to store feedback."); Lay_ShowErrorAndExit ("Not enough memory to store feedback.");
Str_Copy (Feedback,row[2], Str_Copy (Feedback,row[2],

View File

@ -1123,7 +1123,7 @@ static void TsI_WriteRowImportedQst (struct XMLElement *StemElem,
{ {
/* Convert the answer, that is in HTML, to rigorous HTML */ /* Convert the answer, that is in HTML, to rigorous HTML */
AnswerTextLength = strlen (Gbl.Test.Answer.Options[NumOpt].Text) * AnswerTextLength = strlen (Gbl.Test.Answer.Options[NumOpt].Text) *
Str_MAX_LENGTH_SPEC_CHAR_HTML; Str_MAX_BYTES_SPEC_CHAR_HTML;
if ((AnswerText = malloc (AnswerTextLength + 1)) == NULL) if ((AnswerText = malloc (AnswerTextLength + 1)) == NULL)
Lay_ShowErrorAndExit ("Not enough memory to store answer."); Lay_ShowErrorAndExit ("Not enough memory to store answer.");
Str_Copy (AnswerText,Gbl.Test.Answer.Options[NumOpt].Text, Str_Copy (AnswerText,Gbl.Test.Answer.Options[NumOpt].Text,
@ -1138,7 +1138,7 @@ static void TsI_WriteRowImportedQst (struct XMLElement *StemElem,
if (Gbl.Test.Answer.Options[NumOpt].Feedback[0]) if (Gbl.Test.Answer.Options[NumOpt].Feedback[0])
{ {
AnswerFeedbackLength = strlen (Gbl.Test.Answer.Options[NumOpt].Feedback) * AnswerFeedbackLength = strlen (Gbl.Test.Answer.Options[NumOpt].Feedback) *
Str_MAX_LENGTH_SPEC_CHAR_HTML; Str_MAX_BYTES_SPEC_CHAR_HTML;
if ((AnswerFeedback = malloc (AnswerFeedbackLength + 1)) == NULL) if ((AnswerFeedback = malloc (AnswerFeedbackLength + 1)) == NULL)
Lay_ShowErrorAndExit ("Not enough memory to store feedback."); Lay_ShowErrorAndExit ("Not enough memory to store feedback.");
Str_Copy (AnswerFeedback, Str_Copy (AnswerFeedback,

View File

@ -70,8 +70,8 @@
#define Usr_BIRTHDAY_STR_DB_LENGTH (4 + 1 + 2 + 1 + 2) // "'%04u-%02u-%02u'" #define Usr_BIRTHDAY_STR_DB_LENGTH (4 + 1 + 2 + 1 + 2) // "'%04u-%02u-%02u'"
#define Usr_MAX_LENGTH_PHONE 16 #define Usr_MAX_CHARS_PHONE 16
#define Usr_MAX_BYTES_PHONE 16 #define Usr_MAX_BYTES_PHONE Usr_MAX_CHARS_PHONE
#define Usr_CLASS_PHOTO_COLS_DEF 10 // Default number of columns in a class photo #define Usr_CLASS_PHOTO_COLS_DEF 10 // Default number of columns in a class photo
#define Usr_CLASS_PHOTO_COLS_MAX 50 // Maximum number of columns in a class photo #define Usr_CLASS_PHOTO_COLS_MAX 50 // Maximum number of columns in a class photo

View File

@ -281,7 +281,7 @@ void Svc_Exit (const char *DetailErrorMessage)
static int Svc_GetPlgCodFromAppKey (const char *appKey) static int Svc_GetPlgCodFromAppKey (const char *appKey)
{ {
char Query[256 + Plg_MAX_LENGTH_PLUGIN_APP_KEY]; char Query[256 + Plg_MAX_BYTES_PLUGIN_APP_KEY];
MYSQL_RES *mysql_res; MYSQL_RES *mysql_res;
MYSQL_ROW row; MYSQL_ROW row;