Changeset 523
- Timestamp:
- 07/03/16 17:36:35 (8 years ago)
- Location:
- cpp
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
cpp/common/stl-util.cpp
r460 r523 77 77 bool ok = false; 78 78 #ifdef USE_VIRTFILE 79 if (!isAbsolutePath(filename))79 // if (!isAbsolutePath(filename)) 80 80 { 81 81 VirtFILE *f=Vfopen(filename,FOPEN_READ_BINARY); … … 89 89 } 90 90 } 91 else91 // else 92 92 #endif 93 93 { … … 120 120 bool writeCompleteFile(const char* filename, const string& text, bool warn_on_fail) 121 121 { 122 #ifdef USE_VIRTFILE 123 VirtFILE *f = Vfopen(filename, FOPEN_WRITE_BINARY); 124 bool ok = f != NULL; 125 if (f) 126 { 127 int zapisane = f->Vwrite(text.c_str(), text.length(), 1); 128 delete f; 129 ok &= zapisane == 1; 130 } 131 #else 122 132 MFILE *f = mfopen(filename, FOPEN_WRITE_BINARY); 123 133 bool ok = f != NULL; … … 128 138 ok &= zapisane == 1; 129 139 } 140 #endif 130 141 if (warn_on_fail && !ok) 131 logPrintf("stl-util", "writeCompleteFile", LOG_WARN, " couldn't write file '%s'", filename);142 logPrintf("stl-util", "writeCompleteFile", LOG_WARN, "Couldn't write file '%s'", filename); 132 143 return ok; 133 144 } -
cpp/common/virtfile/virtfile.h
r427 r523 136 136 DLLEXP bool Vdirexists(const char* path, bool is_writable); 137 137 138 #ifdef VIRTFILE_OVERLOADING 139 //may be needed for redefine... or if someone simply prefers overloading ;-) 140 138 141 DLLEXP int fread(void *ptr, size_t size, size_t nmemb, VirtFILE* f); 139 142 DLLEXP int fwrite(const void *ptr, size_t size, size_t nmemb, VirtFILE* f); 140 141 143 142 144 //since we want our own feof(VirtFILE*) function and some systems unfortunately define feof as a macro, we need to #undef it. Same as in virtfile.cpp … … 174 176 DLLEXP int closedir(VirtDIR* d); 175 177 178 #endif //VIRTFILE_OVERLOADING 179 176 180 #endif 177 -
cpp/frams/param/multiparamload.cpp
r413 r523 66 66 if (file && ownfile) 67 67 { 68 fclose(file);68 delete file; 69 69 file=0; 70 70 } … … 258 258 { 259 259 VirtFILE *f; 260 while(f=popstack()) fclose(f);260 while(f=popstack()) delete f; 261 261 } 262 262 … … 264 264 { 265 265 if (!filestack.size()) return false; 266 if (file) fclose(file);266 if (file) delete file; 267 267 file=popstack(); 268 268 return true; -
cpp/frams/param/param.cpp
r483 r523 25 25 int z; 26 26 char last_char = 0; 27 while ((z = f getc(f)) != EOF)27 while ((z = f->Vgetc()) != EOF) 28 28 { 29 29 if (z == '~') … … 267 267 if ((altname == NULL) || (altname[0] != 0)) 268 268 { 269 err |= (f puts(altname ? altname : getName(), f) == EOF);270 err |= (f puts(":\n", f) == EOF);269 err |= (f->Vputs(altname ? altname : getName()) == EOF); 270 err |= (f->Vputs(":\n") == EOF); 271 271 withname = true; 272 272 } … … 274 274 err |= saveprop(f, i, p, force); 275 275 if (withname) 276 err |= (f puts("\n", f) == EOF);276 err |= (f->Vputs("\n") == EOF); 277 277 return err; 278 278 } … … 290 290 int err = 0, cr; 291 291 292 err |= (f puts(p, f) == EOF); fputc(':', f);292 err |= (f->Vputs(p) == EOF); f->Vputc(':'); 293 293 cr = 0; 294 294 if ((*typ == 'x') || (*typ == 'o')) … … 304 304 if (ws.len() > 50) cr = 1; 305 305 else for (t = w; *t; t++) if ((*t == 10) || (*t == 13)) { cr = 1; break; } 306 if (cr) f puts("~\n", f);307 err |= (f puts(w, f) == EOF);308 err |= (f puts(cr ? "~\n" : "\n", f) == EOF);306 if (cr) f->Vputs("~\n"); 307 err |= (f->Vputs(w) == EOF); 308 err |= (f->Vputs(cr ? "~\n" : "\n") == EOF); 309 309 return err; 310 310 } … … 464 464 } 465 465 removeCR(s); 466 int ch; while ((ch = f getc(f)) != EOF) if (ch == '\n') break;466 int ch; while ((ch = f->Vgetc()) != EOF) if (ch == '\n') break; 467 467 unquoteTilde(s); 468 468 if (linenum && (flags(i)&PARAM_LINECOMMENT)) … … 501 501 (*linenum) += lfcount; 502 502 } 503 int ch; while ((ch = f getc(f)) != EOF) if (ch == '\n') break;503 int ch; while ((ch = f->Vgetc()) != EOF) if (ch == '\n') break; 504 504 } 505 505 } -
cpp/frams/util/sstringutils.cpp
r512 r523 16 16 loadSString(f, s); 17 17 ret = 1; 18 fclose(f);18 delete f; 19 19 } 20 20 else if (framsgmodule) … … 29 29 while (!f->Veof()) 30 30 { 31 len = f read(buf, 1, sizeof(buf), f);31 len = f->Vread(buf, 1, sizeof(buf)); 32 32 s.append(buf, len); 33 33 } … … 44 44 while (!eolfound) 45 45 { 46 char *r = f gets(buf, sizeof(buf), f);46 char *r = f->Vgets(buf, sizeof(buf)); 47 47 if (r == NULL) break; 48 48 ret = true; -
cpp/frams/vm/framscript.y
r489 r523 149 149 150 150 asmlines: /* empty */ 151 | ASMLINE { fputs(str($1),trctx.out);fputc('\n',trctx.out);}152 | asmlines ASMLINE { fputs(str($2),trctx.out);fputc('\n',trctx.out);}151 | ASMLINE {trctx.out->Vputs(str($1));trctx.out->Vputc('\n');} 152 | asmlines ASMLINE {trctx.out->Vputs(str($2));trctx.out->Vputc('\n');} 153 153 ; 154 154
Note: See TracChangeset
for help on using the changeset viewer.