add binary mode flag to fopen calls
This commit is contained in:
parent
1db746ea77
commit
6239e2f2dd
@ -528,7 +528,7 @@ static void onJIT(Body* body, u8* binEx, u64 sz) {
|
|||||||
#if USE_PERF
|
#if USE_PERF
|
||||||
if (!perf_map) {
|
if (!perf_map) {
|
||||||
B s = m_c8vec_0("/tmp/perf-"); AFMT("%l.map", getpid());
|
B s = m_c8vec_0("/tmp/perf-"); AFMT("%l.map", getpid());
|
||||||
perf_map = file_open(s, "open", "wa");
|
perf_map = file_open(s, "open", "wab");
|
||||||
printsB(s); printf(": map\n");
|
printsB(s); printf(": map\n");
|
||||||
dec(s);
|
dec(s);
|
||||||
}
|
}
|
||||||
@ -609,7 +609,7 @@ Nvm_res m_nvm(Body* body) {
|
|||||||
u32* origBC = body->bc;
|
u32* origBC = body->bc;
|
||||||
u32 bodyOff = origBC - (u32*)body->bl->bc;
|
u32 bodyOff = origBC - (u32*)body->bl->bc;
|
||||||
#if STORE_JIT_MAP
|
#if STORE_JIT_MAP
|
||||||
if (!jit_map) jit_map = fopen("cbqn-jit.bqn", "wa");
|
if (!jit_map) jit_map = fopen("cbqn-jit.bqn", "wab");
|
||||||
fprintf(jit_map, "{\n");
|
fprintf(jit_map, "{\n");
|
||||||
print_jit_line(body, NULL, body->bl->map[bodyOff]);
|
print_jit_line(body, NULL, body->bl->map[bodyOff]);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -61,7 +61,7 @@ I8Arr* stream_bytes(FILE* f) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
I8Arr* path_bytes(B path) { // consumes
|
I8Arr* path_bytes(B path) { // consumes
|
||||||
FILE* f = file_open(path, "read", "r");
|
FILE* f = file_open(path, "read", "rb");
|
||||||
int seekRes = fseek(f, 0, SEEK_END);
|
int seekRes = fseek(f, 0, SEEK_END);
|
||||||
I8Arr* src;
|
I8Arr* src;
|
||||||
if (seekRes==-1) {
|
if (seekRes==-1) {
|
||||||
@ -217,7 +217,7 @@ void free_chars(CharBuf b) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void path_wChars(B path, B x) { // consumes path
|
void path_wChars(B path, B x) { // consumes path
|
||||||
FILE* f = file_open(path, "write to", "w");
|
FILE* f = file_open(path, "write to", "wb");
|
||||||
|
|
||||||
u64 len = utf8lenB(x);
|
u64 len = utf8lenB(x);
|
||||||
TALLOC(char, val, len);
|
TALLOC(char, val, len);
|
||||||
@ -241,7 +241,7 @@ void file_wBytes(FILE* f, B name, B x) {
|
|||||||
free_chars(buf);
|
free_chars(buf);
|
||||||
}
|
}
|
||||||
void path_wBytes(B path, B x) { // consumes path
|
void path_wBytes(B path, B x) { // consumes path
|
||||||
FILE* f = file_open(path, "write to", "w");
|
FILE* f = file_open(path, "write to", "wb");
|
||||||
file_wBytes(f, path, x);
|
file_wBytes(f, path, x);
|
||||||
fclose(f);
|
fclose(f);
|
||||||
dec(path);
|
dec(path);
|
||||||
@ -433,7 +433,7 @@ static u8 types_val[] = {
|
|||||||
|
|
||||||
void cbqn_heapDump(char* name0) {
|
void cbqn_heapDump(char* name0) {
|
||||||
char* name = name0==NULL? "CBQNHeapDump" : name0;
|
char* name = name0==NULL? "CBQNHeapDump" : name0;
|
||||||
FILE* f = fopen(name, "w");
|
FILE* f = fopen(name, "wb");
|
||||||
if (f==NULL) {
|
if (f==NULL) {
|
||||||
fprintf(stderr, "Failed to dump heap - could not open file for writing\n");
|
fprintf(stderr, "Failed to dump heap - could not open file for writing\n");
|
||||||
return;
|
return;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user