From: <sv...@va...> - 2008-06-29 15:07:01
|
Author: de Date: 2008-06-29 16:07:04 +0100 (Sun, 29 Jun 2008) New Revision: 440 Log: trivial white-space mods Modified: trunk/valkyrie/core/memcheck_object.cpp trunk/valkyrie/main.cpp trunk/valkyrie/options/options_widgets.cpp trunk/valkyrie/options/valgrind_options_page.cpp trunk/valkyrie/options/vk_option.cpp trunk/valkyrie/vk_config.cpp trunk/valkyrie/vk_utils.cpp Modified: trunk/valkyrie/core/memcheck_object.cpp =================================================================== --- trunk/valkyrie/core/memcheck_object.cpp 2008-06-28 18:56:26 UTC (rev 439) +++ trunk/valkyrie/core/memcheck_object.cpp 2008-06-29 15:07:04 UTC (rev 440) @@ -57,7 +57,7 @@ connect( m_logpoller, SIGNAL(logUpdated()), this, SLOT(readVgLog()) ); - /* these opts should be kept in exactly the same order as valgrind + /* these opts should be kept in exactly the same order as valgrind outputs them, as it makes keeping up-to-date a lot easier. */ addOpt( LEAK_CHECK, VkOPTION::ARG_STRING, VkOPTION::WDG_COMBO, "memcheck", '\0', "leak-check", Modified: trunk/valkyrie/main.cpp =================================================================== --- trunk/valkyrie/main.cpp 2008-06-28 18:56:26 UTC (rev 439) +++ trunk/valkyrie/main.cpp 2008-06-29 15:07:04 UTC (rev 440) @@ -125,10 +125,10 @@ QString toolname = vkConfig->rdEntry("tool", "valgrind"); ToolObjList tools = valkyrie.valgrind()->toolObjList(); for ( ToolObject* tool=tools.first(); tool; tool=tools.next() ) { - if ( tool->name() == toolname ) { - vkWin->showToolView( tool->objId() ); - break; - } + if ( tool->name() == toolname ) { + vkWin->showToolView( tool->objId() ); + break; + } } } Modified: trunk/valkyrie/options/options_widgets.cpp =================================================================== --- trunk/valkyrie/options/options_widgets.cpp 2008-06-28 18:56:26 UTC (rev 439) +++ trunk/valkyrie/options/options_widgets.cpp 2008-06-29 15:07:04 UTC (rev 440) @@ -72,11 +72,11 @@ void OptionWidget::setEnabled( bool enable ) { - if ( m_wLabel != 0 ) - m_wLabel->setEnabled( enable ); - if ( m_widg != 0 ) { - m_widg->setEnabled( enable ); - } + if ( m_wLabel != 0 ) + m_wLabel->setEnabled( enable ); + if ( m_widg != 0 ) { + m_widg->setEnabled( enable ); + } } Modified: trunk/valkyrie/options/valgrind_options_page.cpp =================================================================== --- trunk/valkyrie/options/valgrind_options_page.cpp 2008-06-28 18:56:26 UTC (rev 439) +++ trunk/valkyrie/options/valgrind_options_page.cpp 2008-06-29 15:07:04 UTC (rev 440) @@ -257,7 +257,7 @@ /* These widgets are disabled because Valkyrie uses --log-file-exactly internally: logging options would interfere with this. */ - // error reporting tab + // error reporting tab m_itemList[Valgrind::LOG_FD ]->setEnabled( false ); m_itemList[Valgrind::LOG_FILE ]->setEnabled( false ); m_itemList[Valgrind::LOG_SOCKET ]->setEnabled( false ); Modified: trunk/valkyrie/options/vk_option.cpp =================================================================== --- trunk/valkyrie/options/vk_option.cpp 2008-06-28 18:56:26 UTC (rev 439) +++ trunk/valkyrie/options/vk_option.cpp 2008-06-29 15:07:04 UTC (rev 440) @@ -272,7 +272,7 @@ } /* ARG_UINT options */ - if (m_argType == VkOPTION::ARG_UINT) { + if ( m_argType == VkOPTION::ARG_UINT ) { /* except don't test cachegrind's horrible cache options */ bool dontTest = ( m_configGroup == "cachegrind" && ( m_longFlag == "I1" || Modified: trunk/valkyrie/vk_config.cpp =================================================================== --- trunk/valkyrie/vk_config.cpp 2008-06-28 18:56:26 UTC (rev 439) +++ trunk/valkyrie/vk_config.cpp 2008-06-29 15:07:04 UTC (rev 440) @@ -34,38 +34,38 @@ called by user from menu 'Options::Save as Default' ---------------------- */ bool VkConfig::sync( Valkyrie* vk ) { - if ( !m_dirty ) - return true; + if ( !m_dirty ) + return true; - /* read config file from disk, and fill the temporary structure - with entries from the file */ - EntryMap rcMap; - if ( !parseFile( vk, rcMap )) { - VK_DEBUG( "failed to parse config file" ); - return false; - } + /* read config file from disk, and fill the temporary structure + with entries from the file */ + EntryMap rcMap; + if ( !parseFile( vk, rcMap )) { + VK_DEBUG( "failed to parse config file" ); + return false; + } - /* augment this structure with the dirty entries from the - config object */ - EntryMapIterator aIt; - for ( aIt = m_EntryMap.begin(); aIt != m_EntryMap.end(); ++aIt) { - const EntryData &dirtyEntry = aIt.data(); - if ( !dirtyEntry.mDirty ) - continue; - /* put dirty entries from the config object into the temporary map. - if the entry exists, replaces the data - if is a new entry (i.e old rc file), insert new key:data */ - rcMap.insert( aIt.key(), dirtyEntry ); - } + /* augment this structure with the dirty entries from the + config object */ + EntryMapIterator aIt; + for ( aIt = m_EntryMap.begin(); aIt != m_EntryMap.end(); ++aIt) { + const EntryData &dirtyEntry = aIt.data(); + if ( !dirtyEntry.mDirty ) + continue; + /* put dirty entries from the config object into the temporary map. + if the entry exists, replaces the data + if is a new entry (i.e old rc file), insert new key:data */ + rcMap.insert( aIt.key(), dirtyEntry ); + } - /* write out updated config */ - if ( !writeConfig( rcMap ) ) { - VK_DEBUG( "failed to write updated config file" ); - return false; - } + /* write out updated config */ + if ( !writeConfig( rcMap ) ) { + VK_DEBUG( "failed to write updated config file" ); + return false; + } - m_dirty = false; - return true; + m_dirty = false; + return true; } @@ -453,12 +453,12 @@ VK_DEBUG( "failed to backup rc file" ); return; } - if ( !QFile::exists(m_rcFileName) ) { + if ( !QFile::exists(m_rcFileName) ) { /* not much we can do about that... */ VK_DEBUG( "no rc file to backup!" ); - return; - } - if ( !QDir().rename( m_rcFileName, bakfile ) ) { + return; + } + if ( !QDir().rename( m_rcFileName, bakfile ) ) { /* oh well... */ VK_DEBUG( "rename failed: couldn't backup rc file" ); return; @@ -472,29 +472,29 @@ { QFile rFile( m_rcFileName ); if ( !rFile.open( IO_ReadOnly ) ) { - /* Error: Failed to open file. */ - vkError( 0, "Parsing Config File", + /* Error: Failed to open file. */ + vkError( 0, "Parsing Config File", "<p>Failed to open config file '%s' for reading.<br>" "%s cannot run without this file.</p>", m_rcFileName.latin1(), vkName() ); return false; } - /* beam me up, scotty */ - QTextStream stream( &rFile ); - EntryMap fileMap = parseConfigToMap( stream ); - rFile.close(); + /* beam me up, scotty */ + QTextStream stream( &rFile ); + EntryMap fileMap = parseConfigToMap( stream ); + rFile.close(); QString defaultConfig = mkConfigDefaults( vk ); QTextStream strm( &defaultConfig, IO_ReadOnly ); EntryMap defaultMap = parseConfigToMap( strm ); - /* Check for correct rc version number - - if mismatch, print warning, update entries */ - QString vk_ver_rc = fileMap[ EntryKey( "valkyrie", "version" ) ].mValue; - QString vk_ver = vkVersion(); + /* Check for correct rc version number + - if mismatch, print warning, update entries */ + QString vk_ver_rc = fileMap[ EntryKey( "valkyrie", "version" ) ].mValue; + QString vk_ver = vkVersion(); - if (vk_ver_rc != vk_ver) { /* Version mismatch - fix rc file */ + if (vk_ver_rc != vk_ver) { /* Version mismatch - fix rc file */ vkInfo( 0, "Parsing Config File", "<p>Valkyrie version mismatch<br/>" "Config file: %s<br/>" @@ -534,7 +534,7 @@ } } - /* fileMap is fine: use that */ + /* fileMap is fine: use that */ dstMap = fileMap; return true; } @@ -603,37 +603,37 @@ EntryKey entryKey( aGroup, key ); EntryData entryData( value, false ); - /* insert into the temporary scratchpad map */ - rcMap.insert( entryKey, entryData ); + /* insert into the temporary scratchpad map */ + rcMap.insert( entryKey, entryData ); } } - return rcMap; + return rcMap; } bool VkConfig::writeConfig( EntryMap rcMap, bool backup/*=false*/ ) { - if (backup) { - /* move old config file, if it exists */ - backupConfigFile(); - } + if (backup) { + /* move old config file, if it exists */ + backupConfigFile(); + } /* The temporary map should now be full of ALL entries. Write it out to disk. */ QFile outF( m_rcFileName ); if ( !outF.open( IO_WriteOnly ) ) { - vkError( 0, "Writing Config File", + vkError( 0, "Writing Config File", "<p>Failed to open config file '%s' for writing.</p>", m_rcFileName.latin1() ); - return false; - } - QTextStream aStream( &outF ); - - /* Write comment header */ - QString hdr = mkConfigHeader(); - aStream << hdr.latin1(); + return false; + } + QTextStream aStream( &outF ); + + /* Write comment header */ + QString hdr = mkConfigHeader(); + aStream << hdr.latin1(); - /* Write out map entries under relevant group sections */ + /* Write out map entries under relevant group sections */ QString currGroup; EntryMapIterator aIt; for ( aIt = rcMap.begin(); aIt != rcMap.end(); ++aIt) { @@ -648,11 +648,11 @@ } /* group data */ - aStream << currKey.mKey << "=" << currEntry.mValue << "\n"; + aStream << currKey.mKey << "=" << currEntry.mValue << "\n"; } - outF.close(); - return true; + outF.close(); + return true; } @@ -660,21 +660,21 @@ */ QString VkConfig::mkConfigHeader( void ) { - QDateTime dt = QDateTime::currentDateTime(); - QString hdr = QString("# %1 configuration file\n").arg(vkName()); - hdr += "# " + dt.toString( "MMMM d hh:mm yyyy" ) + "\n"; - hdr += "# Warning: This file is auto-generated, edits may be lost!\n"; - return hdr; + QDateTime dt = QDateTime::currentDateTime(); + QString hdr = QString("# %1 configuration file\n").arg(vkName()); + hdr += "# " + dt.toString( "MMMM d hh:mm yyyy" ) + "\n"; + hdr += "# Warning: This file is auto-generated, edits may be lost!\n"; + return hdr; } QString VkConfig::mkConfigDefaults( Valkyrie* vk ) { - QString str; - QTextStream ts( &str, IO_WriteOnly ); + QString str; + QTextStream ts( &str, IO_WriteOnly ); - QString header = mkConfigHeader(); + QString header = mkConfigHeader(); - const char * window_colors = "[Colors]\n\ + const char * window_colors = "[Colors]\n\ background=214,205,187\n\ base=255,255,255\n\ dkgray=128,128,128\n\ @@ -683,13 +683,13 @@ nullColor=239,227,211\n\ text=0,0,0\n\n"; - const char * mainwin_size_pos = "[MainWin]\n\ + const char * mainwin_size_pos = "[MainWin]\n\ height=600\n\ width=550\n\ x-pos=400\n\ y-pos=0\n\n"; - const char * dbase = "[Database]\n\ + const char * dbase = "[Database]\n\ user=auser\n\ host=localhost\n\ pword=123\n\ @@ -697,18 +697,18 @@ logging=true\n\ logfile=\n\n"; - ts << header << "\n" << window_colors << mainwin_size_pos << dbase; + ts << header << "\n" << window_colors << mainwin_size_pos << dbase; - /* a new tool might have been added, or other changes made, in - which case this fn wouldn't contain the correct options=values - if it were hard-wired in. Better safe than sorry: just get all - tools that are present to spew their options/flags out to disk. */ - VkObject* vkobj; - VkObjectList vkObjecList = vk->vkObjList(); - for ( vkobj = vkObjecList.first(); vkobj; vkobj = vkObjecList.next() ) { - ts << vkobj->configEntries(); - } - return str; + /* a new tool might have been added, or other changes made, in + which case this fn wouldn't contain the correct options=values + if it were hard-wired in. Better safe than sorry: just get all + tools that are present to spew their options/flags out to disk. */ + VkObject* vkobj; + VkObjectList vkObjecList = vk->vkObjList(); + for ( vkobj = vkObjecList.first(); vkobj; vkobj = vkObjecList.next() ) { + ts << vkobj->configEntries(); + } + return str; } Modified: trunk/valkyrie/vk_utils.cpp =================================================================== --- trunk/valkyrie/vk_utils.cpp 2008-06-28 18:56:26 UTC (rev 439) +++ trunk/valkyrie/vk_utils.cpp 2008-06-29 15:07:04 UTC (rev 440) @@ -118,27 +118,27 @@ /* Create a unique filename, with an optional extension ---------------- */ QString vk_mkstemp( QString filepath, QString ext/*=QString::null*/ ) { - /* create tempfiles with datetime, so can sort easily if they stay around */ + /* create tempfiles with datetime, so can sort easily if they stay around */ - QString datetime = QDateTime::currentDateTime().toString( "-yyyy.MM.dd-hh.mm.ss"); - QString unique = filepath + datetime; - if (!ext.isNull()) unique += "." + ext; + QString datetime = QDateTime::currentDateTime().toString( "-yyyy.MM.dd-hh.mm.ss"); + QString unique = filepath + datetime; + if (!ext.isNull()) unique += "." + ext; - if ( QFile::exists(unique) ) { - /* fall back on mkstemp */ - char* tmpname = vk_str_malloc( unique.length() + 10 ); - sprintf( tmpname, "%s.XXXXXX", unique.latin1() ); - int fd = mkstemp( tmpname ); - if ( fd == -1 ) { - /* something went wrong */ - VK_DEBUG("failed to create unique filename from '%s'.", - filepath.latin1() ); - return QString::null; - } - unique = QString( tmpname ); - tmpname = vk_str_free( tmpname ); - } - return unique; + if ( QFile::exists(unique) ) { + /* fall back on mkstemp */ + char* tmpname = vk_str_malloc( unique.length() + 10 ); + sprintf( tmpname, "%s.XXXXXX", unique.latin1() ); + int fd = mkstemp( tmpname ); + if ( fd == -1 ) { + /* something went wrong */ + VK_DEBUG("failed to create unique filename from '%s'.", + filepath.latin1() ); + return QString::null; + } + unique = QString( tmpname ); + tmpname = vk_str_free( tmpname ); + } + return unique; } |