mirror of
https://github.com/chiteroman/PlayIntegrityFix.git
synced 2025-02-22 22:28:48 +08:00
removed useless code
This commit is contained in:
parent
2269f63ff3
commit
bf1217e9e7
@ -20,61 +20,29 @@
|
|||||||
#define CUSTOM_JSON_FORK "/data/adb/modules/playintegrityfix/custom.pif.json"
|
#define CUSTOM_JSON_FORK "/data/adb/modules/playintegrityfix/custom.pif.json"
|
||||||
#define CUSTOM_JSON "/data/adb/pif.json"
|
#define CUSTOM_JSON "/data/adb/pif.json"
|
||||||
|
|
||||||
static inline ssize_t xread(int fd, void *buffer, size_t count) {
|
static ssize_t xread(int fd, void *buffer, size_t count) {
|
||||||
auto *buf = static_cast<char *>(buffer);
|
|
||||||
ssize_t total = 0;
|
ssize_t total = 0;
|
||||||
|
char *buf = static_cast<char *>(buffer);
|
||||||
while (count > 0) {
|
while (count > 0) {
|
||||||
ssize_t ret = read(fd, buf, count);
|
ssize_t ret = TEMP_FAILURE_RETRY(read(fd, buf, count));
|
||||||
|
if (ret < 0) return -1;
|
||||||
if (ret < 0) {
|
|
||||||
// Retry if interrupted
|
|
||||||
if (errno == EINTR) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// If 0, we've hit EOF (read no more data)
|
|
||||||
if (ret == 0) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
buf += ret;
|
buf += ret;
|
||||||
total += ret;
|
total += ret;
|
||||||
count -= ret;
|
count -= ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
return total;
|
return total;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline ssize_t xwrite(int fd, const void *buffer, size_t count) {
|
static ssize_t xwrite(int fd, const void *buffer, size_t count) {
|
||||||
auto *buf = static_cast<const char *>(buffer);
|
|
||||||
ssize_t total = 0;
|
ssize_t total = 0;
|
||||||
|
char *buf = (char *) buffer;
|
||||||
while (count > 0) {
|
while (count > 0) {
|
||||||
ssize_t ret = write(fd, buf, count);
|
ssize_t ret = TEMP_FAILURE_RETRY(write(fd, buf, count));
|
||||||
|
if (ret < 0) return -1;
|
||||||
if (ret < 0) {
|
|
||||||
// Retry if interrupted
|
|
||||||
if (errno == EINTR) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Technically, write returning 0 is unusual (e.g., disk full); handle it if needed
|
|
||||||
if (ret == 0) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
buf += ret;
|
buf += ret;
|
||||||
total += ret;
|
total += ret;
|
||||||
count -= ret;
|
count -= ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
return total;
|
return total;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user