diff options
author | Jorge Arellano Cid <jcid@dillo.org> | 2009-02-08 21:16:37 -0300 |
---|---|---|
committer | Jorge Arellano Cid <jcid@dillo.org> | 2009-02-08 21:16:37 -0300 |
commit | 845493306279f446dbac9568a0a1e0f442e615dd (patch) | |
tree | dbf0a36e50a268b456760ce881a802d28979cc5f | |
parent | 283a7960e615b14c21b7ce757b0fcbe5c945bb95 (diff) |
's/if(/if (/g' 's/for(/for (/g' 's/while(/while (/g', and indentation.
-rw-r--r-- | dlib/dlib.c | 4 | ||||
-rw-r--r-- | dpi/datauri.c | 113 | ||||
-rw-r--r-- | dpi/downloads.cc | 2 | ||||
-rw-r--r-- | dpi/https.c | 4 | ||||
-rw-r--r-- | dw/alignedtextblock.cc | 4 | ||||
-rw-r--r-- | dw/findtext.cc | 4 | ||||
-rw-r--r-- | dw/fltkimgbuf.cc | 6 | ||||
-rw-r--r-- | dw/fltkplatform.cc | 18 | ||||
-rw-r--r-- | dw/fltkpreview.cc | 2 | ||||
-rw-r--r-- | dw/fltkui.cc | 18 | ||||
-rw-r--r-- | dw/fltkviewbase.cc | 12 | ||||
-rw-r--r-- | dw/fltkviewport.cc | 12 | ||||
-rw-r--r-- | dw/image.cc | 6 | ||||
-rw-r--r-- | dw/iterator.cc | 12 | ||||
-rw-r--r-- | dw/layout.cc | 18 | ||||
-rw-r--r-- | dw/style.hh | 8 | ||||
-rw-r--r-- | lout/container.cc | 110 | ||||
-rw-r--r-- | lout/misc.cc | 28 | ||||
-rw-r--r-- | lout/object.cc | 26 | ||||
-rw-r--r-- | lout/signal.cc | 8 | ||||
-rw-r--r-- | src/css.hh | 10 | ||||
-rw-r--r-- | src/dillo.cc | 2 |
22 files changed, 213 insertions, 214 deletions
diff --git a/dlib/dlib.c b/dlib/dlib.c index 0f318134..023f869a 100644 --- a/dlib/dlib.c +++ b/dlib/dlib.c @@ -850,10 +850,10 @@ char *dGetline (FILE *stream) dReturn_val_if_fail (stream, 0); dstr = dStr_sized_new(64); - while((ch = fgetc(stream)) != EOF) { + while ((ch = fgetc(stream)) != EOF) { if (ch == '\\') { /* continue with the next line */ - while((ch = fgetc(stream)) != EOF && ch != '\n'); + while ((ch = fgetc(stream)) != EOF && ch != '\n') ; continue; } dStr_append_c(dstr, ch); diff --git a/dpi/datauri.c b/dpi/datauri.c index 0165eba4..9d8fbcb7 100644 --- a/dpi/datauri.c +++ b/dpi/datauri.c @@ -39,63 +39,60 @@ static SockHandler *sh = NULL; static int b64decode(unsigned char* str) { - unsigned char *cur, *start; - int d, dlast, phase; - unsigned char c; - static int table[256] = { - -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, /* 00-0F */ - -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, /* 10-1F */ - -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,62,-1,-1,-1,63, /* 20-2F */ - 52,53,54,55,56,57,58,59,60,61,-1,-1,-1,-1,-1,-1, /* 30-3F */ - -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14, /* 40-4F */ - 15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1, /* 50-5F */ - -1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40, /* 60-6F */ - 41,42,43,44,45,46,47,48,49,50,51,-1,-1,-1,-1,-1, /* 70-7F */ - -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, /* 80-8F */ - -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, /* 90-9F */ - -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, /* A0-AF */ - -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, /* B0-BF */ - -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, /* C0-CF */ - -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, /* D0-DF */ - -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, /* E0-EF */ - -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 /* F0-FF */ - }; - - d = dlast = phase = 0; - start = str; - for (cur = str; *cur != '\0'; ++cur ) - { - // jer: treat line endings as physical breaks. - //if (*cur == '\n' || *cur == '\r'){phase = dlast = 0; continue;} - d = table[(int)*cur]; - if(d != -1) - { - switch(phase) - { - case 0: - ++phase; - break; - case 1: - c = ((dlast << 2) | ((d & 0x30) >> 4)); - *str++ = c; - ++phase; - break; - case 2: - c = (((dlast & 0xf) << 4) | ((d & 0x3c) >> 2)); - *str++ = c; - ++phase; - break; - case 3: - c = (((dlast & 0x03 ) << 6) | d); - *str++ = c; - phase = 0; - break; - } - dlast = d; - } - } - *str = '\0'; - return str - start; + unsigned char *cur, *start; + int d, dlast, phase; + unsigned char c; + static int table[256] = { + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, /* 00-0F */ + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, /* 10-1F */ + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,62,-1,-1,-1,63, /* 20-2F */ + 52,53,54,55,56,57,58,59,60,61,-1,-1,-1,-1,-1,-1, /* 30-3F */ + -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14, /* 40-4F */ + 15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1, /* 50-5F */ + -1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40, /* 60-6F */ + 41,42,43,44,45,46,47,48,49,50,51,-1,-1,-1,-1,-1, /* 70-7F */ + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, /* 80-8F */ + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, /* 90-9F */ + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, /* A0-AF */ + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, /* B0-BF */ + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, /* C0-CF */ + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, /* D0-DF */ + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, /* E0-EF */ + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 /* F0-FF */ + }; + + d = dlast = phase = 0; + start = str; + for (cur = str; *cur != '\0'; ++cur ) { + // jer: treat line endings as physical breaks. + //if (*cur == '\n' || *cur == '\r'){phase = dlast = 0; continue;} + d = table[(int)*cur]; + if (d != -1) { + switch(phase) { + case 0: + ++phase; + break; + case 1: + c = ((dlast << 2) | ((d & 0x30) >> 4)); + *str++ = c; + ++phase; + break; + case 2: + c = (((dlast & 0xf) << 4) | ((d & 0x3c) >> 2)); + *str++ = c; + ++phase; + break; + case 3: + c = (((dlast & 0x03 ) << 6) | d); + *str++ = c; + phase = 0; + break; + } + dlast = d; + } + } + *str = '\0'; + return str - start; } /* Modified from src/url.c --------------------------------------------------*/ @@ -113,7 +110,7 @@ static int Url_decode_hex_octet(const char *s) hex[2] = 0; hex_value = strtol(hex, &tail, 16); if (tail - hex == 2) - return hex_value; + return hex_value; } return -1; } diff --git a/dpi/downloads.cc b/dpi/downloads.cc index bafb90d7..59df6361 100644 --- a/dpi/downloads.cc +++ b/dpi/downloads.cc @@ -513,7 +513,7 @@ void DLItem::log_text_add(const char *buf, ssize_t st) if (isdigit(*q++ = *p)) { // keep here } else if (*p == 'K') { - for(--q; isdigit(q[-1]); --q) ; log_state = ST_discard; + for (--q; isdigit(q[-1]); --q) ; log_state = ST_discard; } else { log_state = ST_copy; } diff --git a/dpi/https.c b/dpi/https.c index c90c4a40..961fc2d6 100644 --- a/dpi/https.c +++ b/dpi/https.c @@ -589,7 +589,7 @@ static int save_certificate_home(X509 * cert) snprintf(buf,4096,"%s/.dillo/certs/", dGethomedir()); mkdir(buf, 01777); - do{ + do { snprintf(buf, 4096, "%s/.dillo/certs/%lx.%u", dGethomedir(), X509_subject_name_hash(cert), i); @@ -612,7 +612,7 @@ static int save_certificate_home(X509 * cert) } i++; /*Don't loop too many times - just give up*/ - } while( i < 1024 ); + } while (i < 1024); return retval; } diff --git a/dw/alignedtextblock.cc b/dw/alignedtextblock.cc index bb24a3bc..a886aed2 100644 --- a/dw/alignedtextblock.cc +++ b/dw/alignedtextblock.cc @@ -54,7 +54,7 @@ void AlignedTextblock::List::unref(int pos) textblocks->set (pos, NULL); refCount--; - if(refCount == 0) + if (refCount == 0) delete this; } @@ -68,7 +68,7 @@ AlignedTextblock::AlignedTextblock (bool limitTextWidth): void AlignedTextblock::setRefTextblock (AlignedTextblock *ref) { - if(ref == NULL) + if (ref == NULL) list = new List(); else list = ref->list; diff --git a/dw/findtext.cc b/dw/findtext.cc index 93564692..eb7dd2c0 100644 --- a/dw/findtext.cc +++ b/dw/findtext.cc @@ -96,7 +96,7 @@ FindtextState::Result FindtextState::search (const char *key, bool caseSens, if (backwards) { /* Go to end */ - while(iterator->next () ) ; + while (iterator->next () ) ; iterator->prev (); //We don't want to be at CharIterator::END. } else { iterator->next (); @@ -127,7 +127,7 @@ FindtextState::Result FindtextState::search (const char *key, bool caseSens, iterator = new CharIterator (widget); if (backwards) { /* Go to end */ - while(iterator->next ()) ; + while (iterator->next ()) ; iterator->prev (); //We don't want to be at CharIterator::END. } else { iterator->next (); diff --git a/dw/fltkimgbuf.cc b/dw/fltkimgbuf.cc index 835f6e76..96164674 100644 --- a/dw/fltkimgbuf.cc +++ b/dw/fltkimgbuf.cc @@ -124,16 +124,16 @@ inline void FltkImgbuf::scaleRow (int row, const core::byte *data) int sr1 = scaledY (row); int sr2 = scaledY (row + 1); - for(int sr = sr1; sr < sr2; sr++) { + for (int sr = sr1; sr < sr2; sr++) { // Avoid multiple passes. if (copiedRows->get(sr)) continue; copiedRows->set (sr, true); if (sr == sr1) { - for(int px = 0; px < root->width; px++) { + for (int px = 0; px < root->width; px++) { int px1 = px * width / root->width; int px2 = (px+1) * width / root->width; - for(int sp = px1; sp < px2; sp++) { + for (int sp = px1; sp < px2; sp++) { memcpy(rawdata + (sr*width + sp)*bpp, data + px*bpp, bpp); } } diff --git a/dw/fltkplatform.cc b/dw/fltkplatform.cc index 4338f0a8..64229155 100644 --- a/dw/fltkplatform.cc +++ b/dw/fltkplatform.cc @@ -48,13 +48,13 @@ FltkFont::FltkFont (core::style::FontAttrs *attrs) copyAttrs (attrs); int fa = 0; - if(weight >= 500) + if (weight >= 500) fa |= BOLD; - if(style != core::style::FONT_STYLE_NORMAL) + if (style != core::style::FONT_STYLE_NORMAL) fa |= ITALIC; font = ::fltk::font(name, fa); - if(font == NULL) { + if (font == NULL) { /* * If using xft, fltk::HELVETICA just means sans, fltk::COURIER * means mono, and fltk::TIMES means serif. @@ -242,7 +242,7 @@ FltkPlatform::FltkPlatform () FltkPlatform::~FltkPlatform () { - if(idleFuncRunning) + if (idleFuncRunning) remove_idle (generalStaticIdle, (void*)this); delete idleQueue; delete views; @@ -325,7 +325,7 @@ void FltkPlatform::generalIdle () idleQueue->removeRef(idleFunc); } - if(idleQueue->isEmpty()) { + if (idleQueue->isEmpty()) { idleFuncRunning = false; remove_idle (generalStaticIdle, (void*)this); } @@ -340,7 +340,7 @@ int FltkPlatform::addIdle (void (core::Layout::*func) ()) * Since ... (todo) we have to wrap around fltk_add_idle. There is only one * idle function, the passed idle function is put into a queue. */ - if(!idleFuncRunning) { + if (!idleFuncRunning) { add_idle (generalStaticIdle, (void*)this); idleFuncRunning = true; } @@ -361,15 +361,15 @@ void FltkPlatform::removeIdle (int idleId) container::typed::Iterator <IdleFunc> it; IdleFunc *idleFunc; - for(found = false, it = idleQueue->iterator(); !found && it.hasNext(); ) { + for (found = false, it = idleQueue->iterator(); !found && it.hasNext(); ) { idleFunc = it.getNext(); - if(idleFunc->id == idleId) { + if (idleFunc->id == idleId) { idleQueue->removeRef (idleFunc); found = true; } } - if(idleFuncRunning && idleQueue->isEmpty()) + if (idleFuncRunning && idleQueue->isEmpty()) remove_idle (generalStaticIdle, (void*)this); } diff --git a/dw/fltkpreview.cc b/dw/fltkpreview.cc index 6bed7adf..3c383638 100644 --- a/dw/fltkpreview.cc +++ b/dw/fltkpreview.cc @@ -191,7 +191,7 @@ void FltkPreviewWindow::reallocate () int mx, my, width, height; bool warp = false; - if(preview->canvasHeight * maxWidth > maxHeight * preview->canvasWidth) { + if (preview->canvasHeight * maxWidth > maxHeight * preview->canvasWidth) { // Expand to maximal height (most likely case). width = preview->canvasWidth * maxHeight / preview->canvasHeight; height = maxHeight; diff --git a/dw/fltkui.cc b/dw/fltkui.cc index 250ee981..d1a2c074 100644 --- a/dw/fltkui.cc +++ b/dw/fltkui.cc @@ -91,7 +91,7 @@ FltkResource::~FltkResource () } delete viewsAndWidgets; - if(style) + if (style) style->unref (); } @@ -152,7 +152,7 @@ void FltkResource::draw (core::View *view, core::Rectangle *area) void FltkResource::setStyle (core::style::Style *style) { - if(this->style) + if (this->style) this->style->unref (); this->style = style; @@ -324,12 +324,12 @@ static core::ButtonState getDwButtonState () int s1 = ::fltk::event_state (); int s2 = (core::ButtonState)0; - if(s1 & ::fltk::SHIFT) s2 |= core::SHIFT_MASK; - if(s1 & ::fltk::CTRL) s2 |= core::CONTROL_MASK; - if(s1 & ::fltk::ALT) s2 |= core::META_MASK; - if(s1 & ::fltk::BUTTON1) s2 |= core::BUTTON1_MASK; - if(s1 & ::fltk::BUTTON2) s2 |= core::BUTTON2_MASK; - if(s1 & ::fltk::BUTTON3) s2 |= core::BUTTON3_MASK; + if (s1 & ::fltk::SHIFT) s2 |= core::SHIFT_MASK; + if (s1 & ::fltk::CTRL) s2 |= core::CONTROL_MASK; + if (s1 & ::fltk::ALT) s2 |= core::META_MASK; + if (s1 & ::fltk::BUTTON1) s2 |= core::BUTTON1_MASK; + if (s1 & ::fltk::BUTTON2) s2 |= core::BUTTON2_MASK; + if (s1 & ::fltk::BUTTON3) s2 |= core::BUTTON3_MASK; return (core::ButtonState)s2; } @@ -1117,7 +1117,7 @@ template <class I> void FltkSelectionResource<I>::pushGroup (const char *name, ::fltk::ItemGroup *group = item->createNewGroupWidget (); widgetStack->stack->getTop()->getTypedValue()->add (group); widgetStack->stack->push (new TypedPointer < ::fltk::Menu> (group)); - if(!enabled) + if (!enabled) group->deactivate (); } } diff --git a/dw/fltkviewbase.cc b/dw/fltkviewbase.cc index ad1b3bc7..ae43b352 100644 --- a/dw/fltkviewbase.cc +++ b/dw/fltkviewbase.cc @@ -178,12 +178,12 @@ core::ButtonState getDwButtonState () int s1 = event_state (); int s2 = (core::ButtonState)0; - if(s1 & SHIFT) s2 |= core::SHIFT_MASK; - if(s1 & CTRL) s2 |= core::CONTROL_MASK; - if(s1 & ALT) s2 |= core::META_MASK; - if(s1 & BUTTON1) s2 |= core::BUTTON1_MASK; - if(s1 & BUTTON2) s2 |= core::BUTTON2_MASK; - if(s1 & BUTTON3) s2 |= core::BUTTON3_MASK; + if (s1 & SHIFT) s2 |= core::SHIFT_MASK; + if (s1 & CTRL) s2 |= core::CONTROL_MASK; + if (s1 & ALT) s2 |= core::META_MASK; + if (s1 & BUTTON1) s2 |= core::BUTTON1_MASK; + if (s1 & BUTTON2) s2 |= core::BUTTON2_MASK; + if (s1 & BUTTON3) s2 |= core::BUTTON3_MASK; return (core::ButtonState)s2; } diff --git a/dw/fltkviewport.cc b/dw/fltkviewport.cc index 411c9566..8e3eea71 100644 --- a/dw/fltkviewport.cc +++ b/dw/fltkviewport.cc @@ -105,8 +105,8 @@ void FltkViewport::adjustScrollbarsAndGadgetsAllocation () vscrollbar->w (SCROLLBAR_THICKNESS); int x = w () - SCROLLBAR_THICKNESS, y = h () - SCROLLBAR_THICKNESS; - for(Iterator <TypedPointer < ::fltk::Widget> > it = gadgets->iterator (); - it.hasNext (); ) { + for (Iterator <TypedPointer < ::fltk::Widget> > it = gadgets->iterator (); + it.hasNext (); ) { ::fltk::Widget *widget = it.getNext()->getTypedValue (); widget->x (0); widget->y (0); @@ -168,10 +168,10 @@ void FltkViewport::draw_area (void *data, const Rectangle& cr ) vp->FltkWidgetView::draw (); - for(Iterator <TypedPointer < ::fltk::Widget> > it = vp->gadgets->iterator (); - it.hasNext (); ) { - ::fltk::Widget *widget = it.getNext()->getTypedValue (); - vp->draw_child (*widget); + for (Iterator <TypedPointer < ::fltk::Widget> > it = vp->gadgets->iterator(); + it.hasNext (); ) { + ::fltk::Widget *widget = it.getNext()->getTypedValue (); + vp->draw_child (*widget); } pop_clip(); diff --git a/dw/image.cc b/dw/image.cc index bd8a1f4e..82fe7252 100644 --- a/dw/image.cc +++ b/dw/image.cc @@ -167,7 +167,7 @@ void Image::sizeRequestImpl (core::Requisition *requisition) } requisition->descent = 0; } else { - if(altText && altText[0]) { + if (altText && altText[0]) { if (altTextWidth == -1) altTextWidth = layout->textWidth (getStyle()->font, altText, strlen (altText)); @@ -310,7 +310,7 @@ void Image::draw (core::View *view, core::Rectangle *area) intersection.x - dx, intersection.y - dy, intersection.width, intersection.height); } else { - if(altText && altText[0]) { + if (altText && altText[0]) { if (altTextWidth == -1) altTextWidth = layout->textWidth (getStyle()->font, altText, strlen (altText)); @@ -335,7 +335,7 @@ void Image::draw (core::View *view, core::Rectangle *area) + getStyle()->font->ascent, altText, strlen(altText)); - if(clippingView) + if (clippingView) view->mergeClippingView (clippingView); } } diff --git a/dw/iterator.cc b/dw/iterator.cc index 39e09d41..41c2c444 100644 --- a/dw/iterator.cc +++ b/dw/iterator.cc @@ -210,7 +210,7 @@ int EmptyIterator::compareTo (misc::Comparable *other) if (content.type == otherIt->content.type) return 0; - else if(content.type == Content::START) + else if (content.type == Content::START) return -1; else return +1; @@ -487,7 +487,7 @@ DeepIterator::DeepIterator (Iterator *it) //DEBUG_MSG (1, " => %s\n", a_Dw_iterator_text (it)); - if(hasContents) { + if (hasContents) { // If this widget has parents, we must construct appropriate iterators. // // \todo There may be a faster way instead of iterating through the @@ -679,7 +679,7 @@ bool CharIterator::next () if (ch == START || it->getContent()->type == Content::BREAK || (it->getContent()->type == Content::TEXT && it->getContent()->text[pos] == 0)) { - if(it->next()) { + if (it->next()) { if (it->getContent()->type == Content::BREAK) ch = '\n'; else { // if (it->getContent()->type == Content::TEXT) @@ -695,7 +695,7 @@ bool CharIterator::next () ch = END; return false; } - } else if(ch == END) + } else if (ch == END) return false; else { // at this point, it->getContent()->type == Content::TEXT @@ -717,7 +717,7 @@ bool CharIterator::prev () { if (ch == END || it->getContent()->type == Content::BREAK || (it->getContent()->type == Content::TEXT && pos == 0)) { - if(it->prev()) { + if (it->prev()) { if (it->getContent()->type == Content::BREAK) ch = '\n'; else { // if (it->getContent()->type == Content::TEXT) @@ -739,7 +739,7 @@ bool CharIterator::prev () ch = START; return false; } - } else if(ch == START) + } else if (ch == START) return false; else { // at this point, it->getContent()->type == Content::TEXT diff --git a/dw/layout.cc b/dw/layout.cc index 2fc83c97..c0652d6c 100644 --- a/dw/layout.cc +++ b/dw/layout.cc @@ -706,7 +706,7 @@ void Layout::enterNotify (View *view, int x, int y, ButtonState state) lastWidget = widgetAtPoint; moveToWidgetAtPoint (x, y, state); - if(widgetAtPoint) { + if (widgetAtPoint) { event.state = state; event.lastWidget = lastWidget; event.currentWidget = widgetAtPoint; @@ -727,7 +727,7 @@ void Layout::leaveNotify (View *view, ButtonState state) lastWidget = widgetAtPoint; moveOutOfView (state); - if(lastWidget) { + if (lastWidget) { event.state = state; event.lastWidget = lastWidget; event.currentWidget = widgetAtPoint; @@ -765,7 +765,7 @@ void Layout::moveToWidget (Widget *newWidgetAtPoint, ButtonState state) if (newWidgetAtPoint && widgetAtPoint) ancestor = newWidgetAtPoint->getNearestCommonAncestor (widgetAtPoint); - else if(newWidgetAtPoint) + else if (newWidgetAtPoint) ancestor = newWidgetAtPoint->getTopLevel (); else ancestor = widgetAtPoint->getTopLevel (); @@ -777,7 +777,7 @@ void Layout::moveToWidget (Widget *newWidgetAtPoint, ButtonState state) for (w = widgetAtPoint; w != ancestor; w = w->getParent ()) trackLen++; trackLen++; // for the ancestor - if(newWidgetAtPoint) + if (newWidgetAtPoint) // second part for (w = newWidgetAtPoint; w != ancestor; w = w->getParent ()) trackLen++; @@ -789,7 +789,7 @@ void Layout::moveToWidget (Widget *newWidgetAtPoint, ButtonState state) for (w = widgetAtPoint; w != ancestor; w = w->getParent ()) track[i++] = w; track[i++] = ancestor; - if(newWidgetAtPoint) { + if (newWidgetAtPoint) { /* second part */ i = trackLen - 1; for (w = newWidgetAtPoint; w != ancestor; w = w->getParent ()) @@ -827,7 +827,7 @@ bool Layout::processMouseEvent (MousePositionEvent *event, Widget *widget; for (widget = widgetAtPoint; widget; widget = widget->getParent ()) { - if(!mayBeSuppressed || widget->isButtonSensitive ()) { + if (!mayBeSuppressed || widget->isButtonSensitive ()) { event->xWidget = event->xCanvas - widget->getAllocation()->x; event->yWidget = event->yCanvas - widget->getAllocation()->y; @@ -865,7 +865,7 @@ void Layout::scrollPosChanged (View *view, int x, int y) for (container::typed::Iterator <View> it = views->iterator (); it.hasNext (); ) { View *thisView = it.getNext(); - if(view != thisView && thisView->usesViewport ()) + if (view != thisView && thisView->usesViewport ()) thisView->scrollTo (scrollX, scrollY); } @@ -885,7 +885,7 @@ void Layout::viewportSizeChanged (View *view, int width, int height) /* If the width has become higher, we test again, whether the vertical * scrollbar (so to speak) can be hidden again. */ - if(usesViewport && width > viewportWidth) + if (usesViewport && width > viewportWidth) canvasHeightGreater = false; /* if size changes, redraw this view. @@ -907,7 +907,7 @@ void Layout::viewportSizeChanged (View *view, int width, int height) for (container::typed::Iterator <View> it = views->iterator (); it.hasNext (); ) { View *thisView = it.getNext(); - if(view != thisView && thisView->usesViewport ()) + if (view != thisView && thisView->usesViewport ()) thisView->setViewportSize (viewportWidth, viewportHeight, actualHScrollbarThickness, actualVScrollbarThickness); diff --git a/dw/style.hh b/dw/style.hh index 9e6672bb..e8897b36 100644 --- a/dw/style.hh +++ b/dw/style.hh @@ -503,7 +503,7 @@ public: } inline void ref () { refCount++; } - inline void unref () { if(--refCount == 0) delete this; } + inline void unref () { if (--refCount == 0) delete this; } }; @@ -532,7 +532,7 @@ public: inline void ref () { refCount++; } inline void unref () - { if(--refCount == 0) delete this; } + { if (--refCount == 0) delete this; } inline void onEnter () { } inline void onLeave () { } @@ -582,7 +582,7 @@ public: char *defaultFamily); inline void ref () { refCount++; } - inline void unref () { if(--refCount == 0) delete this; } + inline void unref () { if (--refCount == 0) delete this; } }; @@ -635,7 +635,7 @@ public: inline void ref () { refCount++; } inline void unref () - { if(--refCount == 0) delete this; } + { if (--refCount == 0) delete this; } }; void drawBorder (View *view, Rectangle *area, diff --git a/lout/container.cc b/lout/container.cc index 0b00c195..6c886baa 100644 --- a/lout/container.cc +++ b/lout/container.cc @@ -43,40 +43,40 @@ Iterator::Iterator() Iterator::Iterator(const Iterator &it2) { impl = it2.impl; - if(impl) + if (impl) impl->ref(); } Iterator::Iterator(Iterator &it2) { impl = it2.impl; - if(impl) + if (impl) impl->ref(); } Iterator &Iterator::operator=(const Iterator &it2) { - if(impl) + if (impl) impl->unref(); impl = it2.impl; - if(impl) + if (impl) impl->ref(); return *this; } Iterator &Iterator::operator=(Iterator &it2) { - if(impl) + if (impl) impl->unref(); impl = it2.impl; - if(impl) + if (impl) impl->ref(); return *this; } Iterator::~Iterator() { - if(impl) + if (impl) impl->unref(); } @@ -88,8 +88,8 @@ void Collection::intoStringBuffer(misc::StringBuffer *sb) { sb->append("{ "); bool first = true; - for(Iterator it = iterator(); it.hasNext(); ) { - if(!first) + for (Iterator it = iterator(); it.hasNext(); ) { + if (!first) sb->append(", "); it.getNext()->intoStringBuffer(sb); first = false; @@ -117,27 +117,27 @@ Vector::~Vector() void Vector::put(Object *newElement, int newPos) { - if(newPos == -1) + if (newPos == -1) newPos = numElements; // Old entry is overwritten. - if(newPos < numElements) { - if(ownerOfObjects && array[newPos]) + if (newPos < numElements) { + if (ownerOfObjects && array[newPos]) delete array[newPos]; } // Allocated memory has to be increased. - if(newPos >= numAlloc) { + if (newPos >= numAlloc) { while (newPos >= numAlloc) numAlloc *= 2; array = (Object**)realloc(array, numAlloc * sizeof(Object*)); } // Insert NULL's into possible gap before new position. - for(int i = numElements; i < newPos; i++) + for (int i = numElements; i < newPos; i++) array[i] = NULL; - if(newPos >= numElements) + if (newPos >= numElements) numElements = newPos + 1; array[newPos] = newElement; @@ -146,8 +146,8 @@ void Vector::put(Object *newElement, int newPos) void Vector::clear() { if (ownerOfObjects) { - for(int i = 0; i < numElements; i++) - if(array[i]) + for (int i = 0; i < numElements; i++) + if (array[i]) delete array[i]; } @@ -156,18 +156,18 @@ void Vector::clear() void Vector::insert(Object *newElement, int pos) { - if(pos >= numElements) + if (pos >= numElements) put(newElement, pos); else { numElements++; // Allocated memory has to be increased. - if(numElements >= numAlloc) { + if (numElements >= numAlloc) { numAlloc *= 2; array = (Object**)realloc(array, numAlloc * sizeof(Object*)); } - for(int i = numElements - 1; i > pos; i--) + for (int i = numElements - 1; i > pos; i--) array[i] = array[i - 1]; array[pos] = newElement; @@ -176,10 +176,10 @@ void Vector::insert(Object *newElement, int pos) void Vector::remove(int pos) { - if(ownerOfObjects && array[pos]) + if (ownerOfObjects && array[pos]) delete array[pos]; - for(int i = pos + 1; i < numElements; i++) + for (int i = pos + 1; i < numElements; i++) array[i - 1] = array[i]; numElements--; @@ -220,8 +220,8 @@ List::~List() void List::clear() { - while(first) { - if(ownerOfObjects && first->object) + while (first) { + if (ownerOfObjects && first->object) delete first->object; Node *next = first->next; delete first; @@ -238,7 +238,7 @@ void List::append(Object *element) newLast->next = NULL; newLast->object = element; - if(last) { + if (last) { last->next = newLast; last = newLast; } else @@ -252,21 +252,21 @@ bool List::remove0(Object *element, bool compare, bool doNotDeleteAtAll) { Node *beforeCur, *cur; - for(beforeCur = NULL, cur = first; cur; beforeCur = cur, cur = cur->next) { + for (beforeCur = NULL, cur = first; cur; beforeCur = cur, cur = cur->next) { if (compare ? (cur->object && element->equals(cur->object)) : element == cur->object) { - if(beforeCur) { + if (beforeCur) { beforeCur->next = cur->next; - if(cur->next == NULL) + if (cur->next == NULL) last = beforeCur; } else { first = cur->next; - if(first == NULL) + if (first == NULL) last = NULL; } - if(ownerOfObjects && cur->object && !doNotDeleteAtAll) + if (ownerOfObjects && cur->object && !doNotDeleteAtAll) delete cur->object; delete cur; @@ -282,7 +282,7 @@ Object *List::ListIterator::getNext() { Object *object; - if(current) { + if (current) { object = current->object; current = current->next; } else @@ -313,20 +313,20 @@ HashTable::HashTable(bool ownerOfKeys, bool ownerOfValues, int tableSize) this->tableSize = tableSize; table = new Node*[tableSize]; - for(int i = 0; i < tableSize; i++) + for (int i = 0; i < tableSize; i++) table[i] = NULL; } HashTable::~HashTable() { - for(int i = 0; i < tableSize; i++) { + for (int i = 0; i < tableSize; i++) { Node *n1 = table[i]; - while(n1) { + while (n1) { Node *n2 = n1->next; - if(ownerOfValues && n1->value) + if (ownerOfValues && n1->value) delete n1->value; - if(ownerOfKeys) + if (ownerOfKeys) delete n1->key; delete n1; @@ -342,9 +342,9 @@ void HashTable::intoStringBuffer(misc::StringBuffer *sb) sb->append("{ "); bool first = true; - for(int i = 0; i < tableSize; i++) { - for(Node *node = table[i]; node; node = node->next) { - if(!first) + for (int i = 0; i < tableSize; i++) { + for (Node *node = table[i]; node; node = node->next) { + if (!first) sb->append(", "); node->key->intoStringBuffer(sb); sb->append(" => "); @@ -369,7 +369,7 @@ void HashTable::put(Object *key, Object *value) bool HashTable::contains(Object *key) { int h = calcHashValue(key); - for(Node *n = table[h]; n; n = n->next) { + for (Node *n = table[h]; n; n = n->next) { if (key->equals(n->key)) return true; } @@ -380,7 +380,7 @@ bool HashTable::contains(Object *key) Object *HashTable::get(Object *key) { int h = calcHashValue(key); - for(Node *n = table[h]; n; n = n->next) { + for (Node *n = table[h]; n; n = n->next) { if (key->equals(n->key)) return n->value; } @@ -393,16 +393,16 @@ bool HashTable::remove(Object *key) int h = calcHashValue(key); Node *last, *cur; - for(last = NULL, cur = table[h]; cur; last = cur, cur = cur->next) { + for (last = NULL, cur = table[h]; cur; last = cur, cur = cur->next) { if (key->equals(cur->key)) { - if(last) + if (last) last->next = cur->next; else table[h] = cur->next; - if(ownerOfValues && cur->value) + if (ownerOfValues && cur->value) delete cur->value; - if(ownerOfKeys) + if (ownerOfKeys) delete cur->key; delete cur; @@ -416,7 +416,7 @@ bool HashTable::remove(Object *key) Object *HashTable::getKey (Object *key) { int h = calcHashValue(key); - for(Node *n = table[h]; n; n = n->next) { + for (Node *n = table[h]; n; n = n->next) { if (key->equals(n->key)) return n->key; } @@ -434,11 +434,11 @@ HashTable::HashTableIterator::HashTableIterator(HashTable *table) void HashTable::HashTableIterator::gotoNext() { - if(node) + if (node) node = node->next; - while(node == NULL) { - if(pos >= table->tableSize - 1) + while (node == NULL) { + if (pos >= table->tableSize - 1) return; pos++; node = table->table[pos]; @@ -449,7 +449,7 @@ void HashTable::HashTableIterator::gotoNext() Object *HashTable::HashTableIterator::getNext() { Object *result; - if(node) + if (node) result = node->key; else result = NULL; @@ -492,7 +492,7 @@ void Stack::push (object::Object *object) newTop->prev = top; top = newTop; - if(bottom == NULL) + if (bottom == NULL) bottom = top; numElements++; @@ -503,11 +503,11 @@ void Stack::pushUnder (object::Object *object) Node *newBottom = new Node (); newBottom->object = object; newBottom->prev = NULL; - if(bottom != NULL) + if (bottom != NULL) bottom->prev = newBottom; bottom = newBottom; - if(top == NULL) + if (top == NULL) top = bottom; numElements++; @@ -522,7 +522,7 @@ void Stack::pop () delete top; top = newTop; - if(top == NULL) + if (top == NULL) bottom = NULL; numElements--; @@ -532,7 +532,7 @@ Object *Stack::StackIterator::getNext() { Object *object; - if(current) { + if (current) { object = current->object; current = current->prev; } else diff --git a/lout/misc.cc b/lout/misc.cc index 2008737b..435fe8be 100644 --- a/lout/misc.cc +++ b/lout/misc.cc @@ -77,11 +77,11 @@ int Comparable::compareFun(const void *p1, const void *p2) { Comparable **c1 = (Comparable**)p1; Comparable **c2 = (Comparable**)p2; - if(c1 && c2) + if (c1 && c2) return ((*c1)->compareTo(*c2)); - else if(c1) + else if (c1) return 1; - else if(c2) + else if (c2) return -1; else return 0; @@ -104,7 +104,7 @@ StringBuffer::StringBuffer() StringBuffer::~StringBuffer() { clear (); - if(str) + if (str) delete[] str; } @@ -121,7 +121,7 @@ void StringBuffer::appendNoCopy(char *str) node->data = str; node->next = NULL; - if(firstNode == NULL) { + if (firstNode == NULL) { firstNode = node; lastNode = node; } else { @@ -141,15 +141,15 @@ void StringBuffer::appendNoCopy(char *str) */ const char *StringBuffer::getChars() { - if(strValid) + if (strValid) return str; - if(str) + if (str) delete[] str; str = new char[numChars + 1]; char *p = str; - for(Node *node = firstNode; node; node = node->next) { + for (Node *node = firstNode; node; node = node->next) { int l = strlen(node->data); memcpy(p, node->data, l * sizeof(char)); p += l; @@ -166,7 +166,7 @@ const char *StringBuffer::getChars() void StringBuffer::clear () { Node *node, *nextNode; - for(node = firstNode; node; node = nextNode) { + for (node = firstNode; node; node = nextNode) { nextNode = node->next; delete node->data; delete node; @@ -196,14 +196,14 @@ BitSet::~BitSet() void BitSet::intoStringBuffer(misc::StringBuffer *sb) { sb->append("["); - for(int i = 0; i < numBytes; i++) + for (int i = 0; i < numBytes; i++) sb->append(get(i) ? "1" : "0"); sb->append("]"); } bool BitSet::get(int i) { - if(8 * i >= numBytes) + if (8 * i >= numBytes) return false; else return bits[i / 8] & (1 << (i % 8)); @@ -211,9 +211,9 @@ bool BitSet::get(int i) void BitSet::set(int i, bool val) { - if(8 * i >= numBytes) { + if (8 * i >= numBytes) { int newNumBytes = numBytes; - while(8 * i >= newNumBytes) + while (8 * i >= newNumBytes) newNumBytes *= 2; bits = (unsigned char*)realloc(bits, newNumBytes * sizeof(unsigned char)); @@ -221,7 +221,7 @@ void BitSet::set(int i, bool val) numBytes = newNumBytes; } - if(val) + if (val) bits[i / 8] |= (1 << (i % 8)); else bits[i / 8] &= ~(1 << (i % 8)); diff --git a/lout/object.cc b/lout/object.cc index 9e36e20c..684bb8fa 100644 --- a/lout/object.cc +++ b/lout/object.cc @@ -186,11 +186,11 @@ int ConstString::hashValue() int ConstString::compareTo(Comparable *other) { String *otherString = (String*)other; - if(str && otherString->str) + if (str && otherString->str) return strcmp(str, otherString->str); - else if(str) + else if (str) return 1; - else if(otherString->str) + else if (otherString->str) return -1; else return 0; @@ -199,7 +199,7 @@ int ConstString::compareTo(Comparable *other) int ConstString::hashValue(const char *str) { - if(str) { + if (str) { int h = 0; for (int i = 0; str[i]; i++) h = (h * 256 + str[i]); @@ -223,7 +223,7 @@ String::String (const char *str): ConstString (str ? strdup(str) : NULL) String::~String () { - if(str) + if (str) delete str; } @@ -239,9 +239,9 @@ PairBase::PairBase(Object *first, Object *second) PairBase::~PairBase() { - if(first) + if (first) delete first; - if(second) + if (second) delete second; } @@ -267,9 +267,9 @@ int PairBase::hashValue() { int value = 0; - if(first) + if (first) value ^= first->hashValue(); - if(second) + if (second) value ^= second->hashValue(); return value; @@ -279,14 +279,14 @@ void PairBase::intoStringBuffer(misc::StringBuffer *sb) { sb->append("<pair: "); - if(first) + if (first) first->intoStringBuffer(sb); else sb->append("(nil)"); sb->append(","); - if(second) + if (second) second->intoStringBuffer(sb); else sb->append("(nil)"); @@ -298,9 +298,9 @@ size_t PairBase::sizeOf() { size_t size = 0; - if(first) + if (first) size += first->sizeOf(); - if(second) + if (second) size += second->sizeOf(); return size; diff --git a/lout/signal.cc b/lout/signal.cc index 46aae626..de9e84b6 100644 --- a/lout/signal.cc +++ b/lout/signal.cc @@ -38,7 +38,7 @@ Emitter::Emitter () Emitter::~Emitter () { - for(Iterator<Receiver> it = receivers->iterator (); it.hasNext (); ) { + for (Iterator<Receiver> it = receivers->iterator (); it.hasNext (); ) { Receiver *receiver = it.getNext (); receiver->unconnectFrom (this); } @@ -77,7 +77,7 @@ void Emitter::connect (Receiver *receiver) */ void Emitter::emitVoid (int signalNo, int argc, Object **argv) { - for(Iterator <Receiver> it = receivers->iterator (); it.hasNext (); ) { + for (Iterator <Receiver> it = receivers->iterator (); it.hasNext (); ) { Receiver *receiver = it.getNext(); emitToReceiver (receiver, signalNo, argc, argv); } @@ -93,7 +93,7 @@ bool Emitter::emitBool (int signalNo, int argc, Object **argv) { bool b = false, bt; - for(Iterator <Receiver> it = receivers->iterator (); it.hasNext (); ) { + for (Iterator <Receiver> it = receivers->iterator (); it.hasNext (); ) { Receiver *receiver = it.getNext(); // Note: All receivers are called, even if one returns true. // Therefore, something like @@ -118,7 +118,7 @@ Receiver::Receiver() Receiver::~Receiver() { - for(Iterator<Emitter> it = emitters->iterator(); it.hasNext(); ) { + for (Iterator<Emitter> it = emitters->iterator(); it.hasNext(); ) { Emitter *emitter = it.getNext(); emitter->unconnect (this); } @@ -246,7 +246,7 @@ class CssPropertyList : public lout::misc::SimpleVector <CssProperty> { void apply (CssPropertyList *props); void print (); inline void ref () { refCount++; } - inline void unref () { if(--refCount == 0) delete this; } + inline void unref () { if (--refCount == 0) delete this; } }; class CssSimpleSelector { @@ -300,7 +300,7 @@ class CssSelector { int specificity (); void print (); inline void ref () { refCount++; } - inline void unref () { if(--refCount == 0) delete this; } + inline void unref () { if (--refCount == 0) delete this; } }; /** @@ -340,7 +340,9 @@ class CssStyleSheet { }; void insert (CssRule *rule); - inline bool equals (lout::object::Object *other) { return this == other; }; + inline bool equals (lout::object::Object *other) { + return this == other; + }; inline int hashValue () { return (intptr_t) this; }; }; @@ -348,7 +350,7 @@ class CssStyleSheet { <lout::object::ConstString, RuleList > { public: RuleMap () : lout::container::typed::HashTable - <lout::object::ConstString, RuleList > (true, true, 256) {}; + <lout::object::ConstString, RuleList > (true, true, 256) {}; }; static const int ntags = 90; // \todo replace 90 diff --git a/src/dillo.cc b/src/dillo.cc index 7be0f923..2f886f6b 100644 --- a/src/dillo.cc +++ b/src/dillo.cc @@ -96,7 +96,7 @@ static void Dillo_print_help(const char *cmdname, const CLI_options *options) { printf("Usage: %s [OPTION]... [--] [URL|FILE]...\n" "Options:\n", cmdname); - while(options && options->help) { + while (options && options->help) { printf("%s\n", options->help); options++; } |