Просмотр исходного кода

ncd: rename static_strings_utils.h --> value_utils.h

ambrop7 13 лет назад
Родитель
Сommit
7c7e66fee2
3 измененных файлов с 12 добавлено и 7 удалено
  1. 8 3
      ncd/modules/arithmetic.c
  2. 1 1
      ncd/modules/call2.c
  3. 3 3
      ncd/value_utils.h

+ 8 - 3
ncd/modules/arithmetic.c

@@ -72,7 +72,7 @@
 #include <misc/parse_number.h>
 #include <ncd/NCDModule.h>
 #include <ncd/static_strings.h>
-#include <ncd/static_strings_utils.h>
+#include <ncd/value_utils.h>
 
 #include <generated/blog_channel_ncd_arithmetic.h>
 
@@ -194,9 +194,14 @@ static void new_boolean_templ (void *vo, NCDModuleInst *i, const struct NCDModul
     }
     
     uintmax_t n1;
+    if (!parse_unsigned_integer_bin(NCDVal_StringValue(n1_arg), NCDVal_StringLength(n1_arg), &n1)) {
+        ModuleLog(o->i, BLOG_ERROR, "wrong first argument");
+        goto fail0;
+    }
+    
     uintmax_t n2;
-    if (!parse_unsigned_integer(NCDVal_StringValue(n1_arg), &n1) || !parse_unsigned_integer(NCDVal_StringValue(n2_arg), &n2)) {
-        ModuleLog(o->i, BLOG_ERROR, "wrong value");
+    if (!parse_unsigned_integer_bin(NCDVal_StringValue(n2_arg), NCDVal_StringLength(n2_arg), &n2)) {
+        ModuleLog(o->i, BLOG_ERROR, "wrong second argument");
         goto fail0;
     }
     

+ 1 - 1
ncd/modules/call2.c

@@ -44,7 +44,7 @@
 #include <misc/debug.h>
 #include <ncd/NCDModule.h>
 #include <ncd/static_strings.h>
-#include <ncd/static_strings_utils.h>
+#include <ncd/value_utils.h>
 
 #include <generated/blog_channel_ncd_call2.h>
 

+ 3 - 3
ncd/static_strings_utils.h → ncd/value_utils.h

@@ -1,5 +1,5 @@
 /**
- * @file static_strings_utils.h
+ * @file value_utils.h
  * @author Ambroz Bizjak <ambrop7@gmail.com>
  * 
  * @section LICENSE
@@ -27,8 +27,8 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef NCD_BOOLEAN_H
-#define NCD_BOOLEAN_H
+#ifndef NCD_VALUE_UTILS_H
+#define NCD_VALUE_UTILS_H
 
 #include <misc/debug.h>
 #include <ncd/NCDVal.h>