Commit 255f5c32 authored by Ian Munsie's avatar Ian Munsie Committed by David S. Miller

i4l: change magic numbers in Eicon DIVA ISDN driver to symbolic names

Replace references to the '20' magic number found throughout the Eicon
ISDN driver for the length of the station_id field in the T30_INFO struct
with the T30_MAX_STATION_ID_LENGTH symbolic constant.
Signed-off-by: default avatarIan Munsie <imunsie@au.ibm.com>
Cc: Armin Schindler <mac@melware.de>
Cc: Karsten Keil <isdn@linux-pingi.de>
Cc: Stoyan Gaydarov <sgayda2@uiuc.edu>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 8b4017d8
...@@ -2754,7 +2754,7 @@ static byte connect_b3_req(dword Id, word Number, DIVA_CAPI_ADAPTER *a, ...@@ -2754,7 +2754,7 @@ static byte connect_b3_req(dword Id, word Number, DIVA_CAPI_ADAPTER *a,
for (i = 0; i < w; i++) for (i = 0; i < w; i++)
((T30_INFO *)(plci->fax_connect_info_buffer))->station_id[i] = fax_parms[4].info[1+i]; ((T30_INFO *)(plci->fax_connect_info_buffer))->station_id[i] = fax_parms[4].info[1+i];
((T30_INFO *)(plci->fax_connect_info_buffer))->head_line_len = 0; ((T30_INFO *)(plci->fax_connect_info_buffer))->head_line_len = 0;
len = offsetof(T30_INFO, station_id) + 20; len = offsetof(T30_INFO, station_id) + T30_MAX_STATION_ID_LENGTH;
w = fax_parms[5].length; w = fax_parms[5].length;
if (w > 20) if (w > 20)
w = 20; w = 20;
...@@ -2892,7 +2892,7 @@ static byte connect_b3_res(dword Id, word Number, DIVA_CAPI_ADAPTER *a, ...@@ -2892,7 +2892,7 @@ static byte connect_b3_res(dword Id, word Number, DIVA_CAPI_ADAPTER *a,
&& (plci->nsf_control_bits & T30_NSF_CONTROL_BIT_ENABLE_NSF) && (plci->nsf_control_bits & T30_NSF_CONTROL_BIT_ENABLE_NSF)
&& (plci->nsf_control_bits & T30_NSF_CONTROL_BIT_NEGOTIATE_RESP)) && (plci->nsf_control_bits & T30_NSF_CONTROL_BIT_NEGOTIATE_RESP))
{ {
len = offsetof(T30_INFO, station_id) + 20; len = offsetof(T30_INFO, station_id) + T30_MAX_STATION_ID_LENGTH;
if (plci->fax_connect_info_length < len) if (plci->fax_connect_info_length < len)
{ {
((T30_INFO *)(plci->fax_connect_info_buffer))->station_id_len = 0; ((T30_INFO *)(plci->fax_connect_info_buffer))->station_id_len = 0;
...@@ -3802,7 +3802,7 @@ static byte manufacturer_res(dword Id, word Number, DIVA_CAPI_ADAPTER *a, ...@@ -3802,7 +3802,7 @@ static byte manufacturer_res(dword Id, word Number, DIVA_CAPI_ADAPTER *a,
break; break;
} }
ncpi = &m_parms[1]; ncpi = &m_parms[1];
len = offsetof(T30_INFO, station_id) + 20; len = offsetof(T30_INFO, station_id) + T30_MAX_STATION_ID_LENGTH;
if (plci->fax_connect_info_length < len) if (plci->fax_connect_info_length < len)
{ {
((T30_INFO *)(plci->fax_connect_info_buffer))->station_id_len = 0; ((T30_INFO *)(plci->fax_connect_info_buffer))->station_id_len = 0;
...@@ -6830,7 +6830,7 @@ static void nl_ind(PLCI *plci) ...@@ -6830,7 +6830,7 @@ static void nl_ind(PLCI *plci)
if(((T30_INFO *)plci->NL.RBuffer->P)->station_id_len) if(((T30_INFO *)plci->NL.RBuffer->P)->station_id_len)
{ {
plci->ncpi_buffer[len] = 20; plci->ncpi_buffer[len] = 20;
for (i = 0; i < 20; i++) for (i = 0; i < T30_MAX_STATION_ID_LENGTH; i++)
plci->ncpi_buffer[++len] = ((T30_INFO *)plci->NL.RBuffer->P)->station_id[i]; plci->ncpi_buffer[++len] = ((T30_INFO *)plci->NL.RBuffer->P)->station_id[i];
} }
if (((plci->NL.Ind & 0x0f) == N_DISC) || ((plci->NL.Ind & 0x0f) == N_DISC_ACK)) if (((plci->NL.Ind & 0x0f) == N_DISC) || ((plci->NL.Ind & 0x0f) == N_DISC_ACK))
...@@ -6844,7 +6844,7 @@ static void nl_ind(PLCI *plci) ...@@ -6844,7 +6844,7 @@ static void nl_ind(PLCI *plci)
if ((plci->requested_options_conn | plci->requested_options | a->requested_options_table[plci->appl->Id-1]) if ((plci->requested_options_conn | plci->requested_options | a->requested_options_table[plci->appl->Id-1])
& ((1L << PRIVATE_FAX_SUB_SEP_PWD) | (1L << PRIVATE_FAX_NONSTANDARD))) & ((1L << PRIVATE_FAX_SUB_SEP_PWD) | (1L << PRIVATE_FAX_NONSTANDARD)))
{ {
i = offsetof(T30_INFO, station_id) + 20 + ((T30_INFO *)plci->NL.RBuffer->P)->head_line_len; i = offsetof(T30_INFO, station_id) + T30_MAX_STATION_ID_LENGTH + ((T30_INFO *)plci->NL.RBuffer->P)->head_line_len;
while (i < plci->NL.RBuffer->length) while (i < plci->NL.RBuffer->length)
plci->ncpi_buffer[++len] = plci->NL.RBuffer->P[i++]; plci->ncpi_buffer[++len] = plci->NL.RBuffer->P[i++];
} }
...@@ -8400,7 +8400,7 @@ static word add_b23(PLCI *plci, API_PARSE *bp) ...@@ -8400,7 +8400,7 @@ static word add_b23(PLCI *plci, API_PARSE *bp)
} }
} }
/* copy station id to NLC */ /* copy station id to NLC */
for(i=0; i<20; i++) for(i=0; i < T30_MAX_STATION_ID_LENGTH; i++)
{ {
if(i<b3_config_parms[2].length) if(i<b3_config_parms[2].length)
{ {
...@@ -8411,29 +8411,29 @@ static word add_b23(PLCI *plci, API_PARSE *bp) ...@@ -8411,29 +8411,29 @@ static word add_b23(PLCI *plci, API_PARSE *bp)
((T30_INFO *)&nlc[1])->station_id[i] = ' '; ((T30_INFO *)&nlc[1])->station_id[i] = ' ';
} }
} }
((T30_INFO *)&nlc[1])->station_id_len = 20; ((T30_INFO *)&nlc[1])->station_id_len = T30_MAX_STATION_ID_LENGTH;
/* copy head line to NLC */ /* copy head line to NLC */
if(b3_config_parms[3].length) if(b3_config_parms[3].length)
{ {
pos = (byte)(fax_head_line_time (&(((T30_INFO *)&nlc[1])->station_id[20]))); pos = (byte)(fax_head_line_time (&(((T30_INFO *)&nlc[1])->station_id[T30_MAX_STATION_ID_LENGTH])));
if (pos != 0) if (pos != 0)
{ {
if (CAPI_MAX_DATE_TIME_LENGTH + 2 + b3_config_parms[3].length > CAPI_MAX_HEAD_LINE_SPACE) if (CAPI_MAX_DATE_TIME_LENGTH + 2 + b3_config_parms[3].length > CAPI_MAX_HEAD_LINE_SPACE)
pos = 0; pos = 0;
else else
{ {
nlc[1 + offsetof(T30_INFO, station_id) + 20 + pos++] = ' '; nlc[1 + offsetof(T30_INFO, station_id) + T30_MAX_STATION_ID_LENGTH + pos++] = ' ';
nlc[1 + offsetof(T30_INFO, station_id) + 20 + pos++] = ' '; nlc[1 + offsetof(T30_INFO, station_id) + T30_MAX_STATION_ID_LENGTH + pos++] = ' ';
len = (byte)b3_config_parms[2].length; len = (byte)b3_config_parms[2].length;
if (len > 20) if (len > 20)
len = 20; len = 20;
if (CAPI_MAX_DATE_TIME_LENGTH + 2 + len + 2 + b3_config_parms[3].length <= CAPI_MAX_HEAD_LINE_SPACE) if (CAPI_MAX_DATE_TIME_LENGTH + 2 + len + 2 + b3_config_parms[3].length <= CAPI_MAX_HEAD_LINE_SPACE)
{ {
for (i = 0; i < len; i++) for (i = 0; i < len; i++)
nlc[1 + offsetof(T30_INFO, station_id) + 20 + pos++] = ((byte *)b3_config_parms[2].info)[1+i]; nlc[1 + offsetof(T30_INFO, station_id) + T30_MAX_STATION_ID_LENGTH + pos++] = ((byte *)b3_config_parms[2].info)[1+i];
nlc[1 + offsetof(T30_INFO, station_id) + 20 + pos++] = ' '; nlc[1 + offsetof(T30_INFO, station_id) + T30_MAX_STATION_ID_LENGTH + pos++] = ' ';
nlc[1 + offsetof(T30_INFO, station_id) + 20 + pos++] = ' '; nlc[1 + offsetof(T30_INFO, station_id) + T30_MAX_STATION_ID_LENGTH + pos++] = ' ';
} }
} }
} }
...@@ -8444,7 +8444,7 @@ static word add_b23(PLCI *plci, API_PARSE *bp) ...@@ -8444,7 +8444,7 @@ static word add_b23(PLCI *plci, API_PARSE *bp)
((T30_INFO *)&nlc[1])->head_line_len = (byte)(pos + len); ((T30_INFO *)&nlc[1])->head_line_len = (byte)(pos + len);
nlc[0] += (byte)(pos + len); nlc[0] += (byte)(pos + len);
for (i = 0; i < len; i++) for (i = 0; i < len; i++)
nlc[1 + offsetof(T30_INFO, station_id) + 20 + pos++] = ((byte *)b3_config_parms[3].info)[1+i]; nlc[1 + offsetof(T30_INFO, station_id) + T30_MAX_STATION_ID_LENGTH + pos++] = ((byte *)b3_config_parms[3].info)[1+i];
} else } else
((T30_INFO *)&nlc[1])->head_line_len = 0; ((T30_INFO *)&nlc[1])->head_line_len = 0;
...@@ -8472,7 +8472,7 @@ static word add_b23(PLCI *plci, API_PARSE *bp) ...@@ -8472,7 +8472,7 @@ static word add_b23(PLCI *plci, API_PARSE *bp)
fax_control_bits |= T30_CONTROL_BIT_ACCEPT_SEL_POLLING; fax_control_bits |= T30_CONTROL_BIT_ACCEPT_SEL_POLLING;
} }
len = nlc[0]; len = nlc[0];
pos = offsetof(T30_INFO, station_id) + 20; pos = offsetof(T30_INFO, station_id) + T30_MAX_STATION_ID_LENGTH;
if (pos < plci->fax_connect_info_length) if (pos < plci->fax_connect_info_length)
{ {
for (i = 1 + plci->fax_connect_info_buffer[pos]; i != 0; i--) for (i = 1 + plci->fax_connect_info_buffer[pos]; i != 0; i--)
...@@ -8524,7 +8524,7 @@ static word add_b23(PLCI *plci, API_PARSE *bp) ...@@ -8524,7 +8524,7 @@ static word add_b23(PLCI *plci, API_PARSE *bp)
} }
PUT_WORD(&(((T30_INFO *)&nlc[1])->control_bits_low), fax_control_bits); PUT_WORD(&(((T30_INFO *)&nlc[1])->control_bits_low), fax_control_bits);
len = offsetof(T30_INFO, station_id) + 20; len = offsetof(T30_INFO, station_id) + T30_MAX_STATION_ID_LENGTH;
for (i = 0; i < len; i++) for (i = 0; i < len; i++)
plci->fax_connect_info_buffer[i] = nlc[1+i]; plci->fax_connect_info_buffer[i] = nlc[1+i];
((T30_INFO *) plci->fax_connect_info_buffer)->head_line_len = 0; ((T30_INFO *) plci->fax_connect_info_buffer)->head_line_len = 0;
......
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