lbkit 0.5.17__tar.gz → 0.5.18__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. {lbkit-0.5.17/lbkit.egg-info → lbkit-0.5.18}/PKG-INFO +1 -1
  2. lbkit-0.5.18/lbkit/__init__.py +2 -0
  3. {lbkit-0.5.17 → lbkit-0.5.18}/lbkit/codegen/ctype_defination.py +37 -32
  4. {lbkit-0.5.17 → lbkit-0.5.18}/lbkit/codegen/idf_interface.py +59 -4
  5. {lbkit-0.5.17 → lbkit-0.5.18}/lbkit/codegen/template/public.c.mako +18 -19
  6. {lbkit-0.5.17 → lbkit-0.5.18}/lbkit/codegen/template/server.c.mako +5 -5
  7. {lbkit-0.5.17 → lbkit-0.5.18/lbkit.egg-info}/PKG-INFO +1 -1
  8. lbkit-0.5.17/lbkit/__init__.py +0 -2
  9. {lbkit-0.5.17 → lbkit-0.5.18}/AUTHORS +0 -0
  10. {lbkit-0.5.17 → lbkit-0.5.18}/LICENSE +0 -0
  11. {lbkit-0.5.17 → lbkit-0.5.18}/MANIFEST.in +0 -0
  12. {lbkit-0.5.17 → lbkit-0.5.18}/README.md +0 -0
  13. {lbkit-0.5.17 → lbkit-0.5.18}/lbkit/ci_robot/__init__.py +0 -0
  14. {lbkit-0.5.17 → lbkit-0.5.18}/lbkit/ci_robot/gitee.py +0 -0
  15. {lbkit-0.5.17 → lbkit-0.5.18}/lbkit/cli.py +0 -0
  16. {lbkit-0.5.17 → lbkit-0.5.18}/lbkit/codegen/__init__.py +0 -0
  17. {lbkit-0.5.17 → lbkit-0.5.18}/lbkit/codegen/codegen.py +0 -0
  18. {lbkit-0.5.17 → lbkit-0.5.18}/lbkit/codegen/renderer.py +0 -0
  19. {lbkit-0.5.17 → lbkit-0.5.18}/lbkit/codegen/template/client.c.mako +0 -0
  20. {lbkit-0.5.17 → lbkit-0.5.18}/lbkit/codegen/template/client.h.mako +0 -0
  21. {lbkit-0.5.17 → lbkit-0.5.18}/lbkit/codegen/template/interface.c.mako +0 -0
  22. {lbkit-0.5.17 → lbkit-0.5.18}/lbkit/codegen/template/interface.introspect.xml.mako +0 -0
  23. {lbkit-0.5.17 → lbkit-0.5.18}/lbkit/codegen/template/public.h.mako +0 -0
  24. {lbkit-0.5.17 → lbkit-0.5.18}/lbkit/codegen/template/server.h.mako +0 -0
  25. {lbkit-0.5.17 → lbkit-0.5.18}/lbkit/component/__init__.py +0 -0
  26. {lbkit-0.5.17 → lbkit-0.5.18}/lbkit/component/arg_parser.py +0 -0
  27. {lbkit-0.5.17 → lbkit-0.5.18}/lbkit/component/build.py +0 -0
  28. {lbkit-0.5.17 → lbkit-0.5.18}/lbkit/component/template/conanbase.mako +0 -0
  29. {lbkit-0.5.17 → lbkit-0.5.18}/lbkit/component/template/deploy.mako +0 -0
  30. {lbkit-0.5.17 → lbkit-0.5.18}/lbkit/component/test.py +0 -0
  31. {lbkit-0.5.17 → lbkit-0.5.18}/lbkit/errors.py +0 -0
  32. {lbkit-0.5.17 → lbkit-0.5.18}/lbkit/helper.py +0 -0
  33. {lbkit-0.5.17 → lbkit-0.5.18}/lbkit/integration/__init__.py +0 -0
  34. {lbkit-0.5.17 → lbkit-0.5.18}/lbkit/integration/build_image.py +0 -0
  35. {lbkit-0.5.17 → lbkit-0.5.18}/lbkit/integration/build_manifest.py +0 -0
  36. {lbkit-0.5.17 → lbkit-0.5.18}/lbkit/integration/build_prepare.py +0 -0
  37. {lbkit-0.5.17 → lbkit-0.5.18}/lbkit/integration/build_rootfs.py +0 -0
  38. {lbkit-0.5.17 → lbkit-0.5.18}/lbkit/integration/config.py +0 -0
  39. {lbkit-0.5.17 → lbkit-0.5.18}/lbkit/integration/task.py +0 -0
  40. {lbkit-0.5.17 → lbkit-0.5.18}/lbkit/integration/template/conanfile.py.mako +0 -0
  41. {lbkit-0.5.17 → lbkit-0.5.18}/lbkit/lbkit.py +0 -0
  42. {lbkit-0.5.17 → lbkit-0.5.18}/lbkit/log.py +0 -0
  43. {lbkit-0.5.17 → lbkit-0.5.18}/lbkit/misc.py +0 -0
  44. {lbkit-0.5.17 → lbkit-0.5.18}/lbkit/tools.py +0 -0
  45. {lbkit-0.5.17 → lbkit-0.5.18}/lbkit.egg-info/SOURCES.txt +0 -0
  46. {lbkit-0.5.17 → lbkit-0.5.18}/lbkit.egg-info/dependency_links.txt +0 -0
  47. {lbkit-0.5.17 → lbkit-0.5.18}/lbkit.egg-info/entry_points.txt +0 -0
  48. {lbkit-0.5.17 → lbkit-0.5.18}/lbkit.egg-info/requires.txt +0 -0
  49. {lbkit-0.5.17 → lbkit-0.5.18}/lbkit.egg-info/top_level.txt +0 -0
  50. {lbkit-0.5.17 → lbkit-0.5.18}/setup.cfg +0 -0
  51. {lbkit-0.5.17 → lbkit-0.5.18}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: lbkit
