Linux build fixes

This commit is contained in:
Jack Andersen 2017-11-12 21:19:49 -10:00
parent cb5d22eed6
commit 6950d96b46
8 changed files with 37 additions and 37 deletions

View File

@ -75,7 +75,7 @@ struct VulkanContext
};
std::unordered_map<const boo::IWindow*, std::unique_ptr<Window>> m_windows;
void initVulkan(const char* appName);
void initVulkan(std::string_view appName);
bool enumerateDevices();
void initDevice();
void initSwapChain(Window& windowCtx, VkSurfaceKHR surface, VkFormat format, VkColorSpaceKHR colorspace);

View File

@ -260,7 +260,7 @@ static void demo_check_layers(const std::vector<VulkanContext::LayerProperties>&
}
}
void VulkanContext::initVulkan(const char* appName)
void VulkanContext::initVulkan(std::string_view appName)
{
if (!glslang::InitializeProcess())
Log.report(logvisor::Fatal, "unable to initialize glslang");
@ -346,7 +346,7 @@ void VulkanContext::initVulkan(const char* appName)
VkApplicationInfo appInfo = {};
appInfo.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO;
appInfo.pNext = nullptr;
appInfo.pApplicationName = appName;
appInfo.pApplicationName = appName.data();
appInfo.applicationVersion = 1;
appInfo.pEngineName = "Boo";
appInfo.engineVersion = 1;

View File

@ -82,7 +82,7 @@ class HIDDeviceUdev final : public IHIDDevice
int i;
char errStr[256];
std::unique_lock<std::mutex> lk(device->m_initMutex);
udev_device* udevDev = udev_device_new_from_syspath(GetUdev(), device->m_devPath.c_str());
udev_device* udevDev = udev_device_new_from_syspath(GetUdev(), device->m_devPath.data());
/* Get device file */
const char* dp = udev_device_get_devnode(udevDev);
@ -90,7 +90,7 @@ class HIDDeviceUdev final : public IHIDDevice
if (fd < 0)
{
snprintf(errStr, 256, "Unable to open %s@%s: %s\n",
device->m_token.getProductName().c_str(), dp, strerror(errno));
device->m_token.getProductName().data(), dp, strerror(errno));
device->m_devImp->deviceError(errStr);
lk.unlock();
device->m_initCond.notify_one();
@ -155,7 +155,7 @@ class HIDDeviceUdev final : public IHIDDevice
static void _threadProcBTLL(std::shared_ptr<HIDDeviceUdev> device)
{
std::unique_lock<std::mutex> lk(device->m_initMutex);
udev_device* udevDev = udev_device_new_from_syspath(GetUdev(), device->m_devPath.c_str());
udev_device* udevDev = udev_device_new_from_syspath(GetUdev(), device->m_devPath.data());
/* Return control to main thread */
device->m_runningTransferLoop = true;
@ -177,7 +177,7 @@ class HIDDeviceUdev final : public IHIDDevice
{
char errStr[256];
std::unique_lock<std::mutex> lk(device->m_initMutex);
udev_device* udevDev = udev_device_new_from_syspath(GetUdev(), device->m_devPath.c_str());
udev_device* udevDev = udev_device_new_from_syspath(GetUdev(), device->m_devPath.data());
/* Get device file */
const char* dp = udev_device_get_devnode(udevDev);
@ -185,7 +185,7 @@ class HIDDeviceUdev final : public IHIDDevice
if (fd < 0)
{
snprintf(errStr, 256, "Unable to open %s@%s: %s\n",
device->m_token.getProductName().c_str(), dp, strerror(errno));
device->m_token.getProductName().data(), dp, strerror(errno));
device->m_devImp->deviceError(errStr);
lk.unlock();
device->m_initCond.notify_one();
@ -204,7 +204,7 @@ class HIDDeviceUdev final : public IHIDDevice
if (ioctl(fd, HIDIOCGRDESCSIZE, &reportDescSize) == -1)
{
snprintf(errStr, 256, "Unable to ioctl(HIDIOCGRDESCSIZE) %s@%s: %s\n",
device->m_token.getProductName().c_str(), dp, strerror(errno));
device->m_token.getProductName().data(), dp, strerror(errno));
device->m_devImp->deviceError(errStr);
close(fd);
return;
@ -216,7 +216,7 @@ class HIDDeviceUdev final : public IHIDDevice
if (ioctl(fd, HIDIOCGRDESC, &reportDesc) == -1)
{
snprintf(errStr, 256, "Unable to ioctl(HIDIOCGRDESC) %s@%s: %s\n",
device->m_token.getProductName().c_str(), dp, strerror(errno));
device->m_token.getProductName().data(), dp, strerror(errno));
device->m_devImp->deviceError(errStr);
close(fd);
return;

View File

@ -50,13 +50,13 @@ namespace boo
IApplication* APP = NULL;
int ApplicationRun(IApplication::EPlatformType platform,
IApplicationCallback& cb,
const std::string& uniqueName,
const std::string& friendlyName,
const std::string& pname,
std::string_view uniqueName,
std::string_view friendlyName,
std::string_view pname,
const std::vector<std::string>& args,
bool singleInstance)
{
std::string thrName = friendlyName + " Main Thread";
std::string thrName = std::string(friendlyName) + " Main Thread";
logvisor::RegisterThreadName(thrName.c_str());
if (APP)
return 1;

View File

@ -10,7 +10,7 @@ DBusConnection* RegisterDBus(const char* appName, bool& isFirst);
namespace boo
{
std::shared_ptr<IWindow> _WindowWaylandNew(const std::string& title);
std::shared_ptr<IWindow> _WindowWaylandNew(std::string_view title);
class ApplicationWayland final : public IApplication
{
@ -28,9 +28,9 @@ class ApplicationWayland final : public IApplication
public:
ApplicationWayland(IApplicationCallback& callback,
const std::string& uniqueName,
const std::string& friendlyName,
const std::string& pname,
std::string_view uniqueName,
std::string_view friendlyName,
std::string_view pname,
const std::vector<std::string>& args,
bool singleInstance)
: m_callback(callback),
@ -51,17 +51,17 @@ public:
return 0;
}
const std::string& getUniqueName() const
std::string_view getUniqueName() const
{
return m_uniqueName;
}
const std::string& getFriendlyName() const
std::string_view getFriendlyName() const
{
return m_friendlyName;
}
const std::string& getProcessName() const
std::string_view getProcessName() const
{
return m_pname;
}
@ -71,7 +71,7 @@ public:
return m_args;
}
std::shared_ptr<IWindow> newWindow(const std::string& title, uint32_t drawSamples)
std::shared_ptr<IWindow> newWindow(std::string_view title, uint32_t drawSamples)
{
return _WindowWaylandNew(title);
}

View File

@ -219,9 +219,9 @@ class ApplicationXlib final : public IApplication
public:
ApplicationXlib(IApplicationCallback& callback,
const std::string& uniqueName,
const std::string& friendlyName,
const std::string& pname,
std::string_view uniqueName,
std::string_view friendlyName,
std::string_view pname,
const std::vector<std::string>& args,
bool singleInstance)
: m_callback(callback),
@ -254,7 +254,7 @@ public:
/* DBus single instance registration */
bool isFirst;
m_dbus = RegisterDBus(uniqueName.c_str(), isFirst);
m_dbus = RegisterDBus(uniqueName.data(), isFirst);
if (m_singleInstance)
{
if (!isFirst)
@ -433,7 +433,7 @@ public:
std::unique_lock<std::mutex> innerLk(initmt);
innerLk.unlock();
initcv.notify_one();
std::string thrName = getFriendlyName() + " Client Thread";
std::string thrName = std::string(getFriendlyName()) + " Client Thread";
logvisor::RegisterThreadName(thrName.c_str());
clientReturn = m_callback.appMain(this);
pthread_kill(mainThread, SIGUSR2);
@ -507,17 +507,17 @@ public:
return clientReturn;
}
const std::string& getUniqueName() const
std::string_view getUniqueName() const
{
return m_uniqueName;
}
const std::string& getFriendlyName() const
std::string_view getFriendlyName() const
{
return m_friendlyName;
}
const std::string& getProcessName() const
std::string_view getProcessName() const
{
return m_pname;
}
@ -527,7 +527,7 @@ public:
return m_args;
}
std::shared_ptr<IWindow> newWindow(const std::string& title, uint32_t drawSamples)
std::shared_ptr<IWindow> newWindow(std::string_view title, uint32_t drawSamples)
{
#if BOO_HAS_VULKAN
std::shared_ptr<IWindow> newWindow = _WindowXlibNew(title, m_xDisp, m_xcbConn, m_xDefaultScreen, m_xIM,

View File

@ -130,7 +130,7 @@ struct WindowWayland : IWindow
return "";
}
void setTitle(const std::string& title)
void setTitle(std::string_view title)
{
}
@ -244,7 +244,7 @@ struct WindowWayland : IWindow
};
std::shared_ptr<IWindow> _WindowWaylandNew(const std::string& title)
std::shared_ptr<IWindow> _WindowWaylandNew(std::string_view title)
{
return std::make_shared<WindowWayland>(title);
}

View File

@ -704,7 +704,7 @@ public:
vk::init_dispatch_table_top(PFN_vkGetInstanceProcAddr(getVkProc));
if (m_ctx->m_instance == VK_NULL_HANDLE)
m_ctx->initVulkan(APP->getUniqueName().c_str());
m_ctx->initVulkan(APP->getUniqueName());
vk::init_dispatch_table_middle(m_ctx->m_instance, false);
if (!m_ctx->enumerateDevices())
@ -1042,7 +1042,7 @@ public:
XSetWMProtocols(m_xDisp, m_windowId, &S_ATOMS->m_wmDeleteWindow, 1);
/* Set the title of the window */
const unsigned char* c_title = (unsigned char*)title.c_str();
const unsigned char* c_title = (unsigned char*)title.data();
XChangeProperty(m_xDisp, m_windowId, XA_WM_NAME, XA_STRING, 8, PropModeReplace, c_title, title.length());
/* Set the title of the window icon */
@ -1133,7 +1133,7 @@ public:
void setTitle(std::string_view title)
{
const unsigned char* c_title = (unsigned char*)title.c_str();
const unsigned char* c_title = (unsigned char*)title.data();
XLockDisplay(m_xDisp);
XChangeProperty(m_xDisp, m_windowId, XA_WM_NAME, XA_STRING, 8,
PropModeReplace, c_title, title.length());
@ -2011,7 +2011,7 @@ public:
}
};
std::shared_ptr<IWindow> _WindowXlibNew(const std::string& title,
std::shared_ptr<IWindow> _WindowXlibNew(std::string_view title,
Display* display, void* xcbConn,
int defaultScreen, XIM xIM, XIMStyle bestInputStyle, XFontSet fontset,
GLXContext lastCtx, void* vulkanHandle, uint32_t drawSamples)