Skip to content
  • Victor Toso's avatar
    operation-options: Fix storing numeric limits · b50dc15f
    Victor Toso authored
    GrlOperationOptions needs to validate user input against the maximum
    and minimum values of a metadata-key of numeric type. For numeric
    types, the follow should always be true:
    
      @min_value_registered <= @min_value_user
      @min_value_user <= @max_value_user
      @max_value_user <= @max_value_registered.
    
    So, we do implement some sort generic CLAMP for numeric types.  Sadly,
    glib does not provide as of yet a g_value_cmp() [0] so we need to
    write a bit more code to make this checks in Grilo today.
    
    The followup commit adds a unit test.
    
    Related: #140
    
    [0] glib#129
    b50dc15f