Skip to content

Commit

Permalink
fix: Fix instances of variableScope
Browse files Browse the repository at this point in the history
  • Loading branch information
uyjulian committed May 18, 2024
1 parent eec60f5 commit a8ca8ce
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 10 deletions.
10 changes: 8 additions & 2 deletions filer.c
Original file line number Diff line number Diff line change
Expand Up @@ -628,7 +628,7 @@ int cmpFile(FILEINFO *a, FILEINFO *b) // Used for directory sort
//--------------------------------------------------------------
void sort(FILEINFO *a, int left, int right)
{
FILEINFO tmp, pivot;
FILEINFO pivot;

if (left < right) {
int i, p;
Expand All @@ -637,6 +637,8 @@ void sort(FILEINFO *a, int left, int right)
p = left;
for (i = left + 1; i <= right; i++) {
if (cmpFile(&a[i], &pivot) < 0) {
FILEINFO tmp;

p = p + 1;
tmp = a[p];
a[p] = a[i];
Expand Down Expand Up @@ -3259,7 +3261,7 @@ int keyboard2(char *out, int max)
//--------------------------------------------------------------
int setFileList(const char *path, const char *ext, FILEINFO *files, int cnfmode)
{
int nfiles, i, j, ret;
int nfiles, i;

size_valid = 0;
time_valid = 0;
Expand Down Expand Up @@ -3370,6 +3372,8 @@ int setFileList(const char *path, const char *ext, FILEINFO *files, int cnfmode)
files[0].stats.AttrFile = sceMcFileAttrSubdir;
nfiles = getDir(path, &files[1]) + 1;
if (strcmp(ext, "*")) {
int j;

for (i = j = 1; i < nfiles; i++) {
if (files[i].stats.AttrFile & sceMcFileAttrSubdir)
files[j++] = files[i];
Expand All @@ -3382,6 +3386,8 @@ int setFileList(const char *path, const char *ext, FILEINFO *files, int cnfmode)
}
if ((file_show == 2) || (file_sort == 2)) {
for (i = 1; i < nfiles; i++) {
int ret;

ret = getGameTitle(path, &files[i], files[i].title);
if (ret < 0)
files[i].title[0] = 0;
Expand Down
14 changes: 7 additions & 7 deletions hdl_info/apa.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,13 +136,6 @@ int apa_ptable_read_ex(hio_t *hio, apa_partition_table_t **table)
u_long size_in_kb;
int result = hio->stat(hio, &size_in_kb);
if (result == 0) {
u_long total_sectors;
// limit HDD size to 128GB - 1KB; that is: exclude the last 128MB chunk
// if (size_in_kb > 128 * 1024 * 1024 - 1)
// size_in_kb = 128 * 1024 * 1024 - 1;

total_sectors = size_in_kb * 2; /* 1KB = 2 sectors of 512 bytes, each */

*table = apa_ptable_alloc();
if (*table != NULL) {
u_long sector = 0;
Expand All @@ -154,6 +147,13 @@ int apa_ptable_read_ex(hio_t *hio, apa_partition_table_t **table)
if (bytes == sizeof(part) &&
get_u32(&part.checksum) == apa_partition_checksum(&part) &&
memcmp(part.magic, PS2_PARTITION_MAGIC, 4) == 0) {
u_long total_sectors;
// limit HDD size to 128GB - 1KB; that is: exclude the last 128MB chunk
// if (size_in_kb > 128 * 1024 * 1024 - 1)
// size_in_kb = 128 * 1024 * 1024 - 1;

total_sectors = size_in_kb * 2; /* 1KB = 2 sectors of 512 bytes, each */

if (get_u32(&part.start) < total_sectors &&
get_u32(&part.start) + get_u32(&part.length) < total_sectors) {
if ((get_u16(&part.flags) == 0x0000) && (get_u16(&part.type) == 0x1337))
Expand Down
3 changes: 2 additions & 1 deletion ps2host/net_fsys.c
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,6 @@ static int fsysLseek(int fd, unsigned int offset, int whence)
//----------------------------------------------------------------------------
static int fsysIoctl(iop_file_t *file, unsigned long request, void *data)
{
int remote_fd = ((struct filedesc_info *)file)->own_fd;
int ret;
dbgprintf("fsysioctl..\n");
// dbgprintf(" fd: %x\n"
Expand All @@ -242,6 +241,8 @@ static int fsysIoctl(iop_file_t *file, unsigned long request, void *data)
remove_flag = 0;

if (request == IOCTL_RENAME) {
int remote_fd = ((struct filedesc_info *)file)->own_fd;

if (lastopen_fd == remote_fd) {
WaitSema(fsys_sema);
ret = pko_ioctl(remote_fd, request, data);
Expand Down

0 comments on commit a8ca8ce

Please sign in to comment.