bool doSpreadsheetStuff(int socket) { // int numBytes; char buffer[BUFFER_SIZE]; char formula[IN_BUF_LIMIT] = ""; FormulaType formulaType = SUM; FormulaType *formulaTypePtr = &formulaType; size_t addr = 0; size_t *addressPtr = &addr; char response[IN_BUF_LIMIT] = ""; char value[IN_BUF_LIMIT] = ""; Cell spreadsheet[GRID]; memset(buffer, 0, BUFFER_SIZE); if (!isFirstRun()) { SOCKET_WRITE(socket, "Do you want to load last spreadsheet? y/n: ", 0); read(socket, response, 3); printf("%s\n", response); if (toupper(response[0]) == 'Y') { if (loadLastSpreadSheet(spreadsheet, socket) != true) SOCKET_WRITE(socket, "Could not load last SpreadSheet\n", MSG_DONTWAIT); else { SOCKET_WRITE(socket, "Last spreadSheet loaded\n", MSG_DONTWAIT); recoveredSpreadSheet = true; } } } run(response, spreadsheet, value, addressPtr, formula, formulaTypePtr, socket); //runs program until user quits saveLastSpreadSheet(spreadsheet); SOCKET_WRITE(socket, "Session saved\n", MSG_DONTWAIT); return false; }
Settings::Settings() : m_settingsMain( new QSettings(QSettings::IniFormat, QSettings::UserScope, "KDE", "Installer") ) { m_settings = new QSettings(installDir()+"/etc/installer.ini",QSettings::IniFormat); QString version = m_settings->value("version", "").toString(); // update to current version if (version.isEmpty()) // version 1 { m_settings->setValue("version", SETTINGS_VERSION); setPackageManagerMode(m_settings->value("DeveloperMode",false).toBool()); m_settings->remove("DeveloperMode"); m_settings->sync(); } else if (version != SETTINGS_VERSION) { qCritical() << "unknown settings version" << version << "found"; } #ifdef DEBUG qDebug() << "installDir:" << installDir(); qDebug() << "downloadDir:" << downloadDir(); qDebug() << "showTitlePage:" << showTitlePage(); qDebug() << "createStartMenuEntries:" << createStartMenuEntries(); qDebug() << "isFirstRun" << isFirstRun(); qDebug() << "proxyMode" << proxyMode(); qDebug() << "proxyHost" << proxyHost(); qDebug() << "proxyPort" << proxyPort(); #endif #ifndef Q_OS_WIN // setProxyMode(Environment); #endif }
float ShapeResultSpacing::computeSpacing(const TextRun& run, size_t index, float& offset) { UChar32 character = run[index]; bool treatAsSpace = (Character::treatAsSpace(character) || (m_normalizeSpace && Character::isNormalizedCanvasSpaceCharacter(character))) && (character != '\t' || !m_allowTabs); if (treatAsSpace && character != noBreakSpaceCharacter) character = spaceCharacter; float spacing = 0; if (m_letterSpacing && !Character::treatAsZeroWidthSpace(character)) spacing += m_letterSpacing; if (treatAsSpace && (index || !isFirstRun(run) || character == noBreakSpaceCharacter)) spacing += m_wordSpacing; if (!hasExpansion()) return spacing; if (treatAsSpace) return spacing + nextExpansion(); if (run.is8Bit() || m_textJustify != TextJustify::TextJustifyAuto) return spacing; // isCJKIdeographOrSymbol() has expansion opportunities both before and // after each character. // http://www.w3.org/TR/jlreq/#line_adjustment if (U16_IS_LEAD(character) && index + 1 < run.length() && U16_IS_TRAIL(run[index + 1])) character = U16_GET_SUPPLEMENTARY(character, run[index + 1]); if (!Character::isCJKIdeographOrSymbol(character)) { m_isAfterExpansion = false; return spacing; } if (!m_isAfterExpansion) { // Take the expansion opportunity before this ideograph. float expandBefore = nextExpansion(); if (expandBefore) { offset += expandBefore; spacing += expandBefore; } if (!hasExpansion()) return spacing; } return spacing + nextExpansion(); }
ULONGLONG CpuUsage::getUsageEx() { ULONGLONG nCpuCopy = m_nCpuUsage; if (::InterlockedIncrement(&m_lRunCount) == 1) { if (!enoughTimePassed()) { ::InterlockedDecrement(&m_lRunCount); return nCpuCopy; } ULONGLONG ullSysNonIdleTime = getSystemNonIdleTimes(); ULONGLONG ullProcNonIdleTime = getProcessNonIdleTimes(); if (!isFirstRun()) { ULONGLONG ullTotalSys = ullSysNonIdleTime - m_ullPrevSysNonIdleTime; if (ullTotalSys == 0) { ::InterlockedDecrement(&m_lRunCount); return nCpuCopy; } m_nCpuUsage = ULONGLONG((ullProcNonIdleTime - m_ullPrevProcNonIdleTime) * 100.0 / (ullTotalSys)); m_ullPrevSysNonIdleTime = ullSysNonIdleTime; m_ullPrevProcNonIdleTime = ullProcNonIdleTime; } m_dwLastRun = (ULONGLONG)GetTickCount(); nCpuCopy = m_nCpuUsage; } ::InterlockedDecrement(&m_lRunCount); return nCpuCopy; }