mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-07-31 20:01:12 +00:00
Remove use of const char * in public API and OS specific where possible
* This prevents unnecessary conversions back and forth between rdcstr and const char * when going through interfaces. In the OS specific layer this is rarely an issue because most of the implementations don't convert to rdcstr, but it is convenient to be able to pass in an rdcstr directly. The few cases where there's an unecessary construction of an rdcstr is acceptable. * A couple of places in the public API need to return a string from a global function, so can't return an rdcstr due to C ABI, so they still return a const char *. * Similarly const char * is kept for logging, to avoid a dependency on rdcstr and because that's one place where unnecessary conversions/constructions may be impactful.
This commit is contained in:
@@ -381,7 +381,7 @@ ReplayStatus InstallRenderDocServer(const rdcstr &deviceID)
|
||||
|
||||
rdcstr apkpath = paths[i] + apk + ".apk";
|
||||
|
||||
if(FileIO::exists(apkpath.c_str()))
|
||||
if(FileIO::exists(apkpath))
|
||||
{
|
||||
apksFolder = paths[i];
|
||||
RDCLOG("APKs found: %s", apksFolder.c_str());
|
||||
@@ -408,7 +408,7 @@ ReplayStatus InstallRenderDocServer(const rdcstr &deviceID)
|
||||
|
||||
apk += GetRenderDocPackageForABI(abi) + ".apk";
|
||||
|
||||
if(!FileIO::exists(apk.c_str()))
|
||||
if(!FileIO::exists(apk))
|
||||
RDCWARN(
|
||||
"%s missing - ensure you build all ABIs your device can support for full compatibility",
|
||||
apk.c_str());
|
||||
@@ -553,7 +553,7 @@ struct AndroidRemoteServer : public RemoteServer
|
||||
}
|
||||
|
||||
virtual rdcpair<ReplayStatus, IReplayController *> OpenCapture(
|
||||
uint32_t proxyid, const char *filename, const ReplayOptions &opts,
|
||||
uint32_t proxyid, const rdcstr &filename, const ReplayOptions &opts,
|
||||
RENDERDOC_ProgressCallback progress) override
|
||||
{
|
||||
ResetAndroidSettings();
|
||||
@@ -575,9 +575,9 @@ struct AndroidRemoteServer : public RemoteServer
|
||||
}
|
||||
|
||||
virtual rdcstr GetHomeFolder() override { return ""; }
|
||||
virtual rdcarray<PathEntry> ListFolder(const char *path) override
|
||||
virtual rdcarray<PathEntry> ListFolder(const rdcstr &path) override
|
||||
{
|
||||
if(path[0] == 0 || (path[0] == '/' && path[1] == 0))
|
||||
if(path.empty() || (path[0] == '/' && path.size() == 1))
|
||||
{
|
||||
SCOPED_TIMER("Fetching android packages and activities");
|
||||
|
||||
@@ -761,7 +761,8 @@ struct AndroidRemoteServer : public RemoteServer
|
||||
}
|
||||
}
|
||||
|
||||
virtual ExecuteResult ExecuteAndInject(const char *a, const char *w, const char *c,
|
||||
virtual ExecuteResult ExecuteAndInject(const rdcstr &packageAndActivity, const rdcstr &,
|
||||
const rdcstr &intentArgs,
|
||||
const rdcarray<EnvironmentModification> &env,
|
||||
const CaptureOptions &opts) override;
|
||||
|
||||
@@ -1114,15 +1115,13 @@ void AndroidRemoteServer::ShutdownConnection()
|
||||
RemoteServer::ShutdownConnection();
|
||||
}
|
||||
|
||||
ExecuteResult AndroidRemoteServer::ExecuteAndInject(const char *a, const char *w, const char *c,
|
||||
ExecuteResult AndroidRemoteServer::ExecuteAndInject(const rdcstr &packageAndActivity,
|
||||
const rdcstr &, const rdcstr &intentArgs,
|
||||
const rdcarray<EnvironmentModification> &env,
|
||||
const CaptureOptions &opts)
|
||||
{
|
||||
LazilyStartLogcatThread();
|
||||
|
||||
rdcstr packageAndActivity = a && a[0] ? a : "";
|
||||
rdcstr intentArgs = c && c[0] ? c : "";
|
||||
|
||||
// we spin up a thread to Ping() every second, since starting a package can block for a long time.
|
||||
int32_t done = 0;
|
||||
Threading::ThreadHandle pingThread = Threading::CreateThread([&done, this]() {
|
||||
@@ -1379,7 +1378,7 @@ ExecuteResult AndroidRemoteServer::ExecuteAndInject(const char *a, const char *w
|
||||
{
|
||||
// Check if the target app has started yet and we can connect to it.
|
||||
ITargetControl *control = RENDERDOC_CreateTargetControl(
|
||||
(AndroidController::m_Inst.GetProtocolName() + "://" + m_deviceID).c_str(), ret.ident,
|
||||
AndroidController::m_Inst.GetProtocolName() + "://" + m_deviceID, ret.ident,
|
||||
"testConnection", false);
|
||||
if(control)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user