2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-09 03:07:41 +00:00

Connection: Make use of std::array where applicable

Uses std::array in place of C arrays where not used as a buffer.
This commit is contained in:
Lioncash
2019-08-23 12:44:53 -04:00
parent a3caa28483
commit 877ca7ad87
2 changed files with 17 additions and 16 deletions

View File

@@ -285,8 +285,8 @@ Connection::Connection(int verbosityLevel) {
while (true) {
/* Construct communication pipes */
#if _WIN32
_pipe(m_readpipe, 2048, _O_BINARY);
_pipe(m_writepipe, 2048, _O_BINARY);
_pipe(m_readpipe.data(), 2048, _O_BINARY);
_pipe(m_writepipe.data(), 2048, _O_BINARY);
HANDLE writehandle = HANDLE(_get_osfhandle(m_writepipe[0]));
SetHandleInformation(writehandle, HANDLE_FLAG_INHERIT, HANDLE_FLAG_INHERIT);
HANDLE readhandle = HANDLE(_get_osfhandle(m_readpipe[1]));
@@ -561,8 +561,9 @@ std::streambuf::int_type PyOutStream::StreamBuf::overflow(int_type ch) {
return ch;
}
static const char* BlendTypeStrs[] = {"NONE", "MESH", "CMESH", "ACTOR", "AREA", "WORLD",
"MAPAREA", "MAPUNIVERSE", "FRAME", "PATH", nullptr};
constexpr std::array<const char*, 11> BlendTypeStrs{
"NONE", "MESH", "CMESH", "ACTOR", "AREA", "WORLD", "MAPAREA", "MAPUNIVERSE", "FRAME", "PATH", nullptr,
};
bool Connection::createBlend(const ProjectPath& path, BlendType type) {
if (m_lock) {
@@ -1548,7 +1549,7 @@ std::pair<atVec3f, atVec3f> DataStream::getMeshAABB() {
}
const char* DataStream::MeshOutputModeString(HMDLTopology topology) {
static const char* STRS[] = {"TRIANGLES", "TRISTRIPS"};
static constexpr std::array<const char*, 2> STRS{"TRIANGLES", "TRISTRIPS"};
return STRS[int(topology)];
}