3
- Version: 0.5.17
3
+ Version: 0.5.18
4
4
  Summary: Tools provided by litebmc.com
5
5
  Home-page: https://www.litebmc.com
6
6
  Author: xuhj@litebmc.com
@@ -0,0 +1,2 @@
1
+
2
+ __version__ = '0.5.18'
@@ -5,9 +5,11 @@ from lbkit.errors import OdfValidateException
5
5
 
6
6
  class IdfValidator():
7
7
  validator = {}
8
+ name = ""
8
9
 
9
- def set_validator(self, value):
10
+ def set_validator(self, value, name):
10
11
  self.validator = value
12
+ self.name = name
11
13
 
12
14
  def odf_validate(self):
13
15
  idf_validator = idf_validator
@@ -84,8 +86,8 @@ class IntegerValidator(IdfValidator):
84
86
  raise OdfValidateException(f"The max value {self.maximum} less than or equal to {self.minimum}")
85
87
  super().__init__()
86
88
 
87
- def set_validator(self, value):
88
- super().set_validator(value)
89
+ def set_validator(self, value, name):
90
+ super().set_validator(value, name)
89
91
  max = self.validator.get("max", self.maximum)
90
92
  if max > self.maximum:
91
93
  max = self.maximum
@@ -97,20 +99,23 @@ class IntegerValidator(IdfValidator):
97
99
  if not self.signed and self.minimum < 0:
98
100
  self.minimum = 0
99
101
  if self.maximum < self.minimum:
100
- raise OdfValidateException(f"The max value {self.maximum} less than or equal to {self.minimum}")
102
+ raise OdfValidateException(f"The max value {self.maximum} less than or equal to {self.minimum}, property {name} validation failed")
101
103
 
102
104
  def odf_validate(self):
103
105
  func = []
104
106
  if self.signed:
105
- if self.minimum == -9223372036854775808:
106
- func.append(f"validate_odf_as_signed(doc, node, prop, {self.maximum}, G_MININT64, error_list)")
107
- else:
108
- func.append(f"validate_odf_as_signed(doc, node, prop, {self.maximum}, {self.minimum}, error_list)")
107
+ min_str = self.minimum
108
+ max_str = self.maximum
109
+ if self.minimum <= -9223372036854775808:
110
+ min_str = "G_MININT64"
111
+ if self.maximum >= 9223372036854775807:
112
+ max_str = "G_MAXINT64"
113
+ func.append(f"validate_odf_as_signed(doc, node, prop, {max_str}, {min_str}, error_list)")
109
114
  else:
