XECOUNT to countof.

This commit is contained in:
Ben Vanik
2014-08-16 17:58:33 -07:00
parent 187d0ad277
commit f2a9fa3bf9
30 changed files with 195 additions and 175 deletions

View File

@@ -9,6 +9,7 @@
#include <xenia/kernel/fs/devices/disc_image_device.h>
#include <poly/math.h>
#include <xenia/kernel/fs/gdfx.h>
#include <xenia/kernel/fs/devices/disc_image_entry.h>
@@ -57,12 +58,12 @@ Entry* DiscImageDevice::ResolvePath(const char* path) {
// Walk the path, one separator at a time.
// We copy it into the buffer and shift it left over and over.
char remaining[poly::max_path];
xestrcpya(remaining, XECOUNT(remaining), path);
xestrcpya(remaining, poly::countof(remaining), path);
while (remaining[0]) {
char* next_slash = strchr(remaining, '\\');
if (next_slash == remaining) {
// Leading slash - shift
xestrcpya(remaining, XECOUNT(remaining), remaining + 1);
xestrcpya(remaining, poly::countof(remaining), remaining + 1);
continue;
}
@@ -82,7 +83,7 @@ Entry* DiscImageDevice::ResolvePath(const char* path) {
if (!next_slash) {
break;
}
xestrcpya(remaining, XECOUNT(remaining), next_slash + 1);
xestrcpya(remaining, poly::countof(remaining), next_slash + 1);
}
Entry::Type type = gdfx_entry->attributes & X_FILE_ATTRIBUTE_DIRECTORY ?

View File

@@ -9,6 +9,7 @@
#include <xenia/kernel/fs/devices/stfs_container_device.h>
#include <poly/math.h>
#include <xenia/kernel/fs/stfs.h>
#include <xenia/kernel/fs/devices/stfs_container_entry.h>
@@ -57,12 +58,12 @@ Entry* STFSContainerDevice::ResolvePath(const char* path) {
// Walk the path, one separator at a time.
// We copy it into the buffer and shift it left over and over.
char remaining[poly::max_path];
xestrcpya(remaining, XECOUNT(remaining), path);
xestrcpya(remaining, poly::countof(remaining), path);
while (remaining[0]) {
char* next_slash = strchr(remaining, '\\');
if (next_slash == remaining) {
// Leading slash - shift
xestrcpya(remaining, XECOUNT(remaining), remaining + 1);
xestrcpya(remaining, poly::countof(remaining), remaining + 1);
continue;
}
@@ -82,7 +83,7 @@ Entry* STFSContainerDevice::ResolvePath(const char* path) {
if (!next_slash) {
break;
}
xestrcpya(remaining, XECOUNT(remaining), next_slash + 1);
xestrcpya(remaining, poly::countof(remaining), next_slash + 1);
}
Entry::Type type = stfs_entry->attributes & X_FILE_ATTRIBUTE_DIRECTORY ?

View File

@@ -11,6 +11,7 @@
#include <xenia/kernel/fs/gdfx.h>
#include <poly/math.h>
using namespace xe;
using namespace xe::kernel;
@@ -105,7 +106,7 @@ GDFX::Error GDFX::Verify(ParseState& state) {
0x00000000, 0x0000FB20, 0x00020600, 0x0FD90000,
};
bool magic_found = false;
for (size_t n = 0; n < XECOUNT(likely_offsets); n++) {
for (size_t n = 0; n < poly::countof(likely_offsets); n++) {
state.game_offset = likely_offsets[n];
if (VerifyMagic(state, state.game_offset + (32 * kXESectorSize))) {
magic_found = true;