mirror of
https://github.com/MidnightCommander/mc
synced 2025-01-03 10:04:32 +03:00
(tar_from_header): ckd_mul() and ckd_add() rather than doing it by hand.
(LG_64): Remove; no longer used. Sync with GNU tar 414f635d8bba4c8894855040b1e6b77b07dc07bd. Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
parent
b9e7ab2f08
commit
79b10fc8a7
@ -46,7 +46,6 @@
|
|||||||
|
|
||||||
/* Log base 2 of common values. */
|
/* Log base 2 of common values. */
|
||||||
#define LG_8 3
|
#define LG_8 3
|
||||||
#define LG_64 6
|
|
||||||
#define LG_256 8
|
#define LG_256 8
|
||||||
|
|
||||||
/*** file scope type declarations ****************************************************************/
|
/*** file scope type declarations ****************************************************************/
|
||||||
@ -313,12 +312,10 @@ tar_from_header (const char *where0, size_t digs, char const *type, intmax_t min
|
|||||||
if (where == lim || !is_octal_digit (*where))
|
if (where == lim || !is_octal_digit (*where))
|
||||||
break;
|
break;
|
||||||
digit = *where - '0';
|
digit = *where - '0';
|
||||||
overflow |= value != (value << LG_8 >> LG_8);
|
overflow |= ckd_mul (&value, value, 8);
|
||||||
value <<= LG_8;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
value++;
|
overflow |= ckd_add (&value, value, 1);
|
||||||
overflow |= value == 0;
|
|
||||||
|
|
||||||
if (!overflow && value <= minus_minval)
|
if (!overflow && value <= minus_minval)
|
||||||
negative = TRUE;
|
negative = TRUE;
|
||||||
@ -342,9 +339,9 @@ tar_from_header (const char *where0, size_t digs, char const *type, intmax_t min
|
|||||||
|
|
||||||
while (where != lim && (dig = base64_map[(unsigned char) *where]) < 64)
|
while (where != lim && (dig = base64_map[(unsigned char) *where]) < 64)
|
||||||
{
|
{
|
||||||
if (value << LG_64 >> LG_64 != value)
|
if (ckd_mul (&value, value, 64))
|
||||||
return (-1);
|
return (-1);
|
||||||
value = (value << LG_64) | dig;
|
value |= dig;
|
||||||
where++;
|
where++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user