Internals: Add more const. No functional change.

This commit is contained in:
Wilson Snyder
2021-06-18 22:24:08 -04:00
parent 6c9c16c31d
commit 52cde49a6f
17 changed files with 532 additions and 510 deletions
+4 -4
View File
@@ -129,7 +129,7 @@ void VerilatedVcd::openNextImp(bool incFilename) {
if (incFilename) {
// Find _0000.{ext} in filename
std::string name = m_filename;
size_t pos = name.rfind('.');
const size_t pos = name.rfind('.');
if (pos > 8 && 0 == std::strncmp("_cat", name.c_str() + pos - 8, 4)
&& std::isdigit(name.c_str()[pos - 4]) && std::isdigit(name.c_str()[pos - 3])
&& std::isdigit(name.c_str()[pos - 2]) && std::isdigit(name.c_str()[pos - 1])) {
@@ -299,10 +299,10 @@ void VerilatedVcd::bufferFlush() VL_MT_UNSAFE_ONE {
if (VL_UNLIKELY(!isOpen())) return;
char* wp = m_wrBufp;
while (true) {
ssize_t remaining = (m_writep - wp);
const ssize_t remaining = (m_writep - wp);
if (remaining == 0) break;
errno = 0;
ssize_t got = m_filep->write(wp, remaining);
const ssize_t got = m_filep->write(wp, remaining);
if (got > 0) {
wp += got;
m_wroteBytes += got;
@@ -352,7 +352,7 @@ void VerilatedVcd::dumpHeader() {
printStr("$version Generated by VerilatedVcd $end\n");
printStr("$date ");
{
time_t tick = time(nullptr);
const time_t tick = time(nullptr);
tm ticktm;
VL_LOCALTIME_R(&tick, &ticktm);
constexpr int bufsize = 50;