MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / cmpStatus

Function cmpStatus

src/common/utils.cpp:1457–1502  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1455}
1456
1457bool cmpStatus(unsigned int len, const ISC_STATUS* a, const ISC_STATUS* b) throw()
1458{
1459 for (unsigned i = 0; i < len; )
1460 {
1461 const ISC_STATUS* op1 = &a[i];
1462 const ISC_STATUS* op2 = &b[i];
1463 if (*op1 != *op2)
1464 return false;
1465
1466 if (i == len - 1 && *op1 == isc_arg_end)
1467 break;
1468
1469 i += nextArg(*op1);
1470 if (i > len) // arg does not fit
1471 return false;
1472
1473 unsigned l1, l2;
1474 const char *s1, *s2;
1475 if (isStr(*op1))
1476 {
1477 if (*op1 == isc_arg_cstring)
1478 {
1479 l1 = op1[1];
1480 l2 = op2[1];
1481 s1 = (const char*)(op1[2]);
1482 s2 = (const char*)(op2[2]);
1483 }
1484 else
1485 {
1486 s1 = (const char*)(op1[1]);
1487 s2 = (const char*)(op2[1]);
1488 l1 = strlen(s1);
1489 l2 = strlen(s2);
1490 }
1491
1492 if (l1 != l2)
1493 return false;
1494 if (memcmp(s1, s2, l1) != 0)
1495 return false;
1496 }
1497 else if (op1[1] != op2[1])
1498 return false;
1499 }
1500
1501 return true;
1502}
1503
1504unsigned int subStatus(const ISC_STATUS* in, unsigned int cin,
1505 const ISC_STATUS* sub, unsigned int csub) throw()

Callers 2

compareMethod · 0.85
prependMethod · 0.85

Calls 2

nextArgFunction · 0.85
isStrFunction · 0.85

Tested by

no test coverage detected