Mailinglist Archive: yast-commit (490 mails)

< Previous Next >
[yast-commit] r39005 - in /branches/tmp/sh/mod-ui/core/libyui/src: ChangeLog YAlignment.cc YAlignment.h YCPDialogParser.cc YSpacing.cc YSpacing.h YTransText.h YUI.h YUI_builtins.cc YWidget.cc YWidget.h
  • From: sh-sh-sh@xxxxxxxxxxxxxxxx
  • Date: Mon, 25 Jun 2007 14:47:00 -0000
  • Message-id: <20070625144701.0B93EC5456@xxxxxxxxxxxxxxxx>
Author: sh-sh-sh
Date: Mon Jun 25 16:47:00 2007
New Revision: 39005

URL: http://svn.opensuse.org/viewcvs/yast?rev=39005&view=rev
Log:
most long params -> int

Modified:
    branches/tmp/sh/mod-ui/core/libyui/src/ChangeLog
    branches/tmp/sh/mod-ui/core/libyui/src/YAlignment.cc
    branches/tmp/sh/mod-ui/core/libyui/src/YAlignment.h
    branches/tmp/sh/mod-ui/core/libyui/src/YCPDialogParser.cc
    branches/tmp/sh/mod-ui/core/libyui/src/YSpacing.cc
    branches/tmp/sh/mod-ui/core/libyui/src/YSpacing.h
    branches/tmp/sh/mod-ui/core/libyui/src/YTransText.h
    branches/tmp/sh/mod-ui/core/libyui/src/YUI.h
    branches/tmp/sh/mod-ui/core/libyui/src/YUI_builtins.cc
    branches/tmp/sh/mod-ui/core/libyui/src/YWidget.cc
    branches/tmp/sh/mod-ui/core/libyui/src/YWidget.h

Modified: branches/tmp/sh/mod-ui/core/libyui/src/ChangeLog
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src/ChangeLog?rev=39005&r1=39004&r2=39005&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/ChangeLog (original)
+++ branches/tmp/sh/mod-ui/core/libyui/src/ChangeLog Mon Jun 25 16:47:00 2007
@@ -58,7 +58,7 @@
   This doesn't do the work completely, but it's a good starting point.
 
 
-* The parameters of YWidget::setSize() are now int, no longer long.
+* All widgets: The parameters of YWidget::setSize() are now int, no longer long.
   The reasoning is the same as with long nicesize() vs. int preferredWidth().
 
   Use the perl scripts from ~sh/Export/ for easier transition:
@@ -69,6 +69,18 @@
 
   This should do the trick, but make sure to double-check what it did.
 
+* All widgets:
+
+  Most 'long' function parameters and return values are now 'int', 
+  including (but not restricted to): 
+
+    * widget sizes
+    * widget positions
+    * layout weights
+
+  gcc should complain about missing places. Also remember to check for '%ld' in
+  y2debug() etc. calls and replace most of them with '%d'.
+
 
 * Factories:
     * Derived UIs now are required to implement:

Modified: branches/tmp/sh/mod-ui/core/libyui/src/YAlignment.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src/YAlignment.cc?rev=39005&r1=39004&r2=39005&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/YAlignment.cc (original)
+++ branches/tmp/sh/mod-ui/core/libyui/src/YAlignment.cc Mon Jun 25 16:47:00 2007
@@ -47,13 +47,13 @@
     //
 
 
-    long leftMargin;
-    long rightMargin;
-    long topMargin;
-    long bottomMargin;
+    int leftMargin;
+    int rightMargin;
+    int topMargin;
+    int bottomMargin;
 
-    long minWidth;
-    long minHeight;
+    int minWidth;
+    int minHeight;
 
     string backgroundPixmap;
 
@@ -86,73 +86,73 @@
 }
 
 
-long YAlignment::leftMargin() const
+int YAlignment::leftMargin() const
 {
     return priv->leftMargin;
 }
 
 
-long YAlignment::rightMargin() const
+int YAlignment::rightMargin() const
 {
     return priv->rightMargin;
 }
 
 
-long YAlignment::topMargin() const
+int YAlignment::topMargin() const
 {
     return priv->topMargin;
 }
 
 
-long YAlignment::bottomMargin() const
+int YAlignment::bottomMargin() const
 {
     return priv->bottomMargin;
 }
 
 
