Skip to content

Commit 0292567

Browse files
committed
Updates requsted in the PR: mostly rename 'size -> length'.
1 parent d3de067 commit 0292567

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

cbmc/src/util/file_util.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -161,11 +161,11 @@ std::string concat_dir_file(
161161
/// This is not designed to operate on path names and will replace folder
162162
/// seperator characters.
163163
/// \param file_name: The file name to sanitize.
164-
/// \param max_size: The maximum size for the file name. If the name is longer,
165-
/// then its size will be cut to the max_size.
164+
/// \param max_length: The maximum length for the file name. If the name is
165+
/// longer, then its length will be cut to the max_length.
166166
std::string make_valid_filename(
167167
std::string file_name,
168-
const std::size_t max_size)
168+
const std::size_t max_length)
169169
{
170170
std::replace(file_name.begin(), file_name.end(), '#', '_');
171171
std::replace(file_name.begin(), file_name.end(), '$', '_');
@@ -174,7 +174,7 @@ std::string make_valid_filename(
174174
std::replace(file_name.begin(), file_name.end(), '\\', '.');
175175
std::replace(file_name.begin(), file_name.end(), '<', '[');
176176
std::replace(file_name.begin(), file_name.end(), '>', ']');
177-
if(file_name.size() > max_size)
178-
file_name.resize(max_size);
177+
if(file_name.size() > max_length)
178+
file_name.resize(max_length);
179179
return file_name;
180180
}

cbmc/src/util/file_util.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ Author: Daniel Kroening, [email protected]
1212

1313
#include <string>
1414

15-
/// This constant defines a maximum name length of any file created by
16-
/// any module of the CProver. The value of the constant was inferred
15+
/// This constant defines the maximum name length of any file created by
16+
/// any module of the CProver. The value of the constant was derived
1717
/// from the most restrictive file system we use on our workstations:
1818
/// 'ecryptfs'.
19-
const std::size_t MAX_FILE_NAME_SIZE = 140;
19+
const std::size_t MAX_FILE_NAME_LENGTH = 140;
2020

2121
void delete_directory(const std::string &path);
2222

@@ -27,6 +27,6 @@ std::string concat_dir_file(const std::string &directory,
2727

2828
std::string make_valid_filename(
2929
std::string filename,
30-
const std::size_t max_size = MAX_FILE_NAME_SIZE);
30+
const std::size_t max_length = MAX_FILE_NAME_LENGTH);
3131

3232
#endif // CPROVER_UTIL_FILE_UTIL_H

src/util/json_map_serializer.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,9 +255,9 @@ class json_map_serializert:public virtual_map_iterated_by_keyt<keyt, valuet>
255255
else
256256
{
257257
const std::size_t max_size =
258-
MAX_FILE_NAME_SIZE // The general size limit.
258+
MAX_FILE_NAME_LENGTH // The general length limit.
259259
- 15 // Save space for unique ID integer.
260-
- std::string(suffix).size(); // Save space for '.json' extension
260+
- std::strlen(suffix); // Save space for '.json' extension
261261
std::string file_name =
262262
make_valid_filename(key_converter(key), max_size);
263263
unsigned long uniqueness=file_name==index_file_name ? 1 : 0;

0 commit comments

Comments
 (0)