Commit 6755df48 authored by kocienda's avatar kocienda
Browse files

I made a pass through the code and cleaned up all compiler warnings

reported by -Wall.
I also added some beginning of support for inlining functions.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@480 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 94673669
......@@ -464,8 +464,8 @@ void HTMLTitleElementImpl::setTitle()
s.compose();
s = KStringHandler::csqueeze( s.visual(), 128 );
HTMLDocumentImpl *d = static_cast<HTMLDocumentImpl *>(ownerDocument());
// FIXME: need to uncomment this eventually
//HTMLDocumentImpl *d = static_cast<HTMLDocumentImpl *>(ownerDocument());
//if ( !d->view()->part()->parentPart() )
// emit d->view()->part()->setWindowCaption( s.visual() );
}
......@@ -143,6 +143,10 @@ public:
m_viewprivate = vp;
};
#ifdef _KWQ_
virtual ~KHTMLToolTip() {}
#endif
protected:
virtual void maybeTip(const QPoint &);
......@@ -1094,7 +1098,8 @@ void KHTMLView::addFormCompletionItem(const QString &name, const QString &value)
// dashes or spaces as those are likely credit card numbers or
// something similar
bool cc_number(true);
for (int i = 0; i < value.length(); ++i)
// [kocienda] fixed signed/unsigned int comparison
for (unsigned int i = 0; i < value.length(); ++i)
{
QChar c(value[i]);
if (!c.isNumber() && c != '-' && !c.isSpace())
......
......@@ -69,8 +69,9 @@ void RenderHR::print(QPainter *p, int _x, int _y, int _w, int _h, int _tx, int _
prev = prev->previousSibling();
if(prev && static_cast<RenderFlow *>(prev)->floatBottom() > prev->height() )
xp += static_cast<RenderFlow *>(prev)->leftOffset( prev->height() );
int yp = _ty ;
// [kocienda] yp is unused because of #if 0 block
//int yp = _ty ;
......
......@@ -729,7 +729,8 @@ void RenderTable::calcFinalColMax(int c, ColInfo* col)
oldmin+=colMinWidth[o];
}
int smin = col->min;
// [kocienda] smin in unused
//int smin = col->min;
int smax = col->max;
if (col->type == Percent)
......@@ -1357,7 +1358,8 @@ void RenderTable::layoutRows(int yoff)
continue;
if ( c < totalCols - 1 && cell == cells[r][c+1] )
continue;
if ( r < (int)totalRows - 1 && cell == cells[r+1][c] )
// [kocienda] fixed signed/unsigned comparison
if ( (int)r < (int)totalRows - 1 && cell == cells[r+1][c] )
continue;
cell->calcVerticalMargins();
......@@ -1378,7 +1380,8 @@ void RenderTable::layoutRows(int yoff)
else if (h.isPercent())
{
Length ch = containingBlock()->style()->height();
RenderObject *containing = containingBlock();
// [kocienda] containing is unused
//RenderObject *containing = containingBlock();
if (ch.isFixed())
th = h.width(ch.value);
else
......@@ -1425,7 +1428,8 @@ void RenderTable::layoutRows(int yoff)
continue;
if ( c < totalCols - 1 && cell == cells[r][c+1] )
continue;
if ( r < (int)totalRows - 1 && cell == cells[r+1][c] )
// [kocienda] fixed signed/unsigned comparison
if ( (int)r < (int)totalRows - 1 && cell == cells[r+1][c] )
continue;
if ( ( indx = c-cell->colSpan()+1 ) < 0 )
......
......@@ -97,7 +97,7 @@ int QCString::find(const char *s, int index=0, bool cs=TRUE) const
result = -1;
if (!s || index >= size()) {
if (!s || index >= (int)size()) {
result = -1;
}
else if (!*s) {
......
......@@ -51,6 +51,8 @@ const QChar QChar::null;
// constructors, copy constructors, and destructors ----------------------------
#ifndef _KWQ_QCHAR_INLINES_
QChar::QChar()
{
c = 0;
......@@ -96,6 +98,8 @@ QChar::~QChar()
// do nothing because the single data member is a UniChar
}
#endif // _KWQ_QCHAR_INLINES_
// member functions ------------------------------------------------------------
ushort QChar::unicode() const
......@@ -231,6 +235,8 @@ int QChar::digitValue() const
// operators -------------------------------------------------------------------
#ifndef _KWQ_QCHAR_INLINES_
bool operator==(QChar qc1, QChar qc2)
{
return qc1.c == qc2.c;
......@@ -321,6 +327,8 @@ bool operator<(char ch, QChar qc)
return ch < qc.c;
}
#endif // _KWQ_QCHAR_INLINES_
#else // USING_BORROWED_QSTRING
// This will help to keep the linker from complaining about empty archives
void KWQChar_Dummy() {}
......
......@@ -374,8 +374,6 @@ void QColor::setHsv(int h, int s, int v)
QColor QColor::light(int factor) const
{
NSColor *newColor;
if (factor <= 0) {
return QColor(*this);
}
......@@ -407,8 +405,6 @@ QColor QColor::light(int factor) const
QColor QColor::dark(int factor) const
{
NSColor *newColor;
if (factor <= 0) {
return QColor(*this);
}
......@@ -493,7 +489,9 @@ QT_STATIC_CONST_IMPL QColor & Qt::darkYellow = stdcol[18];
void QColor::initGlobalColors()
{
NSAutoreleasePool *colorPool = [[NSAutoreleasePool allocWithZone:NULL] init];
NSAutoreleasePool *colorPool;
colorPool = [[NSAutoreleasePool allocWithZone:NULL] init];
globals_init = TRUE;
......
......@@ -132,10 +132,14 @@ int QFont::weight() const
bool QFont::setItalic(bool flag)
{
if (flag)
if (flag) {
_setTrait (NSItalicFontMask);
else
return TRUE;
}
else {
_setTrait (NSUnitalicFontMask);
return FALSE;
}
}
......
......@@ -145,7 +145,6 @@ static NSMutableDictionary *metricsCache = nil;
- (NSRect)rectForString:(NSString *)string
{
KWQLayoutFragment *cachedFragment, *fragment;
NSTextStorage *textStorage;
if (fragmentCache == nil){
fragmentCache = [[NSMutableDictionary alloc] init];
......
......@@ -60,5 +60,6 @@ QFrame::QFrame(const QFrame &)
QFrame &QFrame::operator=(const QFrame &)
{
_logNeverImplemented();
return *this;
}
......@@ -27,15 +27,15 @@
void KCursor::setAutoHideCursor(QWidget *w, bool enable) {}
QCursor KCursor::arrowCursor() {}
QCursor KCursor::crossCursor() {}
QCursor KCursor::sizeAllCursor() {}
QCursor KCursor::sizeHorCursor() {}
QCursor KCursor::sizeVerCursor() {}
QCursor KCursor::sizeBDiagCursor() {}
QCursor KCursor::sizeFDiagCursor() {}
QCursor KCursor::ibeamCursor() {}
QCursor KCursor::waitCursor() {}
QCursor KCursor::arrowCursor() { return QCursor(); }
QCursor KCursor::crossCursor() { return QCursor(); }
QCursor KCursor::sizeAllCursor() { return QCursor(); }
QCursor KCursor::sizeHorCursor() { return QCursor(); }
QCursor KCursor::sizeVerCursor() { return QCursor(); }
QCursor KCursor::sizeBDiagCursor() { return QCursor(); }
QCursor KCursor::sizeFDiagCursor() { return QCursor(); }
QCursor KCursor::ibeamCursor() { return QCursor(); }
QCursor KCursor::waitCursor() { return QCursor(); }
KCursor::KCursor()
......
......@@ -66,17 +66,17 @@ public:
kdbgstream &operator<<(const QCString &);
kdbgstream &operator<<(KDBGFUNC);
// protected -------------------------------------------------------------------
// private ---------------------------------------------------------------------
private:
// add copy constructor
// this private declaration prevents copying
#ifdef _KWQ_PEDANTIC_
kdbgstream(const kdbgstream &);
#endif
// protected -------------------------------------------------------------------
// private ---------------------------------------------------------------------
private:
// add assignment operator
// this private declaration prevents assignment
#ifdef _KWQ_PEDANTIC_
......
......@@ -33,31 +33,37 @@ kdbgstream::kdbgstream(unsigned int area, unsigned int level, bool print=true)
kdbgstream &kdbgstream::operator<<(int)
{
return *this;
}
kdbgstream &kdbgstream::operator<<(const char *)
{
return *this;
}
kdbgstream &kdbgstream::operator<<(const void *)
{
return *this;
}
kdbgstream &kdbgstream::operator<<(const QString &)
{
return *this;
}
kdbgstream &kdbgstream::operator<<(const QCString &)
{
return *this;
}
kdbgstream &kdbgstream::operator<<(KDBGFUNC)
{
return *this;
}
......@@ -65,36 +71,43 @@ kdbgstream &kdbgstream::operator<<(KDBGFUNC)
kdbgstream kdDebug(int area = 0)
{
return kdbgstream(0,0);
}
kdbgstream kdWarning(int area = 0)
{
return kdbgstream(0,0);
}
kdbgstream kdWarning(bool cond, int area = 0)
{
return kdbgstream(0,0);
}
kdbgstream kdError(int area = 0)
{
return kdbgstream(0,0);
}
kdbgstream kdError(bool cond, int area = 0)
{
return kdbgstream(0,0);
}
kdbgstream kdFatal(int area = 0)
{
return kdbgstream(0,0);
}
kdbgstream kdFatal(bool cond, int area = 0)
{
return kdbgstream(0,0);
}
......
......@@ -28,7 +28,7 @@
#include <qfont.h>
#include <qtextcodec.h>
#include <Foundation/Foundation.h>
#import <Foundation/Foundation.h>
#include <job.h>
#include <jobclasses.h>
......@@ -45,12 +45,15 @@
#include <kjs.h>
#include <kjs_dom.h>
#include <dom_doc.h>
#include <qcursor.h>
#include <KWQKHTMLPart.h>
#import <WCURICache.h>
#import <WCURICacheData.h>
#import <KWQView.h>
static bool cache_init = false;
static void recursive(const DOM::Node &pNode, const DOM::Node &node)
......@@ -279,6 +282,8 @@ bool KHTMLPart::closeURL()
//d->m_doc = 0;
return true;
}
......@@ -421,7 +426,7 @@ bool KHTMLPart::onlyLocalReferences() const
}
#ifdef _KWQ_TIMING
static long totalWriteTime = 0;
static double totalWriteTime = 0;
#endif
......@@ -509,7 +514,7 @@ void KHTMLPart::write(const char *str, int len)
if ( len == -1 )
len = strlen( str );
long start = _GetMillisecondsSinceEpoch();
double start = CFAbsoluteTimeGetCurrent();
QString decoded = d->m_decoder->decode( str, len );
......@@ -525,9 +530,9 @@ void KHTMLPart::write(const char *str, int len)
t->write( decoded, true );
#ifdef _KWQ_TIMING
long thisTime = _GetMillisecondsSinceEpoch() - start;
double thisTime = CFAbsoluteTimeGetCurrent() - start;
totalWriteTime += thisTime;
KWQDEBUGLEVEL3 (0x200, "tokenize/parse length = %d, milliseconds = %d, total = %d\n", len, thisTime, totalWriteTime);
KWQDEBUGLEVEL3 (0x200, "tokenize/parse length = %e, milliseconds = %e, total = %e\n", len, thisTime, totalWriteTime);
#endif
}
......@@ -665,10 +670,12 @@ void KHTMLPart::setURLCursor( const QCursor &c )
_logNeverImplemented();
}
// FIXME: this should be removed
static const QCursor staticURLCursor = QCursor();
const QCursor& KHTMLPart::urlCursor() const
{
_logNeverImplemented();
return staticURLCursor;
}
......@@ -707,6 +714,7 @@ QString KHTMLPart::selectedText() const
DOM::Range KHTMLPart::selection() const
{
_logNeverImplemented();
return DOM::Range();
}
......@@ -946,7 +954,8 @@ void KHTMLPart::khtmlMouseMoveEvent( khtml::MouseMoveEvent *event )
// The mouse is over something
if ( url.length() )
{
bool shiftPressed = ( _mouse->state() & ShiftButton );
// FIXME: this is unused
//bool shiftPressed = ( _mouse->state() & ShiftButton );
// Image map
if ( !innerNode.isNull() && innerNode.elementId() == ID_IMG )
......@@ -1067,7 +1076,6 @@ void KHTMLPart::khtmlMouseMoveEvent( khtml::MouseMoveEvent *event )
void KHTMLPart::khtmlMouseReleaseEvent( khtml::MouseReleaseEvent *event )
{
QMouseEvent *_mouse = event->qmouseEvent();
DOM::Node innerNode = event->innerNode();
d->m_mousePressNode = DOM::Node();
......@@ -1080,7 +1088,7 @@ void KHTMLPart::khtmlMouseReleaseEvent( khtml::MouseReleaseEvent *event )
// HACK! FIXME!
if (d->m_strSelectedURL != QString::null) {
[((QWidget *)view())->getView() resetView];
[((KWQHTMLView *)((QWidget *)view())->getView()) resetView];
KURL clickedURL(completeURL( splitUrlTarget(d->m_strSelectedURL)));
openURL (clickedURL);
// [kocienda]: shield your eyes!
......
......@@ -28,7 +28,7 @@
#include <qfont.h>
#include <qtextcodec.h>
#include <Foundation/Foundation.h>
#import <Foundation/Foundation.h>
#include <job.h>
#include <jobclasses.h>
......@@ -45,12 +45,15 @@
#include <kjs.h>
#include <kjs_dom.h>
#include <dom_doc.h>
#include <qcursor.h>
#include <KWQKHTMLPart.h>
#import <WCURICache.h>
#import <WCURICacheData.h>
#import <KWQView.h>
static bool cache_init = false;
static void recursive(const DOM::Node &pNode, const DOM::Node &node)
......@@ -279,6 +282,8 @@ bool KHTMLPart::closeURL()
//d->m_doc = 0;
return true;
}
......@@ -421,7 +426,7 @@ bool KHTMLPart::onlyLocalReferences() const
}
#ifdef _KWQ_TIMING
static long totalWriteTime = 0;
static double totalWriteTime = 0;
#endif
......@@ -509,7 +514,7 @@ void KHTMLPart::write(const char *str, int len)
if ( len == -1 )
len = strlen( str );
long start = _GetMillisecondsSinceEpoch();
double start = CFAbsoluteTimeGetCurrent();
QString decoded = d->m_decoder->decode( str, len );
......@@ -525,9 +530,9 @@ void KHTMLPart::write(const char *str, int len)
t->write( decoded, true );
#ifdef _KWQ_TIMING
long thisTime = _GetMillisecondsSinceEpoch() - start;
double thisTime = CFAbsoluteTimeGetCurrent() - start;
totalWriteTime += thisTime;
KWQDEBUGLEVEL3 (0x200, "tokenize/parse length = %d, milliseconds = %d, total = %d\n", len, thisTime, totalWriteTime);
KWQDEBUGLEVEL3 (0x200, "tokenize/parse length = %e, milliseconds = %e, total = %e\n", len, thisTime, totalWriteTime);
#endif
}
......@@ -665,10 +670,12 @@ void KHTMLPart::setURLCursor( const QCursor &c )
_logNeverImplemented();
}
// FIXME: this should be removed
static const QCursor staticURLCursor = QCursor();
const QCursor& KHTMLPart::urlCursor() const
{
_logNeverImplemented();
return staticURLCursor;
}
......@@ -707,6 +714,7 @@ QString KHTMLPart::selectedText() const
DOM::Range KHTMLPart::selection() const
{
_logNeverImplemented();
return DOM::Range();
}
......@@ -946,7 +954,8 @@ void KHTMLPart::khtmlMouseMoveEvent( khtml::MouseMoveEvent *event )
// The mouse is over something
if ( url.length() )
{
bool shiftPressed = ( _mouse->state() & ShiftButton );
// FIXME: this is unused
//bool shiftPressed = ( _mouse->state() & ShiftButton );
// Image map
if ( !innerNode.isNull() && innerNode.elementId() == ID_IMG )
......@@ -1067,7 +1076,6 @@ void KHTMLPart::khtmlMouseMoveEvent( khtml::MouseMoveEvent *event )
void KHTMLPart::khtmlMouseReleaseEvent( khtml::MouseReleaseEvent *event )
{
QMouseEvent *_mouse = event->qmouseEvent();
DOM::Node innerNode = event->innerNode();
d->m_mousePressNode = DOM::Node();
......@@ -1080,7 +1088,7 @@ void KHTMLPart::khtmlMouseReleaseEvent( khtml::MouseReleaseEvent *event )
// HACK! FIXME!
if (d->m_strSelectedURL != QString::null) {
[((QWidget *)view())->getView() resetView];
[((KWQHTMLView *)((QWidget *)view())->getView()) resetView];
KURL clickedURL(completeURL( splitUrlTarget(d->m_strSelectedURL)));
openURL (clickedURL);
// [kocienda]: shield your eyes!
......
......@@ -33,7 +33,7 @@ KHTMLSettings::KHTMLSettings()
// set available font families...ask the system
NSFontManager *sharedFontManager;
NSArray *array, *fontSizeArray;
int i;
unsigned int i;
sharedFontManager = [NSFontManager sharedFontManager];
array = [sharedFontManager availableFontFamilies];
......
......@@ -108,8 +108,6 @@ private:
TransferJob::TransferJob(const KURL &url, bool reload=false, bool showProgressInfo=true)
{
NSString *string;
_url = url;
_reload = reload;
_showProgressInfo = showProgressInfo;
......
......@@ -41,13 +41,15 @@ KLineEdit::~KLineEdit()
void KLineEdit::setMouseTracking(bool)
{
KWQNSTextField *fieldView = (KWQNSTextField *)getView();
KWQNSTextField *fieldView;
fieldView = (KWQNSTextField *)getView();
}
void KLineEdit::setContextMenuEnabled(bool showMenu)
{
KWQNSTextField *fieldView = (KWQNSTextField *)getView();
KWQNSTextField *fieldView;
fieldView = (KWQNSTextField *)getView();
}
......
......@@ -49,8 +49,8 @@ public:
// constructors, copy constructors, and destructors ------------------------
KSharedPtr() {}
KSharedPtr(const KSharedPtr &) {}
KSharedPtr() { object = 0; }
KSharedPtr(const KSharedPtr &) {object = 0;}
~KSharedPtr() {}
// member functions --------------------------------------------------------
......@@ -58,11 +58,14 @@ public:
// operators ---------------------------------------------------------------
KSharedPtr &operator=(const KSharedPtr &) {}
T *operator->() {}
T *operator->() { return object; }
// protected -------------------------------------------------------------------
// private ---------------------------------------------------------------------
private:
T *object;
}; // class KSharedPtr =========================================================
......
......@@ -28,10 +28,12 @@
//FIX ME:
static QString tempQString = QString();
static KMimeType::Ptr tempPtr = KMimeType::Ptr();
KMimeType::Ptr KMimeType::findByURL(const KURL &, mode_t=0, bool=false, bool)
{
_logNotYetImplemented();
return tempPtr;
}
......