Logo Search packages:      
Sourcecode: qt4-x11 version File versions

void SegmentTermEnum::growBuffer ( const uint32_t  length  )  [private]

Instantiate a buffer of length length+1

Definition at line 358 of file SegmentTermEnum.cpp.

References buffer, and bufferLength.

Referenced by readTerm(), and seek().

      //Func - Instantiate a buffer of length length+1
      //Pre  - length > 0
      //Post - pre(buffer) has been deleted with its contents. A new buffer
      //       has been allocated of length length+1 and the text of term has been copied
      //       to buffer
            //todo: we could guess that we will need to re-grow this
            //buffer a few times...so start off with a reasonable grow
            if ( bufferLength > length )

        //Store the new bufferLength
            if ( length - bufferLength < LUCENE_SEGMENTTERMENUM_GROWSIZE )
                  bufferLength = length+LUCENE_SEGMENTTERMENUM_GROWSIZE;
                  bufferLength = length+1;

            bool copy = buffer==NULL;

            //Instantiate the new buffer + 1 is needed for terminator '\0'
            if ( buffer == NULL )
                  buffer = (TCHAR*)malloc(sizeof(TCHAR) * (bufferLength+1));
                  buffer = (TCHAR*)realloc(buffer, sizeof(TCHAR) * (bufferLength+1));

            if ( copy ){
                  //Copy the text of term into buffer

Generated by  Doxygen 1.6.0   Back to index