Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jul 24, 2006, 12:59:44 PM (18 years ago)
Author:
bensch
Message:

some newlines

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/terrain/src/lib/util/filesys/binary_file.cc

    r9414 r9415  
    4646                                        delete chunk;
    4747                                        return NULL;
    48                                 }       
     48                                }
    4949                                break;
    5050                        default:
     
    6464                        case 's':
    6565                                chunk->chunks[currChunk] = new DataSemantics();
    66                                 chunk->chunks[currChunk]->isTerminal = true;   
     66                                chunk->chunks[currChunk]->isTerminal = true;
    6767                                chunk->chunks[currChunk]->type = bytesize( *curr );
    68                                 chunk->chunks[currChunk]->totalSize = bytesize( *curr );                                               
     68                                chunk->chunks[currChunk]->totalSize = bytesize( *curr );
    6969                                currChunk++;
    7070                                break;
     
    8989                                *cp = '\0';
    9090                                chunk->chunks[currChunk] = compileSemantics( tmp );
    91                                 currChunk++;                                   
     91                                currChunk++;
    9292                                break;
    9393                        case ')':
     
    111111                                        delete[] tmp; delete chunk;
    112112                                        return NULL;
    113                                 }                               
     113                                }
    114114                                if ( currChunk ) {
    115115                                        chunk->chunks[currChunk-1]->quantifier = quantifier;
    116                                         chunk->chunks[currChunk-1]->totalSize*= quantifier;                                     
    117                                 }       
     116                                        chunk->chunks[currChunk-1]->totalSize*= quantifier;
     117                                }
    118118                                else {
    119119                                        printf( "Syntax error: Quantifier without a preceding type\n" );
     
    141141                switch( _comp->type ) {
    142142                        case TT_INT:
    143                                 iptr = (int*)ptr;                       
     143                                iptr = (int*)ptr;
    144144                                for ( int i = 0; i < _comp->quantifier; ++i ) {
    145145                                        swap32( iptr );
     
    152152                                        swap16( sptr );
    153153                                        sptr++;
    154                                 }                       
     154                                }
    155155                                break;
    156156                        case TT_BYTE:
     
    163163                                convert_data( _comp->chunks[i], ptr );
    164164                                ptr+= _comp->chunks[i]->totalSize;
    165                         }                       
    166                 }
    167 
    168         }       
    169 }
    170 void BinaryFile::read( const char *_semantics, int _chunks, 
     165                        }
     166                }
     167
     168        }
     169}
     170void BinaryFile::read( const char *_semantics, int _chunks,
    171171        void* _buf, size_t& _bytesRead )
    172172{
    173         pDataSemantics comp = compileSemantics( _semantics );           
     173        pDataSemantics comp = compileSemantics( _semantics );
    174174        fread( _buf, comp->totalSize, _chunks, this->handle() );
    175175        if ( byteorder != NATIVE_BYTEORDER ) {
    176176                for ( int i = 0; i < _chunks; ++i ) {
    177177                        convert_data( comp, (char*)_buf+i*comp->totalSize );
    178                 }       
    179         }       
     178                }
     179        }
    180180        _bytesRead = comp->totalSize*_chunks;
    181         delete comp;   
    182 }
    183 void BinaryFile::read( const char *_semantics, 
     181        delete comp;
     182}
     183void BinaryFile::read( const char *_semantics,
    184184        void* _buf, size_t& _bytesRead )
    185185{
    186         pDataSemantics comp = compileSemantics( _semantics );           
     186        pDataSemantics comp = compileSemantics( _semantics );
    187187        fread( _buf, comp->totalSize, 1, this->handle() );
    188        
     188
    189189        if ( byteorder != NATIVE_BYTEORDER ) {
    190190                convert_data( comp, _buf );
    191         }       
    192         delete comp;           
    193 }
    194 
    195 void BinaryFile::write( const char *_semantics, 
     191        }
     192        delete comp;
     193}
     194
     195void BinaryFile::write( const char *_semantics,
    196196        void* _buf, size_t& _bytesWritten )
    197197{
     
    199199        if ( byteorder != NATIVE_BYTEORDER ) {
    200200                convert_data( comp, _buf );
    201         }       
     201        }
    202202        _bytesWritten = comp->totalSize;
    203203        fwrite( _buf, comp->totalSize, 1, this->handle() );
Note: See TracChangeset for help on using the changeset viewer.