-void YAlignment::setLeftMargin( long margin )
+void YAlignment::setLeftMargin( int margin )
 {
     priv->leftMargin = margin;
 }
 
 
-void YAlignment::setRightMargin( long margin )
+void YAlignment::setRightMargin( int margin )
 {
     priv->rightMargin = margin;
 }
 
 
-void YAlignment::setTopMargin( long margin )
+void YAlignment::setTopMargin( int margin )
 {
     priv->topMargin = margin;
 }
 
 
-void YAlignment::setBottomMargin( long margin )
+void YAlignment::setBottomMargin( int margin )
 {
     priv->bottomMargin = margin;
 }
 
 
-long YAlignment::minWidth() const
+int YAlignment::minWidth() const
 {
     return priv->minWidth;
 }
 
 
-long YAlignment::minHeight() const
+int YAlignment::minHeight() const
 {
     return priv->minHeight;
 }
 
 
-void YAlignment::setMinWidth( long width )
+void YAlignment::setMinWidth( int width )
 {
     priv->minWidth = width;
 }
 
 
-void YAlignment::setMinHeight( long height )
+void YAlignment::setMinHeight( int height )
 {
     priv->minHeight = height;
 }
@@ -213,26 +213,26 @@
     }
 
 
-    long newSize[ YUIAllDimensions ];
+    int newSize[ YUIAllDimensions ];
     newSize[ YD_HORIZ ]  = newWidth;
     newSize[ YD_VERT  ]  = newHeight;
 
-    long offset[ YUIAllDimensions ];
+    int offset[ YUIAllDimensions ];
     offset[ YD_HORIZ ] = leftMargin();
     offset[ YD_VERT  ] = topMargin();
 
-    long totalMargin[ YUIAllDimensions ];
+    int totalMargin[ YUIAllDimensions ];
     totalMargin[ YD_HORIZ ] = leftMargin() + rightMargin();
     totalMargin[ YD_VERT  ] = topMargin()  + bottomMargin();
 
-    long newChildSize[ YUIAllDimensions ];
-    long newChildPos [ YUIAllDimensions ];
+    int newChildSize[ YUIAllDimensions ];
+    int newChildPos [ YUIAllDimensions ];
 
 
     for ( YUIDimension dim = YD_HORIZ; dim <= YD_VERT; dim = (YUIDimension) (dim+1) )
     {
-       long childNiceSize = firstChild()->nicesize( dim );
-       long niceSize      = childNiceSize + totalMargin[ dim ];
+       int childNiceSize = firstChild()->nicesize( dim );
+       int niceSize      = childNiceSize + totalMargin[ dim ];
 
        if ( newSize[ dim ] >= niceSize )
            // Optimum case: enough space for the child and all margins
@@ -260,7 +260,7 @@
                // Redistribute remaining space according to margin ratio
                // (disregarding integer rounding errors - we don't care about one pixel)
 
-               long remaining = newSize[ dim ] - childNiceSize;
+               int remaining = newSize[ dim ] - childNiceSize;
                offset     [ dim ] = remaining * offset[ dim ] / totalMargin[ dim ];
                totalMargin[ dim ] = remaining;
            }
@@ -305,7 +305,7 @@
 
 
 
