Skip to content

Commit aa2f567

Browse files
Remove TString nullptr ctor usages (#12207)
1 parent da20d39 commit aa2f567

File tree

4 files changed

+66
-66
lines changed

4 files changed

+66
-66
lines changed

ydb/core/blobstorage/dsproxy/ut_fat/dsproxy_ut.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3071,7 +3071,7 @@ class TTestBlobStorageProxyBasic1 : public TTestBlobStorageProxy {
30713071
break;
30723072
case 230:
30733073
if (Env->ShouldBeUndiscoverable) {
3074-
TEST_RESPONSE(MessageDiscoverResult, ERROR, 0, nullptr);
3074+
TEST_RESPONSE(MessageDiscoverResult, ERROR, 0, "");
30753075
} else {
30763076
TEST_RESPONSE(MessageDiscoverResult, OK, 1, testData2);
30773077
}
@@ -3080,7 +3080,7 @@ class TTestBlobStorageProxyBasic1 : public TTestBlobStorageProxy {
30803080
break;
30813081
case 240:
30823082
if (Env->ShouldBeUndiscoverable) {
3083-
TEST_RESPONSE(MessageDiscoverResult, ERROR, 0, 0);
3083+
TEST_RESPONSE(MessageDiscoverResult, ERROR, 0, "");
30843084
} else {
30853085
TEST_RESPONSE(MessageDiscoverResult, OK, 1, "");
30863086
}
@@ -3089,7 +3089,7 @@ class TTestBlobStorageProxyBasic1 : public TTestBlobStorageProxy {
30893089
break;
30903090
case 250:
30913091
if (Env->ShouldBeUndiscoverable) {
3092-
TEST_RESPONSE(MessageDiscoverResult, ERROR, 0, 0);
3092+
TEST_RESPONSE(MessageDiscoverResult, ERROR, 0, "");
30933093
} else {
30943094
TEST_RESPONSE(MessageDiscoverResult, NODATA, 0, "");
30953095
}
@@ -3098,7 +3098,7 @@ class TTestBlobStorageProxyBasic1 : public TTestBlobStorageProxy {
30983098
break;
30993099
case 260:
31003100
if (Env->ShouldBeUndiscoverable) {
3101-
TEST_RESPONSE(MessageDiscoverResult, ERROR, 0, 0);
3101+
TEST_RESPONSE(MessageDiscoverResult, ERROR, 0, "");
31023102
} else {
31033103
TEST_RESPONSE(MessageDiscoverResult, OK, 1, testData2);
31043104
}
@@ -3107,7 +3107,7 @@ class TTestBlobStorageProxyBasic1 : public TTestBlobStorageProxy {
31073107
break;
31083108
case 270:
31093109
if (Env->ShouldBeUndiscoverable) {
3110-
TEST_RESPONSE(MessageDiscoverResult, ERROR, 0, 0);
3110+
TEST_RESPONSE(MessageDiscoverResult, ERROR, 0, "");
31113111
} else {
31123112
TEST_RESPONSE(MessageDiscoverResult, OK, 1, "");
31133113
}
@@ -3117,7 +3117,7 @@ class TTestBlobStorageProxyBasic1 : public TTestBlobStorageProxy {
31173117
case 280:
31183118
{
31193119
if (Env->ShouldBeUndiscoverable) {
3120-
TEST_RESPONSE(MessageDiscoverResult, ERROR, 0, 0);
3120+
TEST_RESPONSE(MessageDiscoverResult, ERROR, 0, "");
31213121
} else {
31223122
TEST_RESPONSE(MessageDiscoverResult, NODATA, 0, "");
31233123
}

ydb/core/client/object_storage_listing_ut.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ Y_UNIT_TEST_SUITE(TObjectStorageListingTest) {
285285
endpoint << "localhost:" << grpcPort;
286286
std::shared_ptr<grpc::Channel> channel = grpc::CreateChannel(endpoint, grpc::InsecureChannelCredentials());
287287
auto stub = Ydb::ObjectStorage::V1::ObjectStorageService::NewStub(channel);
288-
288+
289289
TAutoPtr<Ydb::ObjectStorage::ListingRequest> request = new Ydb::ObjectStorage::ListingRequest();
290290
request->Setpath_column_prefix(pathPrefix);
291291
request->Settable_name(table);
@@ -427,7 +427,7 @@ Y_UNIT_TEST_SUITE(TObjectStorageListingTest) {
427427
grpc::Status status = stub->List(&rcontext, *request, &response);
428428

429429
UNIT_ASSERT_VALUES_EQUAL(response.status(), Ydb::StatusIds::SUCCESS);
430-
430+
431431
commonPrefixes.clear();
432432
contents.clear();
433433

@@ -437,7 +437,7 @@ Y_UNIT_TEST_SUITE(TObjectStorageListingTest) {
437437
commonPrefixes.emplace_back(row);
438438
}
439439
}
440-
440+
441441
if (response.has_contents()) {
442442
auto &files = response.contents();
443443
for (auto row : files.rows()) {
@@ -468,7 +468,7 @@ Y_UNIT_TEST_SUITE(TObjectStorageListingTest) {
468468

469469
TVector<TString> commonPrefixes;
470470
TVector<TString> contents;
471-
DoS3Listing(GRPC_PORT, bucket, pathPrefix, pathDelimiter, startAfter, nullptr, columnsToReturn, maxKeys, commonPrefixes, contents);
471+
DoS3Listing(GRPC_PORT, bucket, pathPrefix, pathDelimiter, startAfter, "", columnsToReturn, maxKeys, commonPrefixes, contents);
472472

473473
UNIT_ASSERT_VALUES_EQUAL(expectedCommonPrefixes.size(), commonPrefixes.size());
474474
ui32 i = 0;
@@ -600,7 +600,7 @@ Y_UNIT_TEST_SUITE(TObjectStorageListingTest) {
600600
return response;
601601
}
602602

603-
Ydb::ObjectStorage::ListingResponse TestS3ListingRequest(const TVector<TString>& prefixColumns,
603+
Ydb::ObjectStorage::ListingResponse TestS3ListingRequest(const TVector<TString>& prefixColumns,
604604
const TString& pathPrefix, const TString& pathDelimiter,
605605
const TString& startAfter, const TVector<TString>& columnsToReturn, ui32 maxKeys,
606606
Ydb::StatusIds_StatusCode expectedStatus = Ydb::StatusIds::SUCCESS,
@@ -854,7 +854,7 @@ Y_UNIT_TEST_SUITE(TObjectStorageListingTest) {
854854
TVector<TString> contents;
855855

856856
auto continuationToken = DoS3Listing(GRPC_PORT, 750, "foo/", "/", "", "", {}, 1, commonPrefixes, contents);
857-
857+
858858
UNIT_ASSERT(continuationToken);
859859
UNIT_ASSERT_EQUAL(1, contents.size());
860860
UNIT_ASSERT_EQUAL(0, commonPrefixes.size());
@@ -947,7 +947,7 @@ Y_UNIT_TEST_SUITE(TObjectStorageListingTest) {
947947
{
948948
TVector<TString> folders;
949949
TVector<TString> files;
950-
DoS3Listing(GRPC_PORT, 100, "/Photos/", "/", nullptr, nullptr, {}, 1000, folders, files, Ydb::ObjectStorage::ListingRequest_EMatchType_EQUAL);
950+
DoS3Listing(GRPC_PORT, 100, "/Photos/", "/", "", "", {}, 1000, folders, files, Ydb::ObjectStorage::ListingRequest_EMatchType_EQUAL);
951951

952952
TVector<TString> expectedFolders = {"/Photos/games/", "/Photos/inner/", "/Photos/test/", "/Photos/test3/", "/Photos/test5/", "/Photos/test6/"};
953953
TVector<TString> expectedFiles = {"/Photos/a.jpg", "/Photos/c.jpg"};
@@ -959,11 +959,11 @@ Y_UNIT_TEST_SUITE(TObjectStorageListingTest) {
959959
{
960960
TVector<TString> folders;
961961
TVector<TString> files;
962-
DoS3Listing(GRPC_PORT, 100, "/Photos/", "/", nullptr, nullptr, {}, 1000, folders, files, Ydb::ObjectStorage::ListingRequest_EMatchType_NOT_EQUAL);
962+
DoS3Listing(GRPC_PORT, 100, "/Photos/", "/", "", "", {}, 1000, folders, files, Ydb::ObjectStorage::ListingRequest_EMatchType_NOT_EQUAL);
963963

964964
TVector<TString> expectedFolders = {"/Photos/folder/", "/Photos/inner/", "/Photos/test/", "/Photos/test2/", "/Photos/test3/", "/Photos/test4/", "/Photos/test5/", "/Photos/test6/"};
965965
TVector<TString> expectedFiles = {"/Photos/b.jpg"};
966-
966+
967967
UNIT_ASSERT_VALUES_EQUAL(expectedFolders, folders);
968968
UNIT_ASSERT_VALUES_EQUAL(expectedFiles, files);
969969
}
@@ -1071,7 +1071,7 @@ Y_UNIT_TEST_SUITE(TObjectStorageListingTest) {
10711071

10721072
UNIT_ASSERT_VALUES_EQUAL(expectedFolders, folders);
10731073
UNIT_ASSERT_VALUES_EQUAL(expectedFiles, files);
1074-
// Three partitions, second should be skipped, because it's next prefix of /Photos/ (/Photos0) exceeds
1074+
// Three partitions, second should be skipped, because it's next prefix of /Photos/ (/Photos0) exceeds
10751075
// the range of second partition. Third (last) partition will always be checked.
10761076
UNIT_ASSERT_EQUAL(2, count);
10771077
}
@@ -1142,7 +1142,7 @@ Y_UNIT_TEST_SUITE(TObjectStorageListingTest) {
11421142
UNIT_ASSERT_VALUES_EQUAL(resultSet.rows(0).items(2).low_128(), 975580256289238738);
11431143
UNIT_ASSERT_VALUES_EQUAL(resultSet.rows(0).items(2).high_128(), 192747);
11441144
UNIT_ASSERT_VALUES_EQUAL(resultSet.rows(0).items(3).low_128(), 123321000000);
1145-
}
1145+
}
11461146
}
11471147

11481148
}}

ydb/core/tablet_flat/ut/ut_db_iface.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -787,7 +787,7 @@ Y_UNIT_TEST_SUITE(DBase) {
787787
stream << cache->DumpRanges();
788788
return stream.Str();
789789
} else {
790-
return nullptr;
790+
return "";
791791
}
792792
};
793793

@@ -860,7 +860,7 @@ Y_UNIT_TEST_SUITE(DBase) {
860860
stream << cache->DumpRanges();
861861
return stream.Str();
862862
} else {
863-
return nullptr;
863+
return "";
864864
}
865865
};
866866

ydb/core/tablet_flat/ut/ut_part.cpp

Lines changed: 47 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -693,7 +693,7 @@ Y_UNIT_TEST_SUITE(TPart) {
693693
{1, prefix + "baaaa"}, // -> (1, "b")
694694
{1, prefix + "bab"},
695695
{1, prefix + "caa"},
696-
696+
697697
{2, prefix + "aaa"}, // -> (2, null)
698698
{2, prefix + "bbb"},
699699
{2, prefix + "ccc"},
@@ -726,13 +726,13 @@ Y_UNIT_TEST_SUITE(TPart) {
726726
UNIT_ASSERT_VALUES_EQUAL(cmp.Compare(*IndexTools::GetFlatLastRecord(*part), TRowTool(*lay).KeyCells(*TSchemedCookRow(*lay).Col(2u, prefix + "cxz"))), 0);
727727
}
728728

729-
UNIT_ASSERT_VALUES_EQUAL(TSerializedCellVec::Serialize(IndexTools::GetKey(*part, 0)),
729+
UNIT_ASSERT_VALUES_EQUAL(TSerializedCellVec::Serialize(IndexTools::GetKey(*part, 0)),
730730
TSerializedCellVec::Serialize(part->IndexPages.HasBTree() ? TVector<TCell>() : TRowTool(*lay).KeyCells(*TSchemedCookRow(*lay).Col(1u, prefix + "aaa"))));
731-
UNIT_ASSERT_VALUES_EQUAL(TSerializedCellVec::Serialize(IndexTools::GetKey(*part, 1)),
731+
UNIT_ASSERT_VALUES_EQUAL(TSerializedCellVec::Serialize(IndexTools::GetKey(*part, 1)),
732732
TSerializedCellVec::Serialize(TRowTool(*lay).KeyCells(*TSchemedCookRow(*lay).Col(1u, prefix + "b"))));
733-
UNIT_ASSERT_VALUES_EQUAL(TSerializedCellVec::Serialize(IndexTools::GetKey(*part, 2)),
733+
UNIT_ASSERT_VALUES_EQUAL(TSerializedCellVec::Serialize(IndexTools::GetKey(*part, 2)),
734734
TSerializedCellVec::Serialize(TRowTool(*lay).KeyCells(*TSchemedCookRow(*lay).Col(2u, nullptr))));
735-
UNIT_ASSERT_VALUES_EQUAL(TSerializedCellVec::Serialize(IndexTools::GetKey(*part, 3)),
735+
UNIT_ASSERT_VALUES_EQUAL(TSerializedCellVec::Serialize(IndexTools::GetKey(*part, 3)),
736736
TSerializedCellVec::Serialize(TRowTool(*lay).KeyCells(*TSchemedCookRow(*lay).Col(2u, prefix + "ccx"))));
737737
}
738738

@@ -753,7 +753,7 @@ Y_UNIT_TEST_SUITE(TPart) {
753753
{1, "baaaa"}, // -> (1, "b")
754754
{1, "bab"},
755755
{1, "caa"},
756-
756+
757757
{2, "aaa"}, // -> (2, null)
758758
{2, "bbb"},
759759
{2, "ccc"},
@@ -788,7 +788,7 @@ Y_UNIT_TEST_SUITE(TPart) {
788788
Cerr << DumpPart(*fullPart, 2) << Endl;
789789

790790
UNIT_ASSERT_GT(fullPart->IndexesRawSize, cutPart->IndexesRawSize);
791-
791+
792792
if (cutPart->IndexPages.HasFlat()) {
793793
const NPage::TCompare<NPage::TFlatIndex::TRecord> cmp(cutPart->Scheme->Groups[0].ColsKeyIdx, *(*lay).Keys);
794794
UNIT_ASSERT_VALUES_EQUAL(cmp.Compare(*IndexTools::GetFlatRecord(*cutPart, 0), TRowTool(*lay).KeyCells(*TSchemedCookRow(*lay).Col(1u, "aaa"))), 0);
@@ -798,13 +798,13 @@ Y_UNIT_TEST_SUITE(TPart) {
798798
UNIT_ASSERT_VALUES_EQUAL(cmp.Compare(*IndexTools::GetFlatLastRecord(*cutPart), TRowTool(*lay).KeyCells(*TSchemedCookRow(*lay).Col(2u, "cxz"))), 0);
799799
}
800800

801-
UNIT_ASSERT_VALUES_EQUAL(TSerializedCellVec::Serialize(IndexTools::GetKey(*cutPart, 0)),
801+
UNIT_ASSERT_VALUES_EQUAL(TSerializedCellVec::Serialize(IndexTools::GetKey(*cutPart, 0)),
802802
TSerializedCellVec::Serialize(cutPart->IndexPages.HasBTree() ? TVector<TCell>() : TRowTool(*lay).KeyCells(*TSchemedCookRow(*lay).Col(1u, "aaa"))));
803-
UNIT_ASSERT_VALUES_EQUAL(TSerializedCellVec::Serialize(IndexTools::GetKey(*cutPart, 1)),
803+
UNIT_ASSERT_VALUES_EQUAL(TSerializedCellVec::Serialize(IndexTools::GetKey(*cutPart, 1)),
804804
TSerializedCellVec::Serialize(TRowTool(*lay).KeyCells(*TSchemedCookRow(*lay).Col(1u, "b"))));
805-
UNIT_ASSERT_VALUES_EQUAL(TSerializedCellVec::Serialize(IndexTools::GetKey(*cutPart, 2)),
805+
UNIT_ASSERT_VALUES_EQUAL(TSerializedCellVec::Serialize(IndexTools::GetKey(*cutPart, 2)),
806806
TSerializedCellVec::Serialize(TRowTool(*lay).KeyCells(*TSchemedCookRow(*lay).Col(2u, nullptr))));
807-
UNIT_ASSERT_VALUES_EQUAL(TSerializedCellVec::Serialize(IndexTools::GetKey(*cutPart, 3)),
807+
UNIT_ASSERT_VALUES_EQUAL(TSerializedCellVec::Serialize(IndexTools::GetKey(*cutPart, 3)),
808808
TSerializedCellVec::Serialize(TRowTool(*lay).KeyCells(*TSchemedCookRow(*lay).Col(2u, "ccx"))));
809809

810810
for (auto r : fullRows) {
@@ -895,7 +895,7 @@ Y_UNIT_TEST_SUITE(TPart) {
895895
Cerr << DumpPart(*fullPart, 2) << Endl;
896896

897897
UNIT_ASSERT_GT(fullPart->IndexesRawSize, cutPart->IndexesRawSize);
898-
898+
899899
for (auto r : fullRows) {
900900
cutWrap.Has(*TSchemedCookRow(*lay).Col(r.first, r.second));
901901
fullWrap.Has(*TSchemedCookRow(*lay).Col(r.first, r.second));
@@ -1004,14 +1004,14 @@ Y_UNIT_TEST_SUITE(TPart) {
10041004

10051005
Cerr << "======= CUT =======" << Endl;
10061006
Cerr << DumpPart(*cutPart, 2) << Endl;
1007-
1007+
10081008
Cerr << "======= FULL =======" << Endl;
10091009
Cerr << DumpPart(*fullPart, 2) << Endl;
10101010

10111011
UNIT_ASSERT_GT(fullPart->IndexesRawSize, cutPart->IndexesRawSize);
10121012
UNIT_ASSERT_GT(cutPart->Slices->size(), 1);
10131013
UNIT_ASSERT_VALUES_EQUAL(fullPart->Slices->size(), 1);
1014-
1014+
10151015
for (auto i : xrange(fullRows.size())) {
10161016
auto &r = fullRows[i];
10171017
fullWrap.To(100 + i).Has(*TSchemedCookRow(*lay).Col(r.first, r.second));
@@ -1069,7 +1069,7 @@ Y_UNIT_TEST_SUITE(TPart) {
10691069
auto check = [&] (ui32 testId, TString a, TString b, TString expected) {
10701070
TPartCook cook(lay, conf);
10711071

1072-
cook.Add(*TSchemedCookRow(*lay).Col(a == "<NULL>" ? nullptr : a));
1072+
cook.Add(*TSchemedCookRow(*lay).Col(a == "<NULL>" ? "" : a));
10731073
cook.Add(*TSchemedCookRow(*lay).Col(b));
10741074

10751075
TCheckIter wrap(cook.Finish(), { });
@@ -1083,73 +1083,73 @@ Y_UNIT_TEST_SUITE(TPart) {
10831083
};
10841084

10851085
check(0,
1086-
"cccccc",
1087-
"ccccccd",
1086+
"cccccc",
1087+
"ccccccd",
10881088
"ccccccd");
10891089

10901090
check(1,
1091-
"cccccc",
1092-
"ccccccddd",
1091+
"cccccc",
1092+
"ccccccddd",
10931093
"ccccccd");
10941094

10951095
check(2,
1096-
"cccccc",
1097-
"cccccd",
1096+
"cccccc",
1097+
"cccccd",
10981098
"cccccd");
10991099

11001100
check(3,
1101-
"cccccc",
1102-
"cccccddd",
1101+
"cccccc",
1102+
"cccccddd",
11031103
"cccccd");
11041104

11051105
check(4,
1106-
"cccccc",
1107-
"ccccd",
1106+
"cccccc",
1107+
"ccccd",
11081108
"ccccd");
11091109

11101110
check(5,
1111-
"cccccc",
1112-
"ccccddd",
1111+
"cccccc",
1112+
"ccccddd",
11131113
"ccccd");
11141114

11151115
check(6,
1116-
"cccccc",
1117-
"cccd",
1116+
"cccccc",
1117+
"cccd",
11181118
"cccd");
11191119

11201120
check(7,
1121-
"cccccc",
1122-
"cccddd",
1121+
"cccccc",
1122+
"cccddd",
11231123
"cccd");
11241124

11251125
check(8,
1126-
"cccccc",
1127-
"d",
1126+
"cccccc",
1127+
"d",
11281128
"d");
11291129

11301130
check(9,
1131-
"cccccc",
1132-
"ddd",
1131+
"cccccc",
1132+
"ddd",
11331133
"d");
11341134

11351135
check(10,
1136-
"",
1137-
"d",
1136+
"",
1137+
"d",
11381138
"d");
1139-
1139+
11401140
check(11,
1141-
"",
1142-
"ddd",
1141+
"",
1142+
"ddd",
11431143
"d");
11441144

11451145
check(12,
1146-
"<NULL>",
1147-
"d",
1146+
"<NULL>",
1147+
"d",
11481148
"d");
1149-
1149+
11501150
check(12,
1151-
"<NULL>",
1152-
"ddd",
1151+
"<NULL>",
1152+
"ddd",
11531153
"d");
11541154

11551155
check(13,
@@ -1190,8 +1190,8 @@ Y_UNIT_TEST_SUITE(TPart) {
11901190
};
11911191

11921192
check(0,
1193-
"cccccc",
1194-
"cccddd",
1193+
"cccccc",
1194+
"cccddd",
11951195
"cccd");
11961196

11971197
check(1,

0 commit comments

Comments
 (0)