MCPcopy Create free account
hub / github.com/apache/cloudberry / SafeScan

Method SafeScan

gpcontrib/gpcloud/src/s3utils.cpp:196–213  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

194}
195
196int64_t Config::SafeScan(const string &varName, const string &section, int64_t defaultValue,
197 int64_t minValue, int64_t maxValue) {
198 int64_t scannedValue = 0;
199
200 // Here we use %12lld to truncate long number string, because configure value
201 // has type of int32_t, who has the range [-2^31, 2^31-1] (10-digit number)
202 bool isSuccess = Scan(section, varName, "%12lld", &scannedValue);
203
204 if (!isSuccess) {
205 scannedValue = defaultValue;
206 } else if (scannedValue > maxValue) {
207 scannedValue = maxValue;
208 } else if (scannedValue < minValue) {
209 scannedValue = minValue;
210 }
211
212 return scannedValue;
213}
214
215bool ToBool(string str) {
216 std::transform(str.begin(), str.end(), str.begin(), ::tolower);

Callers 1

InitConfigFunction · 0.80

Calls 1

ScanClass · 0.50

Tested by

no test coverage detected