110
- if self.maximum == 18446744073709551615:
111
- func.append(f"validate_odf_as_unsigned(doc, node, prop, G_MAXUINT64, {self.minimum}, error_list)")
112
- else:
113
- func.append(f"validate_odf_as_unsigned(doc, node, prop, {self.maximum}, {self.minimum}, error_list)")
115
+ max_str = f"{self.maximum}UL"
116
+ if self.maximum >= 18446744073709551615:
117
+ max_str = "G_MAXUINT64"
118
+ func.append(f"validate_odf_as_unsigned(doc, node, prop, {max_str}, {self.minimum}UL, error_list)")
114
119
  return func
115
120
 
116
121
  def odf_schema(self, allow_ref):
@@ -142,21 +147,21 @@ class IntegerValidator(IdfValidator):
142
147
  class IntegerArrayValidator(IntegerValidator):
143
148
  def odf_validate(self):
144
149
  func = []
145
- min = self.minimum
146
- max = self.maximum
150
+ min_str = f"{self.minimum}UL"
151
+ max_str = f"{self.maximum}UL"
147
152
  if self.signed:
148
- if self.minimum <= -0x8000_0000_0000_0000:
149
- min = "G_MININT64"
153
+ if self.minimum <= -9223372036854775808:
154
+ min_str = "G_MININT64"
150
155
  if self.maximum >= 0x7fff_ffff_ffff_ffff:
151
- max = "G_MAXINT64"
156
+ max_str = "G_MAXINT64"
152
157
  else:
153
158
  if self.maximum >= 0xffff_ffff_ffff_ffff:
154
- max = "G_MAXUINT64"
159
+ max_str = "G_MAXUINT64"
155
160
 
156
161
  if self.signed:
157
- func.append(f"validate_odf_as_signed_v(doc, node, prop, {max}, {min}, error_list)")
162
+ func.append(f"validate_odf_as_signed_v(doc, node, prop, {max_str}, {min_str}, error_list)")
158
163
  else:
159
- func.append(f"validate_odf_as_unsigned_v(doc, node, prop, {max}, {min}, error_list)")
164
+ func.append(f"validate_odf_as_unsigned_v(doc, node, prop, {max_str}, {min_str}, error_list)")
160
165
  return func
161
166
 
162
167
  def odf_schema(self, allow_ref):
@@ -199,18 +204,18 @@ class FloatValidator(IdfValidator):
199
204
  def odf_validate(self):
200
205
  func = ["validate_odf_as_double(doc, node, prop, error_list)"]
201
206
  if self.exclusive_max is not None:
202
- func.append(f"validate_odf_as_float_exclusive_max(doc, node, prop, {self.exclusive_max}, error_list)")
207
+ func.append(f"validate_odf_as_double_exclusive_max(doc, node, prop, {self.exclusive_max}, error_list)")
203
208
  elif self.maximum != sys.float_info.max:
204
- func.append(f"validate_odf_as_float_max(doc, node, prop, {self.maximum}, error_list)")
209
+ func.append(f"validate_odf_as_double_max(doc, node, prop, {self.maximum}, error_list)")
205
210
 
206
211
  if self.exclusive_min is not None:
207
- func.append(f"validate_odf_as_float_exclusive_min(doc, node, prop, {self.exclusive_min}, error_list)")
212
+ func.append(f"validate_odf_as_double_exclusive_min(doc, node, prop, {self.exclusive_min}, error_list)")
208
213
  elif self.minimum != (-sys.float_info.max):
209
- func.append(f"validate_odf_as_float_min(doc, node, prop, {self.minimum}, error_list)")
214
+ func.append(f"validate_odf_as_double_min(doc, node, prop, {self.minimum}, error_list)")
210
215
  return func
211
216
 
