-rw-r--r-- | noncore/apps/confedit/listviewitemconffile.cpp | 59 | ||||
-rw-r--r-- | noncore/apps/opie-console/io_irda.cpp | 1 | ||||
-rw-r--r-- | noncore/apps/opie-console/mainwindow.cpp | 10 | ||||
-rw-r--r-- | noncore/apps/opie-reader/CFilter.cpp | 2 | ||||
-rw-r--r-- | noncore/apps/opie-reader/CRegExp.cpp | 4 | ||||
-rw-r--r-- | noncore/apps/opie-reader/Palm2QImage.cpp | 4 | ||||
-rw-r--r-- | noncore/apps/opie-reader/QTReader.cpp | 2 | ||||
-rw-r--r-- | noncore/apps/opie-reader/plucker_base.cpp | 2 | ||||
-rw-r--r-- | noncore/apps/opie-reader/striphtml.cpp | 2 | ||||
-rw-r--r-- | noncore/apps/tinykate/libkate/document/katehighlight.cpp | 10 | ||||
-rw-r--r-- | noncore/net/ftplib/ftplib.c | 2 | ||||
-rw-r--r-- | noncore/settings/sysinfo/contrib/dhry.c | 2 |
12 files changed, 52 insertions, 48 deletions
diff --git a/noncore/apps/confedit/listviewitemconffile.cpp b/noncore/apps/confedit/listviewitemconffile.cpp index 2958cf5..a7d6b00 100644 --- a/noncore/apps/confedit/listviewitemconffile.cpp +++ b/noncore/apps/confedit/listviewitemconffile.cpp @@ -1,149 +1,154 @@ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ // (c) 2002 Patrick S. Vogt <tille@handhelds.org> #include "listviewitemconffile.h" #include "listviewitemconfigentry.h" /* OPIE */ #include <opie2/odebug.h> using namespace Opie::Core; /* QT */ #include <qmessagebox.h> #include <qtextstream.h> #define tr QObject::tr ListViewItemConfFile::ListViewItemConfFile(QFileInfo *file, QListView *parent) : ListViewItemConf(parent), _valid(false) { confFileInfo = file; // parseFile(); displayText(); } ListViewItemConfFile::~ListViewItemConfFile() { } void ListViewItemConfFile::displayText() { setText(0,(_changed?"*":"")+confFileInfo->fileName()); } QString ListViewItemConfFile::fileName() { - return confFileInfo->fileName(); + return confFileInfo->fileName(); } void ListViewItemConfFile::parseFile() { - //odebug << "ListViewItemConfFile::parseFile BEGIN" << oendl; - QFile confFile(confFileInfo->absFilePath()); - if(! confFile.open(IO_ReadOnly)) - QMessageBox::critical(0,tr("Could not open"),tr("The file ")+confFileInfo->fileName()+tr(" could not be opened."),1,0); - QTextStream t( &confFile ); - QString s; + //odebug << "ListViewItemConfFile::parseFile BEGIN" << oendl; + QFile confFile(confFileInfo->absFilePath()); + if(! confFile.open(IO_ReadOnly)) + QMessageBox::critical(0,tr("Could not open"),tr("The file ")+confFileInfo->fileName()+tr(" could not be opened."),1,0); + + QTextStream t( &confFile ); + QString s; QString group; - ListViewItemConfigEntry *groupItem; + ListViewItemConfigEntry *groupItem = 0; ListViewItemConfigEntry *item; while ( !t.atEnd() ) { - s = t.readLine().stripWhiteSpace(); - //odebug << "line: >" << s.latin1() << "<\n" << oendl; - if (s.contains("<?xml")) - { - _valid = false; - break; - }else - if ( s[0] == '[' && s[s.length()-1] == ']' ) - { - // odebug << "got group"+s << oendl; + s = t.readLine().stripWhiteSpace(); + //odebug << "line: >" << s.latin1() << "<\n" << oendl; + if (s.contains("<?xml")) + { + _valid = false; + break; + } + else if ( s[0] == '[' && s[s.length()-1] == ']' ) + { + //odebug << "got group"+s << oendl; group = s.mid(1,s.length()-2); - if (!groupItem) groupItem = new ListViewItemConfigEntry(this, tr("no group") ); + if (!groupItem) + groupItem = new ListViewItemConfigEntry(this, tr("no group") ); + groupItem = new ListViewItemConfigEntry(this, group ); insertItem( groupItem ); - } else - if ( int pos = s.find('=') ) + } + else if ( int pos = s.find('=') ) { -// odebug << "got key"+s << oendl; - if (!groupItem) odebug << "PANIK NO GROUP! >" << group.latin1() << "<" << oendl; - item = new ListViewItemConfigEntry(this, group, s ); + //odebug << "got key"+s << oendl; + if (!groupItem) + odebug << "PANIC! no group >" << group.latin1() << "<" << oendl; + + item = new ListViewItemConfigEntry(this, group, s ); groupItem->insertItem( item ); } } - confFile.close(); - setExpandable( _valid ); -// odebug << "ListViewItemConfFile::parseFile END" << oendl; + confFile.close(); + setExpandable( _valid ); + //odebug << "ListViewItemConfFile::parseFile END" << oendl; } void ListViewItemConfFile::remove() { QFile::remove(confFileInfo->absFilePath()); QFile::remove(backupFileName()); delete this; } void ListViewItemConfFile::revert() { if (!_changed) { // read the backup file QFile conf(confFileInfo->absFilePath()); QFile back(backupFileName()); if (!back.open(IO_ReadOnly)) return; if (!conf.open(IO_WriteOnly)) return; #define SIZE 124 char buf[SIZE]; while (int c = back.readBlock(buf, SIZE) ) conf.writeBlock(buf,c); conf.close(); back.close(); } parseFile(); expand(); } void ListViewItemConfFile::save() { if (!_changed) return; QFile conf(confFileInfo->absFilePath()); QFile back(backupFileName()); if (!conf.open(IO_ReadOnly)) return; if (!back.open(IO_WriteOnly)) return; char buf[SIZE]; while (int c = conf.readBlock(buf, SIZE) ) back.writeBlock(buf,c); conf.close(); back.close(); if (!conf.open(IO_WriteOnly)) return; QTextStream *t = new QTextStream( &conf ); for (QListViewItem *it = firstChild(); it!=0;it = it->nextSibling()) { ((ListViewItemConfigEntry*)it)->save(t); } conf.close(); unchanged(); } bool ListViewItemConfFile::revertable() { return _changed || QFile(backupFileName()).exists(); } QString ListViewItemConfFile::backupFileName() { diff --git a/noncore/apps/opie-console/io_irda.cpp b/noncore/apps/opie-console/io_irda.cpp index 9d27c85..a0f72ae 100644 --- a/noncore/apps/opie-console/io_irda.cpp +++ b/noncore/apps/opie-console/io_irda.cpp @@ -1,64 +1,65 @@ #include "io_irda.h" IOIrda::IOIrda( const Profile &config ) : IOSerial( config ) { m_attach = 0; } IOIrda::~IOIrda() { if ( m_attach ) { delete m_attach; } } void IOIrda::close() { IOSerial::close(); // still need error handling delete m_attach; } bool IOIrda::open() { bool ret; // irdaattach here m_attach = new Opie::Core::OProcess(); *m_attach << "irattach /dev/ttyS2 -s"; connect( m_attach, SIGNAL( processExited(Opie::Core::OProcess*) ), this, SLOT( slotExited(Opie::Core::OProcess*) ) ); if ( m_attach->start() ) { ret= IOSerial::open(); } else { // emit error!!! delete m_attach; m_attach = 0l; + ret = false; } return ret; } void IOIrda::reload( const Profile &config ) { m_device = config.readEntry("Device", IRDA_DEFAULT_DEVICE); m_baud = config.readNumEntry("Baud", IRDA_DEFAULT_BAUD); m_parity = config.readNumEntry("Parity", IRDA_DEFAULT_PARITY); m_dbits = config.readNumEntry("DataBits", IRDA_DEFAULT_DBITS); m_sbits = config.readNumEntry("StopBits", IRDA_DEFAULT_SBITS); m_flow = config.readNumEntry("Flow", IRDA_DEFAULT_FLOW); } QString IOIrda::identifier() const { return "irda"; } QString IOIrda::name() const { return "Irda IO Layer"; } void IOIrda::slotExited(Opie::Core::OProcess* proc ){ close(); delete proc; } diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp index aba7244..a884179 100644 --- a/noncore/apps/opie-console/mainwindow.cpp +++ b/noncore/apps/opie-console/mainwindow.cpp @@ -646,146 +646,142 @@ void MainWindow::slotSessionChanged( Session* ses ) { m_recordLog->setText( tr("Start log") ); } if ( ( m_curSession->layer() )->supports()[1] == 0 ) { m_transfer->setEnabled( false ); } else { m_transfer->setEnabled( true ); } QWidget *w = m_curSession->widget(); if(w) w->setFocus(); if(currentSession()->profile().readNumEntry("Wrap", 80)){ m_isWrapped = true; } else { m_isWrapped = false; } m_kb->load(currentSession()->profile()); } } void MainWindow::slotWrap() { if(m_curSession) { EmulationHandler *e = m_curSession->emulationHandler(); if(e) { e->setWrap( m_isWrapped ? 80:0 ); m_isWrapped = !m_isWrapped; } } } void MainWindow::slotFullscreen() { if ( m_isFullscreen ) { ( m_curSession->widgetStack() )->reparent( savedParentFullscreen, 0, QPoint(0,0), true ); ( m_curSession->widgetStack() )->resize( savedParentFullscreen->width(), savedParentFullscreen->height() ); ( m_curSession->emulationHandler() )->cornerButton()->hide(); disconnect( ( m_curSession->emulationHandler() )->cornerButton(), SIGNAL( pressed() ), this, SLOT( slotFullscreen() ) ); } else { savedParentFullscreen = ( m_curSession->widgetStack() )->parentWidget(); ( m_curSession->widgetStack() )->setFrameStyle( QFrame::NoFrame ); ( m_curSession->widgetStack() )->reparent( 0, WStyle_Tool | WStyle_Customize | WStyle_StaysOnTop , QPoint(0,0), false ); ( m_curSession->widgetStack() )->resize( qApp->desktop()->width(), qApp->desktop()->height() ); ( m_curSession->widgetStack() )->setFocus(); ( m_curSession->widgetStack() )->show(); ( ( m_curSession->emulationHandler() )->cornerButton() )->show(); connect( ( m_curSession->emulationHandler() )->cornerButton(), SIGNAL( pressed() ), this, SLOT( slotFullscreen() ) ); } m_isFullscreen = !m_isFullscreen; } void MainWindow::slotScrollbarSelected(int index) { - int loc; + int loc = 0; Config cfg( "Konsole" ); cfg.setGroup("ScrollBar"); - if(index == sm_none) - { - loc = 0; - } - else if(index == sm_left) + if(index == sm_left) { loc = 1; } else if(index == sm_right) { loc = 2; } - cfg.writeEntry("Position", loc); + cfg.writeEntry("Position", loc); if (currentSession()) { currentSession()->emulationHandler()->setScrollbarLocation(loc); } m_scrollbar->setItemChecked(sm_none, index == sm_none); m_scrollbar->setItemChecked(sm_left, index == sm_left); m_scrollbar->setItemChecked(sm_right, index == sm_right); } void MainWindow::slotKeyReceived(FKey k, ushort, ushort, bool pressed) { if ( m_curSession ) { QEvent::Type state; if (pressed) state = QEvent::KeyPress; else state = QEvent::KeyRelease; QKeyEvent ke(state, k.qcode, k.unicode, 0, QString(QChar(k.unicode))); // is this the best way to do this? cant figure out any other way to work QApplication::sendEvent((QObject *)m_curSession->widget(), &ke); ke.ignore(); } } void MainWindow::slotCopy() { if (!currentSession() ) return; currentSession()->emulationHandler()->copy(); } void MainWindow::slotPaste() { if (!currentSession() ) return; currentSession()->emulationHandler()->paste(); } /* * Save the session */ void MainWindow::slotSaveSession() { if (!currentSession() ) { QMessageBox::information(this, tr("Save Connection"), tr("<qt>There is no Connection.</qt>"), 1 ); return; } manager()->add( currentSession()->profile() ); manager()->save(); populateProfiles(); } void MainWindow::slotSaveLog() { if( currentSession()->emulationHandler()->isLogging() ) { DocLnk nf; QString m_logName = currentSession()->emulationHandler()->logFileName(); QFileInfo info(m_logName); nf.setType("text/plain"); nf.setFile(m_logName); nf.setName(info.fileName()); nf.writeLink(); m_recordLog->setText( tr("Start log") ); m_recordingLog = false; diff --git a/noncore/apps/opie-reader/CFilter.cpp b/noncore/apps/opie-reader/CFilter.cpp index 25cdfae..a4ea60a 100644 --- a/noncore/apps/opie-reader/CFilter.cpp +++ b/noncore/apps/opie-reader/CFilter.cpp @@ -440,129 +440,129 @@ void repalm::getch(tchar& ch, CStyle& sty, unsigned long& pos) break; case 0x99: ch = 0x2122; break; case 0x9a: ch = 0x0161; break; case 0x9b: ch = 0x203a; break; case 0x9c: ch = 0x0153; break; case 0x9e: ch = 0x017e; break; case 0x9f: ch = 0x0178; break; case 0x18: ch = 0x2026; break; case 0x19: ch = 0x2007; break; case 0x8d: ch = 0x2662; break; case 0x8e: ch = 0x2663; break; case 0x8f: ch = 0x2661; break; case 0x90: ch = 0x2660; break; default: break; } } //static tchar nextpart[] = { 'C','l','i','c','k',' ','h','e','r','e',' ','f','o','r',' ','t','h','e',' ','n','e','x','t',' ','p','a','r','t',0 }; //static tchar prevpart[] = { 'C','l','i','c','k',' ','h','e','r','e',' ','f','o','r',' ','t','h','e',' ','p','r','e','v','i','o','u','s',' ','p','a','r','t',0 }; void DePluck::getch(tchar& ch, CStyle& sty, unsigned long& pos) { if (m_buffed > 0) { sty = m_laststyle; ch = nextpart[m_current++]; if (m_current == m_buffed) { m_current = m_buffed = 0; } } else { if (m_buffer != 0) { ch = m_buffer; m_buffer = 0; return; } - unsigned long lnk, lnkoff; + unsigned long lnk = 0, lnkoff = 0; do { if (nextpart[m_buffed] == 0) break; parent->getch(ch, sty, pos); m_laststyle = sty; if (sty.getLink()) { lnk = sty.getData(); lnkoff = sty.getOffset(); } } while (ch == nextpart[m_buffed] && sty.getLink() && ++m_buffed); m_current = 0; if (nextpart[m_buffed] == 0) { m_buffed = 0; QString dmy, dmy2; parent->hyperlink(lnk, lnkoff, dmy, dmy2); do { parent->getch(ch, sty, pos); } while (ch != 10); parent->getch(ch, sty, pos); } else if (m_buffed > 0) { m_buffer = ch; ch = nextpart[0]; if (m_buffed == 1) { m_buffed = 0; } else m_current = 1; } } return; } HighlightFilter::HighlightFilter(QTReader* _p) : pReader(_p), lastpos(0), nextpos(0), red(255), green(255), blue(255) { } #include "Bkmks.h" #include "QTReader.h" void HighlightFilter::refresh(unsigned long pos) { bkmks = pReader->Bkmklist(); red = green = blue = 255; if (bkmks == NULL) { lastpos = 0; nextpos = 0xffffffff; } else { lastpos = 0; nextpos = 0xffffffff; for (CList<Bkmk>::iterator i = bkmks->begin(); i != bkmks->end(); i++) { if ((*i).value() <= pos && pos < (*i).value2()) diff --git a/noncore/apps/opie-reader/CRegExp.cpp b/noncore/apps/opie-reader/CRegExp.cpp index 6318d28..e3194df 100644 --- a/noncore/apps/opie-reader/CRegExp.cpp +++ b/noncore/apps/opie-reader/CRegExp.cpp @@ -48,129 +48,129 @@ void CRegExpFilt::regchar(tchar c, bool insens) { tchar t = upper(c); CV[t] = 0; t = lower(c); CV[t] = 0; } else { CV[c] = 0; } } void CRegExpFilt::prepreprocessing(const QString& pat, bool insens) { for (unsigned int p = 0; p < pat.length(); p++) { #ifdef _WINDOWS switch (pat.at(p).unicode()) #else switch (pat[p].unicode()) #endif { case '{': { break; } case '}': { break; } case '^': { break; } case '.' : { break; } case '#': { p++; #ifdef _WINDOWS while ('0' <= pat.at(p).unicode() && pat.at(p).unicode() <= '9') #else while ('0' <= pat[p].unicode() && pat[p].unicode() <= '9') #endif { } p--; break; } case '\\' : { #ifdef _WINDOWS tchar c = escapedchar(pat.at(++p).unicode()); #else tchar c = escapedchar(pat[++p].unicode()); #endif regchar(c, insens); break; } case '[' : { - tchar clast; + tchar clast = 0; bool invert = false; tchar c; #ifdef _WINDOWS if (pat.at(p+1).unicode() == '^') #else if (pat[p+1].unicode() == '^') #endif { p++; invert = true; } #ifdef _WINDOWS while ((c = pat.at(++p).unicode()) != ']') #else while ((c = pat[++p].unicode()) != ']') #endif { if (c == '\\') { #ifdef _WINDOWS c = escapedchar(pat.at(++p).unicode()); #else c = escapedchar(pat[++p].unicode()); #endif if (c == ']') break; } if (c == '-') { #ifdef _WINDOWS c = pat.at(++p).unicode(); #else c = pat[++p].unicode(); #endif for (tchar j = clast; j <= c; j++) { regchar(j, insens); } } else { regchar(c, insens); } clast = c; } break; } default : { #ifdef _WINDOWS regchar(pat.at(p).unicode(), insens); #else regchar(pat[p].unicode(), insens); #endif break; } } } /* for (iter i = CV.begin(); i != CV.end(); ++i) { printf("Pre: [%u]\n", i.first()); } */ CV[0] = 0; @@ -226,129 +226,129 @@ unsigned int CRegExpFilt::preprocessing(const QString& pat, bool insens) case '#': { if (m > 0) { p++; int count = 0; #ifdef _WINDOWS while ('0' <= pat.at(p).unicode() && pat.at(p).unicode() <= '9') #else while ('0' <= pat[p].unicode() && pat[p].unicode() <= '9') #endif { #ifdef _WINDOWS count = 10*count + pat.at(p++).unicode() - '0'; #else count = 10*count + pat[p++].unicode() - '0'; #endif } p--; count = count-1; unsigned int mask = 0; for (unsigned int i = m; i < m+count; i++) { mask |= bit[i]; } for (iter it = CV.begin(); it != CV.end(); ++it) { if (CV[it.first()] & bit[m-1]) { CV[it.first()] |= mask; } } if (keep & bit[m-1]) keep |= mask; m += count; } else { p++; } break; } case '\\' : { #ifdef _WINDOWS tchar c = escapedchar(pat.at(++p).unicode()); #else tchar c = escapedchar(pat[++p].unicode()); #endif if (insens) { CV[upper(c)] |= bit[m]; CV[lower(c)] |= bit[m]; } else { CV[c] |= bit[m]; } m++; break; } case '[' : { - tchar c, clast; + tchar c, clast = 0; bool invert = false; #ifdef _WINDOWS if (pat.at(p+1).unicode() == '^') #else if (pat[p+1].unicode() == '^') #endif { p++; invert = true; } #ifdef _WINDOWS while ((c = pat.at(++p).unicode()) != ']') #else while ((c = pat[++p].unicode()) != ']') #endif { if (c == '\\') { #ifdef _WINDOWS c = escapedchar(pat.at(++p).unicode()); #else c = escapedchar(pat[++p].unicode()); #endif if (c == ']') break; } if (c == '-') { #ifdef _WINDOWS c = pat.at(++p).unicode(); #else c = pat[++p].unicode(); #endif for (tchar j = clast; j <= c; j++) { if (insens) { iter it; if ((it = CV.find(upper(j))) != CV.end()) CV[it] |= bit[m]; else CV[0] |= bit[m]; if ((it = CV.find(lower(j))) != CV.end()) CV[it] |= bit[m]; else CV[0] |= bit[m]; } else { iter it; if ((it = CV.find(j)) != CV.end()) CV[it] |= bit[m]; else { CV[0] |= bit[m]; } } } } else { if (insens) { iter it; if ((it = CV.find(upper(c))) != CV.end()) diff --git a/noncore/apps/opie-reader/Palm2QImage.cpp b/noncore/apps/opie-reader/Palm2QImage.cpp index 361755f..09cad1c 100644 --- a/noncore/apps/opie-reader/Palm2QImage.cpp +++ b/noncore/apps/opie-reader/Palm2QImage.cpp @@ -64,217 +64,217 @@ static ColorMapEntry Palm8BitColormap[] = { { 51, 255, 255 }, { 51, 204, 255 }, { 51, 153, 255 }, { 51, 102, 255 }, { 51, 51, 255 }, { 51, 0, 255 }, { 51, 255, 204 }, { 51, 204, 204 }, { 51, 153, 204 }, { 51, 102, 204 }, { 51, 51, 204 }, { 51, 0, 204 }, { 51, 255, 153 }, { 51, 204, 153 }, { 51, 153, 153 }, { 51, 102, 153 }, { 51, 51, 153 }, { 51, 0, 153 }, { 0, 255, 255 }, { 0, 204, 255 }, { 0, 153, 255 }, { 0, 102, 255 }, { 0, 51, 255 }, { 0, 0, 255 }, { 0, 255, 204 }, { 0, 204, 204 }, { 0, 153, 204 }, { 0, 102, 204 }, { 0, 51, 204 }, { 0, 0, 204 }, { 0, 255, 153 }, { 0, 204, 153 }, { 0, 153, 153 }, { 0, 102, 153 }, { 0, 51, 153 }, { 0, 0, 153 }, { 255, 255, 102 }, { 255, 204, 102 }, { 255, 153, 102 }, { 255, 102, 102 }, { 255, 51, 102 }, { 255, 0, 102 }, { 255, 255, 51 }, { 255, 204, 51 }, { 255, 153, 51 }, { 255, 102, 51 }, { 255, 51, 51 }, { 255, 0, 51 }, { 255, 255, 0 }, { 255, 204, 0 }, { 255, 153, 0 }, { 255, 102, 0 }, { 255, 51, 0 }, { 255, 0, 0 }, { 204, 255, 102 }, { 204, 204, 102 }, { 204, 153, 102 }, { 204, 102, 102 }, { 204, 51, 102 }, { 204, 0, 102 }, { 204, 255, 51 }, { 204, 204, 51 }, { 204, 153, 51 }, { 204, 102, 51 }, { 204, 51, 51 }, { 204, 0, 51 }, { 204, 255, 0 }, { 204, 204, 0 }, { 204, 153, 0 }, { 204, 102, 0 }, { 204, 51, 0 }, { 204, 0, 0 }, { 153, 255, 102 }, { 153, 204, 102 }, { 153, 153, 102 }, { 153, 102, 102 }, { 153, 51, 102 }, { 153, 0, 102 }, { 153, 255, 51 }, { 153, 204, 51 }, { 153, 153, 51 }, { 153, 102, 51 }, { 153, 51, 51 }, { 153, 0, 51 }, { 153, 255, 0 }, { 153, 204, 0 }, { 153, 153, 0 }, { 153, 102, 0 }, { 153, 51, 0 }, { 153, 0, 0 }, { 102, 255, 102 }, { 102, 204, 102 }, { 102, 153, 102 }, { 102, 102, 102 }, { 102, 51, 102 }, { 102, 0, 102 }, { 102, 255, 51 }, { 102, 204, 51 }, { 102, 153, 51 }, { 102, 102, 51 }, { 102, 51, 51 }, { 102, 0, 51 }, { 102, 255, 0 }, { 102, 204, 0 }, { 102, 153, 0 }, { 102, 102, 0 }, { 102, 51, 0 }, { 102, 0, 0 }, { 51, 255, 102 }, { 51, 204, 102 }, { 51, 153, 102 }, { 51, 102, 102 }, { 51, 51, 102 }, { 51, 0, 102 }, { 51, 255, 51 }, { 51, 204, 51 }, { 51, 153, 51 }, { 51, 102, 51 }, { 51, 51, 51 }, { 51, 0, 51 }, { 51, 255, 0 }, { 51, 204, 0 }, { 51, 153, 0 }, { 51, 102, 0 }, { 51, 51, 0 }, { 51, 0, 0 }, { 0, 255, 102 }, { 0, 204, 102 }, { 0, 153, 102 }, { 0, 102, 102 }, { 0, 51, 102 }, { 0, 0, 102 }, { 0, 255, 51 }, { 0, 204, 51 }, { 0, 153, 51 }, { 0, 102, 51 }, { 0, 51, 51 }, { 0, 0, 51 }, { 0, 255, 0 }, { 0, 204, 0 }, { 0, 153, 0 }, { 0, 102, 0 }, { 0, 51, 0 }, { 17, 17, 17 }, { 34, 34, 34 }, { 68, 68, 68 }, { 85, 85, 85 }, { 119, 119, 119 }, { 136, 136, 136 }, { 170, 170, 170 }, { 187, 187, 187 }, { 221, 221, 221 }, { 238, 238, 238 }, { 192, 192, 192 }, { 128, 0, 0 }, { 128, 0, 128 }, { 0, 128, 0 }, { 0, 128, 128 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }}; static ColorMapEntry Palm1BitColormap[] = {{ 255, 255, 255 }, { 0, 0, 0 }}; static ColorMapEntry Palm2BitColormap[] = { { 255, 255, 255 }, { 192, 192, 192 }, { 128, 128, 128 }, { 0, 0, 0 }}; static ColorMapEntry Palm4BitColormap[] = { { 255, 255, 255 }, { 238, 238, 238 }, { 221, 221, 221 }, { 204, 204, 204 }, { 187, 187, 187 }, { 170, 170, 170 }, { 153, 153, 153 }, { 136, 136, 136 }, { 119, 119, 119 }, { 102, 102, 102 }, { 85, 85, 85 }, { 68, 68, 68 }, { 51, 51, 51 }, { 34, 34, 34 }, { 17, 17, 17 }, { 0, 0, 0 }}; QImage* Palm2QImage (unsigned char *image_bytes_in, int byte_count_in) { unsigned int width, height, bytes_per_row, flags, next_depth_offset; unsigned int bits_per_pixel, version, transparent_index, compression_type, i, j, inval, inbit, mask, incount; unsigned int palm_red_bits, palm_green_bits, palm_blue_bits; - unsigned char *palm_ptr, *x_ptr, *imagedata, *inbyte, *rowbuf, *lastrow, + unsigned char *palm_ptr, *x_ptr, *inbyte, *rowbuf, *lastrow, *imagedatastart, *palmimage; ColorMapEntry *colormap; palmimage = image_bytes_in; width = READ_BIGENDIAN_SHORT(palmimage + 0); height = READ_BIGENDIAN_SHORT(palmimage + 2); bytes_per_row = READ_BIGENDIAN_SHORT(palmimage + 4); flags = READ_BIGENDIAN_SHORT(palmimage + 6); bits_per_pixel = palmimage[8]; version = palmimage[9]; next_depth_offset = READ_BIGENDIAN_SHORT(palmimage + 10); transparent_index = palmimage[12]; compression_type = palmimage[13]; /* bytes 14 and 15 are reserved by Palm and always 0 */ #if 0 // qDebug ("Palm image is %dx%d, %d bpp, version %d, flags 0x%x, compression %d", width, height, bits_per_pixel, version, flags, compression_type); #endif if (compression_type == PALM_COMPRESSION_PACKBITS) { // qDebug ("Image uses packbits compression; not yet supported"); return NULL; } else if ((compression_type != PALM_COMPRESSION_NONE) && (compression_type != PALM_COMPRESSION_RLE) && (compression_type != PALM_COMPRESSION_SCANLINE)) { // qDebug ("Image uses unknown compression, code 0x%x", compression_type); return NULL; } /* as of PalmOS 4.0, there are 6 different kinds of Palm pixmaps: 1, 2, or 4 bit grayscale 8-bit StaticColor using the Palm standard colormap 8-bit PseudoColor using a user-specified colormap 16-bit DirectColor using 5 bits for red, 6 for green, and 5 for blue Each of these can be compressed with one of four compression schemes, "RLE", "Scanline", "PackBits", or none. We begin by constructing the colormap. */ if (flags & PALM_HAS_COLORMAP_FLAG) { // qDebug("Palm images with custom colormaps are not currently supported.\n"); return NULL; } else if (bits_per_pixel == 1) { colormap = Palm1BitColormap; imagedatastart = palmimage + 16; } else if (bits_per_pixel == 2) { colormap = Palm2BitColormap; imagedatastart = palmimage + 16; } else if (bits_per_pixel == 4) { colormap = Palm4BitColormap; imagedatastart = palmimage + 16; } else if (bits_per_pixel == 8) { colormap = Palm8BitColormap; imagedatastart = palmimage + 16; } else if (bits_per_pixel == 16 && (flags & PALM_DIRECT_COLOR_FLAG)) { colormap = NULL; palm_red_bits = palmimage[16]; palm_green_bits = palmimage[17]; palm_blue_bits = palmimage[18]; // qDebug("Bits:%d, %d, %d", palm_red_bits, palm_green_bits, palm_blue_bits); if (palm_blue_bits > 8 || palm_green_bits > 8 || palm_red_bits > 8) { // qDebug("Can't handle this format DirectColor image -- too wide in some color (%d:%d:%d)\n", palm_red_bits, palm_green_bits, palm_blue_bits); return NULL; } if (bits_per_pixel > (8 * sizeof(unsigned long))) { // qDebug ("Can't handle this format DirectColor image -- too many bits per pixel (%d)\n", bits_per_pixel); return NULL; } imagedatastart = palmimage + 24; } else { // qDebug("Unknown bits-per-pixel of %d encountered.\n", bits_per_pixel); return NULL; } #ifndef USEQPE QImage* qimage = new QImage(width, height, 32); #else QImage* qimage = new QImage(width, height, 16); #endif /* row by row, uncompress the Palm image and copy it to the JPEG buffer */ rowbuf = new unsigned char[bytes_per_row * width]; lastrow = new unsigned char[bytes_per_row * width]; - for (i=0, palm_ptr = imagedatastart , x_ptr = imagedata; i < height; ++i) { + for (i=0, palm_ptr = imagedatastart , x_ptr = 0; i < height; ++i) { // qDebug("inval:%x palm_ptr:%x x_ptr:%x bpr:%x", inval, palm_ptr, x_ptr, bytes_per_row); /* first, uncompress the Palm image */ if ((flags & PALM_IS_COMPRESSED_FLAG) && (compression_type == PALM_COMPRESSION_RLE)) { for (j = 0; j < bytes_per_row; ) { incount = *palm_ptr++; inval = *palm_ptr++; memset(rowbuf + j, inval, incount); j += incount; } } else if ((flags & PALM_IS_COMPRESSED_FLAG) && (compression_type == PALM_COMPRESSION_SCANLINE)) { for (j = 0; j < bytes_per_row; j += 8) { incount = *palm_ptr++; inval = ((bytes_per_row - j) < 8) ? (bytes_per_row - j) : 8; for (inbit = 0; inbit < inval; inbit += 1) { if (incount & (1 << (7 - inbit))) rowbuf[j + inbit] = *palm_ptr++; else rowbuf[j + inbit] = lastrow[j + inbit]; } } memcpy (lastrow, rowbuf, bytes_per_row); } else if (((flags & PALM_IS_COMPRESSED_FLAG) && (compression_type == PALM_COMPRESSION_NONE)) || ((flags & PALM_IS_COMPRESSED_FLAG) == 0)) { memcpy (rowbuf, palm_ptr, bytes_per_row); palm_ptr += bytes_per_row; } else { qDebug("Case 4"); qDebug("Is compressed:%s", ((flags & PALM_IS_COMPRESSED_FLAG) == 0) ? "false" : "true"); qDebug("Has colourmap:%s", ((flags & PALM_HAS_COLORMAP_FLAG) == 0) ? "false" : "true"); qDebug("Has transparency:%s", ((flags & PALM_HAS_TRANSPARENCY_FLAG) == 0) ? "false" : "true"); qDebug("Direct colour:%s", ((flags & PALM_DIRECT_COLOR_FLAG) == 0) ? "false" : "true"); qDebug("four byte field:%s", ((flags & PALM_4_BYTE_FIELD_FLAG) == 0) ? "false" : "true"); memcpy (rowbuf, palm_ptr, bytes_per_row); palm_ptr += bytes_per_row; } /* next, write it to the GDK bitmap */ if (colormap) { mask = (1 << bits_per_pixel) - 1; for (inbit = 8 - bits_per_pixel, inbyte = rowbuf, j = 0; j < width; ++j) { inval = ((*inbyte) & (mask << inbit)) >> inbit; /* correct for oddity of the 8-bit color Palm pixmap... */ if ((bits_per_pixel == 8) && (inval == 0xFF)) inval = 231; /* now lookup the correct color and set the pixel in the GTK bitmap */ QRgb colour = qRgb(colormap[inval].red, colormap[inval].green, colormap[inval].blue); qimage->setPixel(j, i, colour); if (!inbit) { ++inbyte; inbit = 8 - bits_per_pixel; } else { inbit -= bits_per_pixel; } } } else if (!colormap && bits_per_pixel == 16) { for (inbyte = rowbuf, j = 0; j < width; ++j) { inval = ((unsigned short)inbyte[0] << (unsigned short)8) | inbyte[1]; /* qDebug ("pixel is %d,%d (%d:%d:%d)", j, i, diff --git a/noncore/apps/opie-reader/QTReader.cpp b/noncore/apps/opie-reader/QTReader.cpp index 0c56dd4..75da8ac 100644 --- a/noncore/apps/opie-reader/QTReader.cpp +++ b/noncore/apps/opie-reader/QTReader.cpp @@ -483,129 +483,129 @@ linkType QTReader::getcurrentpos(int x, int y, int w, int h, int& lineno, size_t CDrawBuffer* t = textarray[lineno]; x = x - t->offset(width(), m_left_border, m_right_border, availht); for (i = t->length(); i > 0 && t->width(availht, i, true, w, m_left_border, m_right_border) > x; i--); offset = i; } return textarray[lineno]->getLinkType(offset, tgt, tgtoffset, pictgt, img, tabtgt); } void QTReader::suspend() { buffdoc.suspend(); /*#ifdef OPIE if (memcmp("/mnt/", m_lastfile.latin1(), 5) == 0) buffdoc.suspend(); #else if (memcmp("/usr/mnt.rom/", m_lastfile.latin1(), 13) == 0) buffdoc.suspend(); #endif */ } void QTReader::setDoubleBuffer(bool _b) { m_doubleBuffered = _b; if (_b || m_rotated) { if (dbuff == NULL) { dbuff = new QPixmap(); dbp = new QPainter(); } if (m_rotated) { dbuff->resize(height(), width()); } else { dbuff->resize(width(), height()); } m_outofdate = true; } else { if (dbuff != NULL) { delete dbuff; delete dbp; } dbuff = NULL; dbp = NULL; } } void QTReader::setTwoTouch(bool _b) { setBackgroundColor( m_bg ); m_twotouch = m_touchone = _b; } void QTReader::setContinuous(bool _b) { buffdoc.setContinuous(m_continuousDocument = _b); } void QTReader::processmousewordevent(size_t startpos, size_t startoffset, QMouseEvent* _e, int lineno) { - unsigned long wrdstart, wrdend; + unsigned long wrdstart = 0, wrdend = 0; QString wrd; int availht = ((m_rotated) ? width() : height()) - m_topmargin - m_bottommargin; if (m_twotouch) { if (m_touchone) { m_touchone = false; m_startpos = startpos; m_startoffset = startoffset; setBackgroundColor( lightGray ); } else { m_touchone = true; setBackgroundColor( m_bg ); size_t endpos, endoffset; endpos = startpos; endoffset = startoffset; size_t currentpos = locate(); if (endpos >= m_startpos) { jumpto(m_startpos); for (int i = 0; i < m_startoffset; i++) { getch(); } wrdstart = buffdoc.explocate(); if (m_startpos == endpos) { for (int i = m_startoffset; i <= endoffset; i++) { wrd += QChar(getch()); } } else { while (buffdoc.explocate() <= endpos) { wrd += QChar(getch()); } for (int i = 0; i < endoffset; i++) { wrd += QChar(getch()); } } wrdend = buffdoc.explocate(); jumpto(currentpos); } } } else if (m_bMonoSpaced) { int chno = (m_rotated) ? (_e->y()-textarray[lineno]->offset(height(), m_left_border, m_right_border, availht))/m_charWidth : (_e->x()-textarray[lineno]->offset(width(), m_left_border, m_right_border, availht))/m_charWidth; if (chno < ustrlen(textarray[lineno]->data())) { wrd[0] = textarray[lineno]->data()[chno]; } } else { CDrawBuffer* t = textarray[lineno]; diff --git a/noncore/apps/opie-reader/plucker_base.cpp b/noncore/apps/opie-reader/plucker_base.cpp index 849edfc..302ac73 100644 --- a/noncore/apps/opie-reader/plucker_base.cpp +++ b/noncore/apps/opie-reader/plucker_base.cpp @@ -644,129 +644,129 @@ unsigned short CPlucker_base::finduid(unsigned short urlid) jmin = jmid; } else { jmax = jmid; } jmid = (jmin+jmax) >> 1; } gotorecordnumber(jmin); UInt16 thishdr_uid, thishdr_nParagraphs; UInt32 thishdr_size; UInt8 thishdr_type, thishdr_reserved; GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); unsigned short luid = thishdr_uid; //qDebug("jmin at end:%u,%u", jmin, luid); if (luid == urlid) { return jmin; } gotorecordnumber(jmax); GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); luid = thishdr_uid; //qDebug("jmax at end:%u,%u", jmax, luid); if (luid == urlid) { return jmax; } //qDebug("Couldn't find %u", urlid); return 0; // Not found! } #include <qnamespace.h> void CPlucker_base::setSaveData(unsigned char*& data, unsigned short& len, unsigned char* src, unsigned short srclen) { unsigned short sz = 0; for (CList<unsigned long>::iterator it = visited.begin(); it != visited.end(); it++) { sz++; } size_t newlen = srclen+sizeof(sz)+sz*sizeof(unsigned long); unsigned char* newdata = new unsigned char[newlen]; unsigned char* pdata = newdata; memcpy(newdata, src, srclen); newdata += srclen; memcpy(newdata, &sz, sizeof(sz)); newdata += sizeof(sz); #ifdef _WINDOWS for (it = visited.begin(); it != visited.end(); it++) #else for (CList<unsigned long>::iterator it = visited.begin(); it != visited.end(); it++) #endif { unsigned long t = *it; // qDebug("[%u]", t); memcpy(newdata, &t, sizeof(t)); newdata += sizeof(t); } m_nav.setSaveData(data, len, pdata, newlen); delete [] pdata; } void CPlucker_base::putSaveData(unsigned char*& src, unsigned short& srclen) { - unsigned short sz; + unsigned short sz = 0; if (srclen >= sizeof(sz)) { memcpy(&sz, src, sizeof(sz)); src += sizeof(sz); srclen -= sizeof(sz); } for (int i = 0; i < sz; i++) { unsigned long t; if (srclen >= sizeof(t)) { memcpy(&t, src, sizeof(t)); // qDebug("[%u]", t); visited.push_front(t); src += sizeof(t); srclen -= sizeof(t); } else { QMessageBox::warning(NULL, PROGNAME, "File data mismatch\nMight fix itself"); break; } } m_nav.putSaveData(src, srclen); } int CPlucker_base::OpenFile(const char *src) { qDebug("plucker openfile:%s", src); m_lastBreak = 0; if (!Cpdb::openpdbfile(src)) { return -1; } if (!CorrectDecoder()) return -1; gotorecordnumber(0); fread(&hdr0, 1, 6, fin); qDebug("Compression type:%u", ntohs(hdr0.version)); switch (ntohs(hdr0.version)) { case 2: m_decompress = UnZip; break; case 1: m_decompress = UnDoc; break; #ifdef USENEF case 3: m_decompress = getdecompressor("PluckerDecompress3"); break; case 4: m_decompress = getdecompressor("PluckerDecompress4"); break; #endif default: m_decompress = NULL; } if (m_decompress == NULL) return -1; setbuffersize(); diff --git a/noncore/apps/opie-reader/striphtml.cpp b/noncore/apps/opie-reader/striphtml.cpp index c434dbb..a2ad56b 100644 --- a/noncore/apps/opie-reader/striphtml.cpp +++ b/noncore/apps/opie-reader/striphtml.cpp @@ -412,129 +412,129 @@ QString striphtml::getname(tchar& ch, const QString& nd) { nm += ch; } else { break; } mygetch(ch, sty, dummy); } return nm; } QString striphtml::getattr(tchar& ch) { QString ref; CStyle sty; unsigned long pos; if (ch == ' ') ch = skip_ws(); if (ch == '=') { ch = skip_ws(); if (ch == '"') { mygetch(ch, sty, pos); ref = getname(ch, "\""); ch = skip_ws(); } else if (ch == '\'') { mygetch(ch, sty, pos); ref = getname(ch, "\'"); ch = skip_ws(); } else { ref = getname(ch, " >"); if (ch == ' ') ch = skip_ws(); } } return ref; } linkType striphtml::hyperlink(unsigned int n, unsigned int, QString& w, QString& nm) { #if defined(USEQPE) || defined(_WINDOWS) QMap<unsigned long, QString>::Iterator hrefit = id2href->find(n); #else QMap<unsigned long, QString>::iterator hrefit = id2href->find(n); #endif if (hrefit == id2href->end()) { return eNone; } QString href = *hrefit; #if defined(USEQPE) || defined(_WINDOWS) QMap<QString, unsigned long>::Iterator fpit = href2filepos->find(href); #else QMap<QString, unsigned long>::iterator fpit = href2filepos->find(href); #endif if (fpit == href2filepos->end()) { if (href == "history.back()") { QString fc = currentfile; - unsigned long loc; + unsigned long loc = 0; htmlmark m(fc, loc); linkType ret = (m_nav.back(m)) ? eFile : eNone; if (fc == m.filename()) { if ((ret & eFile) != 0) { locate(m.posn()); return eLink; } } return eNone; } qDebug("Searching for %s", (const char*)href); QString file, name; int colon = href.find('#'); if (colon >= 0) { file = dehtml(href.left(colon)); name = dehtml(href.right(href.length()-colon-1)); } else { file = dehtml(href); } qDebug("File:%s", (const char*)file); qDebug("Name:%s", (const char*)name); if (file.isEmpty()) { if (parent->findanchor(name)) { reset(); return eLink; } fpit = href2filepos->find(name); if (fpit != href2filepos->end()) { locate(*fpit); return eLink; } else { // nm = QString("<a[^>]*name[ \t]*=[ \t]*\"") + name + "\""; qDebug("Do a search for:%s", (const char*)name); findanchor(name); return eLink; } } else // if (href.find('#') == -1) { if (m_bchm) { w = file; nm = name; return eFile; } else { diff --git a/noncore/apps/tinykate/libkate/document/katehighlight.cpp b/noncore/apps/tinykate/libkate/document/katehighlight.cpp index 89024f7..ee6030f 100644 --- a/noncore/apps/tinykate/libkate/document/katehighlight.cpp +++ b/noncore/apps/tinykate/libkate/document/katehighlight.cpp @@ -1255,165 +1255,167 @@ HlManager::HlManager() : QObject(0L) { hlList.append(new Highlight(modeList.at(i))); i++; } } HlManager::~HlManager() { if(syntax) delete syntax; } HlManager *HlManager::self() { if ( !s_pSelf ) s_pSelf = new HlManager; return s_pSelf; } Highlight *HlManager::getHl(int n) { if (n < 0 || n >= (int) hlList.count()) n = 0; return hlList.at(n); } int HlManager::defaultHl() { KateConfig *config; config = KGlobal::config(); config->setGroup("General Options"); #warning fixme return nameFind(config->readEntry("Highlight")); } int HlManager::nameFind(const QString &name) { int z; for (z = hlList.count() - 1; z > 0; z--) { if (hlList.at(z)->iName == name) break; } return z; } int HlManager::wildcardFind(const QString &fileName) { Highlight *highlight; int p1, p2; QString w; for (highlight = hlList.first(); highlight != 0L; highlight = hlList.next()) { p1 = 0; w = highlight->getWildcards(); while (p1 < (int) w.length()) { p2 = w.find(';',p1); if (p2 == -1) p2 = w.length(); if (p1 < p2) { QRegExp regExp(w.mid(p1,p2 - p1),true,true); if (regExp.match(fileName) == 0) return hlList.at(); } p1 = p2 + 1; } } return -1; } int HlManager::makeAttribs(Highlight *highlight, Attribute *a, int maxAttribs) { ItemStyleList defaultStyleList; - ItemStyle *defaultStyle; + ItemStyle *defaultStyle = 0; ItemDataList itemDataList; ItemData *itemData; int nAttribs, z; odebug << "HlManager::makeAttribs" << oendl; defaultStyleList.setAutoDelete(true); getDefaults(defaultStyleList); // itemDataList.setAutoDelete(true); highlight->getItemDataList(itemDataList); nAttribs = itemDataList.count(); for (z = 0; z < nAttribs; z++) { - odebug << "HlManager::makeAttribs: createing one attribute definition" << oendl; + odebug << "HlManager::makeAttribs: creating an attribute definition" << oendl; itemData = itemDataList.at(z); if (itemData->defStyle) { // default style defaultStyle = defaultStyleList.at(itemData->defStyleNum); a[z].col = defaultStyle->col; a[z].selCol = defaultStyle->selCol; a[z].bold = defaultStyle->bold; a[z].italic = defaultStyle->italic; } else { // custom style a[z].col = itemData->col; a[z].selCol = itemData->selCol; a[z].bold = itemData->bold; a[z].italic = itemData->italic; } } for (; z < maxAttribs; z++) { a[z].col = black; a[z].selCol = black; - a[z].bold = defaultStyle->bold; - a[z].italic = defaultStyle->italic; + if (defaultStyle) { + a[z].bold = defaultStyle->bold; + a[z].italic = defaultStyle->italic; + } } return nAttribs; } int HlManager::defaultStyles() { return 10; } QString HlManager::defaultStyleName(int n) { static QStringList names; if (names.isEmpty()) { names << i18n("Normal"); names << i18n("Keyword"); names << i18n("Data Type"); names << i18n("Decimal/Value"); names << i18n("Base-N Integer"); names << i18n("Floating Point"); names << i18n("Character"); names << i18n("String"); names << i18n("Comment"); names << i18n("Others"); } return names[n]; } void HlManager::getDefaults(ItemStyleList &list) { KateConfig *config; int z; ItemStyle *i; QString s; QRgb col, selCol; list.setAutoDelete(true); //ItemStyle(color, selected color, bold, italic) list.append(new ItemStyle(black,white,false,false)); //normal list.append(new ItemStyle(black,white,true,false)); //keyword list.append(new ItemStyle(darkRed,white,false,false)); //datatype list.append(new ItemStyle(blue,cyan,false,false)); //decimal/value list.append(new ItemStyle(darkCyan,cyan,false,false)); //base n list.append(new ItemStyle(darkMagenta,cyan,false,false));//float list.append(new ItemStyle(magenta,magenta,false,false)); //char list.append(new ItemStyle(red,red,false,false)); //string list.append(new ItemStyle(darkGray,gray,false,true)); //comment list.append(new ItemStyle(darkGreen,green,false,false)); //others #warning fixme /* config = KateFactory::instance()->config(); config->setGroup("Default Item Styles"); for (z = 0; z < defaultStyles(); z++) { i = list.at(z); s = config->readEntry(defaultStyleName(z)); if (!s.isEmpty()) { sscanf(s.latin1(),"%X,%X,%d,%d",&col,&selCol,&i->bold,&i->italic); i->col.setRgb(col); i->selCol.setRgb(selCol); } } */ } diff --git a/noncore/net/ftplib/ftplib.c b/noncore/net/ftplib/ftplib.c index addf9d2..ce4c05f 100644 --- a/noncore/net/ftplib/ftplib.c +++ b/noncore/net/ftplib/ftplib.c @@ -720,129 +720,129 @@ static int FtpOpenPort(netbuf *nControl, netbuf **nData, int mode, int dir) } if (listen(sData, 1) < 0) { perror("listen"); net_close(sData); return 0; } if (getsockname(sData, &sin.sa, &l) < 0) return 0; sprintf(buf, "PORT %d,%d,%d,%d,%d,%d", (unsigned char) sin.sa.sa_data[2], (unsigned char) sin.sa.sa_data[3], (unsigned char) sin.sa.sa_data[4], (unsigned char) sin.sa.sa_data[5], (unsigned char) sin.sa.sa_data[0], (unsigned char) sin.sa.sa_data[1]); if (!FtpSendCmd(buf,'2',nControl)) { net_close(sData); return 0; } } ctrl = calloc(1,sizeof(netbuf)); if (ctrl == NULL) { perror("calloc"); net_close(sData); return -1; } if ((mode == 'A') && ((ctrl->buf = malloc(FTPLIB_BUFSIZ)) == NULL)) { perror("calloc"); net_close(sData); free(ctrl); return -1; } ctrl->handle = sData; ctrl->dir = dir; ctrl->idletime = nControl->idletime; ctrl->idlearg = nControl->idlearg; ctrl->xfered = 0; ctrl->xfered1 = 0; ctrl->cbbytes = nControl->cbbytes; if (ctrl->idletime.tv_sec || ctrl->idletime.tv_usec || ctrl->cbbytes) ctrl->idlecb = nControl->idlecb; else ctrl->idlecb = NULL; *nData = ctrl; return 1; } /* * FtpAcceptConnection - accept connection from server * * return 1 if successful, 0 otherwise */ static int FtpAcceptConnection(netbuf *nData, netbuf *nControl) { int sData; struct sockaddr addr; unsigned int l; int i; struct timeval tv; fd_set mask; - int rv; + int rv = 1; FD_ZERO(&mask); FD_SET(nControl->handle, &mask); FD_SET(nData->handle, &mask); tv.tv_usec = 0; tv.tv_sec = ACCEPT_TIMEOUT; printf("<<<<<<<<<<<<<<<<%d\n",ACCEPT_TIMEOUT); i = nControl->handle; if (i < nData->handle) i = nData->handle; i = select(i+1, &mask, NULL, NULL, &tv); if (i == -1) { strncpy(nControl->response, strerror(errno), sizeof(nControl->response)); net_close(nData->handle); nData->handle = 0; rv = 0; } else if (i == 0) { strcpy(nControl->response, "timed out waiting for connection"); net_close(nData->handle); nData->handle = 0; rv = 0; } else { if (FD_ISSET(nData->handle, &mask)) { l = sizeof(addr); sData = accept(nData->handle, &addr, &l); i = errno; net_close(nData->handle); if (sData > 0) { rv = 1; nData->handle = sData; } else { strncpy(nControl->response, strerror(i), sizeof(nControl->response)); nData->handle = 0; rv = 0; } } else if (FD_ISSET(nControl->handle, &mask)) { net_close(nData->handle); nData->handle = 0; readresp('2', nControl); rv = 0; } } return rv; } /* * FtpAccess - return a handle for a data stream * * return 1 if successful, 0 otherwise */ GLOBALDEF int FtpAccess(const char *path, int typ, int mode, netbuf *nControl, diff --git a/noncore/settings/sysinfo/contrib/dhry.c b/noncore/settings/sysinfo/contrib/dhry.c index 07fd1c0..5426157 100644 --- a/noncore/settings/sysinfo/contrib/dhry.c +++ b/noncore/settings/sysinfo/contrib/dhry.c @@ -511,129 +511,129 @@ Enumeration Func_1 (); #define REG register #endif /* variables for time measurement: */ #define Too_Small_Time 2 /* Measurements should last at least 2 seconds */ double Begin_Time, End_Time, User_Time; double Microseconds, Dhrystones_Per_Second, Vax_Mips; /* end of variables for time measurement */ /**********************************************************************************************/ Proc_1 (Ptr_Val_Par) /******************/ REG Rec_Pointer Ptr_Val_Par; /* executed once */ { REG Rec_Pointer Next_Record = Ptr_Val_Par->Ptr_Comp; /* == Ptr_Glob_Next */ /* Local variable, initialized with Ptr_Val_Par->Ptr_Comp, */ /* corresponds to "rename" in Ada, "with" in Pascal */ structassign (*Ptr_Val_Par->Ptr_Comp, *Ptr_Glob); Ptr_Val_Par->variant.var_1.Int_Comp = 5; Next_Record->variant.var_1.Int_Comp = Ptr_Val_Par->variant.var_1.Int_Comp; Next_Record->Ptr_Comp = Ptr_Val_Par->Ptr_Comp; Proc_3 (&Next_Record->Ptr_Comp); /* Ptr_Val_Par->Ptr_Comp->Ptr_Comp == Ptr_Glob->Ptr_Comp */ if (Next_Record->Discr == Ident_1) /* then, executed */ { Next_Record->variant.var_1.Int_Comp = 6; Proc_6 (Ptr_Val_Par->variant.var_1.Enum_Comp, &Next_Record->variant.var_1.Enum_Comp); Next_Record->Ptr_Comp = Ptr_Glob->Ptr_Comp; Proc_7 (Next_Record->variant.var_1.Int_Comp, 10, &Next_Record->variant.var_1.Int_Comp); } else /* not executed */ structassign (*Ptr_Val_Par, *Ptr_Val_Par->Ptr_Comp); } /* Proc_1 */ Proc_2 (Int_Par_Ref) /******************/ /* executed once */ /* *Int_Par_Ref == 1, becomes 4 */ One_Fifty *Int_Par_Ref; { One_Fifty Int_Loc; - Enumeration Enum_Loc; + Enumeration Enum_Loc = Ident_2; Int_Loc = *Int_Par_Ref + 10; do /* executed once */ if (Ch_1_Glob == 'A') /* then, executed */ { Int_Loc -= 1; *Int_Par_Ref = Int_Loc - Int_Glob; Enum_Loc = Ident_1; } /* if */ while (Enum_Loc != Ident_1); /* true */ } /* Proc_2 */ Proc_3 (Ptr_Ref_Par) /******************/ /* executed once */ /* Ptr_Ref_Par becomes Ptr_Glob */ Rec_Pointer *Ptr_Ref_Par; { if (Ptr_Glob != Null) /* then, executed */ *Ptr_Ref_Par = Ptr_Glob->Ptr_Comp; Proc_7 (10, Int_Glob, &Ptr_Glob->variant.var_1.Int_Comp); } /* Proc_3 */ Proc_4 () /* without parameters */ /*******/ /* executed once */ { Boolean Bool_Loc; Bool_Loc = Ch_1_Glob == 'A'; Bool_Glob = Bool_Loc | Bool_Glob; Ch_2_Glob = 'B'; } /* Proc_4 */ Proc_5 () /* without parameters */ /*******/ /* executed once */ { Ch_1_Glob = 'A'; Bool_Glob = false; } /* Proc_5 */ /* Procedure for the assignment of structures, */ /* if the C compiler doesn't support this feature */ #ifdef NOSTRUCTASSIGN memcpy (d, s, l) register char *d; register char *s; register int l; { while (l--) *d++ = *s++; } #endif Proc_6 (Enum_Val_Par, Enum_Ref_Par) |