-long YAlignment::totalMargins( YUIDimension dim ) const
+int YAlignment::totalMargins( YUIDimension dim ) const
 {
     if ( dim == YD_HORIZ )     return leftMargin() + rightMargin();
     else                       return topMargin()  + bottomMargin();

Modified: branches/tmp/sh/mod-ui/core/libyui/src/YAlignment.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src/YAlignment.h?rev=39005&r1=39004&r2=39005&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/YAlignment.h (original)
+++ branches/tmp/sh/mod-ui/core/libyui/src/YAlignment.h Mon Jun 25 16:47:00 2007
@@ -61,72 +61,72 @@
      * Return the left margin in pixels, the distance between the left edge of
      * this alignment and the left edge of the child widget.
      **/
-    long leftMargin() const;
+    int leftMargin() const;
 
     /**
      * Return the right margin in pixels, the distance between the right edge
      * of this alignment and the right edge of the child widget.
      **/
-    long rightMargin() const;
+    int rightMargin() const;
 
     /**
      * Return the top margin in pixels, the distance between the top edge of
      * this alignment and the top edge of the child widget.
      **/
-    long topMargin() const;
+    int topMargin() const;
 
     /**
      * Return the bottom margin in pixels, the distance between the bottom
      * edge of this alignment and the bottom edge of the child widget.
      **/
-    long bottomMargin() const;
+    int bottomMargin() const;
 
     /**
      * Return the sum of all margins in the specified dimension.
      **/
-    long totalMargins( YUIDimension dim ) const;
+    int totalMargins( YUIDimension dim ) const;
 
     /**
      * Set the left margin in pixels.
      **/
-    void setLeftMargin( long margin );
+    void setLeftMargin( int margin );
 
     /**
      * Set the right margin in pixels.
      **/
-    void setRightMargin( long margin );
+    void setRightMargin( int margin );
 
     /**
      * Set the top margin in pixels.
      **/
-    void setTopMargin( long margin );
+    void setTopMargin( int margin );
 
     /**
      * Set the bottom margin in pixels.
      **/
-    void setBottomMargin( long margin );
+    void setBottomMargin( int margin );
 
     /**
      * Return the minimum width of this alignment or 0 if none is set.
      * preferredWidth() will never return less than this value.
      **/
-    long minWidth() const;
+    int minWidth() const;
 
     /**
      * Return the minimum height of this alignment or 0 if none is set.
      * preferredHeight() will never return less than this value.
      **/
-    long minHeight() const;
+    int minHeight() const;
 
     /**
      * Set the minimum width to return for preferredWidth().
      **/
-    void setMinWidth( long width );
+    void setMinWidth( int width );
 
     /**
      * Set the minimum height to return for preferredHeight().
      **/
-    void setMinHeight( long height );
+    void setMinHeight( int height );
 
     /**
      * Set a background pixmap.
@@ -157,7 +157,7 @@
     /**
      * Move a child widget to a new position.
      **/
-    virtual void moveChild( YWidget *child, long newx, long newy ) = 0;
+    virtual void moveChild( YWidget *child, int newx, int newy ) = 0;
 
     /**
      * Return this widget's stretchability.

Modified: branches/tmp/sh/mod-ui/core/libyui/src/YCPDialogParser.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src/YCPDialogParser.cc?rev=39005&r1=39004&r2=39005&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/YCPDialogParser.cc (original)
+++ branches/tmp/sh/mod-ui/core/libyui/src/YCPDialogParser.cc Mon Jun 25 16:47:00 2007
@@ -885,7 +885,7 @@
        return 0;
     }
     rejectAllOptions( term,optList );
-    long weightValue = (long)( term->value( argnr )->asInteger()->value() );
+    int weightValue = term->value( argnr )->asInteger()->value();
 
     /*
      * This is an exception from the general rule: No YWeight widget is created,

Modified: branches/tmp/sh/mod-ui/core/libyui/src/YSpacing.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src/YSpacing.cc?rev=39005&r1=39004&r2=39005&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/YSpacing.cc (original)
+++ branches/tmp/sh/mod-ui/core/libyui/src/YSpacing.cc Mon Jun 25 16:47:00 2007
@@ -23,13 +23,13 @@
 
 struct YSpacingPrivate
 {
-    YSpacingPrivate( YUIDimension dim, long size )
+    YSpacingPrivate( YUIDimension dim, int size )
        : dim( dim )
        , size( size )
        {}
     
     YUIDimension       dim;
-    long               size;
+    int                        size;
 };
 
 
@@ -57,13 +57,13 @@
 }
 
 
-long YSpacing::size() const
+int YSpacing::size() const
 {
     return priv->size;
 }
 
 
-long YSpacing::size( YUIDimension dim ) const
+int YSpacing::size( YUIDimension dim ) const
 {
     if ( dim == priv->dim ) return priv->size;
     else                       return 0;

Modified: branches/tmp/sh/mod-ui/core/libyui/src/YSpacing.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src/YSpacing.h?rev=39005&r1=39004&r2=39005&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/YSpacing.h (original)
+++ branches/tmp/sh/mod-ui/core/libyui/src/YSpacing.h Mon Jun 25 16:47:00 2007
@@ -72,7 +72,7 @@
      * This is the device dependent size (pixels or character cells), not the
      * abstract UI layout unit from the constructor.
      **/
-    long size() const;
+    int size() const;
 
     /**
      * Return the size in the specified dimension.
@@ -80,7 +80,7 @@
      * This is the device dependent size (pixels or character cells), not the
      * abstract UI layout unit from the constructor.
      **/
-    long size( YUIDimension dim ) const;
+    int size( YUIDimension dim ) const;
 
     /**
      * Preferred width of the widget.

Modified: branches/tmp/sh/mod-ui/core/libyui/src/YTransText.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src/YTransText.h?rev=39005&r1=39004&r2=39005&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/YTransText.h (original)
+++ branches/tmp/sh/mod-ui/core/libyui/src/YTransText.h Mon Jun 25 16:47:00 2007
@@ -25,7 +25,7 @@
 
 /**
  * Helper class for translated strings: Stores a message in the original
- * ( untranslated ) version along with the translation into the current locale.
+ * (untranslated) version along with the translation into the current locale.
  **/
 class YTransText
 {

Modified: branches/tmp/sh/mod-ui/core/libyui/src/YUI.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src/YUI.h?rev=39005&r1=39004&r2=39005&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/YUI.h (original)
+++ branches/tmp/sh/mod-ui/core/libyui/src/YUI.h Mon Jun 25 16:47:00 2007
@@ -240,7 +240,7 @@
      *
      * Derived UI may want to reimplement this method.
      **/
-    virtual long deviceUnits( YUIDimension dim, float layout_units );
+    virtual int deviceUnits( YUIDimension dim, float layout_units );
 
     /**
      * Convert device dependent units into logical layout spacing units.
@@ -248,7 +248,7 @@
      *
      * Derived UI may want to reimplement this method.
      **/
-    virtual float layoutUnits( YUIDimension dim, long device_units );
+    virtual float layoutUnits( YUIDimension dim, int device_units );
 
     /**
      * Returns 'true' if widget geometry should be reversed for languages that

Modified: branches/tmp/sh/mod-ui/core/libyui/src/YUI_builtins.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src/YUI_builtins.cc?rev=39005&r1=39004&r2=39005&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/YUI_builtins.cc (original)
+++ branches/tmp/sh/mod-ui/core/libyui/src/YUI_builtins.cc Mon Jun 25 16:47:00 2007
@@ -1910,9 +1910,9 @@
  * This default function assumes 80x25 units.
  * Derived UIs may want to reimplement this.
  **/
-long YUI::deviceUnits( YUIDimension dim, float layout_units )
+int YUI::deviceUnits( YUIDimension dim, float layout_units )
 {
-    return (long) ( layout_units + 0.5 );
+    return (int) ( layout_units + 0.5 );
 }
 
 
@@ -1923,7 +1923,7 @@
  * This default function assumes 80x25 units.
  * Derived UIs may want to reimplement this.
  **/
-float YUI::layoutUnits( YUIDimension dim, long device_units )
+float YUI::layoutUnits( YUIDimension dim, int device_units )
 {
     return (float) device_units;
 }

Modified: branches/tmp/sh/mod-ui/core/libyui/src/YWidget.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src/YWidget.cc?rev=39005&r1=39004&r2=39005&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/YWidget.cc (original)
+++ branches/tmp/sh/mod-ui/core/libyui/src/YWidget.cc Mon Jun 25 16:47:00 2007
@@ -451,7 +451,7 @@
 }
 
 
-long YWidget::weight( YUIDimension dim )
+int YWidget::weight( YUIDimension dim )
 {
     return _weight[ dim ];
 }

Modified: branches/tmp/sh/mod-ui/core/libyui/src/YWidget.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src/YWidget.h?rev=39005&r1=39004&r2=39005&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/YWidget.h (original)
+++ branches/tmp/sh/mod-ui/core/libyui/src/YWidget.h Mon Jun 25 16:47:00 2007
@@ -416,7 +416,7 @@
      *
      * @param dim Dimension, either YD_HORIZ or YD_VERT
      **/
-    virtual long weight( YUIDimension dim );
+    virtual int weight( YUIDimension dim );
 
     /**
      * Return whether or not the widget has a weight.
@@ -689,7 +689,7 @@
     /**
      * Weight in both dimensions.
      **/
-    long _weight [ YUIAllDimensions ];
+    int _weight [ YUIAllDimensions ];
 
     /**
      * window ID of the current widget

--
To unsubscribe, e-mail: yast-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages