===================================================================== Found a 141 line (462 tokens) duplication in the following files: Starting at line 121 of /home/tom/tmp/mute/MUTE_fileSharing-0.1-rc5_UnixSource/MUTE/userInterface/textBased/textMUTE.cpp Starting at line 128 of /home/tom/tmp/mute/MUTE_fileSharing-0.1-rc5_UnixSource/MUTE/layers/pointToPoint/test/testPointToPoint.cpp return false; } char returnValue = false; SimpleVector *tokens = tokenizeString( inMessage ); // second token is message type int numTokens = tokens->size(); if( numTokens > 2 ) { char *messageType = *( tokens->getElement( 1 ) ); if( strcmp( messageType, "Chat" ) == 0 ) { char *pointerToBody = strstr( inMessage, "Body:" ); recentMessageLock->lock(); if( pointerToBody != NULL ) { // skip the body tag pointerToBody = &( pointerToBody[ strlen( "Body:" ) ] ); recentMessages->push_back( stringDuplicate( pointerToBody ) ); } else { // body not found recentMessages->push_back( stringDuplicate( "[missing body]" ) ); } recentContacts->push_back( stringDuplicate( inFromContact ) ); returnValue = true; recentMessageLock->unlock(); messageReadySemaphore->signal(); } } for( int i=0; igetElement( i ) ); } delete tokens; return returnValue; } class MessagePrintingThread : public Thread { public: MessagePrintingThread() : mStopLock( new MutexLock() ), mStopped( false ) { } ~MessagePrintingThread() { delete mStopLock; } void stop() { mStopLock->lock(); mStopped = true; mStopLock->unlock(); } // implements the Thread interface void run(); protected: char isStopped() { mStopLock->lock(); char stopped = mStopped; mStopLock->unlock(); return stopped; } MutexLock *mStopLock; char mStopped; }; void MessagePrintingThread::run() { while( !isStopped() ) { // wait for a message to be ready messageReadySemaphore->wait(); // semaphore also signaled when we need to stop if( !isStopped() ) { recentMessageLock->lock(); int numMessages = recentMessages->size(); // print one message, if there is one if( numMessages > 0 ) { char *message = *( recentMessages->getElement( 0 ) ); char *from = *( recentContacts->getElement( 0 ) ); if( mostRecentContact != NULL ) { delete [] mostRecentContact; } mostRecentContact = stringDuplicate( from ); printMessageLock->lock(); printf( "\n[ %s ]: %s\n", from, message ); // print a fresh prompt printf( "> " ); fflush( stdout ); printMessageLock->unlock(); delete [] from; delete [] message; recentMessages->deleteElement( 0 ); recentContacts->deleteElement( 0 ); } recentMessageLock->unlock(); } } } int main() { ===================================================================== Found a 74 line (232 tokens) duplication in the following files: Starting at line 65 of /home/tom/tmp/mute/MUTE_fileSharing-0.1-rc5_UnixSource/MUTE/userInterface/fileTransferWebInterface/test/testWebServer.cpp Starting at line 72 of /home/tom/tmp/mute/MUTE_fileSharing-0.1-rc5_UnixSource/MUTE/layers/fileTransfer/test/testFileTransfer.cpp readChars->push_back( (char)readInt ); readInt = getc( stdin ); } char *readLine = readChars->getElementString(); delete readChars; return readLine; } int readUserInt( char *inPrompt ) { int readInt; int numRead = 0; while( numRead != 1 ) { printf( inPrompt ); fflush( stdout ); numRead = scanf( "%d", &readInt ); } return readInt; } // callback for incoming files void fileHandler( unsigned char *inChunk, int inChunkLengthInBytes, void *inExtraParam ) { // extra param is file stream FILE *outputFile = (FILE *)inExtraParam; fwrite( inChunk, 1, inChunkLengthInBytes, outputFile ); printf( "." ); fflush( stdout ); } int main() { char *randomSeed = SettingsManager::getStringSetting( "randomSeed" ); if( randomSeed == NULL ) { randomSeed = readUserString( "Enter some randomness: " ); } else { printf( "Using randomness saved from last time\n" ); } muteSeedRandomGenerator( randomSeed ); delete [] randomSeed; char valueFound; int portNumber = SettingsManager::getIntSetting( "port", &valueFound ); if( ! valueFound ) { portNumber = readUserInt( "Enter port number to listen on: " ); SettingsManager::setSetting( "port", portNumber ); } ===================================================================== Found a 18 line (218 tokens) duplication in the following files: Starting at line 344 of /home/tom/tmp/mute/MUTE_fileSharing-0.1-rc5_UnixSource/MUTE/crypto/des.cpp Starting at line 381 of /home/tom/tmp/mute/MUTE_fileSharing-0.1-rc5_UnixSource/MUTE/crypto/des.cpp work = r ^ kptr[4*i+1]; l ^= Spbox[7][(work) & 0x3f] ^ Spbox[5][(work >> 8) & 0x3f] ^ Spbox[3][(work >> 16) & 0x3f] ^ Spbox[1][(work >> 24) & 0x3f]; work = rotrFixed(l, 4U) ^ kptr[4*i+2]; r ^= Spbox[6][(work) & 0x3f] ^ Spbox[4][(work >> 8) & 0x3f] ^ Spbox[2][(work >> 16) & 0x3f] ^ Spbox[0][(work >> 24) & 0x3f]; work = l ^ kptr[4*i+3]; r ^= Spbox[7][(work) & 0x3f] ^ Spbox[5][(work >> 8) & 0x3f] ^ Spbox[3][(work >> 16) & 0x3f] ^ Spbox[1][(work >> 24) & 0x3f]; } ===================================================================== Found a 19 line (187 tokens) duplication in the following files: Starting at line 197 of /home/tom/tmp/mute/MUTE_fileSharing-0.1-rc5_UnixSource/MUTE/crypto/sha.cpp Starting at line 125 of /home/tom/tmp/mute/MUTE_fileSharing-0.1-rc5_UnixSource/MUTE/crypto/sha.cpp R( 0); R( 1); R( 2); R( 3); R( 4); R( 5); R( 6); R( 7); R( 8); R( 9); R(10); R(11); R(12); R(13); R(14); R(15); } /* Add the working vars back into context.state[] */ state[0] += a(0); state[1] += b(0); state[2] += c(0); state[3] += d(0); state[4] += e(0); state[5] += f(0); state[6] += g(0); state[7] += h(0); /* Wipe variables */ memset(W, 0, sizeof(W)); memset(T, 0, sizeof(T)); } ===================================================================== Found a 34 line (172 tokens) duplication in the following files: Starting at line 405 of /home/tom/tmp/mute/MUTE_fileSharing-0.1-rc5_UnixSource/MUTE/otherApps/fileSharing/userInterface/textBased/textFileSharingMUTE.cpp Starting at line 574 of /home/tom/tmp/mute/MUTE_fileSharing-0.1-rc5_UnixSource/MUTE/otherApps/fileSharing/userInterface/wxWindows/GuiApp.cpp // change the default log level int newLogLevel = -1; if( strcmp( logLevelString, "DEACTIVATE_LEVEL" ) == 0 ) { newLogLevel = Log::DEACTIVATE_LEVEL; } else if( strcmp( logLevelString, "CRITICAL_ERROR_LEVEL" ) == 0 ) { newLogLevel = Log::CRITICAL_ERROR_LEVEL; } else if( strcmp( logLevelString, "ERROR_LEVEL" ) == 0 ) { newLogLevel = Log::ERROR_LEVEL; } else if( strcmp( logLevelString, "WARNING_LEVEL" ) == 0 ) { newLogLevel = Log::WARNING_LEVEL; } else if( strcmp( logLevelString, "INFO_LEVEL" ) == 0 ) { newLogLevel = Log::INFO_LEVEL; } else if( strcmp( logLevelString, "DETAIL_LEVEL" ) == 0 ) { newLogLevel = Log::DETAIL_LEVEL; } else if( strcmp( logLevelString, "TRACE_LEVEL" ) == 0 ) { newLogLevel = Log::TRACE_LEVEL; } if( newLogLevel != -1 ) { AppLog::setLoggingLevel( newLogLevel ); } delete [] logLevelString; } ===================================================================== Found a 39 line (150 tokens) duplication in the following files: Starting at line 460 of /home/tom/tmp/mute/MUTE_fileSharing-0.1-rc5_UnixSource/MUTE/crypto/integer.cpp Starting at line 409 of /home/tom/tmp/mute/MUTE_fileSharing-0.1-rc5_UnixSource/MUTE/crypto/integer.cpp ===================================================================== Found a 33 line (137 tokens) duplication in the following files: Starting at line 48 of /home/tom/tmp/mute/MUTE_fileSharing-0.1-rc5_UnixSource/MUTE/common/AESEncryptor.cpp Starting at line 48 of /home/tom/tmp/mute/MUTE_fileSharing-0.1-rc5_UnixSource/MUTE/common/AESDecryptor.cpp // use passed-in IV HexDecoder ivDecoder; ivDecoder.Put( (byte *)inInitializationVector, strlen( inInitializationVector ) ); ivDecoder.MessageEnd(); int decodedIVLength = ivDecoder.MaxRetrievable(); if( decodedIVLength == decodedKeyLength ) { ivPassedIn = true; iv = new unsigned char[ decodedIVLength ]; ivDecoder.Get( (byte *)iv, decodedIVLength ); } else { // iv not the same length as key ivPassedIn = false; } } if( !ivPassedIn ){ // make all-zero IV that is same length as key iv = new unsigned char[ decodedKeyLength ]; for( int i=0; i> 3) & (blockSize-1); if (num != 0) { if ((num+len) >= blockSize) { memcpy((byte *)data.ptr+num, input, blockSize-num); HashBlock(data); input += (blockSize-num); len-=(blockSize - num); num=0; // drop through and do the rest } else { memcpy((byte *)data.ptr+num, input, len); return; } } // we now can process the input data in blocks of blockSize // chars and save the leftovers to this->data. if (len >= blockSize) { ===================================================================== Found a 22 line (115 tokens) duplication in the following files: Starting at line 289 of /home/tom/tmp/mute/MUTE_fileSharing-0.1-rc5_UnixSource/MUTE/layers/pointToPoint/pointToPointCommunicator.cpp Starting at line 485 of /home/tom/tmp/mute/MUTE_fileSharing-0.1-rc5_UnixSource/MUTE/layers/pointToPoint/pointToPointCommunicator.cpp char *mapFileName = autoSprintf( "%s.mva", inContactName ); File *mapFile = subDir->getChildFile( mapFileName ); delete [] mapFileName; char *oldMapFileName = autoSprintf( "%s.old.mva", inContactName ); File *oldMapFile = subDir->getChildFile( oldMapFileName ); delete [] oldMapFileName; // .mvt = "MUTE Virtual address timeout" char *timeoutFileName = autoSprintf( "%s.mvt", inContactName ); File *timeoutFile = subDir->getChildFile( timeoutFileName ); delete [] timeoutFileName; delete subDir; if( mapFile != NULL && oldMapFile != NULL && timeoutFile != NULL ) { // stop receiving on our two most recent addresses if( mapFile->exists() ) { ===================================================================== Found a 38 line (114 tokens) duplication in the following files: Starting at line 89 of /home/tom/tmp/mute/MUTE_fileSharing-0.1-rc5_UnixSource/MUTE/crypto/testAESEncrypt.cpp Starting at line 89 of /home/tom/tmp/mute/MUTE_fileSharing-0.1-rc5_UnixSource/MUTE/crypto/testAESDecrypt.cpp charReadAsInt = getc( messageFile ); } fclose( messageFile ); fclose( outputFile ); delete [] oneCharOutputString; delete [] oneCharInputString; } delete [] keyBuffer; delete [] iv; } void usage( char *inAppName ) { printf( "Usage:\n" ); printf( "\t%s key_file message_file output_file\n", inAppName ); printf( "Example:\n" ); printf( "\t%s test.key message.txt output.txt \n", inAppName ); exit( 1 ); } int main( char inNumArgs, char **inArgs ) { if( inNumArgs != 4 ) { usage( inArgs[0] ); } ===================================================================== Found a 24 line (109 tokens) duplication in the following files: Starting at line 1381 of /home/tom/tmp/mute/MUTE_fileSharing-0.1-rc5_UnixSource/MUTE/otherApps/fileSharing/fileShare.cpp Starting at line 948 of /home/tom/tmp/mute/MUTE_fileSharing-0.1-rc5_UnixSource/MUTE/layers/fileTransfer/fileTransmitter.cpp // is this the chunk we're looking for? if( fileChunk->mChunkNumber == chunkNumber ) { char *lengthString = *( tokens->getElement( 7 ) ); // default to 0 int length = 0; sscanf( lengthString, "%d", &length ); fileChunk->mLengthInBytes = length; char *encodedData = *( tokens->getElement( 9 ) ); int dataLength; unsigned char *decodedData = base64Decode( encodedData, &dataLength ); if( decodedData != NULL ) { if( dataLength == length ) { fileChunk->mChunkData = decodedData; fileChunk->mSemaphore->signal(); ===================================================================== Found a 24 line (104 tokens) duplication in the following files: Starting at line 133 of /home/tom/tmp/mute/MUTE_fileSharing-0.1-rc5_UnixSource/MUTE/otherApps/fileSharing/userInterface/wxWindows/SettingsPanel.cpp Starting at line 168 of /home/tom/tmp/mute/MUTE_fileSharing-0.1-rc5_UnixSource/MUTE/otherApps/fileSharing/userInterface/wxWindows/SettingsPanel.cpp 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL, 0 ); gridSizer->Add( new wxStaticText( this, -1, "" ), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL, 0 ); gridSizer->Add( new wxStaticText( this, -1, "(-1 for no limit)" ), 0, wxALIGN_CENTER, 0 ); gridSizer->Add( new wxStaticText( this, -1, "" ), 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL, 0 ); ===================================================================== Found a 23 line (102 tokens) duplication in the following files: Starting at line 196 of /home/tom/tmp/mute/MUTE_fileSharing-0.1-rc5_UnixSource/MUTE/crypto/nbtheory.cpp Starting at line 223 of /home/tom/tmp/mute/MUTE_fileSharing-0.1-rc5_UnixSource/MUTE/crypto/nbtheory.cpp { if (n <= 1) return false; if (n.IsEven()) return n==2; assert(n>2); Integer b=3; unsigned int i=0; int j; while ((j=Jacobi(b.Squared()-4, n)) == 1) { if (++i==64 && n.IsSquare()) // avoid infinite loop if n is a square return false; ++b; ++b; } if (j==0) return false; That took 1651 milliseconds