212
- def set_validator(self, value):
213
- super().set_validator(value)
217
+ def set_validator(self, value, name):
218
+ super().set_validator(value, name)
214
219
  self.maximum = self.validator.get("max", self.maximum)
215
220
  self.minimum = self.validator.get("min", self.minimum)
216
221
  self.exclusive_max = self.validator.get("exclusive_max", None)
@@ -256,14 +261,14 @@ class FloatArrayValidator(FloatValidator):
256
261
  def odf_validate(self):
257
262
  func = ["validate_odf_as_double_v(doc, node, prop, error_list)"]
258
263
  if self.exclusive_max is not None:
259
- func.append(f"validate_odf_as_float_exclusive_max_v(doc, node, prop, {self.exclusive_max}, error_list)")
264
+ func.append(f"validate_odf_as_double_exclusive_max_v(doc, node, prop, {self.exclusive_max}, error_list)")
260
265
  elif self.maximum != sys.float_info.max:
261
- func.append(f"validate_odf_as_float_max_v(doc, node, prop, {self.maximum}, error_list)")
266
+ func.append(f"validate_odf_as_double_max_v(doc, node, prop, {self.maximum}, error_list)")
262
267
 
263
268
  if self.exclusive_min is not None:
264
- func.append(f"validate_odf_as_float_exclusive_min_v(doc, node, prop, {self.exclusive_min}, error_list)")
269
+ func.append(f"validate_odf_as_double_exclusive_min_v(doc, node, prop, {self.exclusive_min}, error_list)")
265
270
  elif self.minimum != (-sys.float_info.max):
266
- func.append(f"validate_odf_as_float_min_v(doc, node, prop, {self.minimum}, error_list)")
271
+ func.append(f"validate_odf_as_double_min_v(doc, node, prop, {self.minimum}, error_list)")
267
272
  return func
268
273
 
269
274
  def odf_schema(self, allow_ref):
@@ -294,9 +299,9 @@ class StringValidator(IdfValidator):
294
299
  self.pattern = pattern
295
300
  super().__init__()
296
301
 
297
- def set_validator(self, value):
302
+ def set_validator(self, value, name):
303
+ super().set_validator(value, name)
298
304
  self.pattern = self.validator.get("pattern", self.pattern)
299
- super().set_validator(value)
300
305
 
301
306
  def odf_validate(self):
302
307
  func = []
@@ -1,11 +1,13 @@
1
1
  import yaml
2
2
  import os
3
3
  import re
4
+ import copy
4
5
  import hashlib
5
6
  from lbkit.log import Logger
6
7
  from lbkit.codegen.renderer import Renderer
7
8
  from lbkit.codegen.ctype_defination import CTYPE_OBJS, RefObjArrayValidator, RefObjValidator
8
9
  from lbkit.misc import load_yml_with_json_schema_validate
10
+ from lbkit.errors import OdfValidateException
9
11
 
10
12
  log = Logger("gen_interface")
11
13
 
@@ -130,6 +132,7 @@ class IdfCtypeRender():
130
132
  intf: IdfInterfaceBase = None
131
133
  ctype: str = None
132
134
  name: str = ""
135
+ idf_data = None
133
136
  flags: list[str] = []
134
137
 
135
138
  def __init__(self):
@@ -144,19 +147,26 @@ class IdfCtypeRender():
144
147
  if "variant" == self.ctype:
145
148
  return []
146
149
  match = re.match(f"^array\[({CTYPE_BASE_REG})\]$", self.ctype)
150
+ validator_cfg = self.validator_cfg
147
151
  if match:
148
152
  if "refobj" in self.flags:
149
153
  valiator = RefObjArrayValidator()
150
154
  return valiator.odf_validate()
151
- ctype_obj = CTYPE_OBJS.get(self.ctype)
152
- return ctype_obj.validator.odf_validate()
155
+ ctype_obj = copy.deepcopy(CTYPE_OBJS.get(self.ctype))
156
+ validator = ctype_obj.validator
157
+ if validator_cfg:
158
+ validator.set_validator(validator_cfg, self.name)
159
+ return validator.odf_validate()
153
160
  match = re.match(f"^({CTYPE_BASE_REG})$", self.ctype)
154
161
  if match:
155
162
  if "refobj" in self.flags:
156
163
  valiator = RefObjValidator()
157
164
  return valiator.odf_validate()
158
- ctype_obj = CTYPE_OBJS.get(self.ctype)
159
- return ctype_obj.validator.odf_validate()
165
+ ctype_obj = copy.deepcopy(CTYPE_OBJS.get(self.ctype))
166
+ validator = ctype_obj.validator
167
+ if validator_cfg:
168
+ validator.set_validator(validator_cfg, self.name)
169
+ return validator.odf_validate()
160
170
  # 非基础类型
161
171
  is_array = False
162
172
  ctype = self.ctype
@@ -500,9 +510,52 @@ class IdfCtypeRender():
500
510
  else:
501
511
  return f"<arg_name> = _load_odf_as_{stru_name}(doc, <node>)"
502
512
 
513
+ @property
514
+ def validator_cfg(self):
515
+ cfg = {}
516
+ if (self.ctype == "string" or self.ctype == "array[string]" or
517
+ self.ctype == "object_path" or self.ctype == "array[object_path]" or
518
+ self.ctype == "signature" or self.ctype == "array[signature]"):
519
+ value = self.idf_data.get("pattern")
520
+ if value:
521
+ cfg["pattern"] = value
522
+ elif (self.ctype == "byte" or self.ctype == "array[byte]" or
523
+ self.ctype == "int16" or self.ctype == "array[int16]" or
524
+ self.ctype == "uint16" or self.ctype == "array[uint16]" or
525
+ self.ctype == "int32" or self.ctype == "array[int32]" or
526
+ self.ctype == "uint32" or self.ctype == "array[uint32]" or
527
+ self.ctype == "int64" or self.ctype == "array[int64]" or
528
+ self.ctype == "uint64" or self.ctype == "array[uint64]"):
529
+ value = self.idf_data.get("max")
530
+ if value:
531
+ cfg["max"] = value
532
+ value = self.idf_data.get("min")
533
+ if value:
534
+ cfg["min"] = value
535
+ if self.ctype == "double" or self.ctype == "array[double]":
536
+ emin = self.idf_data.get("exclusive_min")
537
+ if emin:
538
+ cfg["exclusive_min"] = emin
539
+ emax = self.idf_data.get("exclusive_max")
540
+ if emax:
541
+ cfg["exclusive_max"] = emax
542
+ mmin = self.idf_data.get("min")
543
+ if mmin:
544
+ cfg["min"] = mmin
545
+ mmax = self.idf_data.get("max")
546
+ if mmax:
547
+ cfg["max"] = mmax
548
+ if mmax is not None and emax is not None:
549
+ raise OdfValidateException(f"Cannot set max and exclusive_max at the same time, property {self.name} validation failed")
550
+ if mmin is not None and emin is not None:
551
+ raise OdfValidateException(f"Cannot set min and exclusive_min at the same time, property {self.name} validation failed")
552
+ return cfg
553
+
554
+
503
555
  class IdfProperty(IdfCtypeRender):
504
556
  def __init__(self, intf: IdfInterfaceBase, prop_data):
505
557
  self.intf = intf
558
+ self.idf_data = prop_data
506
559
  self.ctype = prop_data.get("type", "")
507
560
  super().__init__()
508
561
  self.name = prop_data.get("name")
@@ -548,8 +601,10 @@ class IdfProperty(IdfCtypeRender):
548
601
  def signature(self):
549
602
  return ctype_to_variant_signature(self.intf, self.ctype)
550
603
 
604
+
551
605
  class IdfParameter(IdfCtypeRender):
552
606
  def __init__(self, intf: IdfInterfaceBase, para_data):
607
+ self.idf_data = para_data
553
608
  self.intf = intf
554
609
  self.name = para_data.get("name")
555
610
  self.ctype = para_data.get("type", "")
@@ -6,21 +6,21 @@
6
6
  % for name, stru in intf.structures.items():
7
7
  /* ${name} structure object */
8
8
  /* START: 结构体${name}及其数组类型的ODF校验函数 */
