durable_rules 2.0.9 → 2.0.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cfa1e57dda8143326832f1c3fda960c12f1c86b5
4
- data.tar.gz: f448dd2fe6abcbb32f56f33e33f3048e4ab0fb10
3
+ metadata.gz: '08354a5b9d64bb706031205f0710774dfe373110'
4
+ data.tar.gz: 32d5ec3373973b43b23510c30319215229080f9d
5
5
  SHA512:
6
- metadata.gz: 7d58e95f7a9364dc84a1296c6db45fcefbabcf4c54e01c904e2d41722a482ae4d384ebaaaa1b9ff3f9a91c4396fb26c8126ac3be3a1c7c1041bc682156ab3d01
7
- data.tar.gz: ee9107a906fe6e38519d43805a7a790406d6e677aba8a4074a27c6fd4d98bb92b07960296f3a22d76f59247861b4c5d387082eac2f2997711af9ba45c191fb01
6
+ metadata.gz: 700351f9793a3bdc225208dbfcc85461c72f2640348f74831f616bc82bbc293fa7adc8da9377c62a4ea3152343cf3b0ccf94398436f50e61a013ee59890c26bd
7
+ data.tar.gz: a5d572adc4e81d3b79bc9f51bd889f95ff77e592c86ef614b4637838265dc3527a527e8996606098ba2b8e944a094f4936ed685f7eae945d0da3e40ff1dabf01
@@ -156,8 +156,8 @@ static unsigned int reduceBool(unsigned char left,
156
156
  return RULES_OK;
157
157
  }
158
158
 
159
- static unsigned int reduceInt(long left,
160
- long right,
159
+ static unsigned int reduceInt(long long left,
160
+ long long right,
161
161
  unsigned char op,
162
162
  jsonProperty *targetProperty) {
163
163
  switch(op) {
@@ -354,10 +354,10 @@ static unsigned int reduceProperties(unsigned char operator,
354
354
  {
355
355
  #ifdef _WIN32
356
356
  char *leftString = (char *)_alloca(sizeof(char)*(MAX_INT_LENGTH + 1));
357
- sprintf_s(leftString, sizeof(char)*(MAX_INT_LENGTH + 1), "%ld", leftProperty->value.i);
357
+ sprintf_s(leftString, sizeof(char)*(MAX_INT_LENGTH + 1), "%lld", leftProperty->value.i);
358
358
  #else
359
359
  char leftString[MAX_INT_LENGTH + 1];
360
- snprintf(leftString, sizeof(char)*(MAX_INT_LENGTH + 1), "%ld", leftProperty->value.i);
360
+ snprintf(leftString, sizeof(char)*(MAX_INT_LENGTH + 1), "%lld", leftProperty->value.i);
361
361
  #endif
362
362
  return reduceString(leftString,
363
363
  leftProperty->valueLength,
@@ -403,10 +403,10 @@ static unsigned int reduceProperties(unsigned char operator,
403
403
  {
404
404
  #ifdef _WIN32
405
405
  char *rightString = (char *)_alloca(sizeof(char)*(MAX_INT_LENGTH + 1));
406
- sprintf_s(rightString, sizeof(char)*(MAX_INT_LENGTH + 1), "%ld", rightProperty->value.i);
406
+ sprintf_s(rightString, sizeof(char)*(MAX_INT_LENGTH + 1), "%lld", rightProperty->value.i);
407
407
  #else
408
408
  char rightString[MAX_INT_LENGTH + 1];
409
- snprintf(rightString, sizeof(char)*(MAX_INT_LENGTH + 1), "%ld", rightProperty->value.i);
409
+ snprintf(rightString, sizeof(char)*(MAX_INT_LENGTH + 1), "%lld", rightProperty->value.i);
410
410
  #endif
411
411
  return reduceString(leftProperty->value.s,
412
412
  leftProperty->valueLength,
@@ -617,10 +617,10 @@ static unsigned int getFrameHashForExpression(ruleset *tree,
617
617
  {
618
618
  #ifdef _WIN32
619
619
  char *string = (char *)_alloca(sizeof(char)*(MAX_INT_LENGTH + 1));
620
- sprintf_s(string, sizeof(char)*(MAX_INT_LENGTH + 1), "%ld", property->value.i);
620
+ sprintf_s(string, sizeof(char)*(MAX_INT_LENGTH + 1), "%lld", property->value.i);
621
621
  #else
622
622
  char string[MAX_INT_LENGTH + 1];
623
- snprintf(string, sizeof(char)*(MAX_INT_LENGTH + 1), "%ld", property->value.i);
623
+ snprintf(string, sizeof(char)*(MAX_INT_LENGTH + 1), "%lld", property->value.i);
624
624
  #endif
625
625
  *hash = fnv1Hash32(string, strlen(string));
626
626
  break;
@@ -716,7 +716,6 @@ static unsigned int isAlphaMatch(ruleset *tree,
716
716
  alpha *currentAlpha,
717
717
  jsonObject *messageObject,
718
718
  unsigned char *propertyMatch) {
719
-
720
719
  *propertyMatch = 0;
721
720
  if (currentAlpha->expression.operator == OP_EX) {
722
721
  *propertyMatch = 1;
@@ -1444,47 +1443,49 @@ static unsigned int isNextMatch(ruleset *tree,
1444
1443
  }
1445
1444
 
1446
1445
  if (*propertyMatch) {
1447
- break;
1446
+ return RULES_OK;
1448
1447
  }
1449
1448
 
1450
1449
  }
1451
1450
  }
1452
1451
  }
1453
-
1452
+
1454
1453
  if (currentAlpha->nextOffset) {
1455
1454
  unsigned int *nextHashset = &tree->nextPool[currentAlpha->nextOffset];
1456
1455
  for(unsigned int propertyIndex = 0; propertyIndex < jo->propertiesLength; ++propertyIndex) {
1457
1456
  jsonProperty *currentProperty = &jo->properties[propertyIndex];
1458
1457
  for (unsigned int entry = currentProperty->hash & HASH_MASK; nextHashset[entry] != 0; entry = (entry + 1) % NEXT_BUCKET_LENGTH) {
1459
- node *hashNode = &tree->nodePool[nextHashset[entry]];
1460
- if (hashNode->value.a.expression.operator == OP_IALL || hashNode->value.a.expression.operator == OP_IANY) {
1461
- CHECK_RESULT(isArrayMatch(tree,
1462
- jo,
1463
- currentProperty,
1464
- &hashNode->value.a,
1465
- propertyMatch));
1466
- } else {
1467
- CHECK_RESULT(isAlphaMatch(tree,
1468
- &hashNode->value.a,
1469
- jo,
1470
- propertyMatch));
1471
- }
1458
+ node *hashNode = &tree->nodePool[nextHashset[entry]];
1459
+ if (currentProperty->hash == hashNode->value.a.expression.left.value.id.propertyNameHash) {
1460
+ if (hashNode->value.a.expression.operator == OP_IALL || hashNode->value.a.expression.operator == OP_IANY) {
1461
+ CHECK_RESULT(isArrayMatch(tree,
1462
+ jo,
1463
+ currentProperty,
1464
+ &hashNode->value.a,
1465
+ propertyMatch));
1466
+ } else {
1467
+ CHECK_RESULT(isAlphaMatch(tree,
1468
+ &hashNode->value.a,
1469
+ jo,
1470
+ propertyMatch));
1471
+ }
1472
1472
 
1473
- if (*propertyMatch && (hashNode->value.a.nextOffset || hashNode->value.a.nextListOffset)) {
1474
- CHECK_RESULT(isNextMatch(tree,
1475
- jo,
1476
- &hashNode->value.a,
1477
- propertyMatch));
1473
+ if (*propertyMatch && (hashNode->value.a.nextOffset || hashNode->value.a.nextListOffset)) {
1474
+ CHECK_RESULT(isNextMatch(tree,
1475
+ jo,
1476
+ &hashNode->value.a,
1477
+ propertyMatch));
1478
1478
 
1479
- }
1479
+ }
1480
1480
 
1481
- if (*propertyMatch) {
1482
- break;
1483
- }
1481
+ if (*propertyMatch) {
1482
+ break;
1483
+ }
1484
+ }
1484
1485
  }
1485
1486
  }
1486
1487
  }
1487
-
1488
+
1488
1489
  return RULES_OK;
1489
1490
  }
1490
1491
 
@@ -1493,6 +1494,7 @@ static unsigned int isArrayMatch(ruleset *tree,
1493
1494
  jsonProperty *currentProperty,
1494
1495
  alpha *arrayAlpha,
1495
1496
  unsigned char *propertyMatch) {
1497
+
1496
1498
  unsigned int result = RULES_OK;
1497
1499
  if (currentProperty->type != JSON_ARRAY) {
1498
1500
  return RULES_OK;
@@ -1553,42 +1555,44 @@ static unsigned int isArrayMatch(ruleset *tree,
1553
1555
  }
1554
1556
  }
1555
1557
 
1556
- if (arrayAlpha->arrayListOffset) {
1557
- unsigned int *nextHashset = &tree->nextPool[arrayAlpha->arrayListOffset];
1558
- for(unsigned int propertyIndex = 0; propertyIndex < jo.propertiesLength; ++propertyIndex) {
1559
- jsonProperty *currentProperty = &jo.properties[propertyIndex];
1560
- for (unsigned int entry = currentProperty->hash & HASH_MASK; nextHashset[entry] != 0; entry = (entry + 1) % NEXT_BUCKET_LENGTH) {
1561
- node *hashNode = &tree->nodePool[nextHashset[entry]];
1562
- if (currentProperty->hash == hashNode->value.a.expression.left.value.id.propertyNameHash) {
1563
- if (hashNode->value.a.expression.operator == OP_IALL || hashNode->value.a.expression.operator == OP_IANY) {
1564
- CHECK_RESULT(isArrayMatch(tree,
1565
- &jo,
1566
- currentProperty,
1567
- &hashNode->value.a,
1568
- propertyMatch));
1569
- } else {
1570
- CHECK_RESULT(isAlphaMatch(tree,
1571
- &hashNode->value.a,
1572
- &jo,
1573
- propertyMatch));
1574
- }
1558
+ if (!*propertyMatch) {
1559
+ if (arrayAlpha->arrayListOffset) {
1560
+ unsigned int *nextHashset = &tree->nextPool[arrayAlpha->arrayListOffset];
1561
+ for(unsigned int propertyIndex = 0; propertyIndex < jo.propertiesLength; ++propertyIndex) {
1562
+ jsonProperty *currentProperty = &jo.properties[propertyIndex];
1563
+ for (unsigned int entry = currentProperty->hash & HASH_MASK; nextHashset[entry] != 0; entry = (entry + 1) % NEXT_BUCKET_LENGTH) {
1564
+ node *hashNode = &tree->nodePool[nextHashset[entry]];
1565
+ if (currentProperty->hash == hashNode->value.a.expression.left.value.id.propertyNameHash) {
1566
+ if (hashNode->value.a.expression.operator == OP_IALL || hashNode->value.a.expression.operator == OP_IANY) {
1567
+ CHECK_RESULT(isArrayMatch(tree,
1568
+ &jo,
1569
+ currentProperty,
1570
+ &hashNode->value.a,
1571
+ propertyMatch));
1572
+ } else {
1573
+ CHECK_RESULT(isAlphaMatch(tree,
1574
+ &hashNode->value.a,
1575
+ &jo,
1576
+ propertyMatch));
1577
+ }
1575
1578
 
1576
- if (*propertyMatch && hashNode->value.a.nextOffset) {
1577
- CHECK_RESULT(isNextMatch(tree,
1578
- &jo,
1579
- &hashNode->value.a,
1580
- propertyMatch));
1579
+ if (*propertyMatch && hashNode->value.a.nextOffset) {
1580
+ CHECK_RESULT(isNextMatch(tree,
1581
+ &jo,
1582
+ &hashNode->value.a,
1583
+ propertyMatch));
1581
1584
 
1582
- }
1585
+ }
1583
1586
 
1584
- if (*propertyMatch && (hashNode->value.a.nextOffset || hashNode->value.a.nextListOffset)) {
1585
- break;
1586
- }
1587
- }
1587
+ if (*propertyMatch && (hashNode->value.a.nextOffset || hashNode->value.a.nextListOffset)) {
1588
+ break;
1589
+ }
1590
+ }
1591
+ }
1588
1592
  }
1589
1593
  }
1590
1594
  }
1591
-
1595
+
1592
1596
  // OP_IANY, one element led a a valid path
1593
1597
  // OP_IALL, all elements led to a valid path
1594
1598
  if ((arrayAlpha->expression.operator == OP_IALL && !*propertyMatch) ||
@@ -1988,7 +1992,7 @@ unsigned int retractFacts(unsigned int handle,
1988
1992
  ruleset *tree;
1989
1993
  RESOLVE_HANDLE(handle, &tree);
1990
1994
 
1991
- return handleMessages(tree, ACTION_ASSERT_EVENT, messages, stateOffset);
1995
+ return handleMessages(tree, ACTION_RETRACT_FACT, messages, stateOffset);
1992
1996
  }
1993
1997
 
1994
1998
  unsigned int updateState(unsigned int handle,
@@ -1397,7 +1397,7 @@ unsigned int setObjectProperty(jsonObject *jo,
1397
1397
  case JSON_INT:
1398
1398
  temp = first[property->valueLength];
1399
1399
  first[property->valueLength] = '\0';
1400
- property->value.i = atol(first);
1400
+ property->value.i = atoll(first);
1401
1401
  first[property->valueLength] = temp;
1402
1402
  break;
1403
1403
  case JSON_DOUBLE:
@@ -67,7 +67,7 @@ typedef struct jsonProperty {
67
67
  unsigned short valueOffset;
68
68
  unsigned short valueLength;
69
69
  union {
70
- long i;
70
+ long long i;
71
71
  double d;
72
72
  unsigned char b;
73
73
  char *s;
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: durable_rules
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.9
4
+ version: 2.0.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jesus Ruiz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-10-02 00:00:00.000000000 Z
11
+ date: 2019-10-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake