mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-04-27 00:31:06 +08:00
gcov.c (md5sum_to_hex): Fix output of MD5 hex bytes.
2017-03-31 Bernd Edlinger <bernd.edlinger@hotmail.de> * gcov.c (md5sum_to_hex): Fix output of MD5 hex bytes. (make_gcov_file_name): Use the canonical path name for generating the MD5 value. (read_line): Fix handling of files with ascii null bytes. From-SVN: r246605
This commit is contained in:
parent
0a55fbc0e5
commit
62a767024c
@ -1,3 +1,10 @@
|
|||||||
|
2017-03-31 Bernd Edlinger <bernd.edlinger@hotmail.de>
|
||||||
|
|
||||||
|
* gcov.c (md5sum_to_hex): Fix output of MD5 hex bytes.
|
||||||
|
(make_gcov_file_name): Use the canonical path name for generating
|
||||||
|
the MD5 value.
|
||||||
|
(read_line): Fix handling of files with ascii null bytes.
|
||||||
|
|
||||||
2017-03-30 Matthew Fortune <matthew.fortune@imgtec.com>
|
2017-03-30 Matthew Fortune <matthew.fortune@imgtec.com>
|
||||||
|
|
||||||
* config/mips/mips.c (mips_expand_vector_init): Create a const_vector
|
* config/mips/mips.c (mips_expand_vector_init): Create a const_vector
|
||||||
|
16
gcc/gcov.c
16
gcc/gcov.c
@ -2167,7 +2167,7 @@ static void
|
|||||||
md5sum_to_hex (const char *sum, char *buffer)
|
md5sum_to_hex (const char *sum, char *buffer)
|
||||||
{
|
{
|
||||||
for (unsigned i = 0; i < 16; i++)
|
for (unsigned i = 0; i < 16; i++)
|
||||||
sprintf (buffer + (2 * i), "%02x", sum[i]);
|
sprintf (buffer + (2 * i), "%02x", (unsigned char)sum[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Generate an output file name. INPUT_NAME is the canonicalized main
|
/* Generate an output file name. INPUT_NAME is the canonicalized main
|
||||||
@ -2216,7 +2216,7 @@ make_gcov_file_name (const char *input_name, const char *src_name)
|
|||||||
char md5sum_hex[33];
|
char md5sum_hex[33];
|
||||||
|
|
||||||
md5_init_ctx (&ctx);
|
md5_init_ctx (&ctx);
|
||||||
md5_process_bytes (result, strlen (result), &ctx);
|
md5_process_bytes (src_name, strlen (src_name), &ctx);
|
||||||
md5_finish_ctx (&ctx, md5sum);
|
md5_finish_ctx (&ctx, md5sum);
|
||||||
md5sum_to_hex (md5sum, md5sum_hex);
|
md5sum_to_hex (md5sum, md5sum_hex);
|
||||||
free (result);
|
free (result);
|
||||||
@ -2512,14 +2512,20 @@ read_line (FILE *file)
|
|||||||
{
|
{
|
||||||
size_t len = strlen (string + pos);
|
size_t len = strlen (string + pos);
|
||||||
|
|
||||||
if (string[pos + len - 1] == '\n')
|
if (len && string[pos + len - 1] == '\n')
|
||||||
{
|
{
|
||||||
string[pos + len - 1] = 0;
|
string[pos + len - 1] = 0;
|
||||||
return string;
|
return string;
|
||||||
}
|
}
|
||||||
pos += len;
|
pos += len;
|
||||||
string = XRESIZEVEC (char, string, string_len * 2);
|
/* If the file contains NUL characters or an incomplete
|
||||||
string_len *= 2;
|
last line, which can happen more than once in one run,
|
||||||
|
we have to avoid doubling the STRING_LEN unnecessarily. */
|
||||||
|
if (pos > string_len / 2)
|
||||||
|
{
|
||||||
|
string_len *= 2;
|
||||||
|
string = XRESIZEVEC (char, string, string_len);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return pos ? string : NULL;
|
return pos ? string : NULL;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user