ncurses 6.2 - patch 20201017
[ncurses.git] / form / frm_opts.c
index 22ca3a1e1176090a5831081d687bb276c68f3f42..a0e8b1c77d4e96bf99d7c777ab31fcc028155127 100644 (file)
@@ -1,5 +1,6 @@
 /****************************************************************************
- * Copyright (c) 1998,2000 Free Software Foundation, Inc.                   *
+ * Copyright 2020 Thomas E. Dickey                                          *
+ * Copyright 1998-2012,2013 Free Software Foundation, Inc.                  *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
 
 /****************************************************************************
  *   Author:  Juergen Pfeifer, 1995,1997                                    *
- *   Contact: http://www.familiepfeifer.de/Contact.aspx?Lang=en             *
  ****************************************************************************/
 
 #include "form.priv.h"
 
-MODULE_ID("$Id: frm_opts.c,v 1.10 2002/07/06 15:33:27 juergen Exp $")
+MODULE_ID("$Id: frm_opts.c,v 1.19 2020/05/24 01:40:20 anonymous.maarten Exp $")
 
 /*---------------------------------------------------------------------------
 |   Facility      :  libnform  
@@ -45,15 +45,17 @@ MODULE_ID("$Id: frm_opts.c,v 1.10 2002/07/06 15:33:27 juergen Exp $")
 |   Return Values :  E_OK              - success
 |                    E_BAD_ARGUMENT    - invalid options
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
-set_form_opts (FORM * form, Form_Options  opts)
+FORM_EXPORT(int)
+set_form_opts(FORM *form, Form_Options opts)
 {
-  opts &= ALL_FORM_OPTS;
-  if (opts & ~ALL_FORM_OPTS)
+  T((T_CALLED("set_form_opts(%p,%d)"), (void *)form, opts));
+
+  opts &= (Form_Options) ALL_FORM_OPTS;
+  if ((unsigned)opts & ~ALL_FORM_OPTS)
     RETURN(E_BAD_ARGUMENT);
   else
     {
-      Normalize_Form( form )->opts = opts;
+      Normalize_Form(form)->opts = opts;
       RETURN(E_OK);
     }
 }
@@ -66,10 +68,11 @@ set_form_opts (FORM * form, Form_Options  opts)
 |
 |   Return Values :  The option flags.
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(Form_Options)
-form_opts (const FORM * form)
+FORM_EXPORT(Form_Options)
+form_opts(const FORM *form)
 {
-  return (Normalize_Form(form)->opts & ALL_FORM_OPTS);
+  T((T_CALLED("form_opts(%p)"), (const void *)form));
+  returnCode((Form_Options) ((unsigned)Normalize_Form(form)->opts & ALL_FORM_OPTS));
 }
 
 /*---------------------------------------------------------------------------
@@ -82,15 +85,17 @@ form_opts (const FORM * form)
 |   Return Values :  E_OK            - success 
 |                    E_BAD_ARGUMENT  - invalid options
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
-form_opts_on (FORM * form, Form_Options opts)
+FORM_EXPORT(int)
+form_opts_on(FORM *form, Form_Options opts)
 {
-  opts &= ALL_FORM_OPTS;
-  if (opts & ~ALL_FORM_OPTS)
+  T((T_CALLED("form_opts_on(%p,%d)"), (void *)form, opts));
+
+  opts &= (Form_Options) ALL_FORM_OPTS;
+  if ((unsigned)opts & ~ALL_FORM_OPTS)
     RETURN(E_BAD_ARGUMENT);
   else
     {
-      Normalize_Form( form )->opts |= opts;    
+      Normalize_Form(form)->opts |= opts;
       RETURN(E_OK);
     }
 }
@@ -105,11 +110,13 @@ form_opts_on (FORM * form, Form_Options opts)
 |   Return Values :  E_OK            - success 
 |                    E_BAD_ARGUMENT  - invalid options
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
-form_opts_off (FORM * form, Form_Options opts)
+FORM_EXPORT(int)
+form_opts_off(FORM *form, Form_Options opts)
 {
-  opts &= ALL_FORM_OPTS;
-  if (opts & ~ALL_FORM_OPTS)
+  T((T_CALLED("form_opts_off(%p,%d)"), (void *)form, opts));
+
+  opts &= (Form_Options) ALL_FORM_OPTS;
+  if ((unsigned)opts & ~ALL_FORM_OPTS)
     RETURN(E_BAD_ARGUMENT);
   else
     {