+2001-12-10 Michael Meeks <michael@ximian.com>
+
+ * cspi/spi_text.c: audit for exception handling,
+ tolerating NULL object references safely etc.
+
+ * cspi/spi_value.c: ditto.
+
+ * cspi/spi_table.c (AccessibleTable_getSummary),
+ (AccessibleTable_getAccessibleAt),
+ (AccessibleTable_getRowHeader),
+ (AccessibleTable_getColumnHeader),
+ (AccessibleTable_getCaption): fix bugs hidden by
+ incorrect casts.
+ (long_seq_to_array): impl.
+ (AccessibleTable_getSelectedRows),
+ (AccessibleTable_getSelectedColumns): use it.
+
2001-12-10 Bill Haneman <bill.haneman@sun.com>
* TODO:
* @obj: a pointer to the #Accessible object on which to operate.
*
* Increment the reference count for an #Accessible object.
- *
**/
void
Accessible_ref (Accessible *obj)
* @obj: a pointer to the #Accessible object on which to operate.
*
* Decrement the reference count for an #Accessible object.
- *
**/
void
Accessible_unref (Accessible *obj)
* @obj: a pointer to the #AccessibleAction on which to operate.
*
* Increment the reference count for an #AccessibleAction.
- *
**/
void
AccessibleAction_ref (AccessibleAction *obj)
* @obj: a pointer to the #AccessibleAction on which to operate.
*
* Decrement the reference count for an #AccessibleAction.
- *
**/
void
AccessibleAction_unref (AccessibleAction *obj)
* @obj: a pointer to an object implementing #AccessibleComponent on which to operate.
*
* Increment the reference count for an #AccessibleComponent.
- *
**/
void
AccessibleComponent_ref (AccessibleComponent *obj)
* @obj: a pointer to the object implementing #AccessibleComponent on which to operate.
*
* Decrement the reference count for an #AccessibleComponent.
- *
**/
void
AccessibleComponent_unref (AccessibleComponent *obj)
long int *startIndex,
long int *endIndex)
{
- long retval;
-
cspi_return_if_fail (obj != NULL);
*startIndex = (long)
Accessible *
AccessibleTable_getCaption (AccessibleTable *obj)
{
- return (Accessible *)
- Accessibility_Table__get_caption (CSPI_OBJREF (obj), cspi_ev ());
+ return cspi_object_add (
+ Accessibility_Table__get_caption (CSPI_OBJREF (obj), cspi_ev ()));
}
/**
*
* Returns: an #Accessible object that serves as the table's summary (often a
* reduced #AccessibleTable).
- *
**/
Accessible *
AccessibleTable_getSummary (AccessibleTable *obj)
{
- return (Accessible *)
- Accessibility_Table__get_summary (CSPI_OBJREF (obj), cspi_ev ());
+ return cspi_object_add (
+ Accessibility_Table__get_summary (CSPI_OBJREF (obj), cspi_ev ()));
}
/**
* of rows that may be outside of the current scrolling window or viewport.
*
* Returns: a #long integer indicating the number of rows in the table.
- *
**/
long
AccessibleTable_getNRows (AccessibleTable *obj)
{
- return (long)
+ long retval;
+
+ cspi_return_val_if_fail (obj != NULL, -1);
+
+ retval =
Accessibility_Table__get_nRows (CSPI_OBJREF (obj), cspi_ev ());
+
+ cspi_return_val_if_ev ("getNRows", -1);
+
+ return retval;
+
}
/**
* of columns that may be outside of the current scrolling window or viewport.
*
* Returns: a #long integer indicating the number of columns in the table.
- *
**/
long
AccessibleTable_getNColumns (AccessibleTable *obj)
{
- return (long)
+ long retval;
+
+ cspi_return_val_if_fail (obj != NULL, -1);
+
+ retval =
Accessibility_Table__get_nColumns (CSPI_OBJREF (obj), cspi_ev ());
+
+ cspi_return_val_if_ev ("", -1);
+
+ return retval;
}
/**
* use #Accessible_getAccessibleAtPoint ().
*
* Returns: an #Accessible object representing the specified table cell.
- *
**/
Accessible *
AccessibleTable_getAccessibleAt (AccessibleTable *obj,
long int row,
long int column)
{
- return (Accessible *)
- Accessibility_Table_getAccessibleAt (CSPI_OBJREF (obj),
- (CORBA_long) row, (CORBA_long) column, cspi_ev ());
+ return cspi_object_add (
+ Accessibility_Table_getAccessibleAt (
+ CSPI_OBJREF (obj), (CORBA_long) row,
+ (CORBA_long) column, cspi_ev ()));
}
/**
*
* Returns: a long integer which serves as the index of a specified cell in the
* table, in a form usable by #Accessible_getChildAtIndex().
- *
**/
long
AccessibleTable_getIndexAt (AccessibleTable *obj,
long int row,
long int column)
{
- return (long)
- Accessibility_Table_getIndexAt (CSPI_OBJREF (obj),
- (CORBA_long) row, (CORBA_long) column, cspi_ev ());
-}
+ long retval;
+ cspi_return_val_if_fail (obj != NULL, -1);
+ retval =
+ Accessibility_Table_getIndexAt (
+ CSPI_OBJREF (obj), (CORBA_long) row,
+ (CORBA_long) column, cspi_ev ());
+
+ cspi_return_val_if_ev ("getIndexAt", -1);
+
+ return retval;
+}
/**
* AccessibleTable_getRowAtIndex:
*
* Returns: a long integer indicating the first row spanned by the child of a
* table, at the specified 1-D (zero-offset) @index.
- *
**/
long
AccessibleTable_getRowAtIndex (AccessibleTable *obj,
long index)
{
- return (long)
+ long retval;
+
+ cspi_return_val_if_fail (obj != NULL, -1);
+
+ retval =
Accessibility_Table_getRowAtIndex (CSPI_OBJREF (obj),
(CORBA_long) index, cspi_ev ());
-}
-
+
+ cspi_return_val_if_ev ("", -1);
+ return retval;
+}
/**
* AccessibleTable_getColumnAtIndex:
*
* Returns: a long integer indicating the first column spanned by the child of a
* table, at the specified 1-D (zero-offset) @index.
- *
**/
long
AccessibleTable_getColumnAtIndex (AccessibleTable *obj,
long index)
{
- return (long)
+ long retval;
+
+ cspi_return_val_if_fail (obj != NULL, -1);
+
+ retval =
Accessibility_Table_getColumnAtIndex (CSPI_OBJREF (obj),
(CORBA_long) index, cspi_ev ());
-}
-
+
+ cspi_return_val_if_ev ("getColumnAtIndex", -1);
+ return retval;
+}
/**
* AccessibleTable_getRowDescription:
* AccessibleTable_getRowHeader, which returns an #Accessible.
*
* Returns: a UTF-8 string describing the specified table row, if available.
- *
**/
char *
AccessibleTable_getRowDescription (AccessibleTable *obj,
- long int row)
+ long int row)
{
- return (char *)
+ char *retval;
+
+ cspi_return_val_if_fail (obj != NULL, NULL);
+
+ retval =
Accessibility_Table_getRowDescription (CSPI_OBJREF (obj),
(CORBA_long) row, cspi_ev ());
-}
-
+
+ cspi_return_val_if_ev ("getRowDescription", NULL);
+ return retval;
+}
/**
* AccessibleTable_getColumnDescription:
* AccessibleTable_getColumnHeader, which returns an #Accessible.
*
* Returns: a UTF-8 string describing the specified table column, if available.
- *
**/
char *
AccessibleTable_getColumnDescription (AccessibleTable *obj,
- long int column)
+ long int column)
{
- return (char *)
+ char *retval;
+
+ cspi_return_val_if_fail (obj != NULL, NULL);
+
+ retval =
Accessibility_Table_getColumnDescription (CSPI_OBJREF (obj),
(CORBA_long) column, cspi_ev ());
-}
+ cspi_return_val_if_ev ("getColumnDescription", NULL);
+ return retval;
+}
/**
* AccessibleTable_getRowExtentAt:
* (some tables can have cells which span multiple rows and/or columns).
*
* Returns: a long integer indicating the number of rows spanned by the specified cell.
- *
**/
long
AccessibleTable_getRowExtentAt (AccessibleTable *obj,
- long int row,
- long int column)
+ long int row,
+ long int column)
{
- return (long)
- Accessibility_Table_getRowExtentAt (CSPI_OBJREF (obj),
- (CORBA_long) row, (CORBA_long) column, cspi_ev ());
-}
+ long retval;
+
+ cspi_return_val_if_fail (obj != NULL, -1);
+ retval =
+ Accessibility_Table_getRowExtentAt (
+ CSPI_OBJREF (obj), (CORBA_long) row,
+ (CORBA_long) column, cspi_ev ());
+
+ cspi_return_val_if_ev ("getRowExtentAt", -1);
+ return retval;
+}
/**
* AccessibleTable_getColumnExtentAt:
* (some tables can have cells which span multiple rows and/or columns).
*
* Returns: a long integer indicating the number of columns spanned by the specified cell.
- *
**/
long
AccessibleTable_getColumnExtentAt (AccessibleTable *obj,
- long int row,
- long int column)
+ long int row,
+ long int column)
{
- return (long)
- Accessibility_Table_getColumnExtentAt (CSPI_OBJREF (obj),
- (CORBA_long) row, (CORBA_long) column, cspi_ev ());
-}
+ long retval;
+
+ cspi_return_val_if_fail (obj != NULL, -1);
+ retval =
+ Accessibility_Table_getColumnExtentAt (
+ CSPI_OBJREF (obj), (CORBA_long) row,
+ (CORBA_long) column, cspi_ev ());
+
+ cspi_return_val_if_ev ("getColumnExtentAt", -1);
+
+ return retval;
+}
/**
* AccessibleTable_getRowHeader:
* AccessibleTable_getRowDescription, which returns a string.
*
* Returns: a #Accessible representatin of the specified table row, if available.
- *
**/
Accessible *
AccessibleTable_getRowHeader (AccessibleTable *obj,
- long int row)
+ long int row)
{
- return (Accessible *)
+ return cspi_object_add (
Accessibility_Table_getRowHeader (CSPI_OBJREF (obj),
- (CORBA_long) row, cspi_ev ());
+ (CORBA_long) row, cspi_ev ()));
}
-
-
/**
* AccessibleTable_getColumnHeader:
* @obj: a pointer to the #AccessibleTable implementor on which to operate.
* AccessibleTable_getColumnDescription, which returns a string.
*
* Returns: a #Accessible representatin of the specified table column, if available.
- *
**/
Accessible *
AccessibleTable_getColumnHeader (AccessibleTable *obj,
long int column)
{
- return (Accessible *)
+ return cspi_object_add (
Accessibility_Table_getColumnHeader (CSPI_OBJREF (obj),
- (CORBA_long) column, cspi_ev ());
+ (CORBA_long) column, cspi_ev ()));
}
-
/**
* AccessibleTable_getNSelectedRows:
* @obj: a pointer to the #AccessibleTable implementor on which to operate.
long
AccessibleTable_getNSelectedRows (AccessibleTable *obj)
{
- return (long)
+ long retval;
+
+ cspi_return_val_if_fail (obj != NULL, -1);
+
+ retval =
Accessibility_Table__get_nSelectedRows (CSPI_OBJREF (obj), cspi_ev ());
+
+ cspi_return_val_if_ev ("getNSelectedRows", -1);
+
+ return retval;
}
+static long
+long_seq_to_array (Accessibility_LongSeq *seq, long int **array)
+{
+ long *j, length, i;
+
+ if (!cspi_check_ev ("getSelectionItems"))
+ {
+ *array = NULL;
+ return 0;
+ }
+
+ length = seq->_length;
+
+ j = *array = g_new (long, length);
+ for (i = 0; i < length; i++)
+ {
+ j[i] = seq->_buffer [i];
+ }
+
+ CORBA_free (seq);
+
+ return length;
+}
/**
* AccessibleTable_getSelectedRows:
**/
long
AccessibleTable_getSelectedRows (AccessibleTable *obj,
- long int **selectedRows)
+ long int **selectedRows)
{
- Accessibility_LongSeq *rows = Accessibility_Table_getSelectedRows (CSPI_OBJREF (obj), cspi_ev ());
- CORBA_long *i;
- long *j;
- long length;
-
- i = rows->_buffer;
- length = (long) rows->_length;
- j = *selectedRows = (long *) malloc (sizeof(long)*length);
-
- while (length--)
- *j++ = (CORBA_long) (*i++);
-
- length = rows->_length;
- CORBA_free (rows);
- return length;
-}
+ Accessibility_LongSeq *rows;
+ *selectedRows = NULL;
+ cspi_return_val_if_fail (obj != NULL, 0);
+
+ rows = Accessibility_Table_getSelectedRows (CSPI_OBJREF (obj), cspi_ev ());
+
+ return long_seq_to_array (rows, selectedRows);
+}
/**
* AccessibleTable_getNSelectedColumns:
long
AccessibleTable_getNSelectedColumns (AccessibleTable *obj)
{
- return (long)
+ long retval;
+
+ cspi_return_val_if_fail (obj != NULL, -1);
+
+ retval =
Accessibility_Table__get_nSelectedColumns (CSPI_OBJREF (obj), cspi_ev ());
-}
+
+ cspi_return_val_if_ev ("getNSelectedColumns", -1);
+ return retval;
+}
/**
* AccessibleTable_getSelectedColumns:
**/
long
AccessibleTable_getSelectedColumns (AccessibleTable *obj,
- long int **selectedColumns)
+ long int **selectedColumns)
{
- Accessibility_LongSeq *columns = Accessibility_Table_getSelectedColumns (CSPI_OBJREF (obj), cspi_ev ());
- CORBA_long *i;
- long *j;
- long length;
-
- i = columns->_buffer;
- length = (long) columns->_length;
- j = *selectedColumns = (long *) malloc (sizeof(long)*length);
-
- while (length--)
- *j++ = (CORBA_long) (*i++);
-
- length = columns->_length;
- CORBA_free (columns);
- return length;
-}
+ Accessibility_LongSeq *columns;
+
+ *selectedColumns = NULL;
+
+ cspi_return_val_if_fail (obj != NULL, 0);
+ columns = Accessibility_Table_getSelectedColumns (CSPI_OBJREF (obj), cspi_ev ());
+
+ return long_seq_to_array (columns, selectedColumns);
+}
/**
* AccessibleTable_isRowSelected:
* Determine whether a table row is selected. Not all tables support row selection.
*
* Returns: #TRUE if the specified row is currently selected, #FALSE if not.
- *
**/
SPIBoolean
AccessibleTable_isRowSelected (AccessibleTable *obj,
- long int row)
+ long int row)
{
- return (SPIBoolean)
+ SPIBoolean retval;
+
+ cspi_return_val_if_fail (obj != NULL, FALSE);
+
+ retval =
Accessibility_Table_isRowSelected (CSPI_OBJREF (obj),
(CORBA_long) row, cspi_ev ());
-}
+ cspi_return_val_if_ev ("isRowSelected", FALSE);
+ return retval;
+}
/**
* AccessibleTable_isColumnSelected:
* Not all tables support column selection.
*
* Returns: #TRUE if the specified column is currently selected, #FALSE if not.
- *
**/
SPIBoolean
AccessibleTable_isColumnSelected (AccessibleTable *obj,
- long int column)
+ long int column)
{
- return (SPIBoolean)
- Accessibility_Table_isColumnSelected (CSPI_OBJREF (obj),
- (CORBA_long) column, cspi_ev ());
-}
+ SPIBoolean retval;
+ cspi_return_val_if_fail (obj != NULL, FALSE);
+ retval =
+ Accessibility_Table_isColumnSelected (CSPI_OBJREF (obj),
+ (CORBA_long) column, cspi_ev ());
+
+ cspi_return_val_if_ev ("isColumnSelected", FALSE);
+
+ return retval;
+}
/**
* AccessibleTable_isSelected:
* Determine whether the cell at a specific row and column is selected.
*
* Returns: #TRUE if the specified cell is currently selected, #FALSE if not.
- *
**/
SPIBoolean
AccessibleTable_isSelected (AccessibleTable *obj,
long int row,
long int column)
{
- return (SPIBoolean)
- Accessibility_Table_isSelected (CSPI_OBJREF (obj),
- (CORBA_long) row, (CORBA_long) column, cspi_ev ());
+ SPIBoolean retval;
+
+ cspi_return_val_if_fail (obj != NULL, FALSE);
+
+ retval =
+ Accessibility_Table_isSelected (CSPI_OBJREF (obj),
+ (CORBA_long) row,
+ (CORBA_long) column, cspi_ev ());
+
+ cspi_return_val_if_ev ("isSelected", FALSE);
+
+ return retval;
}
* @obj: a pointer to the #AccessibleText object on which to operate.
*
* Increment the reference count for an #AccessibleText object.
- *
**/
void
AccessibleText_ref (AccessibleText *obj)
* @obj: a pointer to the #Accessible object on which to operate.
*
* Decrement the reference count for an #AccessibleText object.
- *
**/
void
AccessibleText_unref (AccessibleText *obj)
*
* Returns: a long integer indicating the total number of
* characters in the #AccessibleText object.
- *
**/
long
AccessibleText_getCharacterCount (AccessibleText *obj)
retval = (long)
Accessibility_Text__get_characterCount (CSPI_OBJREF (obj), cspi_ev ());
- cspi_return_val_if_ev ("_getCharacterCount", -1);
+ cspi_return_val_if_ev ("getCharacterCount", -1);
return retval;
}
*
* Returns: a text string containing characters from @startOffset
* to @endOffset-1, inclusive, encoded as UTF-8.
- *
**/
char *
AccessibleText_getText (AccessibleText *obj,
long int startOffset,
long int endOffset)
{
- return (char *)
+ char *retval;
+
+ cspi_return_val_if_fail (obj != NULL, NULL);
+
+ retval =
Accessibility_Text_getText (CSPI_OBJREF (obj),
- (CORBA_long) startOffset, (CORBA_long) endOffset, cspi_ev ());
+ (CORBA_long) startOffset,
+ (CORBA_long) endOffset,
+ cspi_ev ());
+
+ cspi_return_val_if_ev ("getText", NULL);
+
+ return retval;
}
/**
* Get the current offset of the text caret in an #AccessibleText object.
*
* Returns: a long integer indicating the current position of the text caret.
- *
**/
long
AccessibleText_getCaretOffset (AccessibleText *obj)
{
- return (long)
+ long retval;
+
+ cspi_return_val_if_fail (obj != NULL, -1);
+
+ retval =
Accessibility_Text__get_caretOffset (CSPI_OBJREF (obj), cspi_ev ());
-}
+ cspi_return_val_if_ev ("getCaretOffset", -1);
+
+ return retval;
+}
/**
* AccessibleText_getAttributes:
* Returns: a text string describing the attributes occurring within the
* attribute run containing @offset, encoded as UTF-8 and
* delimited by ':'
- *
**/
char *
AccessibleText_getAttributes (AccessibleText *obj,
{
CORBA_long retStartOffset, retEndOffset;
char *retval;
+
+ if (obj == NULL)
+ {
+ *startOffset = *endOffset = 0;
+ return NULL;
+ }
+
retval = (char *)
Accessibility_Text_getAttributes (CSPI_OBJREF (obj),
(CORBA_long) offset,
&retStartOffset,
&retEndOffset,
cspi_ev ());
- *startOffset = (long) retStartOffset;
- *endOffset = (long) retEndOffset;
- return retval;
-}
+ if (!cspi_check_ev ("getAttributes"))
+ {
+ *startOffset = *endOffset = 0;
+ }
+ else
+ {
+ *startOffset = retStartOffset;
+ *endOffset = retEndOffset;
+ }
+ return retval;
+}
/**
* AccessibleText_setCaretOffset:
* Set the text caret position for an #AccessibleText object.
*
* Returns: #TRUE if successful, #FALSE otherwise.
- *
**/
SPIBoolean
AccessibleText_setCaretOffset (AccessibleText *obj,
long int newOffset)
{
- return (SPIBoolean)
+ SPIBoolean retval;
+
+ cspi_return_val_if_fail (obj != NULL, FALSE);
+
+ retval =
Accessibility_Text_setCaretOffset (CSPI_OBJREF (obj),
(CORBA_long) newOffset, cspi_ev ());
+
+ cspi_return_val_if_ev ("setCaretOffset", FALSE);
+
+ return retval;
}
/**
* Returns: a UTF-8 string representing the delimited text, both of whose
* delimiting boundaries are before the current offset, or
* an empty string if no such text exists.
- *
**/
char *
AccessibleText_getTextBeforeOffset (AccessibleText *obj,
* Returns: a UTF-8 string representing the delimited text, whose
* delimiting boundaries bracket the current offset, or
* an empty string if no such text exists.
- *
**/
char *
AccessibleText_getTextAtOffset (AccessibleText *obj,
{
CORBA_long corbaStartOffset;
CORBA_long corbaEndOffset;
- char *retval = "";
+ char *retval;
+
+ if (obj == NULL)
+ {
+ *startOffset = *endOffset = 0;
+ return NULL;
+ }
+
retval = Accessibility_Text_getTextAtOffset (CSPI_OBJREF (obj),
(CORBA_long) offset,
(Accessibility_TEXT_BOUNDARY_TYPE) type,
&corbaStartOffset,
&corbaEndOffset,
cspi_ev ());
- *startOffset = (long) corbaStartOffset;
- *endOffset = (long) corbaEndOffset;
+
+ if (!cspi_check_ev ("getTextAtOffset"))
+ {
+ *startOffset = *endOffset = 0;
+ retval = NULL;
+ }
+ else
+ {
+ *startOffset = corbaStartOffset;
+ *endOffset = corbaEndOffset;
+ }
#ifdef CSPI_DEBUG
fprintf (stderr, "text offsets %ld to %ld\n", *startOffset, *endOffset);
#endif
return retval;
}
-
/**
* AccessibleText_getTextAfterOffset:
* @obj: a pointer to the #AccessibleText object on which to operate.
* Returns: a UTF-8 string representing the delimited text, both of whose
* delimiting boundaries are after or inclusive of the current
* offset, or an empty string if no such text exists.
- *
**/
char *
AccessibleText_getTextAfterOffset (AccessibleText *obj,
{
char *retval;
CORBA_long retStartOffset, retEndOffset;
+
+ if (obj == NULL)
+ {
+ *startOffset = *endOffset = 0;
+ return NULL;
+ }
+
retval = (char *)
Accessibility_Text_getTextAfterOffset (CSPI_OBJREF (obj),
(CORBA_long) offset, (Accessibility_TEXT_BOUNDARY_TYPE) type,
&retStartOffset, &retEndOffset,
cspi_ev ());
- *startOffset = (long) retStartOffset;
- *endOffset = (long) retEndOffset;
- return retval;
-}
+ if (!cspi_check_ev ("getTextAfterOffset"))
+ {
+ *startOffset = *endOffset = 0;
+ }
+ else
+ {
+ *startOffset = retStartOffset;
+ *endOffset = retEndOffset;
+ }
+ return retval;
+}
/**
* AccessibleText_getCharacterAtOffset:
* UCS-4 unicode code point of the given character, or
* 0xFFFFFFFF if the character in question cannot be represented
* in the UCS-4 encoding.
- *
**/
unsigned long
AccessibleText_getCharacterAtOffset (AccessibleText *obj,
long int offset)
{
- return (unsigned long)
+ long retval;
+
+ cspi_return_val_if_fail (obj != NULL, -1);
+
+ retval =
Accessibility_Text_getCharacterAtOffset (CSPI_OBJREF (obj),
- (CORBA_long) offset, cspi_ev ());
+ (CORBA_long) offset,
+ cspi_ev ());
+
+ cspi_return_val_if_ev ("getCharacterAtOffset", -1);
+
+ return retval;
}
/**
*
* Get the bounding box containing the glyph representing
* the character at a particular text offset.
- *
**/
void
AccessibleText_getCharacterExtents (AccessibleText *obj,
AccessibleCoordType type)
{
CORBA_long retX, retY, retWidth, retHeight;
+
+ if (obj == NULL)
+ {
+ *x = *y = 0;
+ *width = *height = 0;
+ return;
+ }
+
Accessibility_Text_getCharacterExtents (CSPI_OBJREF (obj),
(CORBA_long) offset,
&retX,
&retWidth,
&retHeight,
(CORBA_short) type, cspi_ev ());
- *x = (long) retX;
- *y = (long) retY;
- *width = (long) retWidth;
- *height = (long) retHeight;
-}
+ if (!cspi_check_ev ("getCharacterExtents"))
+ {
+ *x = *y = 0;
+ *width = *height = 0;
+ }
+ else
+ {
+ *x = retX;
+ *y = retY;
+ *width = retWidth;
+ *height = retHeight;
+ }
+}
/**
* AccessibleText_getOffsetAtPoint:
long int y,
AccessibleCoordType type)
{
- return (long)
+ long retval;
+
+ cspi_return_val_if_fail (obj != NULL, -1);
+
+ retval =
Accessibility_Text_getOffsetAtPoint (CSPI_OBJREF (obj),
- (CORBA_long) x, (CORBA_long) y, (CORBA_short) type, cspi_ev ());
-}
+ (CORBA_long) x,
+ (CORBA_long) y,
+ (CORBA_short) type, cspi_ev ());
+ cspi_return_val_if_ev ("getOffsetAtPoint", -1);
+
+ return retval;
+}
/**
* AccessibleText_getNSelections:
* Returns: a long integer indicating the current
* number of non-contiguous text selections active
* within an #AccessibleText object.
- *
**/
long
AccessibleText_getNSelections (AccessibleText *obj)
{
- return (long)
+ long retval;
+
+ cspi_return_val_if_fail (obj != NULL, -1);
+
+ retval =
Accessibility_Text_getNSelections (CSPI_OBJREF (obj), cspi_ev ());
-}
+ cspi_return_val_if_ev ("getNSelections", -1);
+ return retval;
+}
/**
* AccessibleText_getSelection:
*
* Get the bounds of the @selectionNum-th active text selection for an
* #AccessibleText object.
- *
**/
void
AccessibleText_getSelection (AccessibleText *obj,
long int *endOffset)
{
CORBA_long retStartOffset, retEndOffset;
+
+ if (obj == NULL)
+ {
+ *endOffset = *startOffset = -1;
+ return;
+ }
+
Accessibility_Text_getSelection (CSPI_OBJREF (obj),
(CORBA_long) selectionNum,
- &retStartOffset, &retEndOffset, cspi_ev ());
-
- *startOffset = (long) retStartOffset;
- *endOffset = (long) retEndOffset;
+ &retStartOffset, &retEndOffset,
+ cspi_ev ());
+
+ if (!cspi_check_ev ("getSelection"))
+ {
+ *startOffset = *endOffset = 0;
+ }
+ else
+ {
+ *startOffset = retStartOffset;
+ *endOffset = retEndOffset;
+ }
}
-
-
/**
* AccessibleText_addSelection:
* @obj: a pointer to the #AccessibleText object on which to operate.
* Select some text (add a text selection) in an #AccessibleText object.
*
* Returns: #TRUE if successful, #FALSE otherwise.
- *
**/
SPIBoolean
AccessibleText_addSelection (AccessibleText *obj,
long int startOffset, long int endOffset)
{
- return (SPIBoolean)
- Accessibility_Text_addSelection (CSPI_OBJREF (obj),
- (CORBA_long) startOffset, (CORBA_long) endOffset,
- cspi_ev ());
-}
+ SPIBoolean retval;
+
+ cspi_return_val_if_fail (obj != NULL, FALSE);
+ retval =
+ Accessibility_Text_addSelection (
+ CSPI_OBJREF (obj), (CORBA_long) startOffset,
+ (CORBA_long) endOffset, cspi_ev ());
+
+ cspi_return_val_if_ev ("addSelection", FALSE);
+
+ return retval;
+}
/**
* AccessibleText_removeSelection:
* De-select a text selection.
*
* Returns: #TRUE if successful, #FALSE otherwise.
- *
**/
SPIBoolean
AccessibleText_removeSelection (AccessibleText *obj,
long int selectionNum)
{
- return (SPIBoolean)
- Accessibility_Text_removeSelection (CSPI_OBJREF (obj),
- (CORBA_long) selectionNum, cspi_ev ());
+ SPIBoolean retval;
+
+ cspi_return_val_if_fail (obj != NULL, FALSE);
+
+ retval =
+ Accessibility_Text_removeSelection (
+ CSPI_OBJREF (obj), (CORBA_long) selectionNum, cspi_ev ());
+
+ cspi_return_val_if_ev ("removeSelection", FALSE);
+
+ return retval;
}
/**
* Change the bounds of an existing #AccessibleText text selection.
*
* Returns: #TRUE if successful, #FALSE otherwise.
- *
**/
SPIBoolean
AccessibleText_setSelection (AccessibleText *obj,
long int startOffset,
long int endOffset)
{
- return (SPIBoolean)
- Accessibility_Text_setSelection (CSPI_OBJREF (obj),
- (CORBA_long) selectionNum,
- (CORBA_long) startOffset,
- (CORBA_long) endOffset, cspi_ev ());
+ cspi_return_val_if_fail (obj != NULL, FALSE);
+
+ Accessibility_Text_setSelection (CSPI_OBJREF (obj),
+ (CORBA_long) selectionNum,
+ (CORBA_long) startOffset,
+ (CORBA_long) endOffset, cspi_ev ());
+
+ cspi_return_val_if_ev ("setSelection", FALSE);
+
+ return TRUE;
}
* @obj: a pointer to the #AccessibleValue implementor on which to operate.
*
* Increment the reference count for an #AccessibleValue object.
- *
**/
void
AccessibleValue_ref (AccessibleValue *obj)
* @obj: a pointer to the #AccessibleValue implementor on which to operate.
*
* Decrement the reference count for an #AccessibleValue object.
- *
**/
void
AccessibleValue_unref (AccessibleValue *obj)
float
AccessibleValue_getMinimumValue (AccessibleValue *obj)
{
- return (float)
+ float retval;
+
+ cspi_return_val_if_fail (obj != NULL, 0.0);
+
+ retval =
Accessibility_Value__get_minimumValue (CSPI_OBJREF (obj), cspi_ev ());
-}
+ cspi_return_val_if_ev ("getMinimumValue", 0.0);
+ return retval;
+}
/**
* AccessibleValue_getCurrentValue:
* Get the current value for an #AccessibleValue.
*
* Returns: the current value for this object.
- *
**/
float
AccessibleValue_getCurrentValue (AccessibleValue *obj)
{
- return (float)
+ float retval;
+
+ cspi_return_val_if_fail (obj != NULL, 0.0);
+
+ retval =
Accessibility_Value__get_currentValue (CSPI_OBJREF (obj), cspi_ev ());
-}
+ cspi_return_val_if_ev ("getCurrentValue", 0.0);
+ return retval;
+}
/**
* AccessibleValue_getMaximumValue:
* Get the maximum allowed value for an #AccessibleValue.
*
* Returns: the maximum allowed value for this object.
- *
**/
float
AccessibleValue_getMaximumValue (AccessibleValue *obj)
{
- return (float)
+ float retval;
+
+ cspi_return_val_if_fail (obj != NULL, 0.0);
+
+ retval =
Accessibility_Value__get_maximumValue (CSPI_OBJREF (obj), cspi_ev ());
-}
+ cspi_return_val_if_ev ("getMaximumValue", 0.0);
+ return retval;
+}
/**
* AccessibleValue_setCurrentValue:
*
* Returns: #TRUE if the value could be assigned the specified value,
* #FALSE otherwise.
- *
**/
SPIBoolean
AccessibleValue_setCurrentValue (AccessibleValue *obj,
float newValue)
{
- Accessibility_Value__set_currentValue (CSPI_OBJREF (obj),
- (CORBA_float) newValue, cspi_ev ());
+ cspi_return_val_if_fail (obj != NULL, FALSE);
+
+ Accessibility_Value__set_currentValue (
+ CSPI_OBJREF (obj), (CORBA_float) newValue, cspi_ev ());
+
+ cspi_return_val_if_ev ("setCurrentValue", FALSE);
+
return TRUE;
}