9
- static gboolean _validate_odf_as_struct_${name}(yaml_document_t *doc, yaml_node_t *node, GString *prop, GSList **error_list);
10
- static gboolean _validate_odf_as_struct_${name}_v(yaml_document_t *doc, yaml_node_t *node, GString *prop, GSList **error_list);
9
+ static gboolean __attribute__((unused)) _validate_odf_as_struct_${name}(yaml_document_t *doc, yaml_node_t *node, GString *prop, GSList **error_list);
10
+ static gboolean __attribute__((unused)) _validate_odf_as_struct_${name}_v(yaml_document_t *doc, yaml_node_t *node, GString *prop, GSList **error_list);
11
11
 
12
12
  % endfor
13
13
  ## 定义枚举ODF加载函数
14
14
  % for name, enum in intf.enumerations.items():
15
15
  /* START: 枚举${name}及其数组类型的ODF校验函数 */
16
- static gboolean _validate_odf_as_enum_${name}(yaml_document_t *doc, yaml_node_t *node, GString *prop, GSList **error_list);
17
- static gboolean _validate_odf_as_enum_${name}_v(yaml_document_t *doc, yaml_node_t *node, GString *prop, GSList **error_list);
16
+ static gboolean __attribute__((unused)) _validate_odf_as_enum_${name}(yaml_document_t *doc, yaml_node_t *node, GString *prop, GSList **error_list);
17
+ static gboolean __attribute__((unused)) _validate_odf_as_enum_${name}_v(yaml_document_t *doc, yaml_node_t *node, GString *prop, GSList **error_list);
18
18
 
19
19
  % endfor
20
20
  ## 定义字典ODF加载函数
21
21
  % for name, dictionary in intf.dictionaries.items():
22
- static gboolean _validate_odf_as_dict_${name}(yaml_document_t *doc, yaml_node_t *node, GString *prop, GSList **error_list);
23
- static gboolean _validate_odf_as_dict_${name}_v(yaml_document_t *doc, yaml_node_t *node, GString *prop, GSList **error_list);
22
+ static gboolean __attribute__((unused)) _validate_odf_as_dict_${name}(yaml_document_t *doc, yaml_node_t *node, GString *prop, GSList **error_list);
23
+ static gboolean __attribute__((unused)) _validate_odf_as_dict_${name}_v(yaml_document_t *doc, yaml_node_t *node, GString *prop, GSList **error_list);
24
24
 
25
25
  % endfor
26
26
  % for name, stru in intf.structures.items():
@@ -36,7 +36,7 @@ GVariant *${name}_encode(const ${name} *value)
36
36
  value = &default_val;
37
37
  }
38
38
  % endif
39
- GVariant *tmp = NULL;
39
+ __attribute__((unused)) GVariant *tmp = NULL;
40
40
  GVariantBuilder builder;
41
41
  const gchar *sig = "${stru.signature}";
42
42
  g_variant_builder_init(&builder, G_VARIANT_TYPE(sig));
@@ -56,7 +56,7 @@ GVariant *${name}_encode(const ${name} *value)
56
56
  ${name} *${name}_decode(GVariant *in)
57
57
  {
58
58
  GVariantIter iter;
59
- GVariant *tmp = NULL;
59
+ __attribute__((unused)) GVariant *tmp = NULL;
60
60
  ${name} *output = g_new0(${name}, 1);
61
61
  if (!in) {
62
62
  return output;
@@ -161,9 +161,9 @@ gboolean _validate_odf_as_struct_${name}(yaml_document_t *doc, yaml_node_t *node
161
161
  "the node type of property %s is not a mapping, get %s", prop->str, gcl_yaml_node_type_str(node->type)));
162
162
  return FALSE;
163
163
  }
164
- gsize len = prop->len;
164
+ __attribute__((unused)) gsize len = prop->len;
165
165
  gboolean valid = TRUE;
166
- yaml_node_t *val;
166
+ __attribute__((unused)) yaml_node_t *val;
167
167
  GHashTable *prop_table = load_yaml_mapping_to_hash_table(doc, node);
168
168
  % for prop in stru.values.parameters:
169
169
  val = g_hash_table_lookup(prop_table, "${prop.name}");
