Changeset 39eb23b0 for libcfa/src


Ignore:
Timestamp:
Jan 14, 2026, 9:21:02 PM (2 weeks ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
master, stuck-waitfor-destruct
Children:
a2940184
Parents:
4904b05
Message:

for opening a file, change to default initialization of mode parameter from overloaded functions; fix fstream initialization bug by calling default constructor in other constructors

Location:
libcfa/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/fstream.cfa

    r4904b05 r39eb23b0  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Apr 14 20:41:51 2025
    13 // Update Count     : 583
     12// Last Modified On : Wed Jan 14 21:12:05 2026
     13// Update Count     : 596
    1414//
    1515
     
    6363// public
    6464void ?{}( ofstream & os ) { os.file$ = 0p; }
    65 void ?{}( ofstream & os, const char name[], const char mode[] ) { open( os, name, mode ); }
    66 void ?{}( ofstream & os, const char name[] ) { open( os, name, "w" ); }
     65void ?{}( ofstream & os, const char name[], const char mode[] ) { os{}; open( os, name, mode ); }
    6766void ^?{}( ofstream & os ) { close( os ); }
    6867
     
    124123                // abort | IO_MSG "open output file \"" | name | "\"" | nl | strerror( errno );
    125124        } // if
    126         (os){ file };                                                                           // initialize
     125        os{ file };                                                                                     // initialize
    127126} // open
    128127
    129 void open( ofstream & os, const char name[] ) { open( os, name, "w" ); }
     128//void open( ofstream & os, const char name[] ) { open( os, name, "w" ); }
    130129
    131130void close( ofstream & os ) with( os ) {
     
    309308        ifstream_data.fail = fail;
    310309        ifstream_data.open = (void(*)(ifstream &, const char *, const char *))open;
    311         ifstream_data.open = (void(*)(ifstream &, const char *))open;
     310//      ifstream_data.open = (void(*)(ifstream &, const char *))open;
    312311        ifstream_data.close = close;
    313312        ifstream_data.read = read;
     
    324323// public
    325324void ?{}( ifstream & is ) { is.file$ = 0p; }
    326 void ?{}( ifstream & is, const char name[], const char mode[] ) { open( is, name, mode ); }
    327 void ?{}( ifstream & is, const char name[] ) { open( is, name, "r" ); }
     325void ?{}( ifstream & is, const char name[], const char mode[] ) { is{}; open( is, name, mode ); }
    328326void ^?{}( ifstream & is ) { close( is ); }
    329327
     
    336334bool eof( ifstream & is ) { return feof( (FILE *)(is.file$) ) != 0; }
    337335
    338 void open( ifstream & is, const char name[], const char mode[] ) {
     336void open( ifstream & is, const char name[], const char mode[] = "r" ) {
    339337        FILE * file;
    340338    for ( cnt; 10 ) {
     
    348346                // abort | IO_MSG "open input file \"" | name | "\"" | nl | strerror( errno );
    349347        } // if
    350         (is){ file };                                                                           // initialize
     348        is{ file };                                                                                     // initialize
    351349} // open
    352350
    353 void open( ifstream & is, const char name[] ) { open( is, name, "r" ); }
     351//void open( ifstream & is, const char name[] ) { open( is, name, "r" ); }
    354352
    355353void close( ifstream & is ) with( is ) {
  • libcfa/src/fstream.hfa

    r4904b05 r39eb23b0  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Apr 14 20:42:01 2025
    13 // Update Count     : 276
     12// Last Modified On : Wed Jan 14 21:11:16 2026
     13// Update Count     : 280
    1414//
    1515
     
    7878void clearerr( ofstream & );
    7979int flush( ofstream & );
    80 void open( ofstream &, const char name[], const char mode[] ); // FIX ME: use default = "w"
    81 void open( ofstream &, const char name[] );
     80void open( ofstream &, const char name[], const char mode[] = "w" );
    8281void close( ofstream & );
    8382
     
    8584
    8685void ?{}( ofstream & );
    87 void ?{}( ofstream &, const char name[], const char mode[] ); // FIX ME: use default = "w"
    88 void ?{}( ofstream &, const char name[] );
     86void ?{}( ofstream &, const char name[], const char mode[] = "w" );
    8987void ^?{}( ofstream & );
    9088
     
    127125bool fail( ifstream & is );
    128126void clearerr( ifstream & );
    129 void open( ifstream & is, const char name[], const char mode[] ); // FIX ME: use default = "r"
    130 void open( ifstream & is, const char name[] );
     127void open( ifstream & is, const char name[], const char mode[] = "r" );
    131128void close( ifstream & is );
    132129ifstream & read( ifstream & is, char data[], size_t size );
    133130
    134131void ?{}( ifstream & is );
    135 void ?{}( ifstream & is, const char name[], const char mode[] ); // FIX ME: use default = "r"
    136 void ?{}( ifstream & is, const char name[] );
     132void ?{}( ifstream & is, const char name[], const char mode[] = "r" );
    137133void ^?{}( ifstream & is );
    138134
Note: See TracChangeset for help on using the changeset viewer.