Changeset 8564

Show
Ignore:
Timestamp:
07/11/08 19:46:30
Author:
robert
Message:

From Joakim Simmonson,
"Opcodes.h:
* Added INVALID_OP as -1 in the Opcodes enum. Note that INVALID_OP is not an actual opcode defined in the OpenFlight? format. The purpose of INVALID_OP is to mark an opcode variable as invalid or uninitialized.

ReaderWriterFLT.cpp:
* The header node is returned if it exists, even if the file does not contain a node hierarchy. The old behaviour returned a ERROR_IN_READING_FILE error.
* Changed opcodes initialized to -1 to the new enum value INVALID_OP."

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • OpenSceneGraph/trunk/src/osgPlugins/OpenFlight/Opcodes.h

    r8003 r8564  
    2323namespace flt { 
    2424 
     25 
     26// Note that INVALID_OP = -1 is not an actual opcode defined in the OpenFlight format. 
     27// The purpose of INVALID_OP is to mark an opcode variable as invalid or uninitialized. 
    2528enum Opcodes 
    2629{ 
     30    INVALID_OP                          = -1, 
    2731    UNKNOWN_OP                          = 0, 
    2832    HEADER_OP                           = 1, 
  • OpenSceneGraph/trunk/src/osgPlugins/OpenFlight/ReaderWriterFLT.cpp

    r8295 r8564  
    8787/*! 
    8888 
    89 FLTReaderWriter supports importing and exporting OSG scene grqphs 
     89FLTReaderWriter supports importing and exporting OSG scene graphs 
    9090from/to OpenFlight files. 
    9191 
     
    285285 
    286286            const int RECORD_HEADER_SIZE = 4; 
    287             opcode_type continuationOpcode = -1
     287            opcode_type continuationOpcode = INVALID_OP
    288288            std::string continuationBuffer; 
    289289 
     
    300300                size_type   size   = (size_type)dataStream.readUInt16(); 
    301301 
     302                // If size == 0, an EOF has probably been reached, i.e. there is nothing  
     303                // more to read so we must return. 
    302304                if (size==0) 
    303                     return ReadResult::ERROR_IN_READING_FILE; 
     305                { 
     306                    // If a header was read, we return it. 
     307                    // This allows us handle files with empty hierarchies. 
     308                    if (document.getHeaderNode()) 
     309                    { 
     310                        return document.getHeaderNode(); 
     311                    } 
     312                    else // (no valid header) 
     313                    { 
     314                        return ReadResult::ERROR_IN_READING_FILE; 
     315                    } 
     316                } 
    304317 
    305318                // variable length record complete? 
     
    311324                    recordStream.readRecordBody(continuationOpcode, continuationBuffer.length(), document); 
    312325 
    313                     continuationOpcode = -1
     326                    continuationOpcode = INVALID_OP
    314327                    continuationBuffer.clear(); 
    315328                }