@@ -501,7 +501,7 @@ static void ${name}_foreach_encode(${key_declare}, ${name}${dictionary.key} *val
501
501
  g_assert(value && dict_builder);
502
502
  % endif
503
503
 
504
- GVariant *tmp = NULL;
504
+ __attribute__((unused)) GVariant *tmp = NULL;
505
505
  GVariantBuilder builder;
506
506
  % if len(dictionary.values.parameters) == 1:
507
507
  ## 当只有一个成员时直接添加值
@@ -563,7 +563,6 @@ ${name} *${name}_decode(GVariant *in)
563
563
  % if len(dictionary.values.parameters) > 1:
564
564
  GVariantIter item_iter;
565
565
  % endif
566
- GVariant *next_item = NULL;
567
566
  GVariant *next_mem = NULL;
568
567
 
569
568
  ${name} *dict = ${name}_new();
@@ -824,7 +823,7 @@ GVariant *${class_name}_${method.name}_Req_encode(${class_name}_${method.name}_R
824
823
  if (!value) {
825
824
  value = &default_val;
826
825
  }
827
- GVariant *tmp = NULL;
826
+ __attribute__((unused)) GVariant *tmp = NULL;
828
827
  GVariantBuilder builder;
829
828
  const gchar *sig = "${method.in_signature}";
830
829
  g_variant_builder_init(&builder, G_VARIANT_TYPE(sig));
@@ -842,7 +841,7 @@ GVariant *${class_name}_${method.name}_Req_encode(${class_name}_${method.name}_R
842
841
  ${class_name}_${method.name}_Req *${class_name}_${method.name}_Req_decode(GVariant *in)
843
842
  {
844
843
  GVariantIter iter;
845
- GVariant *tmp = NULL;
844
+ __attribute__((unused)) GVariant *tmp = NULL;
846
845
  ${class_name}_${method.name}_Req *output = g_new0(${class_name}_${method.name}_Req, 1);
847
846
  if (!in) {
848
847
  return output;
@@ -885,7 +884,7 @@ GVariant *${class_name}_${method.name}_Rsp_encode(${class_name}_${method.name}_R
885
884
  if (!value) {
886
885
  value = &default_val;
887
886
  }
888
- GVariant *tmp = NULL;
887
+ __attribute__((unused)) GVariant *tmp = NULL;
889
888
  GVariantBuilder builder;
890
889
  const gchar *sig = "${method.out_signature}";
891
890
  g_variant_builder_init(&builder, G_VARIANT_TYPE(sig));
@@ -903,7 +902,7 @@ GVariant *${class_name}_${method.name}_Rsp_encode(${class_name}_${method.name}_R
903
902
  ${class_name}_${method.name}_Rsp *${class_name}_${method.name}_Rsp_decode(GVariant *in)
904
903
  {
905
904
  GVariantIter iter;
906
- GVariant *tmp = NULL;
905
+ __attribute__((unused)) GVariant *tmp = NULL;
907
906
  ${class_name}_${method.name}_Rsp *output = g_new0(${class_name}_${method.name}_Rsp, 1);
908
907
  if (!in) {
909
908
  return output;
@@ -1077,7 +1076,7 @@ GVariant *${class_name}_${signal.name}_Msg_encode(${class_name}_${signal.name}_M
1077
1076
  if (!value) {
1078
1077
  value = &default_val;
1079
1078
  }
1080
- GVariant *tmp = NULL;
1079
+ __attribute__((unused)) GVariant *tmp = NULL;
1081
1080
  GVariantBuilder builder;
1082
1081
  const gchar *sig = "${signal.signature}";
1083
1082
  g_variant_builder_init(&builder, G_VARIANT_TYPE(sig));
@@ -1095,7 +1094,7 @@ GVariant *${class_name}_${signal.name}_Msg_encode(${class_name}_${signal.name}_M
1095
1094
  ${class_name}_${signal.name}_Msg *${class_name}_${signal.name}_Msg_decode(GVariant *in)
1096
1095
  {
1097
1096
  GVariantIter iter;
1098
- GVariant *tmp = NULL;
1097
+ __attribute__((unused)) GVariant *tmp = NULL;
1099
1098
  ${class_name}_${signal.name}_Msg *output = g_new0(${class_name}_${signal.name}_Msg, 1);
1100
1099
  if (!in) {
1101
1100
  return output;
@@ -1162,7 +1161,7 @@ static gboolean _validate_odf_prop_${prop.name}(yaml_document_t *doc, GHashTable
1162
1161
  if (!node) {
1163
1162
  ## 检查属性是否存在
1164
1163
  % if "required" in prop.flags:
1165
- *error_list = g_slist_append(*error_list, g_error_new(ODF_ERROR, ODF_ERROR_PROP_MISSING, "Property %s is missing", prop->str));
1164
+ *error_list = g_slist_append(*error_list, g_error_new(ODF_ERROR, ODF_ERROR_PROP_MISSING, "Property ${prop.name} is missing"));
1166
1165
  valid = FALSE;
1167
1166
  % endif
1168
1167
  break;
@@ -44,7 +44,7 @@ ${name} *_load_odf_as_${name}(yaml_document_t *doc, yaml_node_t *node)
44
44
  % if cnt == 0:
45
45
  return g_new0(${name}, 1);
46
46
  % else:
47
- yaml_node_t *val;
47
+ __attribute__((unused)) yaml_node_t *val;
48
48
  ${name} *output = g_new0(${name}, 1);
49
49
  GHashTable *prop_table = load_yaml_mapping_to_hash_table(doc, node);
50
50
  % for prop in stru.values.parameters:
@@ -236,7 +236,6 @@ gboolean ${class_name}_${signal.name}_Signal(const ${class_name} *object, const
236
236
  static GclObject *_${class_name}_create(const gchar *obj_name, gpointer opaque);
237
237
  static void _load_from_odf(yaml_document_t *doc, yaml_node_t *node, GclObject *gcl_obj,
238
238
  property_reference_loaded ref_loaded, gpointer user_data);
239
- static void _valid_from_odf(yaml_document_t *doc, yaml_node_t *node, const gchar *object_name);
240
239
 
241
240
  static GclInterface _${class_name}_interface = {
242
241
  .create = _${intf.alias}_create,
@@ -255,7 +254,7 @@ static void _load_odf_as_prop_${prop.name}(yaml_document_t *doc, GHashTable *pro
255
254
  const gchar *flags = NULL;
256
255
  yaml_node_t *val = g_hash_table_lookup(prop_table, "_${prop.name}_flags");
257
256
  if (val && val->type == YAML_SCALAR_NODE) {
258
- flags = val->data.scalar.value;
257
+ flags = (const gchar *)val->data.scalar.value;
259
258
  }
260
259
  val = g_hash_table_lookup(prop_table, "${prop.name}");
261
260
  ## validate接口在加载odf前完成属性是否必选校验,此处如果是必选属性一定存在
@@ -269,8 +268,9 @@ static void _load_odf_as_prop_${prop.name}(yaml_document_t *doc, GHashTable *pro
269
268
  % if "refobj" in prop.flags:
270
269
  ref_loaded(obj, &${properties}.${prop.name}, doc, val, user_data, flags);
271
270
  % else:
272
- if (val->type == YAML_SCALAR_NODE && val->data.scalar.value[0] == '$' &&
273
- g_regex_match(gcl_ref_prop_regex(), val->data.scalar.value, 0, NULL)) {
271
+ const gchar *val_str = (const gchar *)val->data.scalar.value;
272
+ if (val->type == YAML_SCALAR_NODE && val_str[0] == '$' &&
273
+ g_regex_match(gcl_ref_prop_regex(), val_str, 0, NULL)) {
274
274
  ref_loaded(obj, &${properties}.${prop.name}, doc, val, user_data, flags);
275
275
  } else {
276
276
  % if prop.odf_load_func() is not None:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: lbkit
3
- Version: 0.5.17
3
+ Version: 0.5.18
4
4
  Summary: Tools provided by litebmc.com
5
5
  Home-page: https://www.litebmc.com
6
6
  Author: xuhj@litebmc.com
@@ -1,2 +0,0 @@
1
-
2
- __version__ = '0.5.17'
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes