[MPlayer-cvslog] r27679 - in trunk: m_property.c m_property.h

reimar subversion at mplayerhq.hu
Wed Oct 1 19:05:18 CEST 2008


Author: reimar
Date: Wed Oct  1 19:05:18 2008
New Revision: 27679

Log:
Add a m_property_flag_ro function for the default behaviour of a
read-only flag.

Modified:
   trunk/m_property.c
   trunk/m_property.h

Modified: trunk/m_property.c
==============================================================================
--- trunk/m_property.c	(original)
+++ trunk/m_property.c	Wed Oct  1 19:05:18 2008
@@ -245,6 +245,17 @@ int m_property_choice(const m_option_t* 
     return m_property_int_range(prop,action,arg,var);
 }
 
+int m_property_flag_ro(const m_option_t* prop,int action,
+                       void* arg,int var) {
+    switch(action) {
+    case M_PROPERTY_PRINT:
+        if(!arg) return 0;
+        *(char**)arg = strdup((var > prop->min) ? MSGTR_Enabled : MSGTR_Disabled);
+        return 1;
+    }
+    return m_property_int_ro(prop,action,arg,var);
+}
+
 int m_property_flag(const m_option_t* prop,int action,
                     void* arg,int* var) {
     switch(action) {
@@ -253,9 +264,7 @@ int m_property_flag(const m_option_t* pr
         *var = *var == prop->min ? prop->max : prop->min;
         return 1;
     case M_PROPERTY_PRINT:
-        if(!arg) return 0;
-        *(char**)arg = strdup((*var > prop->min) ? MSGTR_Enabled : MSGTR_Disabled);
-        return 1;
+        return m_property_flag_ro(prop, action, arg, *var);
     }
     return m_property_int_range(prop,action,arg,var);
 }

Modified: trunk/m_property.h
==============================================================================
--- trunk/m_property.h	(original)
+++ trunk/m_property.h	Wed Oct  1 19:05:18 2008
@@ -169,6 +169,9 @@ int m_property_int_range(const m_option_
 int m_property_choice(const m_option_t* prop,int action,
                       void* arg,int* var);
 
+int m_property_flag_ro(const m_option_t* prop,int action,
+                    void* arg,int var);
+
 /// Switch betwen min and max.
 int m_property_flag(const m_option_t* prop,int action,
                     void* arg,int* var);



More information about the MPlayer-cvslog mailing list