Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up uses of the recently deprecated ST::null and ST::null_t #732

Merged
merged 1 commit into from
Nov 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Sources/Plasma/Apps/plClient/winmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -656,7 +656,7 @@ static void SaveUserPass(LoginDialogParam* pLoginParam, wchar_t* password)
if (pLoginParam->remember)
store->SetPassword(pLoginParam->username, thePass);
else
store->SetPassword(pLoginParam->username, ST::null);
store->SetPassword(pLoginParam->username, ST::string());
}

NetCommSetAccountUsernamePassword(theUser, pLoginParam->namePassHash);
Expand Down
2 changes: 1 addition & 1 deletion Sources/Plasma/Apps/plPythonPack/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ void FindSubDirs(std::vector<plFileName> &dirnames, const plFileName &path)
}
}

void FindPackages(std::vector<plFileName>& fileNames, std::vector<plFileName>& pathNames, const plFileName& path, const ST::string& parent_package=ST::null)
void FindPackages(std::vector<plFileName>& fileNames, std::vector<plFileName>& pathNames, const plFileName& path, const ST::string& parent_package={})
{
std::vector<plFileName> packages;
FindSubDirs(packages, path);
Expand Down
4 changes: 2 additions & 2 deletions Sources/Plasma/Apps/plUruLauncher/plClientLauncher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ ST::string plClientLauncher::GetAppArgs() const
{
// If -Repair was specified, there are no args for the next call...
if (hsCheckBits(fFlags, kRepairGame)) {
return ST::null;
return ST::string();
}

ST::string_stream ss;
Expand Down Expand Up @@ -477,7 +477,7 @@ void plClientLauncher::ParseArguments()

// last chance setup
if (hsCheckBits(fFlags, kPatchOnly))
fClientExecutable = ST::null;
fClientExecutable = plFileName();
else if (hsCheckBits(fFlags, kRepairGame))
fClientExecutable = plManifest::PatcherExecutable();

Expand Down
4 changes: 2 additions & 2 deletions Sources/Plasma/CoreLib/plCmdParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ plCmdParserImpl::plCmdParserImpl(const plCmdArgDef* defs, size_t defCount)
// Store the argument data
plCmdArgData& arg = fArgArray[loop];
arg.def = def;
arg.buffer = ST::null;
arg.buffer = ST::string();
arg.nameChars = def.name.size();
arg.isSpecified = false;

Expand Down Expand Up @@ -348,7 +348,7 @@ bool plCmdParserImpl::TokenizeFlags(plCmdTokenState* state, const ST::string& st

// Process values for boolean arguments
if (isBool) {
result = ProcessValue(state, lastIndex, ST::null);
result = ProcessValue(state, lastIndex, ST::string());
continue;
}

Expand Down
2 changes: 1 addition & 1 deletion Sources/Plasma/CoreLib/plFileSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ ST::string plFileName::GetFileExt() const
if (dot > end)
return fName.substr(dot + 1);

return ST::null;
return ST::string();
}

ST::string plFileName::GetFileNameNoExt() const
Expand Down
20 changes: 10 additions & 10 deletions Sources/Plasma/CoreLib/plFileSystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,6 @@ class plFileName
/** Construct an empty filename. */
plFileName() { }

/** Construct an empty filename. */
plFileName(const ST::null_t &) { }

/** Construct a filename from the UTF-8 character data in \a cstr. */
plFileName(const char *cstr) : fName(cstr) { }

Expand All @@ -77,20 +74,16 @@ class plFileName
/** Copy constructor. */
plFileName(const plFileName &copy) : fName(copy.fName) { }

/** Move constructor. */
plFileName(plFileName &&move) : fName(std::move(move.fName)) { }

/** Assignment operator. Same as plFileName(const char *). */
plFileName &operator=(const char *cstr)
{
fName.operator=(cstr);
return *this;
}

/** Assignment operator. Same as plFileName(const ST::null_t &). */
plFileName &operator=(const ST::null_t &)
{
fName.operator=(ST::null);
return *this;
}

/** Assignment operator. Same as plFileName(const ST::string &). */
plFileName &operator=(const ST::string &copy)
{
Expand All @@ -105,6 +98,13 @@ class plFileName
return *this;
}

/** Assignment operator. Same as plFileName(plFileName &&). */
plFileName &operator=(plFileName &&move)
{
fName.operator=(std::move(move.fName));
return *this;
}

/** Comparison operator. */
bool operator==(const char *other) const { return fName.operator==(other); }

Expand Down
8 changes: 4 additions & 4 deletions Sources/Plasma/FeatureLib/pfConsole/pfConsoleCommands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ plKey FindObjectByName(const ST::string& name, int type, const ST::string& ageNa
ST::string thisAge = plAgeLoader::GetInstance()->GetCurrAgeDesc().GetAgeName();
if (!thisAge.empty())
{
key = plKeyFinder::Instance().StupidSearch(thisAge, ST::null, type, name, subString);
key = plKeyFinder::Instance().StupidSearch(thisAge, ST::string(), type, name, subString);
if (key != nil)
{
if (statusStr)
Expand All @@ -300,7 +300,7 @@ plKey FindObjectByName(const ST::string& name, int type, const ST::string& ageNa
}
}
// Fallback
key = plKeyFinder::Instance().StupidSearch(ageName, ST::null, type, name, subString);
key = plKeyFinder::Instance().StupidSearch(ageName, ST::string(), type, name, subString);

if (!key)
{
Expand Down Expand Up @@ -5719,7 +5719,7 @@ PF_CONSOLE_CMD( Animation, // Group name
{
plAnimCmdMsg *msg = new plAnimCmdMsg();
msg->SetCmd(plAnimCmdMsg::kContinue);
msg->SetAnimName(ST::null);
msg->SetAnimName(ST::string());
msg->SetBCastFlag(plMessage::kPropagateToModifiers);
SendAnimCmdMsg(ST::string::from_utf8(params[0]), msg);
}
Expand All @@ -5731,7 +5731,7 @@ PF_CONSOLE_CMD( Animation, // Group name
{
plAnimCmdMsg *msg = new plAnimCmdMsg();
msg->SetCmd(plAnimCmdMsg::kStop);
msg->SetAnimName(ST::null);
msg->SetAnimName(ST::string());
msg->SetBCastFlag(plMessage::kPropagateToModifiers);
SendAnimCmdMsg(ST::string::from_utf8(params[0]), msg);
}
Expand Down
6 changes: 3 additions & 3 deletions Sources/Plasma/FeatureLib/pfJournalBook/pfJournalBook.h
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ class pfBookData : public hsKeyedObject
kTurnBackPage
};

pfBookData(const ST::string &guiName = ST::null);
pfBookData(const ST::string &guiName = {});
virtual ~pfBookData();

void LoadGUI(); // need this seperate because the plKey isn't setup until the constructor is done
Expand Down Expand Up @@ -364,8 +364,8 @@ class pfJournalBook : public hsKeyedObject
// The constructor takes in the esHTML source for the journal, along with
// the name of the mipmap to use as the cover of the book. The callback
// key is the keyed object to send event messages to (see <img> tag).
pfJournalBook( const char *esHTMLSource, plKey coverImageKey = nil, plKey callbackKey = nil, const plLocation &hintLoc = plLocation::kGlobalFixedLoc, const ST::string &guiName = ST::null );
pfJournalBook( const wchar_t *esHTMLSource, plKey coverImageKey = nil, plKey callbackKey = nil, const plLocation &hintLoc = plLocation::kGlobalFixedLoc, const ST::string &guiName = ST::null );
pfJournalBook(const char *esHTMLSource, plKey coverImageKey = nil, plKey callbackKey = nil, const plLocation &hintLoc = plLocation::kGlobalFixedLoc, const ST::string &guiName = {});
pfJournalBook(const wchar_t *esHTMLSource, plKey coverImageKey = nil, plKey callbackKey = nil, const plLocation &hintLoc = plLocation::kGlobalFixedLoc, const ST::string &guiName = {});

virtual ~pfJournalBook();

Expand Down
4 changes: 2 additions & 2 deletions Sources/Plasma/FeatureLib/pfMessage/pfKIMsg.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ class pfKIMsg : public plMessage
void IInit()
{
fCommand = kNoCommand;
fString = ST::null;
fUser = ST::null;
fString = ST::string();
fUser = ST::string();
fPlayerID = 0;
fFlags = 0;
fDelay = 0.0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ pfFilePasswordStore::pfFilePasswordStore()
ST::string pfFilePasswordStore::GetPassword(const ST::string& username)
{
plFileName loginDat = plFileName::Join(plFileSystem::GetInitPath(), "login.dat");
ST::string password = ST::null;
ST::string password;

#ifndef PLASMA_EXTERNAL_RELEASE
// internal builds can use the local init directory
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ ST::string pfApplePasswordStore::GetPassword(const ST::string& username)
&passwd,
nullptr) != errSecSuccess)
{
return ST::null;
return ST::string();
}

ST::string ret(reinterpret_cast<const char*>(passwd), size_t(passwd_len));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ ST::string pfWin32PasswordStore::GetPassword(const ST::string& username)
{
PCREDENTIALW credential;
ST::string target = ST::format("{}__{}", GetServerDisplayName(), username);
ST::string password = ST::null;
ST::string password;

if (!CredReadW(target.to_wchar().data(), CRED_TYPE_GENERIC, 0, &credential)) {
return password;
Expand Down
6 changes: 3 additions & 3 deletions Sources/Plasma/FeatureLib/pfPatcher/pfPatcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ struct pfPatcherWorker : public hsThread

void OnQuit() override;

void EndPatch(ENetError result, const ST::string& msg=ST::null);
void EndPatch(ENetError result, const ST::string& msg={});
bool IssueRequest();
void Run() override;
void ProcessFile();
Expand Down Expand Up @@ -317,8 +317,8 @@ static void IPreloaderManifestDownloadCB(ENetError result, void* param, const wc
// so, we need to ask the AuthSrv about our game code
{
hsLockGuard(patcher->fRequestMut);
patcher->fRequests.emplace_back(ST::null, pfPatcherWorker::Request::kPythonList);
patcher->fRequests.emplace_back(ST::null, pfPatcherWorker::Request::kSdlList);
patcher->fRequests.emplace_back(ST::string(), pfPatcherWorker::Request::kPythonList);
patcher->fRequests.emplace_back(ST::string(), pfPatcherWorker::Request::kSdlList);
}

// continue pumping requests
Expand Down
2 changes: 1 addition & 1 deletion Sources/Plasma/FeatureLib/pfPython/cyAccountManagement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ ST::string cyAccountManagement::GetAccountName()
if (acct)
return acct->accountName;
else
return ST::null;
return ST::string();
}

void cyAccountManagement::CreatePlayer(const ST::string& playerName, const ST::string& avatar, const ST::string& invitationCode)
Expand Down
2 changes: 1 addition & 1 deletion Sources/Plasma/FeatureLib/pfPython/cyMisc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -641,7 +641,7 @@ ST::string cyMisc::GetPrevAgeName()
if (als)
return als->GetAgeInfo()->GetAgeFilename();
}
return ST::null;
return ST::string();
}

PyObject* cyMisc::GetPrevAgeInfo()
Expand Down
2 changes: 1 addition & 1 deletion Sources/Plasma/FeatureLib/pfPython/plPythonFileMod.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1356,7 +1356,7 @@ bool plPythonFileMod::MsgReceive(plMessage* msg)
auto pRLNMsg = IScriptWantsMsg<plRoomLoadNotifyMsg>(kfunc_PageLoad, msg);
if (pRLNMsg) {
ICallScriptMethod(kfunc_PageLoad, pRLNMsg->GetWhatHappen(),
pRLNMsg->GetRoom() ? pRLNMsg->GetRoom()->GetName() : ST::null);
pRLNMsg->GetRoom() ? pRLNMsg->GetRoom()->GetName() : ST::string());
return true;
}

Expand Down
2 changes: 1 addition & 1 deletion Sources/Plasma/FeatureLib/pfPython/plPythonParameter.h
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ typedef struct plPythonParameter
fString = str;
}
else
fString = ST::null;
fString = ST::string();
break;

case kSceneObject:
Expand Down
2 changes: 1 addition & 1 deletion Sources/Plasma/FeatureLib/pfPython/pyCritterBrain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ std::string pyCritterBrain::BehaviorName(int behavior) const
ST::string pyCritterBrain::AnimationName(int behavior) const
{
if (!fBrain)
return ST::null;
return ST::string();
return fBrain->AnimationName(behavior);
}

Expand Down
2 changes: 1 addition & 1 deletion Sources/Plasma/FeatureLib/pfPython/pyDniInfoSource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ ST::string pyDniInfoSource::GetAgeName() const
{
hsRef<RelVaultNode> node = VaultGetAgeInfoNode();
if (!node)
return ST::null;
return ST::string();

VaultAgeInfoNode ageInfo(node);
return ageInfo.GetAgeInstanceName();
Expand Down
10 changes: 5 additions & 5 deletions Sources/Plasma/FeatureLib/pfPython/pyGUIControlListBox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,12 @@ class pfColorListElement : public pfGUIListText
if ( string1 )
{
fString1 = hsStringToWString(string1);
fText = ST::null;
fText = ST::string();
}
else
{
fString1 = nil;
fText = ST::null;
fText = ST::string();
}
fTextColor1 = color1;
if (string2)
Expand All @@ -105,12 +105,12 @@ class pfColorListElement : public pfGUIListText
{
fString1 = new wchar_t[wcslen(string1)+1];
wcscpy(fString1,string1);
fText = ST::null;
fText = ST::string();
}
else
{
fString1 = nil;
fText = ST::null;
fText = ST::string();
}
fTextColor1 = color1;
if (string2)
Expand All @@ -132,7 +132,7 @@ class pfColorListElement : public pfGUIListText
{
delete [] fString1;
fString1 = nil;
fText = ST::null;
fText = ST::string();
}
if ( fString2 )
delete [] fString2;
Expand Down
2 changes: 1 addition & 1 deletion Sources/Plasma/FeatureLib/pfPython/pyGameScore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ ST::string pyGameScore::GetGameName() const
{
if (fScore)
return fScore->GetGameName();
return ST::null;
return ST::string();
}

void pyGameScore::AddPoints(int32_t numPoints, pyKey& rcvr)
Expand Down
2 changes: 1 addition & 1 deletion Sources/Plasma/FeatureLib/pfPython/pyGameScoreMsg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ ST::string pyGameScoreListMsg::GetName() const
{
if (pfGameScoreListMsg* pList = pfGameScoreListMsg::ConvertNoRef(fMsg))
return pList->GetName();
return ST::null;
return ST::string();
}

uint32_t pyGameScoreListMsg::GetOwnerID() const
Expand Down
2 changes: 1 addition & 1 deletion Sources/Plasma/FeatureLib/pfPython/pyGlueHelpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ ST::string PyUnicode_AsSTString(PyObject* obj)
return ST::string::from_utf8(str, size, ST::assume_valid);
}

return ST::null;
return ST::string();
}

int PyUnicode_STStringConverter(PyObject* obj, void* str)
Expand Down
8 changes: 4 additions & 4 deletions Sources/Plasma/FeatureLib/pfPython/pyJournalBook.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ class pyJournalBook

// required functions for PyObject interoperability
PYTHON_CLASS_NEW_FRIEND(ptBook);
static PyObject *New(std::string htmlSource, plKey coverImageKey = nil, plKey callbackKey = nil, const ST::string &guiName = ST::null);
static PyObject *New(std::wstring htmlSource, plKey coverImageKey = nil, plKey callbackKey = nil, const ST::string &guiName = ST::null);
static PyObject *New(std::string htmlSource, plKey coverImageKey = nil, plKey callbackKey = nil, const ST::string &guiName = {});
static PyObject *New(std::wstring htmlSource, plKey coverImageKey = nil, plKey callbackKey = nil, const ST::string &guiName = {});
PYTHON_CLASS_CHECK_DEFINITION; // returns true if the PyObject is a pyJournalBook object
PYTHON_CLASS_CONVERT_FROM_DEFINITION(pyJournalBook); // converts a PyObject to a pyJournalBook (throws error if not correct type)

Expand All @@ -95,8 +95,8 @@ class pyJournalBook
static void AddPlasmaConstantsClasses(PyObject *m);

// Deletes the existing book and re-creates it, for use by the python glue
void MakeBook(std::string esHTMLSource, plKey coverImageKey = nil, plKey callbackKey = nil, const ST::string &guiName = ST::null);
void MakeBook(std::wstring esHTMLSource, plKey coverImageKey = nil, plKey callbackKey = nil, const ST::string &guiName = ST::null);
void MakeBook(std::string esHTMLSource, plKey coverImageKey = nil, plKey callbackKey = nil, const ST::string &guiName = {});
void MakeBook(std::wstring esHTMLSource, plKey coverImageKey = nil, plKey callbackKey = nil, const ST::string &guiName = {});

// Interface functions per book
virtual void Show( bool startOpened );
Expand Down
2 changes: 1 addition & 1 deletion Sources/Plasma/FeatureLib/pfPython/pyPlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
pyPlayer::pyPlayer() // only used by python glue, do NOT call
{
fAvatarKey = nil;
fPlayerName = ST::null;
fPlayerName = ST::string();
fPlayerID = 0;
fDistSq = -1;
fIsCCR = false;
Expand Down
Loading