MCPcopy Create free account
hub / github.com/TheOfficialFloW/VitaShell / allocateReadFile

Function allocateReadFile

file.c:51–69  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

49const char symlink_header_bytes[SYMLINK_HEADER_SIZE] = {0xF1, 0x1E, 0x00, 0x00};
50
51int allocateReadFile(const char *file, void **buffer) {
52 SceUID fd = sceIoOpen(file, SCE_O_RDONLY, 0);
53 if (fd < 0)
54 return fd;
55
56 int size = sceIoLseek32(fd, 0, SCE_SEEK_END);
57 sceIoLseek32(fd, 0, SCE_SEEK_SET);
58
59 *buffer = malloc(size);
60 if (!*buffer) {
61 sceIoClose(fd);
62 return VITASHELL_ERROR_NO_MEMORY;
63 }
64
65 int read = sceIoRead(fd, *buffer, size);
66 sceIoClose(fd);
67
68 return read;
69}
70
71int ReadFile(const char *file, void *buf, int size) {
72 SceUID fd = sceIoOpen(file, SCE_O_RDONLY, 0);

Callers 4

readConfigFunction · 0.85
makeHeadBinFunction · 0.85
refreshNeededFunction · 0.85
refreshAppFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected