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

Function getDbPathInfo

src/common/utils.cpp:1558–1586  ·  view source on GitHub ↗

moves DB path information (from limbo transaction) to another buffer

Source from the content-addressed store, hash-verified

1556
1557// moves DB path information (from limbo transaction) to another buffer
1558void getDbPathInfo(unsigned int& itemsLength, const unsigned char*& items,
1559 unsigned int& bufferLength, unsigned char*& buffer,
1560 Firebird::Array<unsigned char>& newItemsBuffer, const Firebird::PathName& dbpath)
1561{
1562 if (itemsLength && items)
1563 {
1564 const unsigned char* ptr = (const unsigned char*) memchr(items, fb_info_tra_dbpath, itemsLength);
1565 if (ptr)
1566 {
1567 newItemsBuffer.add(items, itemsLength);
1568 newItemsBuffer.remove(ptr - items);
1569 items = newItemsBuffer.begin();
1570 --itemsLength;
1571
1572 unsigned int len = dbpath.length();
1573 if (len + 4 > bufferLength)
1574 {
1575 len = bufferLength - 4;
1576 }
1577 bufferLength -= (len + 3);
1578 *buffer++ = fb_info_tra_dbpath;
1579 *buffer++ = len;
1580 *buffer++ = len >> 8;
1581 memcpy(buffer, dbpath.c_str(), len);
1582 buffer += len;
1583 *buffer = isc_info_end;
1584 }
1585 }
1586}
1587
1588// returns true if passed info items work with running svc thread
1589bool isRunningCheck(const UCHAR* items, unsigned int length)

Callers 2

getInfoMethod · 0.85
getInfoMethod · 0.85

Calls 5

addMethod · 0.45
removeMethod · 0.45
beginMethod · 0.45
lengthMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected