8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-23 06:03:02 +01:00

Big cleanup.

God have pity on platform maintainers.
I only can compile/test Win32; sorry, folks.
This commit is contained in:
robocop 2004-02-20 06:43:27 +00:00
parent 9e7376b1f1
commit 5c3c8abd9a
220 changed files with 5303 additions and 5083 deletions

View File

@ -24,7 +24,7 @@
//
//____________________________________________________________
//
// $Id: alice.cpp,v 1.49 2004-01-28 07:50:13 robocop Exp $
// $Id: alice.cpp,v 1.50 2004-02-20 06:42:27 robocop Exp $
//
// 2001.07.06 Sean Leyne - Code Cleanup, removed "#ifdef READONLY_DATABASE"
// conditionals, as the engine now fully supports
@ -119,7 +119,7 @@ static void alice_output(const SCHAR*, ...) ATTRIBUTE_FORMAT(1,2);
// if gfix is run as a service
//
static int output_svc(SVC output_data, const UCHAR * output_buf)
static int output_svc(svc* output_data, const UCHAR * output_buf)
{
ib_fprintf(ib_stdout, "%s", output_buf);
return 0;
@ -232,7 +232,7 @@ int common_main(int argc,
else if (argc > 1 && !strcmp(argv[1], "-svc_thd")) {
tdgbl->sw_service = true;
tdgbl->sw_service_thd = true;
tdgbl->service_blk = (SVC) output_data;
tdgbl->service_blk = (svc*) output_data;
tdgbl->status = tdgbl->service_blk->svc_status;
argv++;
argc--;
@ -539,7 +539,7 @@ int common_main(int argc,
CMD_UTIL_put_svc_status(tdgbl->service_blk->svc_status, ALICE_MSG_FAC,
20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
SVC_STARTED(tdgbl->service_blk);
tdgbl->service_blk->svc_started();
#else
ALICE_print(21, 0, 0, 0, 0, 0); /* msg 21: plausible options are:\n */
for (table = alice_in_sw_table; table->in_sw_msg; table++)
@ -605,7 +605,7 @@ int common_main(int argc,
{
/* All "calls" to exit_local(), normal and error exits, wind up here */
SVC_STARTED(tdgbl->service_blk);
tdgbl->service_blk->svc_started();
int exit_code = tdgbl->exit_code;

View File

@ -126,20 +126,20 @@ enum tdr_state_vals {
/* a couple of obscure blocks used only in data allocator routines */
class vec : public pool_alloc_rpt<class blk*, alice_type_vec>
{
public:
ULONG vec_count;
blk *vec_object[1];
};
typedef vec* VEC;
//class alice_vec : public pool_alloc_rpt<class blk*, alice_type_vec>
//{
//public:
// ULONG vec_count;
// blk *vec_object[1];
//};
//typedef alice_vec* VEC;
class vcl : public pool_alloc_rpt<SLONG, alice_type_vcl>
{
ULONG vcl_count;
SLONG vcl_long[1];
};
typedef vcl* VCL;
//class alice_vcl : public pool_alloc_rpt<SLONG, alice_type_vcl>
//{
// ULONG vcl_count;
// SLONG vcl_long[1];
//};
//typedef alice_vcl* VCL;
/* Global switches and data */
@ -168,7 +168,7 @@ public:
pfn_svc_output output_proc;
svc* output_data;
IB_FILE* output_file;
SVC service_blk;
svc* service_blk;
isc_db_handle db_handle;
isc_tr_handle tr_handle;
ISC_STATUS* status;

View File

@ -26,7 +26,7 @@
#define ALICE_ALICE_PROTO_H
#ifdef SUPERSERVER
int ALICE_main(SVC service);
int ALICE_main(svc* service);
#endif
void ALICE_down_case(const TEXT*, TEXT*, const size_t);

View File

@ -24,7 +24,7 @@
//
//____________________________________________________________
//
// $Id: exe.cpp,v 1.27 2003-11-18 12:33:42 brodsom Exp $
// $Id: exe.cpp,v 1.28 2004-02-20 06:42:27 robocop Exp $
//
// 2001.07.06 Sean Leyne - Code Cleanup, removed "#ifdef READONLY_DATABASE"
// conditionals, as the engine now fully supports
@ -102,7 +102,7 @@ int EXE_action(const TEXT* database, const ULONG switches)
isc_attach_database(tdgbl->status, 0, database, &handle, dpb_length,
reinterpret_cast<SCHAR*>(dpb));
SVC_STARTED(tdgbl->service_blk);
tdgbl->service_blk->svc_started();
if (tdgbl->status[1])
error = true;
@ -156,7 +156,7 @@ int EXE_two_phase(const TEXT* database, const ULONG switches)
isc_attach_database(tdgbl->status, 0, database, &handle,
dpb_length, reinterpret_cast<char*>(dpb));
SVC_STARTED(tdgbl->service_blk);
tdgbl->service_blk->svc_started();
if (tdgbl->status[1])
error = true;

View File

@ -37,7 +37,7 @@
*/
/*
$Id: backup.epp,v 1.50 2004-02-06 07:07:44 skidder Exp $
$Id: backup.epp,v 1.51 2004-02-20 06:42:30 robocop Exp $
*/
#include "firebird.h"
@ -1358,14 +1358,14 @@ void put_blob( burp_fld* field, ISC_QUAD * blob_id, ULONG count)
ULONG segments = 0;
USHORT max_segment = 0;
UCHAR *p = blob_info;
const UCHAR* p = blob_info;
UCHAR item;
while ((item = *p++) != isc_info_end)
{
USHORT l = (USHORT) isc_vax_integer((char*) p, 2);
const USHORT l = (USHORT) isc_vax_integer((const char*) p, 2);
p += 2;
USHORT n = (USHORT) isc_vax_integer((char*) p, l);
const USHORT n = (USHORT) isc_vax_integer((const char*) p, l);
p += l;
switch (item)
{

View File

@ -590,9 +590,8 @@ int common_main(int argc,
// NOMEM: return error, FREE: during function exit in the SETJMP
if (tdgbl == NULL)
{
SVC service;
service = (SVC) output_data;
SVC_STARTED(service);
svc* service = (svc*) output_data;
service->svc_started();
return FINI_ERROR;
}
@ -638,7 +637,7 @@ int common_main(int argc,
else if (argc > 1 && !strcmp(argv[1], "-svc_thd")) {
tdgbl->gbl_sw_service_gbak = true;
tdgbl->gbl_sw_service_thd = true;
tdgbl->service_blk = (SVC) output_data;
tdgbl->service_blk = (svc*) output_data;
tdgbl->status = tdgbl->service_blk->svc_status;
argv++;
argc--;
@ -1144,17 +1143,17 @@ int common_main(int argc,
switch (action) {
case (RESTORE):
SVC_STARTED(tdgbl->service_blk);
tdgbl->service_blk->svc_started();
result = RESTORE_restore(file1, file2);
break;
case (BACKUP):
SVC_STARTED(tdgbl->service_blk);
tdgbl->service_blk->svc_started();
result = BACKUP_backup(file1, file2);
break;
case (QUIT):
SVC_STARTED(tdgbl->service_blk);
tdgbl->service_blk->svc_started();
BURP_abort();
break;
}
@ -1244,7 +1243,7 @@ void BURP_abort(void)
BURP_print(83, 0, 0, 0, 0, 0);
// msg 83 Exiting before completion due to errors
SVC_STARTED(tdgbl->service_blk);
tdgbl->service_blk->svc_started();
BURP_exit_local(FINI_ERROR, tdgbl);
}
@ -1279,7 +1278,7 @@ void BURP_error(USHORT errcode, bool abort,
arg1_t, arg1, arg2_t, arg2, arg3_t, arg3,
arg4_t, arg4, arg5_t, arg5);
SVC_STARTED(tdgbl->service_blk);
tdgbl->service_blk->svc_started();
#endif
BURP_msg_partial(256, 0, 0, 0, 0, 0); // msg 256: gbak: ERROR:
BURP_msg_put(errcode, arg1, arg2, arg3, arg4, arg5);

View File

@ -25,7 +25,7 @@
#define BURP_BURP_PROTO_H
#ifdef SUPERSERVER
int BURP_main(SVC service);
int BURP_main(svc* service);
#endif
void BURP_abort(void);

View File

@ -24,7 +24,7 @@
* 2003.08.17 Claudio Valderrama: Fix SF Bug #750659.
*/
/*
$Id: restore.epp,v 1.66 2004-02-16 23:24:31 arnobrinkman Exp $
$Id: restore.epp,v 1.67 2004-02-20 06:42:30 robocop Exp $
*/
#include "firebird.h"
@ -1936,7 +1936,7 @@ void get_blob (const burp_fld* fields,
ISC_QUAD* blob_id = (ISC_QUAD*) ((UCHAR*) record_buffer + field->fld_offset);
FRBRD* blob = NULL;
ISC_STATUS_ARRAY status_vector;
char blob_desc[] = {isc_bpb_version1, isc_bpb_type, 1, blob_type};
const char blob_desc[] = {isc_bpb_version1, isc_bpb_type, 1, blob_type};
if (isc_create_blob2 (status_vector, &DB, &gds_trans, &blob, blob_id,
sizeof(blob_desc), blob_desc))

View File

@ -32,7 +32,7 @@
* Contributor(s):
*
*
* $Id: alloc.cpp,v 1.37 2004-01-28 07:50:18 robocop Exp $
* $Id: alloc.cpp,v 1.38 2004-02-20 06:42:35 robocop Exp $
*
*/
@ -297,7 +297,7 @@ MemoryPool* MemoryPool::internal_create(size_t instance_size, int *cur_mem, int
poolBlk->length = MEM_ALIGN(instance_size);
poolBlk->prev = NULL;
MemoryBlock *hdr = (MemoryBlock*) (mem +
MemoryBlock* hdr = (MemoryBlock*) (mem +
MEM_ALIGN(sizeof(MemoryExtent)) +
MEM_ALIGN(sizeof(MemoryBlock)) +
MEM_ALIGN(instance_size));

View File

@ -34,7 +34,7 @@
* Contributor(s):
*
*
* $Id: alloc.h,v 1.31 2004-02-08 16:35:40 alexpeshkoff Exp $
* $Id: alloc.h,v 1.32 2004-02-20 06:42:35 robocop Exp $
*
*/
@ -207,7 +207,7 @@ public:
static void globalFree(void* block) {
if (block)
((MemoryBlock*)((char*)block-MEM_ALIGN(sizeof(MemoryBlock))))->pool->deallocate(block);
((MemoryBlock*)((char*)block - MEM_ALIGN(sizeof(MemoryBlock))))->pool->deallocate(block);
}
void* calloc(size_t size, SSHORT type = 0
@ -277,7 +277,7 @@ static inline void* operator new[](size_t s) {
// Do not complain here. It causes client tools to crash on Red Hat 8.0
// fprintf(stderr, "You MUST allocate all memory from a pool. Don't use the default global new[]().\n");
#endif // DEV_BUILD
// return getDefaultMemoryPool()->->calloc(s, 0
// return getDefaultMemoryPool()->calloc(s, 0
return getDefaultMemoryPool()->allocate(s, 0
#ifdef DEBUG_GDS_ALLOC
,__FILE__,__LINE__

View File

@ -12,7 +12,7 @@
namespace {
int StringIgnoreCaseCompare(const char* s1, const char* s2, unsigned int l) {
while (l--) {
int delta = toupper(*s1++) - toupper(*s2++);
const int delta = toupper(*s1++) - toupper(*s2++);
if (delta) {
return delta;
}
@ -35,12 +35,12 @@ namespace {
l = strlen(s);
}
Firebird::AbstractString::const_pointer end = s + l;
while(s < end) {
unsigned char c = static_cast<unsigned char>(*s++);
while (s < end) {
const unsigned char c = static_cast<unsigned char>(*s++);
m[c >> 3] |= (1 << (c & 7));
}
}
inline bool Contains(char c) {
inline bool Contains(const char c) {
return m[c >> 3] & (1 << (c & 7));
}
};
@ -52,18 +52,23 @@ namespace Firebird {
AbstractString::AbstractString(const AbstractString& v) {
memcpy(createStorage(v.length()), v.c_str(), v.length());
}
AbstractString::AbstractString(size_type size, const_pointer data) {
memcpy(createStorage(size), data, size);
}
AbstractString::AbstractString(const_pointer p1, size_type n1,
const_pointer p2, size_type n2) {
const_pointer p2, size_type n2)
{
char *s = createStorage(n1 + n2);
memcpy(s, p1, n1);
memcpy(&s[n1], p2, n2);
}
AbstractString::AbstractString(size_type size, char_type c) {
memset(createStorage(size), c, size);
}
void AbstractString::AdjustRange(size_type length, size_type& pos, size_type& n) {
if (pos == npos) {
pos = length > n ? length - n : 0;
@ -77,6 +82,7 @@ namespace Firebird {
n = length - pos;
}
}
AbstractString::pointer AbstractString::baseAssign(size_type n) {
StoragePair x;
openStorage(x, n
@ -87,6 +93,7 @@ namespace Firebird {
x.newStorage[n] = 0;
return x.newStorage;
}
AbstractString::pointer AbstractString::baseAppend(size_type n) {
StoragePair x;
openStorage(x, length() + n
@ -100,6 +107,7 @@ namespace Firebird {
x.newStorage[length()] = 0;
return &x.newStorage[x.oldSize];
}
AbstractString::pointer AbstractString::baseInsert(size_type p0, size_type n) {
if (p0 >= length()) {
return baseAppend(n);
@ -122,6 +130,7 @@ namespace Firebird {
x.newStorage[length()] = 0;
return &x.newStorage[p0];
}
void AbstractString::baseErase(size_type p0, size_type n) {
AdjustRange(length(), p0, n);
StoragePair x;
@ -141,11 +150,12 @@ namespace Firebird {
}
x.newStorage[length()] = 0;
}
/* void AbstractString::reserve(size_type n) {
if (n <= actualSize) {
return;
}
unsigned short l = userSize;
const unsigned short l = userSize;
StoragePair x;
openStorage(x, n
#ifdef DEV_BUILD
@ -161,6 +171,7 @@ namespace Firebird {
}
x.newStorage[l] = 0;
}*/
void AbstractString::resize(size_type n, char_type c) {
if (n == length()) {
return;
@ -179,6 +190,7 @@ namespace Firebird {
}
x.newStorage[n] = 0;
}
AbstractString::size_type AbstractString::rfind(const_pointer s, size_type pos) const {
const size_type l = strlen(s);
int lastpos = length() - l;
@ -198,6 +210,7 @@ namespace Firebird {
}
return npos;
}
AbstractString::size_type AbstractString::rfind(char_type c, size_type pos) const {
int lastpos = length() - 1;
if (lastpos < 0) {
@ -216,6 +229,7 @@ namespace Firebird {
}
return npos;
}
AbstractString::size_type AbstractString::find_first_of(const_pointer s, size_type pos, size_type n) const {
strBitMask sm(s, n);
const_pointer p = &c_str()[pos];
@ -227,6 +241,7 @@ namespace Firebird {
}
return npos;
}
AbstractString::size_type AbstractString::find_last_of(const_pointer s, size_type pos, size_type n) const {
strBitMask sm(s, n);
int lpos = length() - 1;
@ -242,6 +257,7 @@ namespace Firebird {
}
return npos;
}
AbstractString::size_type AbstractString::find_first_not_of(const_pointer s, size_type pos, size_type n) const {
strBitMask sm(s, n);
const_pointer p = &c_str()[pos];
@ -253,6 +269,7 @@ namespace Firebird {
}
return npos;
}
AbstractString::size_type AbstractString::find_last_not_of(const_pointer s, size_type pos, size_type n) const {
strBitMask sm(s, n);
int lpos = length() - 1;
@ -268,6 +285,7 @@ namespace Firebird {
}
return npos;
}
bool AbstractString::LoadFromFile(FILE *file) {
baseErase(0, length());
if (! file)
@ -283,16 +301,19 @@ namespace Firebird {
}
return rc;
}
void AbstractString::upper() {
for(pointer p = Modify(); *p; p++) {
*p = toupper(*p);
}
}
void AbstractString::lower() {
for(pointer p = Modify(); *p; p++) {
*p = tolower(*p);
}
}
void AbstractString::baseTrim(TrimType WhereTrim, const_pointer ToTrim) {
strBitMask sm(ToTrim, strlen(ToTrim));
const_pointer b = c_str();
@ -331,6 +352,7 @@ namespace Firebird {
}
x.newStorage[NewLength] = 0;
}
int PathNameComparator::compare(AbstractString::const_pointer s1, AbstractString::const_pointer s2, AbstractString::size_type n) {
if (CASE_SENSITIVITY)
return memcmp(s1, s2, n);

View File

@ -32,7 +32,7 @@
* Contributor(s):
*
*
* $Id: rwlock.h,v 1.9 2003-11-21 19:42:06 kkuznetsov Exp $
* $Id: rwlock.h,v 1.10 2004-02-20 06:42:35 robocop Exp $
*
*/
@ -46,7 +46,8 @@
#define LOCK_WRITER_OFFSET 50000
namespace Firebird {
namespace Firebird
{
// This class works on Windows 98/NT4 or later. Win95 is not supported
// Should work pretty fast.
@ -65,47 +66,61 @@ private:
// funcions
//
#if (defined(_MSC_VER) && (_MSC_VER <= 1200)) || defined(MINGW)
inline LONG InterlockedIncrement_uni(volatile LONG* lock_p){
inline LONG InterlockedIncrement_uni(volatile LONG* lock_p)
{
return InterlockedIncrement(const_cast<LONG*>(lock_p));
}
inline LONG InterlockedDecrement_uni(volatile LONG* lock_p){
inline LONG InterlockedDecrement_uni(volatile LONG* lock_p)
{
return InterlockedDecrement(const_cast<LONG*>(lock_p));
}
inline LONG InterlockedExchangeAdd_uni(volatile LONG* lock_p, LONG value){
inline LONG InterlockedExchangeAdd_uni(volatile LONG* lock_p, LONG value)
{
return InterlockedExchangeAdd(const_cast<LONG*>(lock_p), value);
}
#else
inline LONG InterlockedIncrement_uni(volatile LONG* lock_p){
inline LONG InterlockedIncrement_uni(volatile LONG* lock_p)
{
return InterlockedIncrement(lock_p);
}
inline LONG InterlockedDecrement_uni(volatile LONG* lock_p){
inline LONG InterlockedDecrement_uni(volatile LONG* lock_p)
{
return InterlockedDecrement(lock_p);
}
inline LONG InterlockedExchangeAdd_uni(volatile LONG* lock_p, LONG value){
inline LONG InterlockedExchangeAdd_uni(volatile LONG* lock_p, LONG value)
{
return InterlockedExchangeAdd(lock_p, value);
}
#endif
public:
RWLock() : lock(0), blockedReaders(0), blockedWriters(0) {
RWLock() : lock(0), blockedReaders(0), blockedWriters(0)
{
readers_semaphore = CreateSemaphore(NULL, 0 /*initial count*/,
INT_MAX, NULL);
writers_event = CreateEvent(NULL, FALSE/*auto-reset*/, FALSE, NULL);
}
~RWLock() { CloseHandle(readers_semaphore); CloseHandle(writers_event); }
~RWLock()
{
CloseHandle(readers_semaphore);
CloseHandle(writers_event);
}
// Returns negative value if writer is active.
// Otherwise returns a number of readers
LONG getState() {
LONG getState() const
{
return lock;
}
void unblockWaiting() {
void unblockWaiting()
{
if (blockedWriters)
SetEvent(writers_event);
else
if (blockedReaders)
ReleaseSemaphore(readers_semaphore, blockedReaders, NULL);
}
bool tryBeginRead() {
bool tryBeginRead()
{
if (lock < 0) return false;
if (InterlockedIncrement_uni(&lock) > 0) return true;
// We stepped on writer's toes. Fix our mistake
@ -113,7 +128,8 @@ public:
unblockWaiting();
return false;
}
bool tryBeginWrite() {
bool tryBeginWrite()
{
if (lock) return false;
if (InterlockedExchangeAdd_uni(&lock, -LOCK_WRITER_OFFSET) == 0) return true;
// We stepped on somebody's toes. Fix our mistake
@ -121,7 +137,8 @@ public:
unblockWaiting();
return false;
}
void beginRead() {
void beginRead()
{
if (!tryBeginRead()) {
InterlockedIncrement_uni(&blockedReaders);
while (!tryBeginRead())
@ -129,7 +146,8 @@ public:
InterlockedDecrement_uni(&blockedReaders);
}
}
void beginWrite() {
void beginWrite()
{
if (!tryBeginWrite()) {
InterlockedIncrement_uni(&blockedWriters);
while (!tryBeginWrite())
@ -137,11 +155,13 @@ public:
InterlockedDecrement_uni(&blockedWriters);
}
}
void endRead() {
void endRead()
{
if (InterlockedDecrement_uni(&lock) == 0)
unblockWaiting();
}
void endWrite() {
void endWrite()
{
if (InterlockedExchangeAdd_uni(&lock, LOCK_WRITER_OFFSET) == -LOCK_WRITER_OFFSET)
unblockWaiting();
}
@ -160,53 +180,67 @@ public:
#include <synch.h>
#include <errno.h>
namespace Firebird {
namespace Firebird
{
class RWLock {
class RWLock
{
private:
rwlock_t lock;
public:
RWLock() {
RWLock()
{
if (rwlock_init(&lock, USYNC_PROCESS, NULL))
{
system_call_failed::raise();
}
}
~RWLock() {
~RWLock()
{
if (rwlock_destroy(&lock))
system_call_failed::raise();
}
void beginRead() {
void beginRead()
{
if (rw_rdlock(&lock))
system_call_failed::raise();
}
bool tryBeginRead() {
int code = rw_tryrdlock(&lock);
if (code == EBUSY) return false;
if (code) system_call_failed::raise();
bool tryBeginRead()
{
const int code = rw_tryrdlock(&lock);
if (code == EBUSY)
return false;
if (code)
system_call_failed::raise();
return true;
}
void endRead() {
void endRead()
{
if (rw_unlock(&lock))
system_call_failed::raise();
}
bool tryBeginWrite() {
int code = rw_trywrlock(&lock);
if (code == EBUSY) return false;
if (code) system_call_failed::raise();
bool tryBeginWrite()
{
const int code = rw_trywrlock(&lock);
if (code == EBUSY)
return false;
if (code)
system_call_failed::raise();
return true;
}
void beginWrite() {
void beginWrite()
{
if (rw_wrlock(&lock))
system_call_failed::raise();
}
void endWrite() {
void endWrite()
{
if (rw_unlock(&lock))
system_call_failed::raise();
}
};
}
} // namespace Firebird
@ -216,9 +250,11 @@ public:
#include <pthread.h>
#include <errno.h>
namespace Firebird {
namespace Firebird
{
class RWLock {
class RWLock
{
private:
pthread_rwlock_t lock;
public:
@ -240,44 +276,57 @@ public:
}
#endif
}
~RWLock() {
~RWLock()
{
if (pthread_rwlock_destroy(&lock))
system_call_failed::raise();
}
void beginRead() {
void beginRead()
{
if (pthread_rwlock_rdlock(&lock))
system_call_failed::raise();
}
bool tryBeginRead() {
int code = pthread_rwlock_tryrdlock(&lock);
if (code == EBUSY) return false;
if (code) system_call_failed::raise();
bool tryBeginRead()
{
const int code = pthread_rwlock_tryrdlock(&lock);
if (code == EBUSY)
return false;
if (code)
system_call_failed::raise();
return true;
}
void endRead() {
void endRead()
{
if (pthread_rwlock_unlock(&lock))
system_call_failed::raise();
}
bool tryBeginWrite() {
int code = pthread_rwlock_trywrlock(&lock);
if (code == EBUSY) return false;
if (code) system_call_failed::raise();
bool tryBeginWrite()
{
const int code = pthread_rwlock_trywrlock(&lock);
if (code == EBUSY)
return false;
if (code)
system_call_failed::raise();
return true;
}
void beginWrite() {
void beginWrite()
{
if (pthread_rwlock_wrlock(&lock))
system_call_failed::raise();
}
void endWrite() {
void endWrite()
{
if (pthread_rwlock_unlock(&lock))
system_call_failed::raise();
}
};
}
} // namespace Firebird
#endif /*solaris*/
#endif /*MULTI_THREAD*/
#endif /*!WIN_NT*/
#endif
#endif // #ifndef RWLOCK_H

View File

@ -62,7 +62,8 @@ static const char* const FOPEN_INPUT_TYPE = "r";
const char* DDL_EXT = ".gdl"; // normal extension for a ddl file
const int MAX_ERRORS = 50;
enum in_sw_values {
enum in_sw_values
{
IN_SW_GDEF_0 = 0, // null switch value
IN_SW_GDEF_G, // generate DDL from a database file
IN_SW_GDEF_R, // replace existing database
@ -80,7 +81,8 @@ enum in_sw_values {
IN_SW_GDEF_PASSWORD // password for PC security
};
static const in_sw_tab_t gdef_in_sw_table[] = {
static const in_sw_tab_t gdef_in_sw_table[] =
{
{ IN_SW_GDEF_G, 0, "EXTRACT", 0, 0, 0, FALSE, 0, 0,
"\t\textract definition from database"}, /* extract DDL from database */
{ IN_SW_GDEF_R, 0, "REPLACE", 0, 0, 0, FALSE, 0, 0,
@ -385,7 +387,7 @@ int CLIB_ROUTINE main( int argc, char* argv[])
DDL_msg_partial(9, 0, 0, 0, 0, 0); /* msg 9: \n1 error during input. */
else
DDL_msg_partial(8, 0, 0, 0, 0, 0); /* msg 8: \nNo errors. */
if (DDL_yes_no(10)){ // msg 10 : save changes before exiting?
if (DDL_yes_no(10)) { // msg 10 : save changes before exiting?
DDL_quit = false;
DDL_errors = 0;
}

View File

@ -20,7 +20,7 @@
//
// All Rights Reserved.
// Contributor(s): ______________________________________.
// $Id: gpre.cpp,v 1.50 2004-01-28 07:50:27 robocop Exp $
// $Id: gpre.cpp,v 1.51 2004-02-20 06:42:41 robocop Exp $
// Revision 1.2 2000/11/16 15:54:29 fsg
// Added new switch -verbose to gpre that will dump
// parsed lines to stderr
@ -135,7 +135,8 @@ static SLONG traced_position = 0;
//___________________________________________________________________
// Test if input language is cpp based.
//
bool isLangCpp(LANG_T lang) {
bool isLangCpp(LANG_T lang)
{
if (lang == lang_cxx || lang == lang_internal) {
return true;
}
@ -239,7 +240,6 @@ enum char_types {
int main(int argc, char* argv[])
{
gpre_sym* symbol;
SLONG end_position;
int i;
TEXT* p;
TEXT spare_file_name[256];
@ -387,7 +387,8 @@ int main(int argc, char* argv[])
{
strcpy(spare_file_name, file_name);
if (file_rename(spare_file_name, ext_tab->in, NULL) &&
(input_file = ib_fopen(spare_file_name, FOPEN_READ_TYPE))) {
(input_file = ib_fopen(spare_file_name, FOPEN_READ_TYPE)))
{
file_name = spare_file_name;
break;
}
@ -862,7 +863,9 @@ int main(int argc, char* argv[])
sw_databases = isc_databases;
try {
for (end_position = 0; end_position = compile_module(end_position,filename_array[3]);); // empty loop
SLONG end_position = 0;
while (end_position = compile_module(end_position,filename_array[3]));
// empty loop body
} // try
catch (const std::exception&) {} // fall through to the cleanup code
@ -913,7 +916,6 @@ int main(int argc, char* argv[])
void CPR_abort()
{
++fatals;
Firebird::status_exception::raise(1);
}
@ -1007,7 +1009,6 @@ void CPR_exit( int stat)
void CPR_warn(const TEXT* string)
{
ib_fprintf(ib_stderr, "(W) %s:%d: %s\n", file_name, line + 1, string);
warnings++;
}
@ -1149,18 +1150,19 @@ void CPR_get_text( TEXT* buffer, const gpre_txt* text)
// A BASIC-specific function which resides here since it reads from
// the input file. Look for a '\n' with no continuation character (&).
// Eat tokens until previous condition is satisfied.
// This function is used to "eat" an BASIC external function definition.
// This function is used to "eat" a BASIC external function definition.
//
void CPR_raw_read()
{
SSHORT c;
SCHAR token_string[MAXSYMLEN];
bool continue_char = false;
SCHAR* p = token_string;
while (c = get_char(input_file)) {
SSHORT c;
while (c = get_char(input_file))
{
position++;
if ((classes[c] == CHR_WHITE) && sw_trace && token_string) {
*p = 0;
@ -1171,7 +1173,7 @@ void CPR_raw_read()
else
*p++ = (SCHAR) c;
if (c = '\n') {
if (c == '\n') { // Changed assignment to comparison. Probable archaic bug
line++;
line_position = 0;
if (!continue_char)
@ -1263,13 +1265,13 @@ TOK CPR_token()
else if (default_lc_ctype && text_subtypes) {
switch (sw_sql_dialect) {
case SQL_DIALECT_V5:
if (isQuoted(token->tok_type)){
if (isQuoted(token->tok_type)) {
token->tok_charset = MSC_find_symbol(HSH_lookup(default_lc_ctype),
SYM_charset);
}
break;
default:
if (token->tok_type == tok_sglquoted){
if (token->tok_type == tok_sglquoted) {
token->tok_charset = MSC_find_symbol(HSH_lookup(default_lc_ctype),
SYM_charset);
}
@ -1593,7 +1595,8 @@ static void finish_based( act* action)
}
if ((based_on->bas_flags & BAS_segment)
&& !(field->fld_flags & FLD_blob)) {
&& !(field->fld_flags & FLD_blob))
{
sprintf(s, "field %s is not a blob",
field->fld_symbol->sym_string);
CPR_error(s);
@ -2016,9 +2019,8 @@ static TOK get_token()
#ifdef GPRE_ADA
if ((sw_language == lang_ada) && (c == '\'')) {
SSHORT c1, c2;
c1 = nextchar();
c2 = nextchar();
const SSHORT c1 = nextchar();
const SSHORT c2 = nextchar();
if (c2 != '\'') {
char_class = CHR_LETTER;
}
@ -2267,11 +2269,10 @@ static TOK get_token()
static int nextchar()
{
SSHORT c;
position++;
line_position++;
if ((c = get_char(input_file)) == '\n') {
const SSHORT c = get_char(input_file);
if (c == '\n') {
line++;
prior_line_position = line_position;
line_position = 0;
@ -2334,10 +2335,7 @@ static int nextchar()
static SLONG pass1(const TEXT* base_directory)
{
act* action;
SLONG start;
// FSG 14.Nov.2000
// FSG 14.Nov.2000
if (sw_verbose) {
ib_fprintf(ib_stderr,
"*********************** PASS 1 ***************************\n");
@ -2347,8 +2345,9 @@ static SLONG pass1(const TEXT* base_directory)
{
while (token.tok_symbol)
{
start = token.tok_position;
if (action = PAR_action(base_directory))
const SLONG start = token.tok_position;
act* action = PAR_action(base_directory);
if (action)
{
action->act_position = start;
if (!(action->act_flags & ACT_back_token)) {
@ -2427,10 +2426,7 @@ static SLONG pass1(const TEXT* base_directory)
static void pass2( SLONG start_position)
{
SSHORT d, prior, comment_start_len, to_skip;
SLONG column, start;
SLONG i;
bool line_pending;
SSHORT c = 0;
@ -2472,15 +2468,12 @@ static void pass2( SLONG start_position)
//
SLONG line = 0;
if (sw_lines)
line_pending = true;
else
line_pending = false;
bool line_pending = sw_lines;
SLONG current = 1 + start_position;
column = 0;
SLONG column = 0;
comment_start_len = strlen(comment_start);
to_skip = 0;
SSHORT comment_start_len = strlen(comment_start);
SSHORT to_skip = 0;
// Dump text until the start of the next action, then process the action.
@ -2532,7 +2525,7 @@ static void pass2( SLONG start_position)
// Unless the action is purely a marker, insert a comment initiator
// into the output stream.
start = column;
const SLONG start = column;
if (!(action->act_flags & ACT_mark)) {
if (sw_language == lang_fortran) {
ib_fputc('\n', out_file);
@ -2558,24 +2551,29 @@ static void pass2( SLONG start_position)
CPR_error("internal error -- unexpected EOF in action");
return;
}
prior = c;
const SSHORT prior = c;
c = get_char(input_file);
if (!suppress_output) {
// close current comment to avoid nesting comments
if (sw_block_comments && !(action->act_flags & ACT_mark) &&
c == comment_start[0]) {
return_char((d = get_char(input_file)));
c == comment_start[0])
{
const SSHORT d = get_char(input_file);
return_char(d);
if (d == comment_start[1])
ib_fputs(comment_stop, out_file);
}
if (sw_language != lang_cobol || !sw_ansi || c == '\n'
|| to_skip-- <= 0)
{
ib_putc(c, out_file);
}
if (c == '\n') {
line++;
if ((sw_language == lang_fortran) ||
(sw_language == lang_ada) ||
(sw_language == lang_cobol)) {
(sw_language == lang_cobol))
{
ib_fputs(comment_start, out_file);
to_skip =
(column < 7) ? comment_start_len - column : 0;
@ -2587,7 +2585,9 @@ static void pass2( SLONG start_position)
if (sw_block_comments && !(action->act_flags & ACT_mark) &&
prior == comment_stop[0] && c == comment_stop[1])
{
ib_fputs(comment_start, out_file);
}
}
}
@ -2603,7 +2603,10 @@ static void pass2( SLONG start_position)
(*gen_routine) (action, start);
if (action->act_type == ACT_routine &&
!action->act_object &&
((sw_language == lang_c) || (isLangCpp(sw_language)))) continue;
((sw_language == lang_c) || (isLangCpp(sw_language))))
{
continue;
}
if (action->act_flags & ACT_break)
return;
@ -2721,7 +2724,7 @@ static void return_char( SSHORT c)
static SSHORT skip_white()
{
SSHORT c, c2, next;
SSHORT c, next;
while (true) {
if ((c = nextchar()) == EOF)
@ -2733,7 +2736,8 @@ static SSHORT skip_white()
#ifdef GPRE_FORTRAN
if (sw_language == lang_fortran &&
line_position == 1 && (c == 'C' || c == 'c' || c == '*')) {
line_position == 1 && (c == 'C' || c == 'c' || c == '*'))
{
while ((c = nextchar()) != '\n' && c != EOF);
continue;
}
@ -2752,7 +2756,8 @@ static SSHORT skip_white()
(!sw_ansi && line_position == 1 &&
(c == 'C' || c == 'c' || c == '*' || c == '/' || c == '\\') ||
(sw_ansi && line_position == 7 && c != '\t' && c != ' '
&& c != '-'))) {
&& c != '-')))
{
while ((c = nextchar()) != '\n' && c != EOF);
continue;
}
@ -2767,7 +2772,7 @@ static SSHORT skip_white()
// skip in-line SQL comments
if (sw_sql && (c == '-')) {
c2 = nextchar();
const SSHORT c2 = nextchar();
if (c2 != '-')
return_char(c2);
else {
@ -2801,17 +2806,19 @@ static SSHORT skip_white()
// skip fortran embedded comments on VMS or hpux or sgi
if (c == '!'
&& (sw_language == lang_fortran)) {
&& (sw_language == lang_fortran))
{
/* If this character is a '!' followed by a '=', this is an
Interbase 'not equal' operator, not a Fortran comment.
Bug #307. mao 6/14/89 */
if ((c2 = nextchar()) == '=') {
return_char(c2);
const SSHORT c3 = nextchar();
if (c3 == '=') {
return_char(c3);
return c;
}
else {
if ((c = c2) != '\n' && c != EOF)
if ((c = c3) != '\n' && c != EOF)
while ((c = nextchar()) != '\n' && c != EOF);
continue;
}

View File

@ -19,7 +19,7 @@
*
* All Rights Reserved.
* Contributor(s): ______________________________________.
* $Id: gpre.h,v 1.58 2004-02-02 11:01:26 robocop Exp $
* $Id: gpre.h,v 1.59 2004-02-20 06:42:41 robocop Exp $
* Revision 1.3 2000/11/27 09:26:13 fsg
* Fixed bugs in gpre to handle PYXIS forms
* and allow edit.e and fred.e to go through
@ -1485,7 +1485,7 @@ EXTERN USHORT ada_flags;
#ifndef fb_assert
#ifdef DEV_BUILD
#undef fb_assert
#define fb_assert(ex) {if (!(ex)){CPR_assert (__FILE__, __LINE__);}}
#define fb_assert(ex) {if (!(ex)) {CPR_assert (__FILE__, __LINE__);}}
#else // DEV_BUILD
#undef fb_assert
#define fb_assert(ex)

View File

@ -20,7 +20,7 @@
//
// All Rights Reserved.
// Contributor(s): ______________________________________.
// $Id: par.cpp,v 1.43 2004-02-02 11:01:26 robocop Exp $
// $Id: par.cpp,v 1.44 2004-02-20 06:42:41 robocop Exp $
// Revision 1.2 2000/11/27 09:26:13 fsg
// Fixed bugs in gpre to handle PYXIS forms
// and allow edit.e and fred.e to go through
@ -439,7 +439,7 @@ act* PAR_database(bool sql, const TEXT* base_directory)
CPR_s_error("quoted file name");
if (isQuoted(token.tok_type)) {
if (base_directory){
if (base_directory) {
db->dbb_filename = string = (TEXT *) MSC_alloc(token.tok_length +
strlen(base_directory) + 1);
MSC_copy_cat(base_directory, strlen(base_directory),

View File

@ -47,7 +47,7 @@ typedef USHORT UNICODE;
#else
#include <stdlib.h> /* prototype for abort() */
#define ERR_assert LD_assert
#define fb_assert(ex) {if (!(ex)){LD_assert (__FILE__, __LINE__); abort();}}
#define fb_assert(ex) {if (!(ex)) {LD_assert (__FILE__, __LINE__); abort();}}
#endif

View File

@ -586,7 +586,7 @@ static void ipi_end_thread( ICC icc)
ipm->ipm_handle = 0;
}
if (ipserver_private_data.ipms == ipm){
if (ipserver_private_data.ipms == ipm) {
ipserver_private_data.ipms = ipm->ipm_next;
}
else {

View File

@ -149,7 +149,7 @@ void ExecuteStatement::Open(TDBB tdbb, jrd_nod* sql, SSHORT nVars, bool SingleTo
status[0] = isc_arg_gds;
status[1] = isc_exec_sql_invalid_req;
status[2] = isc_arg_string;
status[3] = reinterpret_cast<ISC_STATUS>(ERR_cstring(StartOfSqlOperator));
status[3] = (ISC_STATUS)(U_IPTR) ERR_cstring(StartOfSqlOperator);
status[4] = isc_arg_end;
Chk(status[1]);
}
@ -216,7 +216,7 @@ rec_err:
tdbb->tdbb_status_vector[3] = i;
tdbb->tdbb_status_vector[4] = isc_arg_string;
tdbb->tdbb_status_vector[5] =
reinterpret_cast<ISC_STATUS>(ERR_cstring(StartOfSqlOperator));
(ISC_STATUS)(U_IPTR) ERR_cstring(StartOfSqlOperator);
tdbb->tdbb_status_vector[6] = isc_arg_end;
Firebird::status_exception::raise(status[1]);
}

View File

@ -57,7 +57,7 @@ public:
struct sbm* plb_buckets; /* available bit map buckets */
struct bms* plb_segments; /* available bit map segments */
struct Dcc* plb_dccs;
class Dcc* plb_dccs;
private:
BlockCache<lls> lls_cache; /* Was plb_lls */

View File

@ -33,7 +33,7 @@
*
*/
/*
$Id: blb.cpp,v 1.53 2004-02-02 11:01:32 robocop Exp $
$Id: blb.cpp,v 1.54 2004-02-20 06:42:59 robocop Exp $
*/
#include "firebird.h"
@ -78,25 +78,25 @@ inline bool SEGMENTED(const blb* blob)
}
static ARR alloc_array(jrd_tra*, ADS);
static BLB allocate_blob(TDBB, jrd_tra*);
static blb* allocate_blob(TDBB, jrd_tra*);
static ISC_STATUS blob_filter(USHORT, CTL, SSHORT, SLONG);
static void check_BID_validity(const blb*, TDBB);
static BLB copy_blob(TDBB, const bid*, bid*);
static void delete_blob(TDBB, BLB, ULONG);
static blb* copy_blob(TDBB, const bid*, bid*);
static void delete_blob(TDBB, blb*, ULONG);
static void delete_blob_id(TDBB, const bid*, ULONG, jrd_rel*);
static ARR find_array(jrd_tra*, const bid*);
static BLF find_filter(TDBB, SSHORT, SSHORT);
static blob_page* get_next_page(TDBB, BLB, WIN *);
static blob_page* get_next_page(TDBB, blb*, WIN *);
#ifdef REPLAY_OSRI_API_CALLS_SUBSYSTEM
static void get_replay_blob(TDBB, const bid*);
#endif
static void insert_page(TDBB, BLB);
static void release_blob(BLB, const bool);
static void insert_page(TDBB, blb*);
static void release_blob(blb*, const bool);
static void slice_callback(SLICE, ULONG, DSC *);
static BLB store_array(TDBB, jrd_tra*, bid*);
static blb* store_array(TDBB, jrd_tra*, bid*);
void BLB_cancel(TDBB tdbb, BLB blob)
void BLB_cancel(TDBB tdbb, blb* blob)
{
/**************************************
*
@ -159,7 +159,7 @@ void BLB_close(TDBB tdbb, class blb* blob)
}
BLB BLB_create(TDBB tdbb, jrd_tra* transaction, bid* blob_id)
blb* BLB_create(TDBB tdbb, jrd_tra* transaction, bid* blob_id)
{
/**************************************
*
@ -177,7 +177,7 @@ BLB BLB_create(TDBB tdbb, jrd_tra* transaction, bid* blob_id)
}
BLB BLB_create2(TDBB tdbb,
blb* BLB_create2(TDBB tdbb,
jrd_tra* transaction, bid* blob_id,
USHORT bpb_length, const UCHAR* bpb)
{
@ -206,10 +206,10 @@ BLB BLB_create2(TDBB tdbb,
SSHORT from_charset, to_charset;
const SSHORT type = gds__parse_bpb2(bpb_length,
bpb,
reinterpret_cast < SSHORT * >(&from),
reinterpret_cast < SSHORT * >(&to),
reinterpret_cast < USHORT * >(&from_charset),
reinterpret_cast < USHORT * >(&to_charset));
&from,
&to,
reinterpret_cast<USHORT*>(&from_charset),
reinterpret_cast<USHORT*>(&to_charset));
blb* blob = allocate_blob(tdbb, transaction);
if (type)
@ -241,7 +241,7 @@ BLB BLB_create2(TDBB tdbb,
if (BLF_create_blob(tdbb,
transaction,
&blob->blb_filter,
(SLONG*)blob_id,
blob_id,
bpb_length,
bpb,
// CVC: This cast is very suspicious to me.
@ -360,7 +360,7 @@ void BLB_garbage_collect(
}
BLB BLB_get_array(TDBB tdbb, jrd_tra* transaction, const bid* blob_id, ADS desc)
blb* BLB_get_array(TDBB tdbb, jrd_tra* transaction, const bid* blob_id, ADS desc)
{
/**************************************
*
@ -374,7 +374,7 @@ BLB BLB_get_array(TDBB tdbb, jrd_tra* transaction, const bid* blob_id, ADS desc)
**************************************/
SET_TDBB(tdbb);
BLB blob = BLB_open2(tdbb, transaction, blob_id, 0, 0);
blb* blob = BLB_open2(tdbb, transaction, blob_id, 0, 0);
if (blob->blb_length < sizeof(ads)) {
BLB_close(tdbb, blob);
@ -392,7 +392,7 @@ BLB BLB_get_array(TDBB tdbb, jrd_tra* transaction, const bid* blob_id, ADS desc)
}
SLONG BLB_get_data(TDBB tdbb, BLB blob, UCHAR* buffer, SLONG length)
SLONG BLB_get_data(TDBB tdbb, blb* blob, UCHAR* buffer, SLONG length)
{
/**************************************
*
@ -429,7 +429,7 @@ SLONG BLB_get_data(TDBB tdbb, BLB blob, UCHAR* buffer, SLONG length)
USHORT BLB_get_segment(TDBB tdbb,
BLB blob, UCHAR* segment, USHORT buffer_length)
blb* blob, UCHAR* segment, USHORT buffer_length)
{
/**************************************
*
@ -747,7 +747,7 @@ SLONG BLB_get_slice(TDBB tdbb,
}
SLONG BLB_lseek(BLB blob, USHORT mode, SLONG offset)
SLONG BLB_lseek(blb* blob, USHORT mode, SLONG offset)
{
/**************************************
*
@ -785,7 +785,7 @@ SLONG BLB_lseek(BLB blob, USHORT mode, SLONG offset)
#ifdef REPLAY_OSRI_API_CALLS_SUBSYSTEM
void BLB_map_blobs(TDBB tdbb, BLB old_blob, BLB new_blob)
void BLB_map_blobs(TDBB tdbb, blb* old_blob, blb* new_blob)
{
/**************************************
*
@ -806,7 +806,7 @@ void BLB_map_blobs(TDBB tdbb, BLB old_blob, BLB new_blob)
DBB dbb = tdbb->tdbb_database;
CHECK_DBB(dbb);
MAP new_map = FB_NEW(*dbb->dbb_permanent) map();
blb_map* new_map = FB_NEW(*dbb->dbb_permanent) blb_map();
new_map->map_old_blob = old_blob;
new_map->map_new_blob = new_blob;
@ -968,7 +968,7 @@ void BLB_move_from_string(TDBB tdbb, const dsc* from_desc, dsc* to_desc, jrd_nod
else
{
USHORT ttype = 0;
BLB blob = 0;
blb* blob = 0;
UCHAR *fromstr = 0;
bid temp_bid;
DSC blob_desc;
@ -1002,7 +1002,7 @@ void BLB_move_from_string(TDBB tdbb, const dsc* from_desc, dsc* to_desc, jrd_nod
}
BLB BLB_open(TDBB tdbb, jrd_tra* transaction, const bid* blob_id)
blb* BLB_open(TDBB tdbb, jrd_tra* transaction, const bid* blob_id)
{
/**************************************
*
@ -1020,7 +1020,7 @@ BLB BLB_open(TDBB tdbb, jrd_tra* transaction, const bid* blob_id)
}
BLB BLB_open2(TDBB tdbb,
blb* BLB_open2(TDBB tdbb,
jrd_tra* transaction, const bid* blob_id,
USHORT bpb_length, const UCHAR* bpb)
{
@ -1043,10 +1043,10 @@ BLB BLB_open2(TDBB tdbb,
SSHORT from_charset, to_charset;
gds__parse_bpb2(bpb_length,
bpb,
reinterpret_cast < SSHORT * >(&from),
reinterpret_cast < SSHORT * >(&to),
reinterpret_cast < USHORT * >(&from_charset),
reinterpret_cast < USHORT * >(&to_charset));
&from,
&to,
reinterpret_cast<USHORT*>(&from_charset),
reinterpret_cast<USHORT*>(&to_charset));
blb* blob = allocate_blob(tdbb, transaction);
@ -1082,7 +1082,7 @@ BLB BLB_open2(TDBB tdbb,
if (BLF_open_blob(tdbb,
transaction,
&control,
reinterpret_cast<const SLONG*>(blob_id),
blob_id,
bpb_length,
bpb,
reinterpret_cast<FPTR_BFILTER_CALLBACK>(blob_filter),
@ -1155,7 +1155,7 @@ BLB BLB_open2(TDBB tdbb,
if (blob_id->bid_relation_id >= vector->count() ||
!(blob->blb_relation =
reinterpret_cast<jrd_rel*>( (*vector)[blob_id->bid_relation_id]) ) )
static_cast<jrd_rel*>( (*vector)[blob_id->bid_relation_id]) ) )
{
ERR_post(isc_bad_segstr_id, 0);
}
@ -1180,7 +1180,7 @@ BLB BLB_open2(TDBB tdbb,
}
void BLB_put_segment(TDBB tdbb, BLB blob, const UCHAR* seg, USHORT segment_length)
void BLB_put_segment(TDBB tdbb, blb* blob, const UCHAR* seg, USHORT segment_length)
{
/**************************************
*
@ -1418,7 +1418,7 @@ void BLB_put_slice( TDBB tdbb,
// CVC: maybe char temp[ADS_LEN(16)]; may work.
SLONG temp[ADS_LEN(16) / 4];
ads* p_ads = reinterpret_cast<ads*>(temp);
BLB blob = BLB_get_array(tdbb, transaction, blob_id, p_ads);
blb* blob = BLB_get_array(tdbb, transaction, blob_id, p_ads);
array = alloc_array(transaction, p_ads);
array->arr_effective_length =
blob->blb_length - array->arr_desc.ads_length;
@ -1628,7 +1628,7 @@ static ARR alloc_array(jrd_tra* transaction, ADS proto_desc)
}
static BLB allocate_blob(TDBB tdbb, jrd_tra* transaction)
static blb* allocate_blob(TDBB tdbb, jrd_tra* transaction)
{
/**************************************
*
@ -1709,7 +1709,7 @@ static ISC_STATUS blob_filter( USHORT action,
return FB_SUCCESS;
case ACTION_get_segment:
blob = (BLB) control->ctl_source_handle;
blob = (blb*) control->ctl_source_handle;
control->ctl_segment_length =
BLB_get_segment(tdbb, blob, control->ctl_buffer,
control->ctl_buffer_length);
@ -1727,7 +1727,7 @@ static ISC_STATUS blob_filter( USHORT action,
return FB_SUCCESS;
case ACTION_put_segment:
blob = (BLB) control->ctl_source_handle;
blob = (blb*) control->ctl_source_handle;
BLB_put_segment(tdbb, blob, control->ctl_buffer,
control->ctl_buffer_length);
return FB_SUCCESS;
@ -1746,7 +1746,7 @@ static ISC_STATUS blob_filter( USHORT action,
return FB_SUCCESS;
case ACTION_seek:
return BLB_lseek((BLB) control->ctl_source_handle, mode, offset);
return BLB_lseek((blb*) control->ctl_source_handle, mode, offset);
default:
ERR_post(isc_uns_ext, 0);
@ -1765,16 +1765,16 @@ static void check_BID_validity(const blb* blob, TDBB tdbb)
*
* Functional description
* There are times when an application passes the engine
* a BID, which we then assume points to a valid BLB structure.
* a bid, which we then assume points to a valid blb structure.
* Specifically, this can occur when an application is trying
* to open a newly created blob (that doesn't have a relation
* ID assigned).
*
* However, it is quite possible that garbage BID is passed in
* However, it is quite possible that garbage bid is passed in
* from an application; resulting in core dumps within the engine
* due to trying to make use of the information.
*
* This function takes a BID's pointer to a blb, and performs
* This function takes a bid's pointer to a blb, and performs
* some validity checks on it. It can't catch all possible
* garbage inputs from an application, but should catch
* many of them.
@ -1799,7 +1799,7 @@ static void check_BID_validity(const blb* blob, TDBB tdbb)
}
static BLB copy_blob(TDBB tdbb, const bid* source, bid* destination)
static blb* copy_blob(TDBB tdbb, const bid* source, bid* destination)
{
/**************************************
*
@ -1854,7 +1854,7 @@ static BLB copy_blob(TDBB tdbb, const bid* source, bid* destination)
}
static void delete_blob(TDBB tdbb, BLB blob, ULONG prior_page)
static void delete_blob(TDBB tdbb, blb* blob, ULONG prior_page)
{
/**************************************
*
@ -2024,7 +2024,7 @@ static BLF find_filter(TDBB tdbb, SSHORT from, SSHORT to)
}
static blob_page* get_next_page(TDBB tdbb, BLB blob, WIN * window)
static blob_page* get_next_page(TDBB tdbb, blb* blob, WIN * window)
{
/**************************************
*
@ -2150,7 +2150,7 @@ static void get_replay_blob(TDBB tdbb, bid* blob_id)
#endif
static void insert_page(TDBB tdbb, BLB blob)
static void insert_page(TDBB tdbb, blb* blob)
{
/**************************************
*
@ -2247,7 +2247,7 @@ static void insert_page(TDBB tdbb, BLB blob)
}
static void release_blob(BLB blob, const bool purge_flag)
static void release_blob(blb* blob, const bool purge_flag)
{
/**************************************
*
@ -2403,7 +2403,7 @@ static void slice_callback(SLICE arg, ULONG count, DSC * descriptors)
}
static BLB store_array(TDBB tdbb, jrd_tra* transaction, bid* blob_id)
static blb* store_array(TDBB tdbb, jrd_tra* transaction, bid* blob_id)
{
/**************************************
*

View File

@ -35,14 +35,14 @@
number of the first segment-clump. The two types of blobs can be
reliably distinguished by a zero or non-zero relation id. */
typedef struct bid {
struct bid {
ULONG bid_relation_id; /* Relation id (or null) */
union {
ULONG bid_temp_id; /* Temporary ID of blob or array. Used for newly created objects (bid_relation_id==0) */
ULONG bid_number; /* Record number */
} bid_stuff;
bool isEmpty() const { return bid_relation_id == 0 && bid_stuff.bid_number == 0; }
} *BID;
};
/* Your basic blob block. */
@ -55,8 +55,8 @@ class blb : public pool_alloc_rpt<UCHAR, type_blb>
blb *blb_next; /* Next blob in transaction */
UCHAR *blb_segment; /* Next segment to be addressed */
struct ctl *blb_filter; /* Blob filter control block, if any */
struct bid blb_blob_id; /* Id of materialized blob */
struct jrd_req *blb_request; /* request that assigned temporary blob */
bid blb_blob_id; /* Id of materialized blob */
class jrd_req *blb_request; /* request that assigned temporary blob */
vcl *blb_pages; /* Vector of pages */
USHORT blb_pointers; /* Max pointer on a page */
USHORT blb_level; /* Storage type */
@ -79,7 +79,6 @@ class blb : public pool_alloc_rpt<UCHAR, type_blb>
/* blb_data must be longword aligned */
UCHAR blb_data[1]; /* A page's worth of blob */
};
typedef blb* BLB;
#define BLB_temporary 1 /* Newly created blob */
#define BLB_eof 2 /* This blob is exhausted */
@ -97,15 +96,15 @@ typedef blb* BLB;
2 large blob -- blob "record" is pointer to pages of pointers
*/
/* mapping blob ids for REPLAY */
class map : public pool_alloc<type_map>
// mapping blob ids for REPLAY
// Useful only with REPLAY_OSRI_API_CALLS_SUBSYSTEM defined.
class blb_map : public pool_alloc<type_map>
{
public:
map *map_next;
blb *map_old_blob;
blb *map_new_blob;
blb_map* map_next;
blb* map_old_blob;
blb* map_new_blob;
};
typedef map* MAP;
#endif /* JRD_BLB_H */
#endif // JRD_BLB_H

View File

@ -28,12 +28,12 @@
extern "C" {
ISC_STATUS BLF_close_blob(TDBB, ctl**);
ISC_STATUS BLF_create_blob(TDBB, jrd_tra*, ctl**, SLONG*,
ISC_STATUS BLF_create_blob(TDBB, jrd_tra*, ctl**, struct bid*,
USHORT, const UCHAR*,
FPTR_BFILTER_CALLBACK, BLF);
ISC_STATUS BLF_get_segment(TDBB, ctl**, USHORT*, USHORT, UCHAR*);
BLF BLF_lookup_internal_filter(TDBB, SSHORT, SSHORT);
ISC_STATUS BLF_open_blob(TDBB, jrd_tra*, ctl**, const SLONG*,
ISC_STATUS BLF_open_blob(TDBB, jrd_tra*, ctl**, const struct bid*,
USHORT, const UCHAR*,
FPTR_BFILTER_CALLBACK, BLF);
ISC_STATUS BLF_put_segment(TDBB, ctl**, USHORT, const UCHAR*);

View File

@ -33,9 +33,9 @@ BLKDEF(type_vec, vec, sizeof(((VEC) NULL)->vec_object[0]))
BLKDEF(type_dbb, dbb, 0)
BLKDEF(type_bcb, bcb, sizeof(((BCB) NULL)->bcb_rpt[0])) /* Done 2 */
BLKDEF(type_bdb, bdb, 0)
BLKDEF(type_pre, pre, 0)
BLKDEF(type_pre, Precedence, 0)
BLKDEF(type_lck, lck, 1)
BLKDEF(type_fil, fil, 1)
BLKDEF(type_fil, jrd_file, 1)
BLKDEF(type_pgc, pgc, 0)
BLKDEF(type_rel, jrd_rel, 0)
BLKDEF(type_fmt, fmt, sizeof(((fmt*) NULL)->fmt_desc[0])) /* Done */
@ -43,12 +43,12 @@ BLKDEF(type_vcl, vcl, sizeof(((VCL) NULL)->vcl_long[0])) /* Done */
BLKDEF(type_req, jrd_req, sizeof(((jrd_req*) NULL)->req_rpb[0])) /* Done */
BLKDEF(type_tra, jrd_tra, 1)
BLKDEF(type_nod, jrd_nod, sizeof(((jrd_nod*) NULL)->nod_arg[0])) /* Done */
BLKDEF(type_csb, Csb, sizeof(((CSB) NULL)->csb_rpt[0])) /* Done */
BLKDEF(type_csb, Csb, sizeof(((Csb*) NULL)->csb_rpt[0])) /* Done */
BLKDEF(type_lls, lls, 0) /* linked list stack */
BLKDEF(type_rec, rec, 1) /* record parameter */
BLKDEF(type_rsb, Rsb, sizeof(((Rsb*) NULL)->rsb_arg[0])) /* Done record source */
BLKDEF(type_bms, bms, 0) /* bit map segment */
BLKDEF(type_dfw, dfw, 1) /* deferred work block */
BLKDEF(type_dfw, Deferred_work, 1) /* deferred work block */
BLKDEF(type_tfb, tfb, 0) /* temporary field block */
BLKDEF(type_str, str, 1) /* random string block */
BLKDEF(type_dcc, Dcc, 0) /* data compression control */
@ -68,14 +68,14 @@ BLKDEF(type_fun, fun, sizeof(((FUN) NULL)->fun_rpt[0])) /* Done Function definit
BLKDEF(type_irl, irl, 0)
BLKDEF(type_acc, acc, 0)
BLKDEF(type_idl, idl, 0)
BLKDEF(type_rsc, Rsc, 0)
BLKDEF(type_sdw, sdw, 0)
BLKDEF(type_rsc, Resource, 0)
BLKDEF(type_sdw, Shadow, 0)
BLKDEF(type_vct, vct, 0) /* Verb actions */
BLKDEF(type_btb, btb, 0)
BLKDEF(type_blf, blf, 0)
BLKDEF(type_arr, arr, sizeof(((ADS) NULL)->ads_rpt[0])) /* Done, but funny Array description */
BLKDEF(type_map, map, 0)
BLKDEF(type_log, log, 0)
BLKDEF(type_map, blb_map, 0)
BLKDEF(type_log, fblog, 0)
BLKDEF(type_dls, dls, 1)
BLKDEF(type_ail, logfiles, 1) /* wal file */
BLKDEF(type_prc, jrd_prc, 1) /* procedure block */
@ -87,11 +87,11 @@ BLKDEF(type_bkm, bkm, 1) /* bookmark block for storing current location */
BLKDEF(type_tpc, tpc, 1) /* TIP page cache block */
BLKDEF(type_rng, rng, 1) /* refresh range */
BLKDEF(type_svc, svc, 1) /* services */
BLKDEF(type_lwt, lwt, 0) /* latch wait block */
BLKDEF(type_lwt, Latch_wait, 0) /* latch wait block */
BLKDEF(type_vcx, vcx, 0) /* view context block */
BLKDEF(type_srpb, srpb, 0) /* save rpb block */
BLKDEF(type_opt, Opt, 0)
BLKDEF(type_prf, prf, 0)
BLKDEF(type_prf, Prefetch, 0)
BLKDEF(type_rse, rse, 0)
BLKDEF(type_lit, lit, 0)
BLKDEF(type_asb, asb, 0)

View File

@ -59,7 +59,8 @@
* subtypes to text.
* (from_type in [0..8], to_type == BLOB_text)
*/
static const FPTR_BFILTER_CALLBACK filters[] = {
static const FPTR_BFILTER_CALLBACK filters[] =
{
filter_text,
filter_transliterate_text,
filter_blr,
@ -72,7 +73,7 @@ static const FPTR_BFILTER_CALLBACK filters[] = {
};
static ISC_STATUS open_blob(TDBB, jrd_tra*, CTL*, SLONG*, USHORT, const UCHAR*,
static ISC_STATUS open_blob(TDBB, jrd_tra*, CTL*, bid*, USHORT, const UCHAR*,
FPTR_BFILTER_CALLBACK,
USHORT, BLF);
@ -130,7 +131,7 @@ ISC_STATUS BLF_close_blob(TDBB tdbb, CTL * filter_handle)
ISC_STATUS BLF_create_blob(TDBB tdbb,
jrd_tra* tra_handle,
CTL* filter_handle,
SLONG* blob_id,
bid* blob_id,
USHORT bpb_length,
const UCHAR* bpb,
FPTR_BFILTER_CALLBACK callback,
@ -241,7 +242,7 @@ BLF BLF_lookup_internal_filter(TDBB tdbb, SSHORT from, SSHORT to)
ISC_STATUS BLF_open_blob(TDBB tdbb,
jrd_tra* tra_handle,
CTL* filter_handle,
const SLONG* blob_id,
const bid* blob_id,
USHORT bpb_length,
const UCHAR* bpb,
FPTR_BFILTER_CALLBACK callback,
@ -262,7 +263,7 @@ ISC_STATUS BLF_open_blob(TDBB tdbb,
// Therefore, throwing const away is safe because it won't be changed.
// Someone might create some crazy filter that calls put_slice, though.
return open_blob(tdbb, tra_handle, filter_handle,
const_cast<SLONG*>(blob_id),
const_cast<bid*>(blob_id),
bpb_length, bpb,
callback,
ACTION_open, filter);
@ -318,7 +319,7 @@ static ISC_STATUS open_blob(
TDBB tdbb,
jrd_tra* tra_handle,
CTL* filter_handle,
SLONG* blob_id,
bid* blob_id,
USHORT bpb_length,
const UCHAR* bpb,
FPTR_BFILTER_CALLBACK callback,

View File

@ -322,7 +322,7 @@ bool keyEquality(USHORT length, const UCHAR* data, const IndexNode* indexNode)
#ifdef SCROLLABLE_CURSORS
UCHAR* lastNode(btree_page* page, EXP expanded_page, BTX* expanded_node)
UCHAR* lastNode(btree_page* page, jrd_exp* expanded_page, BTX* expanded_node)
{
/**************************************
*

View File

@ -45,13 +45,13 @@ typedef struct btx {
#define BTX_SIZE 2
// format of expanded index buffer
typedef struct jrd_exp {
struct jrd_exp {
USHORT exp_length;
ULONG exp_incarnation;
btx exp_nodes[1];
} *EXP;
};
#define EXP_SIZE OFFSETA (EXP, exp_nodes)
#define EXP_SIZE OFFSETA (jrd_exp*, exp_nodes)
struct dynKey {
USHORT keyLength;
@ -79,7 +79,7 @@ namespace BTreeNode {
bool keyEquality(USHORT length, const UCHAR* data, const IndexNode* indexNode);
#ifdef SCROLLABLE_CURSORS
UCHAR* lastNode(btree_page* page, EXP expanded_page, BTX* expanded_node);
UCHAR* lastNode(btree_page* page, jrd_exp* expanded_page, BTX* expanded_node);
#endif
UCHAR* nextNode(IndexNode* node, UCHAR* pointer,

View File

@ -97,15 +97,17 @@ inline void MOVE_BYTE(UCHAR*& x_from, UCHAR*& x_to)
// 256 is the old maximum possible key_length.
#define GARBAGE_COLLECTION_NEW_PAGE_MAX_THRESHOLD ((dbb->dbb_page_size - 256))
typedef struct {
struct INT64_KEY {
double d_part;
SSHORT s_part;
} INT64_KEY;
};
// I assume this wasn't done sizeof(INT64_KEY) on purpose, since alignment might affect it.
#define INT64_KEY_LENGTH (sizeof (double) + sizeof (SSHORT))
static const double pow10[] =
{ 1.e00, 1.e01, 1.e02, 1.e03, 1.e04, 1.e05, 1.e06, 1.e07, 1.e08, 1.e09,
{
1.e00, 1.e01, 1.e02, 1.e03, 1.e04, 1.e05, 1.e06, 1.e07, 1.e08, 1.e09,
1.e10, 1.e11, 1.e12, 1.e13, 1.e14, 1.e15, 1.e16, 1.e17, 1.e18, 1.e19,
1.e20, 1.e21, 1.e22, 1.e23, 1.e24, 1.e25, 1.e26, 1.e27, 1.e28, 1.e29,
1.e30, 1.e31, 1.e32, 1.e33, 1.e34, 1.e35, 1.e36
@ -117,7 +119,8 @@ static const struct { /* Used in make_int64_key() */
UINT64 limit;
SINT64 factor;
SSHORT scale_change;
} int64_scale_control[] = {
} int64_scale_control[] =
{
{
QUADCONST(922337203685470000), QUADCONST(1), 0}, {
QUADCONST(92233720368547000), QUADCONST(10), 1}, {
@ -138,7 +141,8 @@ static const struct { /* Used in make_int64_key() */
QUADCONST(93), QUADCONST(10000000000000000), 16}, {
QUADCONST(10), QUADCONST(100000000000000000), 17}, {
QUADCONST(1), QUADCONST(1000000000000000000), 18}, {
QUADCONST(0), QUADCONST(0), 0}};
QUADCONST(0), QUADCONST(0), 0}
};
/* The first four entries in the array int64_scale_control[] ends with the
* limit having 0's in the end. This is to inhibit any rounding off that
@ -162,13 +166,13 @@ typedef enum contents {
static SLONG add_node(TDBB, WIN *, IIB *, KEY *, SLONG *, SLONG *, SLONG *);
static void complement_key(KEY *);
static void compress(TDBB, DSC *, KEY *, USHORT, bool, bool, USHORT);
static USHORT compress_root(TDBB, IRT);
static USHORT compress_root(TDBB, index_root_page*);
static void copy_key(const KEY*, KEY*);
static CONTENTS delete_node(TDBB, WIN *, UCHAR *);
static void delete_tree(TDBB, USHORT, USHORT, SLONG, SLONG);
static DSC *eval(TDBB, jrd_nod*, DSC *, bool *);
static SLONG fast_load(TDBB, jrd_rel*, IDX *, USHORT, SCB, SelectivityList&);
static IRT fetch_root(TDBB, WIN *, jrd_rel*);
static index_root_page* fetch_root(TDBB, WIN *, jrd_rel*);
static UCHAR *find_node_start_point(btree_page*, KEY *, UCHAR *, USHORT *, bool, bool, bool = false, SLONG = NO_VALUE);
static UCHAR* find_area_start_point(btree_page*, const KEY*, UCHAR *, USHORT *, bool, bool, SLONG = NO_VALUE);
static SLONG find_page(btree_page*, const KEY*, UCHAR, SLONG = NO_VALUE, bool = false);
@ -182,7 +186,7 @@ static void print_int64_key(SINT64, SSHORT, INT64_KEY);
static CONTENTS remove_node(TDBB, IIB *, WIN *);
static CONTENTS remove_leaf_node(TDBB, IIB *, WIN *);
static bool scan(TDBB, UCHAR *, SBM *, USHORT, USHORT, KEY *, USHORT, SCHAR);
static void update_selectivity(IRT, USHORT, const SelectivityList&);
static void update_selectivity(index_root_page*, USHORT, const SelectivityList&);
USHORT BTR_all(TDBB tdbb,
jrd_rel* relation,
@ -203,32 +207,27 @@ USHORT BTR_all(TDBB tdbb,
* and return no indices.
*
**************************************/
DBB dbb;
IRT root;
STR new_buffer;
USHORT count, i;
IDX *buffer;
SLONG size;
SET_TDBB(tdbb);
dbb = tdbb->tdbb_database;
DBB dbb = tdbb->tdbb_database;
CHECK_DBB(dbb);
WIN window(-1);
buffer = *start_buffer;
if (!(root = fetch_root(tdbb, &window, relation))) {
IDX* buffer = *start_buffer;
index_root_page* root = fetch_root(tdbb, &window, relation);
if (!root) {
return 0;
}
if ((SLONG) (root->irt_count * sizeof(IDX)) > *idx_size) {
size = (sizeof(IDX) * dbb->dbb_max_idx) + ALIGNMENT;
*csb_idx_allocation = new_buffer = FB_NEW_RPT(*dbb->dbb_permanent, size) str();
const SLONG size = (sizeof(IDX) * dbb->dbb_max_idx) + ALIGNMENT;
str* new_buffer = FB_NEW_RPT(*dbb->dbb_permanent, size) str();
*csb_idx_allocation = new_buffer;
buffer = *start_buffer =
(IDX *) FB_ALIGN((U_IPTR) new_buffer->str_data, ALIGNMENT);
*idx_size = size - ALIGNMENT;
}
count = 0;
for (i = 0; i < root->irt_count; i++) {
USHORT count = 0;
for (USHORT i = 0; i < root->irt_count; i++) {
if (BTR_description(relation, root, buffer, i)) {
count++;
buffer = NEXT_IDX(buffer->idx_rpt, buffer->idx_count);
@ -272,7 +271,8 @@ void BTR_create(TDBB tdbb,
// Index is created. Go back to the index root page and update it to
// point to the index.
WIN window(relation->rel_index_root);
IRT root = (IRT) CCH_FETCH(tdbb, &window, LCK_write, pag_root);
index_root_page* root =
(index_root_page*) CCH_FETCH(tdbb, &window, LCK_write, pag_root);
CCH_MARK(tdbb, &window);
root->irt_rpt[idx->idx_id].irt_root = idx->idx_root;
root->irt_rpt[idx->idx_id].irt_flags &= ~irt_in_progress;
@ -294,30 +294,26 @@ void BTR_delete_index(TDBB tdbb, WIN * window, USHORT id)
* Delete an index if it exists.
*
**************************************/
USHORT relation_id;
SLONG prior, next;
irt::irt_repeat * irt_desc;
SET_TDBB(tdbb);
DBB dbb = tdbb->tdbb_database;
CHECK_DBB(dbb);
// Get index descriptor. If index doesn't exist, just leave.
IRT root = (IRT) window->win_buffer;
index_root_page* root = (index_root_page*) window->win_buffer;
if (id >= root->irt_count) {
CCH_RELEASE(tdbb, window);
}
else {
irt_desc = root->irt_rpt + id;
index_root_page::irt_repeat* irt_desc = root->irt_rpt + id;
CCH_MARK(tdbb, window);
next = irt_desc->irt_root;
const SLONG next = irt_desc->irt_root;
// remove the pointer to the top-level index page before we delete it
irt_desc->irt_root = 0;
irt_desc->irt_flags = 0;
prior = window->win_page;
relation_id = root->irt_relation;
const SLONG prior = window->win_page;
const USHORT relation_id = root->irt_relation;
CCH_RELEASE(tdbb, window);
delete_tree(tdbb, relation_id, id, next, prior);
@ -325,7 +321,7 @@ void BTR_delete_index(TDBB tdbb, WIN * window, USHORT id)
}
bool BTR_description(jrd_rel* relation, IRT root, IDX * idx, SSHORT id)
bool BTR_description(jrd_rel* relation, index_root_page* root, IDX * idx, SSHORT id)
{
/**************************************
*
@ -344,7 +340,7 @@ bool BTR_description(jrd_rel* relation, IRT root, IDX * idx, SSHORT id)
return false;
}
irt::irt_repeat* irt_desc = &root->irt_rpt[id];
index_root_page::irt_repeat* irt_desc = &root->irt_rpt[id];
if (irt_desc->irt_root == 0) {
return false;
@ -542,10 +538,11 @@ btree_page* BTR_find_page(TDBB tdbb,
}
window->win_page = retrieval->irb_relation->rel_index_root;
IRT rpage = (IRT) CCH_FETCH(tdbb, window, LCK_read, pag_root);
index_root_page* rpage = (index_root_page*) CCH_FETCH(tdbb, window, LCK_read, pag_root);
if (!BTR_description
(retrieval->irb_relation, rpage, idx, retrieval->irb_index)) {
(retrieval->irb_relation, rpage, idx, retrieval->irb_index))
{
CCH_RELEASE(tdbb, window);
IBERROR(260); // msg 260 index unexpectedly deleted
}
@ -646,7 +643,7 @@ void BTR_insert(TDBB tdbb, WIN * root_window, IIB * insertion)
// The top of the index has split. We need to make a new level and
// update the index root page. Oh boy.
IRT root = (IRT) CCH_FETCH(tdbb, root_window, LCK_write, pag_root);
index_root_page* root = (index_root_page*) CCH_FETCH(tdbb, root_window, LCK_write, pag_root);
window.win_page = root->irt_rpt[idx->idx_id].irt_root;
bucket = (btree_page*) CCH_FETCH(tdbb, &window, LCK_write, pag_index);
@ -761,16 +758,14 @@ IDX_E BTR_key(TDBB tdbb, jrd_rel* relation, REC record, IDX * idx, KEY * key, id
DSC desc;
DSC* desc_ptr;
SSHORT stuff_count;
IDX_E result;
idx::idx_repeat* tail;
int missing_unique_segments = 0;
SET_TDBB(tdbb);
DBB dbb = tdbb->tdbb_database;
CHECK_DBB(dbb);
result = idx_e_ok;
tail = idx->idx_rpt;
IDX_E result = idx_e_ok;
idx::idx_repeat* tail = idx->idx_rpt;
try {
@ -879,37 +874,31 @@ USHORT BTR_key_length(jrd_rel* relation, IDX * idx)
* Compute the maximum key length for an index.
*
**************************************/
fmt* format;
USHORT n, key_length, length;
idx::idx_repeat * tail;
TDBB tdbb;
USHORT length;
tdbb = GET_THREAD_DATA;
TDBB tdbb = GET_THREAD_DATA;
format = MET_current(tdbb, relation);
tail = idx->idx_rpt;
const fmt* format = MET_current(tdbb, relation);
idx::idx_repeat* tail = idx->idx_rpt;
// If there is only a single key, the computation is straightforward.
if (idx->idx_count == 1) {
if (tail->idx_itype == idx_numeric ||
tail->idx_itype == idx_timestamp1)
switch (tail->idx_itype)
{
case idx_numeric:
case idx_timestamp1:
return sizeof(double);
}
if (tail->idx_itype == idx_sql_time) {
case idx_sql_time:
return sizeof(ULONG);
}
if (tail->idx_itype == idx_sql_date) {
case idx_sql_date:
return sizeof(SLONG);
}
if (tail->idx_itype == idx_timestamp2) {
case idx_timestamp2:
return sizeof(SINT64);
}
if (tail->idx_itype == idx_numeric2) {
case idx_numeric2:
return INT64_KEY_LENGTH;
}
@ -938,9 +927,9 @@ USHORT BTR_key_length(jrd_rel* relation, IDX * idx)
}
// Compute length of key for segmented indices.
key_length = 0;
USHORT key_length = 0;
for (n = 0; n < idx->idx_count; n++, tail++) {
for (USHORT n = 0; n < idx->idx_count; n++, tail++) {
switch (tail->idx_itype)
{
case idx_numeric:
@ -977,7 +966,7 @@ USHORT BTR_key_length(jrd_rel* relation, IDX * idx)
#ifdef SCROLLABLE_CURSORS
UCHAR *BTR_last_node(btree_page* page, EXP expanded_page, BTX * expanded_node)
UCHAR *BTR_last_node(btree_page* page, jrd_exp* expanded_page, BTX * expanded_node)
{
/**************************************
*
@ -1091,12 +1080,11 @@ USHORT BTR_lookup(TDBB tdbb, jrd_rel* relation, USHORT id, IDX * buffer)
* Return a description of the specified index.
*
**************************************/
IRT root;
SET_TDBB(tdbb);
WIN window(-1);
if (!(root = fetch_root(tdbb, &window, relation))) {
index_root_page* root = fetch_root(tdbb, &window, relation);
if (!root) {
return FB_FAILURE;
}
@ -1127,12 +1115,8 @@ void BTR_make_key(TDBB tdbb,
*
**************************************/
DSC *desc, temp_desc;
SSHORT stuff_count;
USHORT n, l;
UCHAR *p, *q;
KEY temp;
bool isNull;
idx::idx_repeat * tail;
SET_TDBB(tdbb);
DBB dbb = tdbb->tdbb_database;
@ -1142,7 +1126,7 @@ void BTR_make_key(TDBB tdbb,
fb_assert(exprs != NULL);
fb_assert(key != NULL);
tail = idx->idx_rpt;
idx::idx_repeat* tail = idx->idx_rpt;
// If the index is a single segment index, don't sweat the compound
// stuff.
@ -1153,10 +1137,10 @@ void BTR_make_key(TDBB tdbb,
}
else {
// Make a compound key
p = key->key_data;
stuff_count = 0;
UCHAR* p = key->key_data;
SSHORT stuff_count = 0;
for (n = 0; n < count; n++, tail++) {
for (USHORT n = 0; n < count; n++, tail++) {
for (; stuff_count; --stuff_count) {
*p++ = 0;
}
@ -1164,8 +1148,8 @@ void BTR_make_key(TDBB tdbb,
compress(tdbb, desc, &temp, tail->idx_itype, isNull,
(idx->idx_flags & idx_descending),
(USHORT) ((n == count - 1) ? fuzzy : FALSE));
for (q = temp.key_data, l = temp.key_length; l;
--l, --stuff_count)
const UCHAR* q = temp.key_data;
for (USHORT l = temp.key_length; l; --l, --stuff_count)
{
if (stuff_count == 0) {
*p++ = idx->idx_count - n;
@ -1197,15 +1181,10 @@ bool BTR_next_index(TDBB tdbb,
* recently change from UCHAR to SHORT
*
**************************************/
IRT root;
SSHORT id;
SLONG trans;
int trans_state;
irt::irt_repeat * irt_desc;
SET_TDBB(tdbb);
if ((USHORT)idx->idx_id == (USHORT)-1) {
SSHORT id;
if ((USHORT)idx->idx_id == (USHORT) -1) {
id = 0;
window->win_bdb = NULL;
}
@ -1213,26 +1192,26 @@ bool BTR_next_index(TDBB tdbb,
id = idx->idx_id + 1;
}
index_root_page* root;
if (window->win_bdb) {
root = (IRT) window->win_buffer;
root = (index_root_page*) window->win_buffer;
}
else if (!(root = fetch_root(tdbb, window, relation))) {
return false;
}
for (; id < root->irt_count; ++id) {
irt_desc = root->irt_rpt + id;
const index_root_page::irt_repeat* irt_desc = root->irt_rpt + id;
if (!irt_desc->irt_root &&
(irt_desc->irt_flags & irt_in_progress) && transaction)
{
trans = irt_desc->irt_stuff.irt_transaction;
const SLONG trans = irt_desc->irt_stuff.irt_transaction;
CCH_RELEASE(tdbb, window);
trans_state = TRA_wait(tdbb, transaction, trans, TRUE);
if ((trans_state == tra_dead)
|| (trans_state == tra_committed))
const int trans_state = TRA_wait(tdbb, transaction, trans, true);
if ((trans_state == tra_dead) || (trans_state == tra_committed))
{
// clean up this left-over index
root = (IRT) CCH_FETCH(tdbb, window, LCK_write, pag_root);
root = (index_root_page*) CCH_FETCH(tdbb, window, LCK_write, pag_root);
irt_desc = root->irt_rpt + id;
if (!irt_desc->irt_root &&
irt_desc->irt_stuff.irt_transaction == trans &&
@ -1243,11 +1222,11 @@ bool BTR_next_index(TDBB tdbb,
else {
CCH_RELEASE(tdbb, window);
}
root = (IRT) CCH_FETCH(tdbb, window, LCK_read, pag_root);
root = (index_root_page*) CCH_FETCH(tdbb, window, LCK_read, pag_root);
continue;
}
else {
root = (IRT) CCH_FETCH(tdbb, window, LCK_read, pag_root);
root = (index_root_page*) CCH_FETCH(tdbb, window, LCK_read, pag_root);
}
}
if (BTR_description(relation, root, idx, id)) {
@ -1325,13 +1304,12 @@ void BTR_remove(TDBB tdbb, WIN * root_window, IIB * insertion)
**************************************/
DBB dbb = tdbb->tdbb_database;
IDX *idx;
idx = insertion->iib_descriptor;
IDX* idx = insertion->iib_descriptor;
WIN window(idx->idx_root);
btree_page* page = (btree_page*) CCH_FETCH(tdbb, &window, LCK_read, pag_index);
// If the page is level 0, re-fetch it for write
UCHAR level = page->btr_level;
const UCHAR level = page->btr_level;
if (level == 0) {
CCH_RELEASE(tdbb, &window);
CCH_FETCH(tdbb, &window, LCK_write, pag_index);
@ -1352,7 +1330,7 @@ void BTR_remove(TDBB tdbb, WIN * root_window, IIB * insertion)
CCH_RELEASE(tdbb, &window);
CCH_RELEASE(tdbb, root_window);
IRT root = (IRT) CCH_FETCH(tdbb, root_window, LCK_write, pag_root);
index_root_page* root = (index_root_page*) CCH_FETCH(tdbb, root_window, LCK_write, pag_root);
page = (btree_page*) CCH_FETCH(tdbb, &window, LCK_write, pag_index);
// get the page number of the child, and check to make sure
@ -1362,7 +1340,7 @@ void BTR_remove(TDBB tdbb, WIN * root_window, IIB * insertion)
IndexNode pageNode;
pointer = BTreeNode::readNode(&pageNode, pointer, flags, false);
SLONG number = pageNode.pageNumber;
const SLONG number = pageNode.pageNumber;
pointer = BTreeNode::readNode(&pageNode, pointer, flags, false);
if (!(BTreeNode::isEndBucket(&pageNode, false) ||
BTreeNode::isEndLevel(&pageNode, false)))
@ -1414,7 +1392,7 @@ void BTR_reserve_slot(TDBB tdbb, jrd_rel* relation, jrd_tra* transaction, IDX *
// Get root page, assign an index id, and store the index descriptor.
// Leave the root pointer null for the time being.
WIN window(relation->rel_index_root);
IRT root = (IRT) CCH_FETCH(tdbb, &window, LCK_write, pag_root);
index_root_page* root = (index_root_page*) CCH_FETCH(tdbb, &window, LCK_write, pag_root);
CCH_MARK(tdbb, &window);
// check that we create no more indexes than will fit on a single root page
@ -1428,8 +1406,9 @@ void BTR_reserve_slot(TDBB tdbb, jrd_rel* relation, jrd_tra* transaction, IDX *
UCHAR *desc;
USHORT l, space;
irt::irt_repeat * root_idx, *end, *slot;
index_root_page::irt_repeat * root_idx, *end, *slot;
bool maybe_no_room = false;
retry:
// dimitr: irtd_selectivity member of IRTD is introduced in ODS11
if (dbb->dbb_ods_version < ODS_VERSION11)
@ -1526,7 +1505,7 @@ void BTR_selectivity(TDBB tdbb, jrd_rel* relation, USHORT id, SelectivityList& s
SET_TDBB(tdbb);
WIN window(-1);
IRT root = fetch_root(tdbb, &window, relation);
index_root_page* root = fetch_root(tdbb, &window, relation);
if (!root) {
return;
}
@ -1696,7 +1675,7 @@ void BTR_selectivity(TDBB tdbb, jrd_rel* relation, USHORT id, SelectivityList& s
// Store the selectivity on the root page
window.win_page = relation->rel_index_root;
window.win_flags = 0;
root = (IRT) CCH_FETCH(tdbb, &window, LCK_write, pag_root);
root = (index_root_page*) CCH_FETCH(tdbb, &window, LCK_write, pag_root);
CCH_MARK(tdbb, &window);
update_selectivity(root, id, selectivity);
CCH_RELEASE(tdbb, &window);
@ -1765,9 +1744,9 @@ static SLONG add_node(TDBB tdbb,
(SSHORT) ((bucket->btr_level == 1) ? LCK_write : LCK_read), pag_index);
// now recursively try to insert the node at the next level down
IIB propogate;
IIB propagate;
split = add_node(tdbb, window, insertion, new_key, new_record_number,
&page, &propogate.iib_sibling);
&page, &propagate.iib_sibling);
if (split == NO_SPLIT) {
return NO_SPLIT;
}
@ -1777,11 +1756,11 @@ static SLONG add_node(TDBB tdbb,
window->win_page = index;
bucket = (btree_page*) CCH_FETCH(tdbb, window, LCK_write, pag_index);
propogate.iib_number = split;
propogate.iib_descriptor = insertion->iib_descriptor;
propogate.iib_relation = insertion->iib_relation;
propogate.iib_duplicates = NULL;
propogate.iib_key = new_key;
propagate.iib_number = split;
propagate.iib_descriptor = insertion->iib_descriptor;
propagate.iib_relation = insertion->iib_relation;
propagate.iib_duplicates = NULL;
propagate.iib_key = new_key;
// now loop through the sibling pages trying to find the appropriate
// place to put the pointer to the lower level page--remember that the
@ -1789,7 +1768,7 @@ static SLONG add_node(TDBB tdbb,
SLONG original_page2;
SLONG sibling_page2;
while (true) {
split = insert_node(tdbb, window, &propogate, new_key,
split = insert_node(tdbb, window, &propagate, new_key,
new_record_number, &original_page2, &sibling_page2);
if (split != NO_VALUE) {
@ -1831,9 +1810,8 @@ static void complement_key(KEY * key)
* Negate a key for descending index.
*
**************************************/
UCHAR *p, *end;
for (p = key->key_data, end = p + key->key_length; p < end; p++) {
UCHAR* p = key->key_data;
for (const UCHAR* const end = p + key->key_length; p < end; p++) {
*p ^= -1;
}
}
@ -1855,7 +1833,6 @@ static void compress(TDBB tdbb,
* Compress a data value into an index key.
*
**************************************/
UCHAR *q, *p;
USHORT length;
UCHAR pad, *ptr;
union {
@ -1874,7 +1851,7 @@ static void compress(TDBB tdbb,
DBB dbb = tdbb->tdbb_database;
CHECK_DBB(dbb);
p = key->key_data;
UCHAR* p = key->key_data;
if (isNull && dbb->dbb_ods_version >= ODS_VERSION7) {
pad = 0;
@ -1955,7 +1932,7 @@ static void compress(TDBB tdbb,
}
else {
USHORT ttype;
length = MOV_get_string_ptr(desc, &ttype, &ptr, (VARY *) temp1, MAX_KEY);
length = MOV_get_string_ptr(desc, &ttype, &ptr, (vary*) temp1, MAX_KEY);
}
if (length) {
@ -2063,6 +2040,8 @@ static void compress(TDBB tdbb,
#ifdef IEEE
const UCHAR* q;
#ifndef WORDS_BIGENDIAN
// For little-endian machines, reverse the order of bytes for the key
// Copy the first set of bytes into key_data
@ -2179,7 +2158,7 @@ static void compress(TDBB tdbb,
}
static USHORT compress_root(TDBB tdbb, IRT page)
static USHORT compress_root(TDBB tdbb, index_root_page* page)
{
/**************************************
*
@ -2191,36 +2170,36 @@ static USHORT compress_root(TDBB tdbb, IRT page)
* Compress an index root page.
*
**************************************/
UCHAR *temp, *p;
USHORT l;
irt::irt_repeat * root_idx, *end;
SET_TDBB(tdbb);
DBB dbb = tdbb->tdbb_database;
CHECK_DBB(dbb);
temp = (UCHAR*)tdbb->tdbb_default->allocate((SLONG) dbb->dbb_page_size, 0
UCHAR* const temp =
(UCHAR*)tdbb->tdbb_default->allocate((SLONG) dbb->dbb_page_size, 0
#ifdef DEBUG_GDS_ALLOC
,__FILE__,__LINE__
#endif
);
memcpy(temp, page, dbb->dbb_page_size);
p = temp + dbb->dbb_page_size;
UCHAR* p = temp + dbb->dbb_page_size;
for (root_idx = page->irt_rpt, end = root_idx + page->irt_count;
index_root_page::irt_repeat* root_idx = page->irt_rpt;
for (const index_root_page::irt_repeat* const end = root_idx + page->irt_count;
root_idx < end; root_idx++)
{
if (root_idx->irt_root) {
USHORT len;
if (dbb->dbb_ods_version < ODS_VERSION11)
l = root_idx->irt_keys * sizeof(irtd_ods10);
len = root_idx->irt_keys * sizeof(irtd_ods10);
else
l = root_idx->irt_keys * sizeof(irtd);
p -= l;
memcpy(p, (SCHAR*)page + root_idx->irt_desc, l);
len = root_idx->irt_keys * sizeof(irtd);
p -= len;
memcpy(p, (SCHAR*)page + root_idx->irt_desc, len);
root_idx->irt_desc = p - temp;
}
}
l = p - temp;
const USHORT l = p - temp;
tdbb->tdbb_default->deallocate(temp);
return l;
@ -2508,11 +2487,9 @@ static DSC *eval(TDBB tdbb, jrd_nod* node, DSC * temp, bool *isNull)
* a flag to indicate a null value.
*
**************************************/
DSC *desc;
SET_TDBB(tdbb);
desc = EVL_expr(tdbb, node);
dsc* desc = EVL_expr(tdbb, node);
*isNull = false;
if (desc && !(tdbb->tdbb_request->req_flags & req_null)) {
@ -2935,7 +2912,7 @@ static SLONG fast_load(TDBB tdbb,
totalJumpSize[0] += BTreeNode::getJumpNodeSize(&jumpNode, flags);
}
// If there wasn't a split, we're done. If there was, propogate the
// If there wasn't a split, we're done. If there was, propagate the
// split upward
for (level = 1; split_pages[level - 1]; level++) {
// initialize the current pointers for this level
@ -2956,7 +2933,7 @@ static SLONG fast_load(TDBB tdbb,
bucket->btr_level = (UCHAR) level;
bucket->btr_header.pag_flags |= flags;
// since this is the beginning of the level, we propogate the lower-level
// since this is the beginning of the level, we propagate the lower-level
// page with a "degenerate" zero-length node indicating that this page holds
// any key value less than the next node
@ -3080,7 +3057,7 @@ static SLONG fast_load(TDBB tdbb,
splitNode.data = key->key_data;
levelPointer = BTreeNode::writeNode(&splitNode, levelPointer, flags, false);
// indicate to propogate the page we just split from
// indicate to propagate the page we just split from
split_pages[level] = window->win_page;
split_record_numbers[level] = splitNode.recordNumber;
CCH_RELEASE(tdbb, window);
@ -3103,7 +3080,7 @@ static SLONG fast_load(TDBB tdbb,
}
// Now propogate up the lower-level bucket by storing a "pointer" to it.
// Now propagate up the lower-level bucket by storing a "pointer" to it.
bucket->btr_prefix_total += prefix;
levelPointer = BTreeNode::writeNode(&levelNode, levelPointer, flags, false);
@ -3273,7 +3250,7 @@ static SLONG fast_load(TDBB tdbb,
}
static IRT fetch_root(TDBB tdbb, WIN * window, jrd_rel* relation)
static index_root_page* fetch_root(TDBB tdbb, WIN * window, jrd_rel* relation)
{
/**************************************
*
@ -3299,7 +3276,7 @@ static IRT fetch_root(TDBB tdbb, WIN * window, jrd_rel* relation)
}
}
return (IRT) CCH_FETCH(tdbb, window, LCK_read, pag_root);
return (index_root_page*) CCH_FETCH(tdbb, window, LCK_read, pag_root);
}
@ -3322,7 +3299,6 @@ static UCHAR *find_node_start_point(btree_page* bucket, KEY * key, UCHAR * value
**************************************/
const SCHAR flags = bucket->btr_header.pag_flags;
register UCHAR *p, *q, *r;
USHORT prefix = 0;
const UCHAR* const key_end = key->key_data + key->key_length;
if (!(flags & btr_all_record_number)) {
@ -3340,7 +3316,7 @@ static UCHAR *find_node_start_point(btree_page* bucket, KEY * key, UCHAR * value
else {
pointer = BTreeNode::getPointerFirstNode(bucket);
}
p = key->key_data + prefix;
UCHAR* p = key->key_data + prefix;
if (flags & btr_large_keys) {
@ -3364,7 +3340,7 @@ static UCHAR *find_node_start_point(btree_page* bucket, KEY * key, UCHAR * value
while (true) {
// Pick up data from node
if (value && node.length) {
r = value + node.prefix;
UCHAR* r = value + node.prefix;
memcpy(r, node.data, node.length);
}
@ -3384,7 +3360,7 @@ static UCHAR *find_node_start_point(btree_page* bucket, KEY * key, UCHAR * value
// than the key, so we can skip it. If it has zero length, then
// it is a duplicate, and can also be skipped.
if (node.prefix == prefix) {
q = node.data;
const UCHAR* q = node.data;
const UCHAR* const nodeEnd = q + node.length;
if (descending) {
while (true) {
@ -3463,7 +3439,7 @@ static UCHAR *find_node_start_point(btree_page* bucket, KEY * key, UCHAR * value
// Pick up data from node
if (value && node->btn_length) {
r = value + node->btn_prefix;
UCHAR* r = value + node->btn_prefix;
memcpy(r, node->btn_data, node->btn_length);
}
@ -3485,7 +3461,7 @@ static UCHAR *find_node_start_point(btree_page* bucket, KEY * key, UCHAR * value
// than the key, so we can skip it. If it has zero length, then
// it is a duplicate, and can also be skipped.
if (node->btn_prefix == prefix) {
q = node->btn_data;
const UCHAR* q = node->btn_data;
const UCHAR* const nodeEnd = q + node->btn_length;
if (descending) {
while (true) {
@ -4061,7 +4037,7 @@ static CONTENTS garbage_collect(TDBB tdbb, WIN * window, SLONG parent_number)
// get to it quickly; don't worry if it's not accurate now or
// is changed after we release the page, since we will fetch
// it in a fault-tolerant way anyway.
SLONG left_number = gc_page->btr_left_sibling;
const SLONG left_number = gc_page->btr_left_sibling;
// if the left sibling is blank, that indicates we are the leftmost page,
// so don't garbage-collect the page; do this for several reasons:
@ -4643,10 +4619,10 @@ static void generate_jump_nodes(TDBB tdbb, btree_page* page, jumpNodeList* jumpN
*splitPrefix = 0;
}
UCHAR *newAreaPosition = pointer + jumpInfo.jumpAreaSize;
UCHAR *endpoint = ((UCHAR*)page + page->btr_length);
UCHAR *halfpoint = ((UCHAR*)page + (dbb->dbb_page_size / 2));
UCHAR *excludePointer = ((UCHAR*)page + excludeOffset);
const UCHAR* newAreaPosition = pointer + jumpInfo.jumpAreaSize;
const UCHAR* const endpoint = ((UCHAR*)page + page->btr_length);
const UCHAR* const halfpoint = ((UCHAR*)page + (dbb->dbb_page_size / 2));
const UCHAR* const excludePointer = ((UCHAR*)page + excludeOffset);
IndexJumpNode jumpNode;
if (flags & btr_large_keys) {
@ -4701,10 +4677,9 @@ static void generate_jump_nodes(TDBB tdbb, btree_page* page, jumpNodeList* jumpN
}
}
else {
btn* node;
while (pointer < endpoint) {
node = (btn*)pointer;
btn* node = (btn*)pointer;
if (!leafPage && (flags & btr_all_record_number)) {
pointer = (UCHAR*)NEXT_NODE_RECNR(node);
}
@ -5164,9 +5139,10 @@ static SLONG insert_node(TDBB tdbb,
}
}
else {
UCHAR* midpoint = NULL;
const UCHAR* midpoint = NULL;
splitpoint = BTreeNode::readNode(&newNode, newNode.nodePointer, flags, leafPage);
if (endOfPage && ((UCHAR*) splitpoint <= (UCHAR*)newBucket + dbb->dbb_page_size)){
if (endOfPage && ((UCHAR*) splitpoint <= (UCHAR*)newBucket + dbb->dbb_page_size))
{
midpoint = splitpoint;
}
else {
@ -5325,7 +5301,7 @@ static SLONG insert_node(TDBB tdbb,
// Update page information.
bucket->btr_sibling = split_window.win_page;
bucket->btr_prefix_total = prefix_total;
// mark the bucket as non garbage-collectable until we can propogate
// mark the bucket as non garbage-collectable until we can propagate
// the split page up to the parent; otherwise its possible that the
// split page we just created will be lost.
bucket->btr_header.pag_flags |= btr_dont_gc;
@ -5367,9 +5343,6 @@ static INT64_KEY make_int64_key(SINT64 q, SSHORT scale)
* Make an Index key for a 64-bit Integer value.
*
**************************************/
UINT64 uq;
INT64_KEY key;
int n;
// Following structure declared above in the modules global section
//
@ -5387,14 +5360,15 @@ static INT64_KEY make_int64_key(SINT64 q, SSHORT scale)
// declared scale of the column was different, actually wind up
// being mapped to the same key.
n = 0;
uq = (UINT64) ((q >= 0) ? q : -q); // absolute value
int n = 0;
UINT64 uq = (UINT64) ((q >= 0) ? q : -q); // absolute value
while (uq < int64_scale_control[n].limit) {
n++;
}
q *= int64_scale_control[n].factor;
scale -= int64_scale_control[n].scale_change;
INT64_KEY key;
key.d_part = ((double) (q / 10000)) / powerof10(scale);
key.s_part = (SSHORT) (q % 10000);
@ -5456,10 +5430,9 @@ static CONTENTS remove_node(TDBB tdbb, IIB * insertion, WIN * window)
return remove_leaf_node(tdbb, insertion, window);
}
SLONG number, parent_number;
CONTENTS result;
while (true) {
number = find_page(page, insertion->iib_key, idx->idx_flags, insertion->iib_number);
const SLONG number =
find_page(page, insertion->iib_key, idx->idx_flags, insertion->iib_number);
// we should always find the node, but let's make sure
if (number == END_LEVEL) {
@ -5475,14 +5448,14 @@ static CONTENTS remove_node(TDBB tdbb, IIB * insertion, WIN * window)
if (number != END_BUCKET) {
// handoff down to the next level, retaining the parent page number
parent_number = window->win_page;
const SLONG parent_number = window->win_page;
page = (btree_page*) CCH_HANDOFF(tdbb, window, number, (SSHORT)
((page->btr_level == 1) ? LCK_write : LCK_read), pag_index);
// if the removed node caused the page to go below the garbage collection
// threshold, and the database was created by a version of the engine greater
// than 8.2, then we can garbage-collect the page
result = remove_node(tdbb, insertion, window);
const CONTENTS result = remove_node(tdbb, insertion, window);
if ((result != contents_above_threshold)
&& (dbb->dbb_ods_version >= ODS_VERSION9))
@ -5533,7 +5506,7 @@ static CONTENTS remove_leaf_node(TDBB tdbb, IIB * insertion, WIN * window)
}
// Make sure first node looks ok
SCHAR flags = page->btr_header.pag_flags;
const SCHAR flags = page->btr_header.pag_flags;
IndexNode node;
pointer = BTreeNode::readNode(&node, pointer, flags, true);
if (prefix > node.prefix
@ -5547,11 +5520,10 @@ static CONTENTS remove_leaf_node(TDBB tdbb, IIB * insertion, WIN * window)
}
// check to make sure the node has the same value
USHORT l;
UCHAR *p, *q;
p = node.data;
q = key->key_data + node.prefix;
if ( (l = node.length) ) {
UCHAR* p = node.data;
const UCHAR* q = key->key_data + node.prefix;
USHORT l = node.length;
if (l) {
do {
if (*p++ != *q++) {
#ifdef DEBUG_BTR
@ -5665,9 +5637,9 @@ static bool scan(TDBB tdbb, UCHAR *pointer, SBM *bitmap, USHORT to_segment,
*
* Functional description
* Do an index scan.
* If we run over the bucket, return TRUE.
* If we run over the bucket, return true.
* If we're completely done (passed END_LEVEL),
* return FALSE.
* return false.
*
**************************************/
@ -5691,7 +5663,7 @@ static bool scan(TDBB tdbb, UCHAR *pointer, SBM *bitmap, USHORT to_segment,
count = key->key_length;
}
UCHAR* end_key = key->key_data + count;
const UCHAR* const end_key = key->key_data + count;
count -= key->key_length;
// reset irb_equality flag passed for optimization
@ -5700,8 +5672,6 @@ static bool scan(TDBB tdbb, UCHAR *pointer, SBM *bitmap, USHORT to_segment,
bool descending = (flag & irb_descending);
bool done = false;
UCHAR* p = NULL;
UCHAR* q = NULL;
USHORT l;
if (page_flags & btr_large_keys) {
IndexNode node;
@ -5730,7 +5700,7 @@ static bool scan(TDBB tdbb, UCHAR *pointer, SBM *bitmap, USHORT to_segment,
else {
// Up to (partial/starting) to_segment is expected to be NULL.
if (node.length && (node.prefix == 0)) {
q = node.data;
const UCHAR* q = node.data;
if (*q > to_segment) {
return false;
}
@ -5740,8 +5710,8 @@ static bool scan(TDBB tdbb, UCHAR *pointer, SBM *bitmap, USHORT to_segment,
else if (node.prefix <= prefix) {
prefix = node.prefix;
p = key->key_data + prefix;
q = node.data;
for (l = node.length; l; --l, prefix++) {
const UCHAR* q = node.data;
for (USHORT l = node.length; l; --l, prefix++) {
if (p >= end_key) {
if (flag) {
break;
@ -5814,7 +5784,7 @@ static bool scan(TDBB tdbb, UCHAR *pointer, SBM *bitmap, USHORT to_segment,
else {
// Up to (partial/starting) to_segment is expected to be NULL.
if (node->btn_length && (node->btn_prefix == 0)) {
q = node->btn_data;
const UCHAR* q = node->btn_data;
if (*q > to_segment) {
return false;
}
@ -5824,8 +5794,8 @@ static bool scan(TDBB tdbb, UCHAR *pointer, SBM *bitmap, USHORT to_segment,
else if (node->btn_prefix <= prefix) {
prefix = node->btn_prefix;
p = key->key_data + prefix;
q = node->btn_data;
for (l = node->btn_length; l; --l, prefix++) {
const UCHAR* q = node->btn_data;
for (USHORT l = node->btn_length; l; --l, prefix++) {
if (p >= end_key) {
if (flag) {
break;
@ -5875,7 +5845,7 @@ static bool scan(TDBB tdbb, UCHAR *pointer, SBM *bitmap, USHORT to_segment,
}
void update_selectivity(IRT root, USHORT id, const SelectivityList& selectivity)
void update_selectivity(index_root_page* root, USHORT id, const SelectivityList& selectivity)
{
/**************************************
*
@ -5889,7 +5859,7 @@ void update_selectivity(IRT root, USHORT id, const SelectivityList& selectivity)
**************************************/
DBB dbb = GET_DBB;
irt::irt_repeat* irt_desc = &root->irt_rpt[id];
index_root_page::irt_repeat* irt_desc = &root->irt_rpt[id];
const USHORT idx_count = irt_desc->irt_keys;
fb_assert(selectivity.getCount() == idx_count);
@ -5901,3 +5871,4 @@ void update_selectivity(IRT root, USHORT id, const SelectivityList& selectivity)
}
irt_desc->irt_stuff.irt_selectivity = selectivity.back();
}

View File

@ -61,7 +61,7 @@ typedef struct idx {
struct vec *idx_foreign_indexes; /* ids for foreign key partner indexes */
jrd_nod* idx_expression; /* node tree for indexed expresssion */
struct dsc idx_expression_desc; /* descriptor for expression result */
struct jrd_req *idx_expression_request; /* stored request for expression evaluation */
class jrd_req* idx_expression_request; /* stored request for expression evaluation */
// This structure should exactly match IRTD structure for current ODS
struct idx_repeat {
USHORT idx_field; /* field id */

View File

@ -32,7 +32,7 @@ USHORT BTR_all(TDBB, jrd_rel*, idx**, idx**, str**, SLONG*);
void BTR_create(TDBB, jrd_rel*, idx*, USHORT, scb*, SelectivityList&);
void BTR_delete_index(TDBB, win*, USHORT);
//USHORT BTR_delete_node(TDBB, btree_page*, USHORT);
bool BTR_description(jrd_rel*, irt*, idx*, SSHORT);
bool BTR_description(jrd_rel*, index_root_page*, idx*, SSHORT);
void BTR_evaluate(tdbb*, irb*, sbm**);
UCHAR* BTR_find_leaf(btree_page*, key*, UCHAR*, USHORT*, int, bool);
btree_page* BTR_find_page(tdbb*, irb*, win*, idx*, key*, key*, bool);

View File

@ -130,10 +130,10 @@ static SSHORT lock_buffer(TDBB, BDB, SSHORT, SSHORT);
static ULONG memory_init(TDBB, BCB, ULONG);
static void page_validation_error(TDBB, win*, SSHORT);
#ifdef CACHE_READER
static void prefetch_epilogue(PRF, ISC_STATUS *);
static void prefetch_init(PRF, TDBB);
static void prefetch_io(PRF, ISC_STATUS *);
static void prefetch_prologue(PRF, SLONG *);
static void prefetch_epilogue(Prefetch*, ISC_STATUS *);
static void prefetch_init(Prefetch*, TDBB);
static void prefetch_io(Prefetch*, ISC_STATUS *);
static void prefetch_prologue(Prefetch*, SLONG *);
#endif
static SSHORT related(BDB, BDB, SSHORT);
static void release_bdb(TDBB, BDB, const bool, const bool, const bool);
@ -183,7 +183,8 @@ static void update_write_direction(TDBB, BDB);
#define DUMMY_CHECKSUM 12345
bool set_write_direction(DBB dbb, BDB bdb, SSHORT direction) {
bool set_write_direction(DBB dbb, BDB bdb, SSHORT direction)
{
#ifdef SUPERSERVER
NBAK_TRACE(("set_write_direction page=%d old=%d new=%d", bdb->bdb_page,
bdb->bdb_write_direction, direction));
@ -200,7 +201,7 @@ bool set_write_direction(DBB dbb, BDB bdb, SSHORT direction) {
bdb->bdb_write_direction = direction;
#else
LCK_ast_inhibit();
switch(bdb->bdb_write_direction) {
switch (bdb->bdb_write_direction) {
case BDB_write_normal:
case BDB_write_both:
switch (direction) {
@ -214,7 +215,7 @@ bool set_write_direction(DBB dbb, BDB bdb, SSHORT direction) {
}
break;
case BDB_write_diff:
switch(direction) {
switch (direction) {
case BDB_write_normal:
case BDB_write_both:
dbb->backup_manager->decrement_diff_use_count();
@ -252,7 +253,8 @@ bool set_write_direction(DBB dbb, BDB bdb, SSHORT direction) {
return true;
}
void CCH_flush_database(TDBB tdbb) {
void CCH_flush_database(TDBB tdbb)
{
/**************************************
*
* C C H _ f l u s h _ d a t a b a s e
@ -354,8 +356,7 @@ USHORT CCH_checksum(BDB bdb)
checksum += *p++;
checksum += *p++;
checksum += *p++;
}
while (p < end);
} while (p < end);
page->pag_checksum = old_checksum;
@ -390,11 +391,11 @@ int CCH_down_grade_dbb(void* ast_object)
* AST.
*
**************************************/
DBB dbb = reinterpret_cast<DBB>(ast_object);
DBB dbb = static_cast<DBB>(ast_object);
/* Ignore the request if the database or lock block does not appear
to be valid . */
LCK lock;
lck* lock;
if ((MemoryPool::blk_type(dbb) != type_dbb) ||
!(lock = dbb->dbb_lock) ||
(MemoryPool::blk_type(lock) != type_lck) || !(lock->lck_id))
@ -494,7 +495,7 @@ if (dbb->dbb_use_count)
}
BOOLEAN CCH_exclusive(TDBB tdbb, USHORT level, SSHORT wait_flag)
bool CCH_exclusive(TDBB tdbb, USHORT level, SSHORT wait_flag)
{
/**************************************
*
@ -503,9 +504,9 @@ BOOLEAN CCH_exclusive(TDBB tdbb, USHORT level, SSHORT wait_flag)
**************************************
*
* Functional description
* Get exclusive access to a database. If we get it, return TRUE.
* Get exclusive access to a database. If we get it, return true.
* If the wait flag is FALSE, and we can't get it, give up and
* return FALSE. There are two levels of database exclusivity: LCK_PW
* return false. There are two levels of database exclusivity: LCK_PW
* guarantees there are no normal users in the database while LCK_EX
* additionally guarantes background database processes like the
* shared cache manager have detached.
@ -516,12 +517,12 @@ BOOLEAN CCH_exclusive(TDBB tdbb, USHORT level, SSHORT wait_flag)
#ifdef SUPERSERVER
if (!CCH_exclusive_attachment(tdbb, level, wait_flag)) {
return FALSE;
return false;
}
#endif
LCK lock = dbb->dbb_lock;
lck* lock = dbb->dbb_lock;
if (!lock) {
return FALSE;
return false;
}
dbb->dbb_flags |= DBB_exclusive;
@ -531,7 +532,7 @@ BOOLEAN CCH_exclusive(TDBB tdbb, USHORT level, SSHORT wait_flag)
if ((lock->lck_physical >= LCK_PW)
|| LCK_convert(tdbb, lock, LCK_PW, wait_flag))
{
return TRUE;
return true;
}
break;
@ -539,7 +540,7 @@ BOOLEAN CCH_exclusive(TDBB tdbb, USHORT level, SSHORT wait_flag)
if (lock->lck_physical == LCK_EX ||
LCK_convert(tdbb, lock, LCK_EX, wait_flag))
{
return TRUE;
return true;
}
break;
@ -556,11 +557,11 @@ BOOLEAN CCH_exclusive(TDBB tdbb, USHORT level, SSHORT wait_flag)
dbb->dbb_flags &= ~DBB_exclusive;
return FALSE;
return false;
}
BOOLEAN CCH_exclusive_attachment(TDBB tdbb, USHORT level, SSHORT wait_flag)
bool CCH_exclusive_attachment(TDBB tdbb, USHORT level, SSHORT wait_flag)
{
/**************************************
*
@ -569,9 +570,9 @@ BOOLEAN CCH_exclusive_attachment(TDBB tdbb, USHORT level, SSHORT wait_flag)
**************************************
*
* Functional description
* Get exclusive access to a database. If we get it, return TRUE.
* Get exclusive access to a database. If we get it, return true.
* If the wait flag is FALSE, and we can't get it, give up and
* return FALSE.
* return false.
*
**************************************/
#define CCH_EXCLUSIVE_RETRY_INTERVAL 1 /* retry interval in seconds */
@ -580,7 +581,7 @@ BOOLEAN CCH_exclusive_attachment(TDBB tdbb, USHORT level, SSHORT wait_flag)
DBB dbb = tdbb->tdbb_database;
att* attachment = tdbb->tdbb_attachment;
if (attachment->att_flags & ATT_exclusive) {
return TRUE;
return true;
}
attachment->att_flags |=
@ -637,7 +638,7 @@ BOOLEAN CCH_exclusive_attachment(TDBB tdbb, USHORT level, SSHORT wait_flag)
ERR_post(isc_deadlock, 0);
}
else {
return FALSE;
return false;
}
}
break;
@ -650,7 +651,7 @@ BOOLEAN CCH_exclusive_attachment(TDBB tdbb, USHORT level, SSHORT wait_flag)
if (level != LCK_none) {
tdbb->tdbb_attachment->att_flags |= ATT_exclusive;
}
return TRUE;
return true;
}
/* Our thread needs to sleep for CCH_EXCLUSIVE_RETRY_INTERVAL seconds. */
@ -675,7 +676,7 @@ BOOLEAN CCH_exclusive_attachment(TDBB tdbb, USHORT level, SSHORT wait_flag)
tdbb->tdbb_attachment->att_flags &=
~(ATT_exclusive_pending | ATT_attach_pending);
return FALSE;
return false;
}
@ -758,7 +759,7 @@ PAG CCH_fake(TDBB tdbb, WIN * window, SSHORT latch_wait)
if (!write_buffer
(tdbb, bdb, bdb->bdb_page, true, tdbb->tdbb_status_vector, true))
{
CCH_unwind(tdbb, TRUE);
CCH_unwind(tdbb, true);
}
}
else if (QUE_NOT_EMPTY(bdb->bdb_lower)) {
@ -783,10 +784,10 @@ PAG CCH_fake(TDBB tdbb, WIN * window, SSHORT latch_wait)
PAG CCH_fetch(TDBB tdbb,
WIN * window,
WIN* window,
USHORT lock_type,
SSHORT page_type,
SSHORT checksum, SSHORT latch_wait, BOOLEAN read_shadow)
SHORT checksum, SSHORT latch_wait, bool read_shadow)
{
/**************************************
*
@ -958,7 +959,7 @@ SSHORT CCH_fetch_lock(TDBB tdbb,
void CCH_fetch_page(
TDBB tdbb,
WIN * window,
SSHORT compute_checksum, BOOLEAN read_shadow)
SSHORT compute_checksum, bool read_shadow)
{
/**************************************
*
@ -988,7 +989,7 @@ void CCH_fetch_page(
THREAD_EXIT;
#endif
page = bdb->bdb_buffer;
fil* file = dbb->dbb_file;
jrd_file* file = dbb->dbb_file;
SSHORT retryCount = 0;
/* We will read a page, and if there is an I/O error we will try to
@ -999,12 +1000,12 @@ void CCH_fetch_page(
FETCH_NO_SHADOW, which is only called from validate
code.
read_shadow = FALSE -> IF an I/O error occurs give up (exit
read_shadow = false -> IF an I/O error occurs give up (exit
the loop, clean up, and return). So the caller,
validate in most cases, can know about it and attempt
to remedy the situation.
read_shadow = TRUE -> IF an I/O error occurs attempt
read_shadow = true -> IF an I/O error occurs attempt
to rollover to the shadow file. If the I/O error is
persistant (more than 3 times) error out of the routine by
calling CCH_unwind, and eventually punting out. */
@ -1012,16 +1013,16 @@ void CCH_fetch_page(
if (!dbb->backup_manager->lock_state(false))
{
PAGE_LOCK_RELEASE(bdb->bdb_lock);
CCH_unwind(tdbb, TRUE);
CCH_unwind(tdbb, true);
}
int bak_state = dbb->backup_manager->get_state();
const int bak_state = dbb->backup_manager->get_state();
ULONG diff_page = 0;
if (bak_state == nbak_state_stalled || bak_state == nbak_state_merge) {
if (!dbb->backup_manager->lock_alloc(false))
{
PAGE_LOCK_RELEASE(bdb->bdb_lock);
dbb->backup_manager->unlock_state();
CCH_unwind(tdbb, TRUE);
CCH_unwind(tdbb, true);
}
diff_page = dbb->backup_manager->get_page_index(bdb->bdb_page);
dbb->backup_manager->unlock_alloc();
@ -1049,7 +1050,7 @@ void CCH_fetch_page(
if (!CCH_rollover_to_shadow(dbb, file, false)) {
PAGE_LOCK_RELEASE(bdb->bdb_lock);
dbb->backup_manager->unlock_state();
CCH_unwind(tdbb, TRUE);
CCH_unwind(tdbb, true);
}
if (file != dbb->dbb_file) {
file = dbb->dbb_file;
@ -1060,7 +1061,7 @@ void CCH_fetch_page(
"IO error loop Unwind to avoid a hang\n");
PAGE_LOCK_RELEASE(bdb->bdb_lock);
dbb->backup_manager->unlock_state();
CCH_unwind(tdbb, TRUE);
CCH_unwind(tdbb, true);
}
}
#ifdef SUPERSERVER
@ -1081,7 +1082,7 @@ void CCH_fetch_page(
if (!dbb->backup_manager->read_difference(diff_page, page)) {
PAGE_LOCK_RELEASE(bdb->bdb_lock);
dbb->backup_manager->unlock_state();
CCH_unwind(tdbb, TRUE);
CCH_unwind(tdbb, true);
}
if (page->pag_type == pag_undefined) {
// Page was marked as allocated inside the difference file, but not really used
@ -1099,7 +1100,7 @@ void CCH_fetch_page(
if (!CCH_rollover_to_shadow(dbb, file, false)) {
PAGE_LOCK_RELEASE(bdb->bdb_lock);
dbb->backup_manager->unlock_state();
CCH_unwind(tdbb, TRUE);
CCH_unwind(tdbb, true);
}
if (file != dbb->dbb_file) {
file = dbb->dbb_file;
@ -1110,7 +1111,7 @@ void CCH_fetch_page(
"IO error loop Unwind to avoid a hang\n");
PAGE_LOCK_RELEASE(bdb->bdb_lock);
dbb->backup_manager->unlock_state();
CCH_unwind(tdbb, TRUE);
CCH_unwind(tdbb, true);
}
}
#ifdef SUPERSERVER
@ -1140,7 +1141,7 @@ void CCH_fetch_page(
/* We should invalidate this bad buffer. */
PAGE_LOCK_RELEASE(bdb->bdb_lock);
CCH_unwind(tdbb, TRUE);
CCH_unwind(tdbb, true);
}
#endif /* NO_CHECKSUM */
@ -1253,8 +1254,8 @@ void CCH_fini(TDBB tdbb)
while (QUE_NOT_EMPTY(bcb->bcb_free_lwt)) {
QUE que = bcb->bcb_free_lwt.que_forward;
QUE_DELETE((*que));
lwt* lwt_ = (LWT) BLOCK(que, LWT, lwt_waiters);
ISC_event_fini(&lwt_->lwt_event);
Latch_wait* lwt = (Latch_wait*) BLOCK(que, Latch_wait*, lwt_waiters);
ISC_event_fini(&lwt->lwt_event);
}
#endif
}
@ -1353,7 +1354,7 @@ void CCH_flush(TDBB tdbb, USHORT flush_flag, SLONG tra_number)
if (!write_buffer
(tdbb, bdb, bdb->bdb_page, write_thru, status, true))
{
CCH_unwind(tdbb, TRUE);
CCH_unwind(tdbb, true);
}
}
}
@ -1362,7 +1363,7 @@ void CCH_flush(TDBB tdbb, USHORT flush_flag, SLONG tra_number)
if (!write_buffer
(tdbb, bdb, bdb->bdb_page, false, status, true))
{
CCH_unwind(tdbb, TRUE);
CCH_unwind(tdbb, true);
}
}
#endif
@ -1434,7 +1435,7 @@ void CCH_flush(TDBB tdbb, USHORT flush_flag, SLONG tra_number)
}
BOOLEAN CCH_free_page(TDBB tdbb)
bool CCH_free_page(TDBB tdbb)
{
/**************************************
*
@ -1455,7 +1456,7 @@ BOOLEAN CCH_free_page(TDBB tdbb)
BCB bcb = dbb->dbb_bcb;
if (dbb->dbb_flags & DBB_read_only) {
return FALSE;
return false;
}
BDB bdb;
@ -1465,13 +1466,13 @@ BOOLEAN CCH_free_page(TDBB tdbb)
if (!write_buffer
(tdbb, bdb, bdb->bdb_page, true, tdbb->tdbb_status_vector, true))
{
CCH_unwind(tdbb, FALSE);
CCH_unwind(tdbb, false);
}
else
return TRUE;
return true;
}
return FALSE;
return false;
}
@ -1559,7 +1560,7 @@ PAG CCH_handoff(TDBB tdbb,
CCH_RELEASE(tdbb, &temp);
if (must_read) {
CCH_FETCH_PAGE(tdbb, window, TRUE, TRUE);
CCH_FETCH_PAGE(tdbb, window, TRUE, true);
}
BDB bdb = window->win_bdb;
@ -1695,7 +1696,7 @@ void CCH_init(TDBB tdbb, ULONG number)
ISC_event_init(event, 0, 0);
count = ISC_event_clear(event);
if (gds__thread_start
(reinterpret_cast < FPTR_INT_VOID_PTR > (cache_reader), dbb,
(reinterpret_cast<FPTR_INT_VOID_PTR>(cache_reader), dbb,
THREAD_high, 0, 0))
{
ERR_bugcheck_msg("cannot start thread");
@ -1714,7 +1715,7 @@ void CCH_init(TDBB tdbb, ULONG number)
count = ISC_event_clear(event);
if (gds__thread_start
(reinterpret_cast < FPTR_INT_VOID_PTR > (cache_writer), dbb,
(reinterpret_cast<FPTR_INT_VOID_PTR>(cache_writer), dbb,
THREAD_high, 0, 0))
{
ERR_bugcheck_msg("cannot start thread");
@ -1858,7 +1859,7 @@ void CCH_must_write(WIN * window)
LCK CCH_page_lock(TDBB tdbb)
lck* CCH_page_lock(TDBB tdbb)
{
/**************************************
*
@ -1980,7 +1981,7 @@ void CCH_prefetch(TDBB tdbb, SLONG * pages, SSHORT count)
}
BOOLEAN CCH_prefetch_pages(TDBB tdbb)
bool CCH_prefetch_pages(TDBB tdbb)
{
/**************************************
*
@ -1998,7 +1999,7 @@ BOOLEAN CCH_prefetch_pages(TDBB tdbb)
enabled. This is called by VIO/garbage_collector() when it
is idle to help satisfy the prefetch demand. */
return FALSE;
return false;
}
@ -2023,7 +2024,7 @@ void update_write_direction(TDBB tdbb, BDB bdb)
// so BDB AST handlers and write_page routine can safely use this information
if (!dbb->backup_manager->lock_state(true)) {
invalidate_and_release_buffer(tdbb, bdb);
CCH_unwind(tdbb, TRUE);
CCH_unwind(tdbb, true);
}
#ifndef SUPERSERVER
bdb->bdb_diff_generation = dbb->backup_manager->get_current_generation();
@ -2058,7 +2059,7 @@ void update_write_direction(TDBB tdbb, BDB bdb)
if (!dbb->backup_manager->lock_alloc(true)) {
dbb->backup_manager->unlock_state();
invalidate_and_release_buffer(tdbb, bdb);
CCH_unwind(tdbb, TRUE);
CCH_unwind(tdbb, true);
}
bdb->bdb_difference_page = dbb->backup_manager->get_page_index(bdb->bdb_page);
dbb->backup_manager->unlock_alloc();
@ -2066,14 +2067,14 @@ void update_write_direction(TDBB tdbb, BDB bdb)
if (!dbb->backup_manager->lock_alloc_write(true)) {
dbb->backup_manager->unlock_state();
invalidate_and_release_buffer(tdbb, bdb);
CCH_unwind(tdbb, TRUE);
CCH_unwind(tdbb, true);
}
bdb->bdb_difference_page = dbb->backup_manager->allocate_difference_page(bdb->bdb_page);
dbb->backup_manager->unlock_alloc_write();
if (!bdb->bdb_difference_page) {
dbb->backup_manager->unlock_state();
invalidate_and_release_buffer(tdbb, bdb);
CCH_unwind(tdbb, TRUE);
CCH_unwind(tdbb, true);
}
NBAK_TRACE(("Allocate difference page %d for database page %d",
bdb->bdb_difference_page, bdb->bdb_page));
@ -2087,7 +2088,7 @@ void update_write_direction(TDBB tdbb, BDB bdb)
if (!dbb->backup_manager->lock_alloc(true)) {
dbb->backup_manager->unlock_state();
invalidate_and_release_buffer(tdbb, bdb);
CCH_unwind(tdbb, TRUE);
CCH_unwind(tdbb, true);
}
bdb->bdb_difference_page = dbb->backup_manager->get_page_index(bdb->bdb_page);
dbb->backup_manager->unlock_alloc();
@ -2104,12 +2105,12 @@ void update_write_direction(TDBB tdbb, BDB bdb)
if (!set_write_direction(dbb, bdb, write_direction)) {
dbb->backup_manager->unlock_state();
invalidate_and_release_buffer(tdbb, bdb);
CCH_unwind(tdbb, TRUE);
CCH_unwind(tdbb, true);
}
dbb->backup_manager->unlock_state();
}
void CCH_release(TDBB tdbb, WIN * window, BOOLEAN release_tail)
void CCH_release(TDBB tdbb, WIN * window, bool release_tail)
{
/**************************************
*
@ -2119,7 +2120,7 @@ void CCH_release(TDBB tdbb, WIN * window, BOOLEAN release_tail)
*
* Functional description
* Release a window. If the release_tail
* flag is TRUE then make the buffer
* flag is true then make the buffer
* least-recently-used.
*
**************************************/
@ -2169,7 +2170,7 @@ void CCH_release(TDBB tdbb, WIN * window, BOOLEAN release_tail)
true))
{
btc_insert(dbb, bdb); /* Don't lose track of must_write */
CCH_unwind(tdbb, TRUE);
CCH_unwind(tdbb, true);
}
}
#ifndef PAGE_LATCHING
@ -2189,7 +2190,7 @@ void CCH_release(TDBB tdbb, WIN * window, BOOLEAN release_tail)
LCK_convert_opt(tdbb, bdb->bdb_lock,
bdb->bdb_lock->lck_logical);
CCH_unwind(tdbb, TRUE);
CCH_unwind(tdbb, true);
}
}
@ -2212,13 +2213,11 @@ void CCH_release(TDBB tdbb, WIN * window, BOOLEAN release_tail)
bdb->bdb_flags & BDB_garbage_collect &&
!(bdb->bdb_scan_count)))
{
BCB bcb;
if (window->win_flags & WIN_garbage_collector)
{
bdb->bdb_flags &= ~BDB_garbage_collect;
}
bcb = dbb->dbb_bcb;
BCB bcb = dbb->dbb_bcb;
QUE_LEAST_RECENTLY_USED(bdb->bdb_in_use);
bdb->bdb_sequence = 0;
#ifdef CACHE_WRITER
@ -2279,7 +2278,7 @@ void CCH_release_exclusive(TDBB tdbb)
}
bool CCH_rollover_to_shadow(DBB dbb, FIL file, const bool inAst)
bool CCH_rollover_to_shadow(DBB dbb, jrd_file* file, const bool inAst)
{
/**************************************
*
@ -2335,7 +2334,7 @@ void CCH_shutdown_database(DBB dbb)
#endif
}
void CCH_unwind(TDBB tdbb, BOOLEAN punt)
void CCH_unwind(TDBB tdbb, bool punt)
{
/**************************************
*
@ -2431,7 +2430,7 @@ void CCH_unwind(TDBB tdbb, BOOLEAN punt)
}
BOOLEAN CCH_validate(WIN * window)
bool CCH_validate(WIN * window)
{
/**************************************
*
@ -2448,22 +2447,22 @@ BOOLEAN CCH_validate(WIN * window)
/* If page is marked for write, checksum is questionable */
if ((bdb->bdb_flags & (BDB_dirty | BDB_db_dirty))) {
return TRUE;
return true;
}
pag* page = window->win_buffer;
const USHORT sum = CCH_checksum(bdb);
if (sum == page->pag_checksum) {
return TRUE;
return true;
}
return FALSE;
return false;
}
bool CCH_write_all_shadows(TDBB tdbb,
SDW shadow,
Shadow* shadow,
BDB bdb,
ISC_STATUS* status, USHORT checksum,
const bool inAst)
@ -2484,7 +2483,7 @@ bool CCH_write_all_shadows(TDBB tdbb,
SET_TDBB(tdbb);
DBB dbb = tdbb->tdbb_database;
SDW sdw = shadow ? shadow : dbb->dbb_shadow;
Shadow* sdw = shadow ? shadow : dbb->dbb_shadow;
if (!sdw) {
return true;
@ -2542,8 +2541,8 @@ bool CCH_write_all_shadows(TDBB tdbb,
if (bdb->bdb_page == HEADER_PAGE) {
/* fixup header for shadow file */
fil* shadow_file = sdw->sdw_file;
hdr* header = (HDR) page;
jrd_file* shadow_file = sdw->sdw_file;
header_page* header = (header_page*) page;
const UCHAR* q = (UCHAR *) dbb->dbb_file->fil_string;
header->hdr_data[0] = HDR_end;
header->hdr_end = HDR_SIZE;
@ -2552,7 +2551,7 @@ bool CCH_write_all_shadows(TDBB tdbb,
PAG_add_header_entry(header, HDR_root_file_name,
(USHORT) strlen((const char*) q), q);
fil* next_file = shadow_file->fil_next;
jrd_file* next_file = shadow_file->fil_next;
if (next_file) {
q = (UCHAR *) next_file->fil_string;
const SLONG last = next_file->fil_min_page - 1;
@ -2590,7 +2589,7 @@ bool CCH_write_all_shadows(TDBB tdbb,
if (!inAst && SDW_check_conditional()) {
if (SDW_lck_update((SLONG) 0)) {
SDW_notify();
CCH_unwind(tdbb, FALSE);
CCH_unwind(tdbb, false);
SDW_dump_pages();
ERR_post(isc_deadlock, 0);
}
@ -2652,7 +2651,7 @@ static BDB alloc_bdb(TDBB tdbb, BCB bcb, UCHAR** memory)
throw;
}
lock->lck_ast = blocking_ast_bdb;
lock->lck_object = reinterpret_cast<blk*>(bdb_);
lock->lck_object = bdb_;
#endif
bdb_->bdb_buffer = (pag*) *memory;
@ -2853,7 +2852,7 @@ static void btc_flush(
(!transaction_mask && !sys_only) || (!bdb->bdb_transactions))
{
if (!write_buffer(tdbb, bdb, page, false, status, true)) {
CCH_unwind(tdbb, TRUE);
CCH_unwind(tdbb, true);
}
}
@ -3329,7 +3328,8 @@ static void THREAD_ROUTINE cache_writer(DBB dbb)
JRD_reschedule(tdbb, 0, true);
}
#ifdef CACHE_READER
else if (SBM_next(bcb->bcb_prefetch, &starting_page, RSE_get_forward)) {
else if (SBM_next(bcb->bcb_prefetch, &starting_page, RSE_get_forward))
{
/* Prefetch some pages in our spare time and in the process
garbage collect the prefetch bitmap. */
prf prefetch;
@ -3454,7 +3454,7 @@ static void check_precedence(TDBB tdbb, WIN * window, SLONG page)
if (!write_buffer
(tdbb, high, high_page, false, tdbb->tdbb_status_vector, true))
{
CCH_unwind(tdbb, TRUE);
CCH_unwind(tdbb, true);
}
return;
}
@ -3473,7 +3473,7 @@ static void check_precedence(TDBB tdbb, WIN * window, SLONG page)
if (!write_buffer
(tdbb, low, low_page, false, tdbb->tdbb_status_vector, true))
{
CCH_unwind(tdbb, TRUE);
CCH_unwind(tdbb, true);
}
PRE_MUTEX_ACQUIRE;
}
@ -3484,12 +3484,12 @@ static void check_precedence(TDBB tdbb, WIN * window, SLONG page)
bcb = dbb->dbb_bcb; /* Re-initialize */
pre* precedence = bcb->bcb_free;
Precedence* precedence = bcb->bcb_free;
if (precedence) {
bcb->bcb_free = (PRE) precedence->pre_hi;
bcb->bcb_free = (Precedence*) precedence->pre_hi;
}
else {
precedence = FB_NEW(*dbb->dbb_bufferpool) pre;
precedence = FB_NEW(*dbb->dbb_bufferpool) Precedence;
}
precedence->pre_low = low;
@ -3524,7 +3524,7 @@ static void clear_precedence(DBB dbb, BDB bdb)
while (QUE_NOT_EMPTY(bdb->bdb_lower)) {
QUE que = bdb->bdb_lower.que_forward;
pre* precedence = BLOCK(que, PRE, pre_lower);
Precedence* precedence = BLOCK(que, Precedence*, pre_lower);
BDB low_bdb = precedence->pre_low;
QUE_DELETE(precedence->pre_higher);
QUE_DELETE(precedence->pre_lower);
@ -3641,7 +3641,7 @@ static void down_grade(TDBB tdbb, BDB bdb)
for (que = bdb->bdb_higher.que_forward; que != &bdb->bdb_higher;
que = que->que_forward)
{
pre* precedence = BLOCK(que, PRE, pre_higher);
Precedence* precedence = BLOCK(que, Precedence*, pre_higher);
if (precedence->pre_flags & PRE_cleared)
continue;
if (invalid) {
@ -3701,7 +3701,7 @@ static void down_grade(TDBB tdbb, BDB bdb)
for (que = bdb->bdb_lower.que_forward; que != &bdb->bdb_lower;
que = que->que_forward)
{
pre* precedence = BLOCK(que, PRE, pre_lower);
Precedence* precedence = BLOCK(que, Precedence*, pre_lower);
BDB blocking_bdb = precedence->pre_low;
if (bdb->bdb_flags & BDB_not_valid)
blocking_bdb->bdb_flags |= BDB_not_valid;
@ -4088,7 +4088,7 @@ static BDB get_buffer(TDBB tdbb, SLONG page, LATCH latch, SSHORT latch_wait)
{
bdb->bdb_flags &= ~BDB_free_pending;
release_bdb(tdbb, bdb, false, false, false);
CCH_unwind(tdbb, TRUE);
CCH_unwind(tdbb, true);
}
}
@ -4115,7 +4115,7 @@ static BDB get_buffer(TDBB tdbb, SLONG page, LATCH latch, SSHORT latch_wait)
PRE_MUTEX_ACQUIRE;
while (QUE_NOT_EMPTY(bdb->bdb_higher)) {
QUE que2 = bdb->bdb_higher.que_forward;
pre* precedence = BLOCK(que2, PRE, pre_higher);
Precedence* precedence = BLOCK(que2, Precedence*, pre_higher);
QUE_DELETE(precedence->pre_higher);
QUE_DELETE(precedence->pre_lower);
precedence->pre_hi = (BDB) bcb->bcb_free;
@ -4332,38 +4332,38 @@ static SSHORT latch_bdb(
DBB dbb = tdbb->tdbb_database;
BCB bcb = dbb->dbb_bcb;
LWT lwt_;
Latch_wait* lwt;
if (QUE_NOT_EMPTY(bcb->bcb_free_lwt)) {
QUE que = bcb->bcb_free_lwt.que_forward;
QUE_DELETE((*que));
lwt_ = (LWT) BLOCK(que, LWT, lwt_waiters);
lwt = (Latch_wait*) BLOCK(que, Latch_wait*, lwt_waiters);
}
else {
lwt_ = FB_NEW(*dbb->dbb_bufferpool) lwt;
QUE_INIT(lwt_->lwt_waiters);
ISC_event_init(&lwt_->lwt_event, 0, 0);
lwt = FB_NEW(*dbb->dbb_bufferpool) Latch_wait;
QUE_INIT(lwt->lwt_waiters);
ISC_event_init(&lwt->lwt_event, 0, 0);
}
lwt_->lwt_flags |= LWT_pending;
lwt_->lwt_latch = type;
lwt_->lwt_tdbb = tdbb;
lwt->lwt_flags |= LWT_pending;
lwt->lwt_latch = type;
lwt->lwt_tdbb = tdbb;
/* Give priority to IO. This might prevent deadlocks while performing
precedence writes. This does not cause starvation because an
exclusive latch is needed to dirty the page again. */
if ((type == LATCH_io) || (type == LATCH_mark)) {
QUE_INSERT(bdb->bdb_waiters, lwt_->lwt_waiters)
QUE_INSERT(bdb->bdb_waiters, lwt->lwt_waiters)
}
else {
QUE_APPEND(bdb->bdb_waiters, lwt_->lwt_waiters);
QUE_APPEND(bdb->bdb_waiters, lwt->lwt_waiters);
}
event_t* event = &lwt_->lwt_event;
event_t* event = &lwt->lwt_event;
int timeout_occurred = FALSE;
/* Loop until the latch is granted or until a timeout occurrs. */
for (SLONG count = ISC_event_clear(event);
((lwt_->lwt_flags & LWT_pending) && !timeout_occurred);
((lwt->lwt_flags & LWT_pending) && !timeout_occurred);
count = ISC_event_clear(event))
{
LATCH_MUTEX_RELEASE;
@ -4382,15 +4382,15 @@ static SSHORT latch_bdb(
}
bcb = dbb->dbb_bcb; /* Re-initialize */
QUE_DELETE(lwt_->lwt_waiters);
QUE_INSERT(bcb->bcb_free_lwt, lwt_->lwt_waiters);
QUE_DELETE(lwt->lwt_waiters);
QUE_INSERT(bcb->bcb_free_lwt, lwt->lwt_waiters);
/* If the latch is not granted then a timeout must have occurred. */
if ((lwt_->lwt_flags & LWT_pending) && timeout_occurred) {
if ((lwt->lwt_flags & LWT_pending) && timeout_occurred) {
LATCH_MUTEX_RELEASE;
if (latch_wait == 1) {
IBERR_build_status(tdbb->tdbb_status_vector, isc_deadlock, 0);
CCH_unwind(tdbb, TRUE);
CCH_unwind(tdbb, true);
}
else {
return 1;
@ -4478,7 +4478,8 @@ static SSHORT lock_buffer(
DBB dbb = tdbb->tdbb_database;
if (dbb->dbb_refresh_ranges && bdb->bdb_flags & BDB_writer &&
(page_type == pag_data || page_type == pag_index)) {
(page_type == pag_data || page_type == pag_index))
{
/* This gives refresh cache ranges the potential to work with page
* latching by taking out a temporary page lock for notification
* purposes.
@ -4522,7 +4523,7 @@ static SSHORT lock_buffer(
if (page_type == pag_header || page_type == pag_transactions) {
fb_assert(lock->lck_ast == blocking_ast_bdb);
fb_assert(lock->lck_object == reinterpret_cast<blk*>(bdb));
fb_assert(lock->lck_object == bdb);
lock->lck_ast = 0;
lock->lck_object = NULL;
}
@ -4540,7 +4541,7 @@ static SSHORT lock_buffer(
fb_assert(page_type == pag_header
|| page_type == pag_transactions);
lock->lck_ast = blocking_ast_bdb;
lock->lck_object = reinterpret_cast<blk*>(bdb);
lock->lck_object = bdb;
bdb->bdb_flags |= BDB_no_blocking_ast;
}
return 1;
@ -4576,7 +4577,7 @@ static SSHORT lock_buffer(
/* CCH_unwind releases all the bdb's and calls ERR_punt()
ERR_punt will longjump. */
CCH_unwind(tdbb, TRUE);
CCH_unwind(tdbb, true);
}
/* Lock requires an upward conversion. Sigh. Try to get the conversion.
@ -4622,7 +4623,7 @@ static SSHORT lock_buffer(
ERR_cstring(errmsg), 0);
ERR_log(JRD_BUGCHK, 216, errmsg); /* msg 216 page %ld, page type %ld lock denied */
CCH_unwind(tdbb, TRUE);
CCH_unwind(tdbb, true);
return 0; /* Added to get rid of Compiler Warning */
#endif
}
@ -4758,12 +4759,12 @@ static void page_validation_error(TDBB tdbb, WIN * window, SSHORT type)
isc_arg_number, (SLONG) type,
isc_arg_number, (SLONG) page->pag_type, 0);
/* We should invalidate this bad buffer. */
CCH_unwind(tdbb, TRUE);
CCH_unwind(tdbb, true);
}
#ifdef CACHE_READER
static void prefetch_epilogue(PRF prefetch, ISC_STATUS * status_vector)
static void prefetch_epilogue(Prefetch* prefetch, ISC_STATUS* status_vector)
{
/**************************************
*
@ -4784,7 +4785,7 @@ static void prefetch_epilogue(PRF prefetch, ISC_STATUS * status_vector)
THREAD_EXIT;
prefetch->prf_piob.piob_wait = TRUE;
const ISC_STATUS status = PIO_status(&prefetch->prf_piob, status_vector);
const bool async_status = PIO_status(&prefetch->prf_piob, status_vector);
THREAD_ENTER;
/* If there was an I/O error release all buffer latches acquired
@ -4793,7 +4794,7 @@ static void prefetch_epilogue(PRF prefetch, ISC_STATUS * status_vector)
TDBB tdbb = prefetch->prf_tdbb;
DBB dbb = tdbb->tdbb_database;
if (status == FALSE) {
if (!async_status) {
BDB* next_bdb = prefetch->prf_bdbs;
for (USHORT i = 0; i < prefetch->prf_max_prefetch; i++) {
if (*next_bdb) {
@ -4829,7 +4830,7 @@ static void prefetch_epilogue(PRF prefetch, ISC_STATUS * status_vector)
}
static void prefetch_init(PRF prefetch, TDBB tdbb)
static void prefetch_init(Prefetch* prefetch, TDBB tdbb)
{
/**************************************
*
@ -4855,7 +4856,7 @@ static void prefetch_init(PRF prefetch, TDBB tdbb)
}
static void prefetch_io(PRF prefetch, ISC_STATUS * status_vector)
static void prefetch_io(Prefetch* prefetch, ISC_STATUS* status_vector)
{
/**************************************
*
@ -4882,12 +4883,12 @@ static void prefetch_io(PRF prefetch, ISC_STATUS * status_vector)
}
THREAD_EXIT;
const ISC_STATUS status =
const bool async_status =
PIO_read_ahead(dbb, prefetch->prf_start_page,
prefetch->prf_io_buffer, prefetch->prf_page_count,
&prefetch->prf_piob, status_vector);
THREAD_ENTER;
if (status == FALSE) {
if (!async_status) {
BDB* next_bdb = prefetch->prf_bdbs;
for (USHORT i = 0; i < prefetch->prf_max_prefetch; i++) {
if (*next_bdb) {
@ -4901,7 +4902,7 @@ static void prefetch_io(PRF prefetch, ISC_STATUS * status_vector)
}
static void prefetch_prologue(PRF prefetch, SLONG* start_page)
static void prefetch_prologue(Prefetch* prefetch, SLONG* start_page)
{
/**************************************
*
@ -4979,7 +4980,7 @@ static SSHORT related(BDB low, BDB high, SSHORT limit)
if (!--limit) {
return PRE_UNKNOWN;
}
pre* precedence = BLOCK(que, PRE, pre_higher);
Precedence* precedence = BLOCK(que, Precedence*, pre_higher);
if (!(precedence->pre_flags & PRE_cleared)) {
if (precedence->pre_hi == high) {
return PRE_EXISTS;
@ -5105,9 +5106,9 @@ static void release_bdb(
{
/* Note that this loop assumes that requests for LATCH_io and LATCH_mark
are queued before LATCH_shared and LATCH_exclusive. */
LWT lwt_ = BLOCK(que, LWT, lwt_waiters);
if (lwt_->lwt_flags & LWT_pending) {
switch (lwt_->lwt_latch) {
Latch_wait* lwt = BLOCK(que, Latch_wait*, lwt_waiters);
if (lwt->lwt_flags & LWT_pending) {
switch (lwt->lwt_latch) {
case LATCH_exclusive:
if (bdb->bdb_use_count) {
LATCH_MUTEX_RELEASE;
@ -5115,9 +5116,9 @@ static void release_bdb(
}
else {
++bdb->bdb_use_count;
bdb->bdb_exclusive = lwt_->lwt_tdbb;
lwt_->lwt_flags &= ~LWT_pending;
ISC_event_post(&lwt_->lwt_event);
bdb->bdb_exclusive = lwt->lwt_tdbb;
lwt->lwt_flags &= ~LWT_pending;
ISC_event_post(&lwt->lwt_event);
LATCH_MUTEX_RELEASE;
return;
}
@ -5128,24 +5129,24 @@ static void release_bdb(
}
else {
++bdb->bdb_use_count;
bdb->bdb_io = lwt_->lwt_tdbb;
lwt_->lwt_flags &= ~LWT_pending;
ISC_event_post(&lwt_->lwt_event);
bdb->bdb_io = lwt->lwt_tdbb;
lwt->lwt_flags &= ~LWT_pending;
ISC_event_post(&lwt->lwt_event);
granted = true;
break;
}
case LATCH_mark:
if (bdb->bdb_exclusive != lwt_->lwt_tdbb) {
if (bdb->bdb_exclusive != lwt->lwt_tdbb) {
cache_bugcheck(298); /* missing exclusive latch */
}
if (bdb->bdb_io) {
break;
}
else {
bdb->bdb_io = lwt_->lwt_tdbb;
lwt_->lwt_flags &= ~LWT_pending;
ISC_event_post(&lwt_->lwt_event);
bdb->bdb_io = lwt->lwt_tdbb;
lwt->lwt_flags &= ~LWT_pending;
ISC_event_post(&lwt->lwt_event);
granted = true;
break;
}
@ -5163,9 +5164,9 @@ static void release_bdb(
break;
}
++bdb->bdb_use_count;
bdb->bdb_shared[i] = lwt_->lwt_tdbb;
lwt_->lwt_flags &= ~LWT_pending;
ISC_event_post(&lwt_->lwt_event);
bdb->bdb_shared[i] = lwt->lwt_tdbb;
lwt->lwt_flags &= ~LWT_pending;
ISC_event_post(&lwt->lwt_event);
granted = true;
break;
}
@ -5286,7 +5287,7 @@ static bool writeable(const bdb* bdblock)
for (const que* queue = bdblock->bdb_higher.que_forward;
queue != &bdblock->bdb_higher; queue = queue->que_forward)
{
const pre* precedence = BLOCK(queue, PRE, pre_higher);
const Precedence* precedence = BLOCK(queue, Precedence*, pre_higher);
if (!(precedence->pre_flags & PRE_cleared) &&
!writeable(precedence->pre_hi))
{
@ -5303,7 +5304,7 @@ static int write_buffer(
BDB bdb,
SLONG page,
const bool write_thru,
ISC_STATUS * status, const bool write_this_page)
ISC_STATUS* status, const bool write_this_page)
{
/**************************************
*
@ -5361,7 +5362,7 @@ static int write_buffer(
while (QUE_NOT_EMPTY(bdb->bdb_higher)) {
BCB bcb = dbb->dbb_bcb; /* Re-initialize in the loop */
QUE que = bdb->bdb_higher.que_forward;
pre* precedence = BLOCK(que, PRE, pre_higher);
Precedence* precedence = BLOCK(que, Precedence*, pre_higher);
if (precedence->pre_flags & PRE_cleared) {
QUE_DELETE(precedence->pre_higher);
QUE_DELETE(precedence->pre_lower);
@ -5472,7 +5473,7 @@ static bool write_page(
/* Before writing db header page, make sure that the next_transaction > oldest_active
transaction */
if (bdb->bdb_page == HEADER_PAGE) {
HDR header = (HDR) page;
header_page* header = (header_page*) page;
if (header->hdr_next_transaction) {
if (header->hdr_oldest_active > header->hdr_next_transaction) {
BUGCHECK(266); /*next transaction older than oldest active */
@ -5536,7 +5537,7 @@ static bool write_page(
// We finished. Adjust transaction accounting and get ready for exit
if (bdb->bdb_page == HEADER_PAGE) {
dbb->dbb_last_header_write =
((HDR) page)->hdr_next_transaction;
((header_page*) page)->hdr_next_transaction;
}
set_write_direction(dbb, bdb, BDB_write_undefined);
}
@ -5545,7 +5546,7 @@ static bool write_page(
#ifdef SUPERSERVER
THREAD_EXIT;
#endif
fil* file = dbb->dbb_file;
jrd_file* file = dbb->dbb_file;
while (!PIO_write(file, bdb, page, status)) {
#ifdef SUPERSERVER
THREAD_ENTER;
@ -5566,7 +5567,7 @@ static bool write_page(
#endif
if (bdb->bdb_page == HEADER_PAGE) {
dbb->dbb_last_header_write =
((HDR) page)->hdr_next_transaction;
((header_page*) page)->hdr_next_transaction;
}
if (dbb->dbb_shadow) {
result =

View File

@ -26,6 +26,9 @@
#include "../include/fb_blk.h"
class lck;
class Precedence;
/* Page buffer cache size constraints. */
#define MIN_PAGE_BUFFERS 50L
@ -41,11 +44,11 @@
class bcb : public pool_alloc_rpt<bcb_repeat, type_bcb>
{
public:
struct lls* bcb_memory; /* Large block partitioned into buffers */
class lls* bcb_memory; /* Large block partitioned into buffers */
struct que bcb_in_use; /* Que of buffers in use */
struct que bcb_empty; /* Que of empty buffers */
class bdb* bcb_btree; /* root of dirty page btree */
struct pre* bcb_free; /* Free precedence blocks */
Precedence* bcb_free; /* Free precedence blocks */
struct que bcb_free_lwt; /* Free latch wait blocks */
SSHORT bcb_flags; /* see below */
SSHORT bcb_free_minimum; /* Threshold to activate cache writer */
@ -72,8 +75,8 @@ typedef bcb *BCB;
class bdb : public pool_alloc<type_bdb>
{
public:
struct dbb* bdb_dbb; /* Database block (for ASTs) */
struct lck* bdb_lock; /* Lock block for buffer */
class dbb* bdb_dbb; /* Database block (for ASTs) */
lck* bdb_lock; /* Lock block for buffer */
struct que bdb_que; /* Buffer que */
struct que bdb_in_use; /* queue of buffers in use */
struct pag* bdb_buffer; /* Actual buffer */
@ -138,7 +141,7 @@ typedef bdb *BDB;
/* PRE -- Precedence block */
class pre : public pool_alloc<type_pre>
class Precedence : public pool_alloc<type_pre>
{
public:
bdb* pre_hi;
@ -147,7 +150,6 @@ class pre : public pool_alloc<type_pre>
struct que pre_higher;
SSHORT pre_flags;
};
typedef pre *PRE;
#define PRE_cleared 1
@ -188,7 +190,7 @@ typedef enum
/* LWT -- Latch wait block */
class lwt : public pool_alloc<type_lwt>
class Latch_wait : public pool_alloc<type_lwt>
{
public:
struct tdbb* lwt_tdbb;
@ -197,7 +199,6 @@ class lwt : public pool_alloc<type_lwt>
struct event_t lwt_event; /* grant event to wait on */
USHORT lwt_flags;
};
typedef lwt *LWT;
#define LWT_pending 1 /* latch request is pending */
@ -210,22 +211,22 @@ typedef lwt *LWT;
/* Prefetch block */
class prf : public pool_alloc<type_prf>
class Prefetch : public pool_alloc<type_prf>
{
public:
struct tdbb*prf_tdbb; /* thread database context */
SLONG prf_start_page; /* starting page of multipage prefetch */
USHORT prf_max_prefetch; /* maximum no. of pages to prefetch */
USHORT prf_page_count; /* actual no. of pages being prefetched */
struct piob prf_piob; /* physical I/O status block */
phys_io_blk prf_piob; /* physical I/O status block */
SCHAR* prf_aligned_buffer; /* buffer address aligned for raw (OS cache bypass) I/O */
SCHAR* prf_io_buffer; /* I/O buffer address */
UCHAR prf_flags;
bdb* prf_bdbs[PREFETCH_MAX_TRANSFER / MIN_PAGE_SIZE];
SCHAR prf_unaligned_buffer[PREFETCH_MAX_TRANSFER + MIN_PAGE_SIZE];
};
typedef prf *PRF;
#define PRF_active 1 /* prefetch block currently in use */
#endif /* JRD_CCH_H */
#endif // JRD_CCH_H

View File

@ -28,16 +28,16 @@ void CCH_shutdown_database(dbb*);
USHORT CCH_checksum(bdb*);
int CCH_down_grade_dbb(void* ast_argument);
BOOLEAN CCH_exclusive(TDBB, USHORT, SSHORT);
BOOLEAN CCH_exclusive_attachment(TDBB, USHORT, SSHORT);
bool CCH_exclusive(TDBB, USHORT, SSHORT);
bool CCH_exclusive_attachment(TDBB, USHORT, SSHORT);
void CCH_expand(TDBB, ULONG);
pag* CCH_fake(TDBB, win*, SSHORT);
pag* CCH_fetch(TDBB, win*, USHORT, SSHORT, SSHORT, SSHORT, BOOLEAN);
pag* CCH_fetch(TDBB, win*, USHORT, SSHORT, SSHORT, SSHORT, bool);
SSHORT CCH_fetch_lock(TDBB, win*, USHORT, SSHORT, SSHORT, SSHORT);
void CCH_fetch_page(TDBB, win*, SSHORT, BOOLEAN);
void CCH_fetch_page(TDBB, win*, SSHORT, bool);
void CCH_fini(TDBB);
void CCH_flush(TDBB, USHORT, SLONG);
BOOLEAN CCH_free_page(TDBB);
bool CCH_free_page(TDBB);
SLONG CCH_get_incarnation(win*);
pag* CCH_handoff(TDBB, win*, SLONG, SSHORT, SSHORT, SSHORT, SSHORT);
void CCH_init(TDBB, ULONG);
@ -47,27 +47,27 @@ void CCH_must_write(win*);
lck* CCH_page_lock(TDBB);
void CCH_precedence(TDBB, win*, SLONG);
void CCH_prefetch(tdbb*, SLONG*, SSHORT);
BOOLEAN CCH_prefetch_pages(TDBB);
void CCH_release(TDBB, win*, BOOLEAN);
bool CCH_prefetch_pages(TDBB);
void CCH_release(TDBB, win*, bool);
void CCH_release_and_free(win*);
void CCH_release_exclusive(TDBB);
bool CCH_rollover_to_shadow(dbb*, fil*, const bool);
void CCH_unwind(TDBB, BOOLEAN);
BOOLEAN CCH_validate(win*);
bool CCH_rollover_to_shadow(dbb*, jrd_file*, const bool);
void CCH_unwind(TDBB, bool);
bool CCH_validate(win*);
void CCH_flush_database(TDBB tdbb);
bool CCH_write_all_shadows(TDBB, sdw*, bdb*,
bool CCH_write_all_shadows(TDBB, Shadow*, bdb*,
ISC_STATUS*, USHORT, const bool);
/* macros for dealing with cache pages */
#define CCH_FETCH(tdbb, window, lock, type) CCH_fetch (tdbb, window, lock, type, 1, 1, 1)
#define CCH_FETCH_NO_SHADOW(tdbb, window, lock, type) CCH_fetch (tdbb, window, lock, type, 1, 1, 0)
#define CCH_FETCH_NO_CHECKSUM(tdbb, window, lock, type) CCH_fetch (tdbb, window, lock, type, 0, 1, 1)
#define CCH_FETCH_TIMEOUT(tdbb, window, lock, type, latch_wait) CCH_fetch (tdbb, window, lock, type, 0, latch_wait, 1)
#define CCH_FETCH(tdbb, window, lock, type) CCH_fetch (tdbb, window, lock, type, 1, 1, true)
#define CCH_FETCH_NO_SHADOW(tdbb, window, lock, type) CCH_fetch (tdbb, window, lock, type, 1, 1, false)
#define CCH_FETCH_NO_CHECKSUM(tdbb, window, lock, type) CCH_fetch (tdbb, window, lock, type, 0, 1, true)
#define CCH_FETCH_TIMEOUT(tdbb, window, lock, type, latch_wait) CCH_fetch (tdbb, window, lock, type, 0, latch_wait, true)
#define CCH_FETCH_LOCK(tdbb, window, lock, wait, latch_wait, type) CCH_fetch_lock (tdbb, window, lock, wait, latch_wait, type)
#define CCH_FETCH_PAGE(tdbb, window, checksum, read_shadow) CCH_fetch_page (tdbb, window, checksum, read_shadow)
#define CCH_RELEASE(tdbb, window) CCH_release (tdbb, window, FALSE)
#define CCH_RELEASE_TAIL(tdbb, window) CCH_release (tdbb, window, TRUE)
#define CCH_RELEASE(tdbb, window) CCH_release (tdbb, window, false)
#define CCH_RELEASE_TAIL(tdbb, window) CCH_release (tdbb, window, true)
#define CCH_MARK(tdbb, window) CCH_mark (tdbb, window, 0)
#define CCH_MARK_SYSTEM(tdbb, window) CCH_mark (tdbb, window, 1)
#define CCH_HANDOFF(tdbb, window, page, lock, type) CCH_handoff (tdbb, window, page, lock, type, 1, 0)

View File

@ -139,7 +139,7 @@ static void pass1_modify(TDBB, Csb*, jrd_nod*);
static RSE pass1_rse(TDBB, Csb*, RSE, jrd_rel*, USHORT);
static void pass1_source(TDBB, Csb*, RSE, jrd_nod*, jrd_nod**, LLS *, jrd_rel*, USHORT);
static jrd_nod* pass1_store(TDBB, Csb*, jrd_nod*);
static jrd_nod* pass1_update(TDBB, Csb*, jrd_rel*, TRIG_VEC, USHORT, USHORT, USHORT, jrd_rel*,
static jrd_nod* pass1_update(TDBB, Csb*, jrd_rel*, trig_vec*, USHORT, USHORT, USHORT, jrd_rel*,
USHORT);
static jrd_nod* pass2(TDBB, Csb*, jrd_nod* const, jrd_nod*);
static void pass2_rse(TDBB, Csb*, RSE);
@ -148,7 +148,7 @@ static void plan_check(Csb*, RSE);
static void plan_set(Csb*, RSE, jrd_nod*);
static void post_procedure_access(TDBB, Csb*, jrd_prc*);
static Rsb* post_rse(TDBB, Csb*, RSE);
static void post_trigger_access(TDBB, Csb*, jrd_rel*, TRIG_VEC, jrd_rel*);
static void post_trigger_access(TDBB, Csb*, jrd_rel*, trig_vec*, jrd_rel*);
static void process_map(TDBB, Csb*, jrd_nod*, fmt**);
static bool stream_in_rse(USHORT, RSE);
static SSHORT strcmp_space(const TEXT*, const TEXT*);
@ -1834,7 +1834,7 @@ jrd_req* CMP_make_request(TDBB tdbb, Csb* csb)
ptr < end; ptr++)
{
VarInvariantArray** var_invariants;
switch((*ptr)->nod_type) {
switch ((*ptr)->nod_type) {
case nod_argument:
{
jrd_nod* msg = (*ptr)->nod_arg[e_arg_message];
@ -1877,18 +1877,18 @@ jrd_req* CMP_make_request(TDBB tdbb, Csb* csb)
// a little complicated since relation locks MUST be taken before
// index locks.
for (RSC resource = request->req_resources; resource;
for (Resource* resource = request->req_resources; resource;
resource = resource->rsc_next)
{
switch (resource->rsc_type)
{
case rsc_relation:
case Resource::rsc_relation:
{
jrd_rel* relation = resource->rsc_rel;
MET_post_existence(tdbb, relation);
break;
}
case rsc_index:
case Resource::rsc_index:
{
jrd_rel* relation = resource->rsc_rel;
IDL index =
@ -1906,7 +1906,7 @@ jrd_req* CMP_make_request(TDBB tdbb, Csb* csb)
}
break;
}
case rsc_procedure:
case Resource::rsc_procedure:
{
jrd_prc* procedure = resource->rsc_prc;
procedure->prc_use_count++;
@ -2050,9 +2050,9 @@ void CMP_post_access(TDBB tdbb,
void CMP_post_resource(TDBB tdbb,
RSC * rsc_ptr,
Resource** rsc_ptr,
BLK rel_or_prc,
enum rsc_s type,
enum Resource::rsc_s type,
USHORT id)
{
/**************************************
@ -2069,23 +2069,23 @@ void CMP_post_resource(TDBB tdbb,
SET_TDBB(tdbb);
RSC resource;
Resource* resource;
for (resource = *rsc_ptr; resource; resource = resource->rsc_next) {
if (resource->rsc_type == type && resource->rsc_id == id)
return;
}
resource = FB_NEW(*tdbb->tdbb_default) Rsc;
resource = FB_NEW(*tdbb->tdbb_default) Resource;
resource->rsc_next = *rsc_ptr;
*rsc_ptr = resource;
resource->rsc_type = type;
resource->rsc_id = id;
switch (type) {
case rsc_relation:
case rsc_index:
case Resource::rsc_relation:
case Resource::rsc_index:
resource->rsc_rel = (jrd_rel*) rel_or_prc;
break;
case rsc_procedure:
case Resource::rsc_procedure:
resource->rsc_prc = (jrd_prc*) rel_or_prc;
break;
default:
@ -2095,7 +2095,7 @@ void CMP_post_resource(TDBB tdbb,
}
void CMP_release_resource(RSC * rsc_ptr, enum rsc_s type, USHORT id)
void CMP_release_resource(Resource** rsc_ptr, enum Resource::rsc_s type, USHORT id)
{
/**************************************
*
@ -2109,7 +2109,7 @@ void CMP_release_resource(RSC * rsc_ptr, enum rsc_s type, USHORT id)
**************************************/
DEV_BLKCHK(*rsc_ptr, type_rsc);
RSC resource;
Resource* resource;
for (; (resource = *rsc_ptr); rsc_ptr = &resource->rsc_next) {
if (resource->rsc_type == type && resource->rsc_id == id)
break;
@ -2198,17 +2198,17 @@ void CMP_release(TDBB tdbb, jrd_req* request)
att* attachment = request->req_attachment;
if (!attachment || !(attachment->att_flags & ATT_shutdown)) {
for (Rsc* resource = request->req_resources;
for (Resource* resource = request->req_resources;
resource; resource = resource->rsc_next)
{
switch (resource->rsc_type) {
case rsc_relation:
case Resource::rsc_relation:
{
jrd_rel* relation = resource->rsc_rel;
MET_release_existence(relation);
break;
}
case rsc_index:
case Resource::rsc_index:
{
jrd_rel* relation = resource->rsc_rel;
idl* index = CMP_get_index_lock(tdbb, relation,
@ -2221,7 +2221,7 @@ void CMP_release(TDBB tdbb, jrd_req* request)
}
break;
}
case rsc_procedure:
case Resource::rsc_procedure:
{
CMP_decrement_prc_use_count(tdbb, resource->rsc_prc);
break;
@ -2742,7 +2742,7 @@ static jrd_nod* copy(TDBB tdbb,
csb_repeat* element = CMP_csb_element(csb, new_stream);
// SKIDDER: Maybe we need to check if we really found a procedure?
element->csb_procedure = MET_lookup_procedure_id(tdbb,
(SSHORT)(IPTR) node->nod_arg[e_prc_procedure], FALSE, FALSE, 0);
(SSHORT)(IPTR) node->nod_arg[e_prc_procedure], false, false, 0);
csb->csb_rpt[new_stream].csb_flags |=
csb->csb_rpt[stream].csb_flags & csb_no_dbkey;
@ -3370,8 +3370,8 @@ static jrd_nod* pass1(TDBB tdbb,
case nod_exec_proc:
procedure = (jrd_prc*) node->nod_arg[e_esp_procedure];
post_procedure_access(tdbb, csb, procedure);
CMP_post_resource(tdbb, &csb->csb_resources, (BLK) procedure,
rsc_procedure, procedure->prc_id);
CMP_post_resource(tdbb, &csb->csb_resources, procedure,
Resource::rsc_procedure, procedure->prc_id);
break;
case nod_store:
@ -3843,7 +3843,7 @@ static RSE pass1_rse(TDBB tdbb,
jrd_nod* first = rse->rse_first;
jrd_nod* skip = rse->rse_skip;
jrd_nod* plan = rse->rse_plan;
BOOLEAN writelock = rse->rse_writelock;
const bool writelock = rse->rse_writelock;
#ifdef SCROLLABLE_CURSORS
jrd_nod* async_message = rse->rse_async_message;
#endif
@ -4033,10 +4033,10 @@ static void pass1_source(TDBB tdbb,
if (source->nod_type == nod_procedure) {
pass1(tdbb, csb, source, parent_view, view_stream, false);
jrd_prc* procedure = MET_lookup_procedure_id(tdbb,
(SSHORT)(IPTR) source->nod_arg[e_prc_procedure], FALSE, FALSE, 0);
(SSHORT)(IPTR) source->nod_arg[e_prc_procedure], false, false, 0);
post_procedure_access(tdbb, csb, procedure);
CMP_post_resource(tdbb, &csb->csb_resources, (BLK) procedure,
rsc_procedure, procedure->prc_id);
CMP_post_resource(tdbb, &csb->csb_resources, procedure,
Resource::rsc_procedure, procedure->prc_id);
return;
}
@ -4061,7 +4061,7 @@ static void pass1_source(TDBB tdbb,
// relation is accessed.
jrd_rel* view = (jrd_rel*) source->nod_arg[e_rel_relation];
CMP_post_resource(tdbb, &csb->csb_resources, (BLK) view, rsc_relation,
CMP_post_resource(tdbb, &csb->csb_resources, view, Resource::rsc_relation,
view->rel_id);
source->nod_arg[e_rel_view] = (jrd_nod*) parent_view;
@ -4250,8 +4250,8 @@ static jrd_nod* pass1_store(TDBB tdbb, Csb* csb, jrd_nod* node)
pass1_update(tdbb, csb, relation, trigger, stream, stream, priv,
parent, parent_stream);
if (!source) {
CMP_post_resource(tdbb, &csb->csb_resources, (BLK) relation,
rsc_relation, relation->rel_id);
CMP_post_resource(tdbb, &csb->csb_resources, relation,
Resource::rsc_relation, relation->rel_id);
return very_orig;
}
@ -4269,8 +4269,8 @@ static jrd_nod* pass1_store(TDBB tdbb, Csb* csb, jrd_nod* node)
}
}
else {
CMP_post_resource(tdbb, &csb->csb_resources, (BLK) relation,
rsc_relation, relation->rel_id);
CMP_post_resource(tdbb, &csb->csb_resources, relation,
Resource::rsc_relation, relation->rel_id);
trigger_seen = true;
jrd_nod* view_node = copy(tdbb, csb, node, map, 0, NULL, false);
node->nod_arg[e_sto_sub_store] = view_node;
@ -4300,7 +4300,7 @@ static jrd_nod* pass1_store(TDBB tdbb, Csb* csb, jrd_nod* node)
static jrd_nod* pass1_update(TDBB tdbb,
Csb* csb,
jrd_rel* relation,
TRIG_VEC trigger,
trig_vec* trigger,
USHORT stream,
USHORT update_stream,
USHORT priv,
@ -5352,8 +5352,7 @@ static void post_procedure_access(TDBB tdbb, Csb* csb, jrd_prc* procedure)
CMP_post_access(tdbb, csb, prc_sec_name, 0,
0, 0, SCL_execute,
object_procedure,
reinterpret_cast <
char *>(procedure->prc_name->str_data));
reinterpret_cast<const char*>(procedure->prc_name->str_data));
// this request also inherits all the access requirements that
// the procedure has
@ -5375,8 +5374,7 @@ static void post_procedure_access(TDBB tdbb, Csb* csb, jrd_prc* procedure)
// direct access from this SP to a resource
CMP_post_access(tdbb, csb, access->acc_security_name,
0, 0,
reinterpret_cast <
char *>(procedure->prc_name->str_data),
reinterpret_cast<const char*>(procedure->prc_name->str_data),
access->acc_mask, access->acc_type,
access->acc_name);
}
@ -5446,7 +5444,8 @@ static Rsb* post_rse(TDBB tdbb, Csb* csb, RSE rse)
}
static void post_trigger_access(TDBB tdbb, Csb* csb, jrd_rel* owner_relation, TRIG_VEC triggers, jrd_rel* view)
static void post_trigger_access(TDBB tdbb, Csb* csb, jrd_rel* owner_relation,
trig_vec* triggers, jrd_rel* view)
{
/**************************************
*

View File

@ -44,8 +44,8 @@ jrd_req* CMP_make_request(TDBB, Csb*);
void CMP_post_access(TDBB, Csb*, const TEXT*, SLONG,
const TEXT*, const TEXT*, USHORT, const TEXT*,
const TEXT*);
void CMP_post_resource(TDBB, Rsc**, blk*, enum rsc_s, USHORT);
void CMP_release_resource(Rsc**, enum rsc_s, USHORT);
void CMP_post_resource(TDBB, Resource**, blk*, enum Resource::rsc_s, USHORT);
void CMP_release_resource(Resource**, enum Resource::rsc_s, USHORT);
void CMP_release(TDBB, jrd_req*);
void CMP_shutdown_database(TDBB);

View File

@ -36,7 +36,7 @@
#define BLOB_untyped 0
/* InterBase defined BLOb subtypes */
/* InterBase defined BLOB subtypes */
#define BLOB_text 1
#define BLOB_blr 2
@ -46,6 +46,7 @@
#define BLOB_format 6
#define BLOB_tra 7
#define BLOB_extfile 8
#define BLOB_max_predefined_type 9
@ -109,5 +110,5 @@ enum frb_sysflag {
#define SQL_MATCH_1_CHAR '_' /* Not translatable */
#define SQL_MATCH_ANY_CHARS '%' /* Not translatable */
#endif /* JRD_CONSTANTS_H */
#endif // JRD_CONSTANTS_H

View File

@ -172,7 +172,7 @@ typedef enum {
#if (defined REQUESTER || defined SUPERCLIENT)
static TEXT cvt_failures[CVT_FAILURE_SPACE];
static TEXT* cvt_failures_ptr = NULL;
static TEXT* error_string(const char*, SSHORT);
static const TEXT* error_string(const char*, SSHORT);
#endif
static void conversion_error(const dsc*, FPTR_ERROR);
@ -348,7 +348,7 @@ double CVT_get_double(const dsc* desc, FPTR_ERROR err)
const SSHORT length =
CVT_make_string(desc, ttype_ascii,
&p,
(VARY *) buffer, sizeof(buffer), err);
(vary*) buffer, sizeof(buffer), err);
value = 0.0;
scale = 0;
SSHORT sign = 0;
@ -608,7 +608,7 @@ SLONG CVT_get_long(const dsc* desc, SSHORT scale, FPTR_ERROR err)
case dtype_cstring:
case dtype_text:
length =
CVT_make_string(desc, ttype_ascii, &p, (VARY *) buffer,
CVT_make_string(desc, ttype_ascii, &p, (vary*) buffer,
sizeof(buffer), err);
scale -= decompose(p, length, dtype_long, &value, err);
break;
@ -874,7 +874,7 @@ SQUAD CVT_get_quad(const dsc* desc, SSHORT scale, FPTR_ERROR err)
case dtype_cstring:
case dtype_text:
length =
CVT_make_string(desc, ttype_ascii, &p, (VARY *) buffer,
CVT_make_string(desc, ttype_ascii, &p, (vary*) buffer,
sizeof(buffer), err);
scale -= decompose(p, length, dtype_quad, &value.high, err);
break;
@ -1030,7 +1030,7 @@ SINT64 CVT_get_int64(const dsc* desc, SSHORT scale, FPTR_ERROR err)
case dtype_cstring:
case dtype_text:
length =
CVT_make_string(desc, ttype_ascii, &p, (VARY *) buffer,
CVT_make_string(desc, ttype_ascii, &p, (vary*) buffer,
sizeof(buffer), err);
scale -= decompose(p, length, dtype_int64, (SLONG *) & value, err);
break;
@ -1238,7 +1238,7 @@ GDS_TIMESTAMP CVT_get_timestamp(const dsc* desc, FPTR_ERROR err)
USHORT CVT_make_string(const dsc* desc,
USHORT to_interp,
const char** address,
VARY* temp,
vary* temp,
USHORT length,
FPTR_ERROR err)
{
@ -1626,8 +1626,8 @@ void CVT_move(const dsc* from, dsc* to, FPTR_ERROR err)
l -= length;
/* TMN: Here we should really have the following fb_assert */
/* fb_assert(length <= MAX_USHORT); */
((VARY *) p)->vary_length = (USHORT) length;
p = reinterpret_cast<UCHAR*>(((VARY *) p)->vary_string);
((vary*) p)->vary_length = (USHORT) length;
p = reinterpret_cast<UCHAR*>(((vary*) p)->vary_string);
CVT_COPY_BUFF(q, p, length);
break;
}
@ -1776,7 +1776,7 @@ static void conversion_error(const dsc* desc, FPTR_ERROR err)
const char* string;
const USHORT length =
CVT_make_string(desc, ttype_ascii, &string,
(VARY *) s, sizeof(s), err);
(vary*) s, sizeof(s), err);
#if (defined REQUESTER || defined SUPERCLIENT)
p = error_string(string, length);
#else
@ -2053,7 +2053,7 @@ static SSHORT decompose(const char* string,
#if (defined REQUESTER || defined SUPERCLIENT)
static TEXT* error_string(const char* in_string, SSHORT length)
static const TEXT* error_string(const char* in_string, SSHORT length)
{
/**************************************
*
@ -2426,7 +2426,7 @@ static void string_to_datetime(
const char* string;
const USHORT length =
CVT_make_string(desc, ttype_ascii, &string,
(VARY *) buffer, sizeof(buffer), err);
(vary*) buffer, sizeof(buffer), err);
const char* p = string;
const char* const end = p + length;

View File

@ -410,14 +410,12 @@ SSHORT CVT2_compare(const dsc* arg1, const dsc* arg2, FPTR_ERROR err)
case dtype_short:
{
SSHORT scale;
SLONG temp1, temp2;
if (arg2->dsc_dtype > dtype_varying)
scale = MIN(arg1->dsc_scale, arg2->dsc_scale);
else
scale = arg1->dsc_scale;
temp1 = CVT_get_long(arg1, scale, err);
temp2 = CVT_get_long(arg2, scale, err);
const SLONG temp1 = CVT_get_long(arg1, scale, err);
const SLONG temp2 = CVT_get_long(arg2, scale, err);
if (temp1 == temp2)
return 0;
if (temp1 > temp2)
@ -430,13 +428,12 @@ SSHORT CVT2_compare(const dsc* arg1, const dsc* arg2, FPTR_ERROR err)
case dtype_int64:
{
SSHORT scale;
SINT64 temp1, temp2;
if (arg2->dsc_dtype > dtype_varying)
scale = MIN(arg1->dsc_scale, arg2->dsc_scale);
else
scale = arg1->dsc_scale;
temp1 = CVT_get_int64(arg1, scale, err);
temp2 = CVT_get_int64(arg2, scale, err);
const SINT64 temp1 = CVT_get_int64(arg1, scale, err);
const SINT64 temp2 = CVT_get_int64(arg2, scale, err);
if (temp1 == temp2)
return 0;
if (temp1 > temp2)
@ -447,23 +444,19 @@ SSHORT CVT2_compare(const dsc* arg1, const dsc* arg2, FPTR_ERROR err)
case dtype_quad:
{
SSHORT scale;
SQUAD temp1, temp2;
if (arg2->dsc_dtype > dtype_varying)
scale = MIN(arg1->dsc_scale, arg2->dsc_scale);
else
scale = arg1->dsc_scale;
temp1 = CVT_get_quad(arg1, scale, err);
temp2 = CVT_get_quad(arg2, scale, err);
const SQUAD temp1 = CVT_get_quad(arg1, scale, err);
const SQUAD temp2 = CVT_get_quad(arg2, scale, err);
return QUAD_COMPARE(temp1, temp2);
}
case dtype_real:
{
float temp1, temp2;
temp1 = (float) CVT_get_double(arg1, err);
temp2 = (float) CVT_get_double(arg2, err);
const float temp1 = (float) CVT_get_double(arg1, err);
const float temp2 = (float) CVT_get_double(arg2, err);
if (temp1 == temp2)
return 0;
if (temp1 > temp2)
@ -476,10 +469,8 @@ SSHORT CVT2_compare(const dsc* arg1, const dsc* arg2, FPTR_ERROR err)
case dtype_d_float:
#endif
{
double temp1, temp2;
temp1 = CVT_get_double(arg1, err);
temp2 = CVT_get_double(arg2, err);
const double temp1 = CVT_get_double(arg1, err);
const double temp2 = CVT_get_double(arg2, err);
if (temp1 == temp2)
return 0;
if (temp1 > temp2)
@ -519,15 +510,14 @@ SSHORT CVT2_blob_compare(const dsc* arg1, const dsc* arg2, FPTR_ERROR err)
* complete in the engine.
*
**************************************/
/* CHARSET_ID charset1, charset2; */
TDBB tdbb = NULL;
SSHORT l1, l2;
USHORT ttype1, ttype2;
SSHORT ret_val = 0;
TextType obj1 = NULL, obj2 = NULL;
DSC desc1, desc2;
bool bin_cmp = false, both_are_text = false;
TDBB tdbb = NULL;
SET_TDBB(tdbb);
/* DEV_BLKCHK (node, type_nod); */
@ -538,7 +528,6 @@ SSHORT CVT2_blob_compare(const dsc* arg1, const dsc* arg2, FPTR_ERROR err)
/* Is arg2 a blob? */
if (arg2->dsc_dtype == dtype_blob)
{
BLB blob1, blob2;
UCHAR buffer1[BUFFER_LARGE], buffer2[BUFFER_LARGE];
/* Same blob id address? */
@ -547,7 +536,8 @@ SSHORT CVT2_blob_compare(const dsc* arg1, const dsc* arg2, FPTR_ERROR err)
else
{
/* Second test for blob id, checking relation and slot. */
BID bid1 = (BID) arg1->dsc_address, bid2 = (BID) arg2->dsc_address;
bid* bid1 = (bid*) arg1->dsc_address;
bid* bid2 = (bid*) arg2->dsc_address;
if (bid1->bid_relation_id == bid2->bid_relation_id &&
((!bid1->bid_relation_id && bid1->bid_stuff.bid_temp_id == bid2->bid_stuff.bid_temp_id) ||
(bid1->bid_relation_id && bid1->bid_stuff.bid_number == bid2->bid_stuff.bid_number)))
@ -572,11 +562,14 @@ SSHORT CVT2_blob_compare(const dsc* arg1, const dsc* arg2, FPTR_ERROR err)
INTL_ASSIGN_TTYPE(&desc1, ttype1);
INTL_ASSIGN_TTYPE(&desc2, ttype2);
blob1 = BLB_open(tdbb, tdbb->tdbb_request->req_transaction, (BID) arg1->dsc_address);
blob2 = BLB_open(tdbb, tdbb->tdbb_request->req_transaction, (BID) arg2->dsc_address);
blb* blob1 = BLB_open(tdbb, tdbb->tdbb_request->req_transaction, (bid*) arg1->dsc_address);
blb* blob2 = BLB_open(tdbb, tdbb->tdbb_request->req_transaction, (bid*) arg2->dsc_address);
/* Can we have a lightweight, binary comparison? */
bin_cmp = (arg1->dsc_sub_type != BLOB_text || arg2->dsc_sub_type != BLOB_text);
// Can we have a lightweight, binary comparison?
bool both_are_text = false;
bool bin_cmp =
(arg1->dsc_sub_type != BLOB_text || arg2->dsc_sub_type != BLOB_text);
if (!bin_cmp)
{
both_are_text = true;
@ -658,9 +651,9 @@ SSHORT CVT2_blob_compare(const dsc* arg1, const dsc* arg2, FPTR_ERROR err)
This is not safe with MBCS for now. */
if (!ret_val)
{
BOOLEAN eof1 = ((blob1->blb_flags & BLB_eof) == BLB_eof);
BOOLEAN eof2 = ((blob2->blb_flags & BLB_eof) == BLB_eof);
UCHAR blank_char = both_are_text ? '\x20' : '\x0';
const bool eof1 = ((blob1->blb_flags & BLB_eof) == BLB_eof);
const bool eof2 = ((blob2->blb_flags & BLB_eof) == BLB_eof);
const UCHAR blank_char = both_are_text ? '\x20' : '\x0';
if (eof1 && !eof2)
{
if (bin_cmp)
@ -711,11 +704,8 @@ SSHORT CVT2_blob_compare(const dsc* arg1, const dsc* arg2, FPTR_ERROR err)
/* The second parameter should be a string. */
else
{
BLB blob1;
UCHAR buffer1[BUFFER_LARGE];
STR temp_str = 0;
UCHAR *dbuf = 0;
if (arg1->dsc_sub_type == BLOB_text)
ttype1 = arg1->dsc_scale; /* Load blob character set */
else
@ -732,7 +722,8 @@ SSHORT CVT2_blob_compare(const dsc* arg1, const dsc* arg2, FPTR_ERROR err)
INTL_ASSIGN_TTYPE(&desc1, ttype1);
/* Can we have a lightweight, binary comparison?*/
bin_cmp = (arg1->dsc_sub_type != BLOB_text || arg2->dsc_dtype > dtype_varying);
bool bin_cmp =
(arg1->dsc_sub_type != BLOB_text || arg2->dsc_dtype > dtype_varying);
if (!bin_cmp)
{
if (arg1->dsc_sub_type == BLOB_text)
@ -759,6 +750,8 @@ SSHORT CVT2_blob_compare(const dsc* arg1, const dsc* arg2, FPTR_ERROR err)
if (!bin_cmp)
(*err) (isc_wish_list, isc_arg_gds, isc_datnotsup, 0);
str* temp_str = 0;
UCHAR* dbuf = 0;
if (arg2->dsc_length > BUFFER_LARGE)
{
temp_str = FB_NEW_RPT(*tdbb->tdbb_default, sizeof(UCHAR) * arg2->dsc_length) str();
@ -768,7 +761,7 @@ SSHORT CVT2_blob_compare(const dsc* arg1, const dsc* arg2, FPTR_ERROR err)
dbuf = buffer1;
desc1.dsc_address = dbuf;
blob1 = BLB_open(tdbb, tdbb->tdbb_request->req_transaction, (BID) arg1->dsc_address);
blb* blob1 = BLB_open(tdbb, tdbb->tdbb_request->req_transaction, (bid*) arg1->dsc_address);
l1 = BLB_get_segment(tdbb, blob1, dbuf, arg2->dsc_length);
desc1.dsc_length = l1;
ret_val = CVT2_compare(&desc1, arg2, err);
@ -794,12 +787,11 @@ void CVT2_get_name(const dsc* desc, TEXT* string, FPTR_ERROR err)
* Get a name (max length 31, NULL terminated) from a descriptor.
*
**************************************/
USHORT length;
VARY_STR(32) temp; /* 31 bytes + 1 NULL */
const char* p;
length = CVT_make_string(desc, ttype_metadata, &p,
(VARY *) & temp, sizeof(temp), err);
USHORT length = CVT_make_string(desc, ttype_metadata, &p,
(vary*) & temp, sizeof(temp), err);
for (; length && *p != ' '; --length)
*string++ = *p++;
@ -810,7 +802,7 @@ void CVT2_get_name(const dsc* desc, TEXT* string, FPTR_ERROR err)
USHORT CVT2_make_string2(const dsc* desc,
USHORT to_interp,
UCHAR** address,
VARY* temp, USHORT length, STR* ptr, FPTR_ERROR err)
vary* temp, USHORT length, STR* ptr, FPTR_ERROR err)
{
/**************************************
*
@ -830,9 +822,7 @@ USHORT CVT2_make_string2(const dsc* desc,
*
*
**************************************/
VARY *varying;
DSC temp_desc;
UCHAR *from_buf;
UCHAR* from_buf;
USHORT from_len;
USHORT from_interp;
@ -858,7 +848,7 @@ USHORT CVT2_make_string2(const dsc* desc,
}
else if (desc->dsc_dtype == dtype_varying) {
varying = (VARY *) desc->dsc_address;
vary* varying = (vary*) desc->dsc_address;
from_buf = reinterpret_cast<UCHAR*>(varying->vary_string);
from_len =
MIN(varying->vary_length, (USHORT) (desc->dsc_length - sizeof(SSHORT)));
@ -866,27 +856,23 @@ USHORT CVT2_make_string2(const dsc* desc,
}
if (desc->dsc_dtype <= dtype_any_text) {
USHORT cs1, cs2;
TDBB tdbb = NULL;
if (to_interp == from_interp) {
*address = from_buf;
return from_len;
}
tdbb = GET_THREAD_DATA;
cs1 = INTL_charset(tdbb, to_interp, err);
cs2 = INTL_charset(tdbb, from_interp, err);
TDBB tdbb = GET_THREAD_DATA;
const USHORT cs1 = INTL_charset(tdbb, to_interp, err);
const USHORT cs2 = INTL_charset(tdbb, from_interp, err);
if (cs1 == cs2) {
*address = from_buf;
return from_len;
}
else {
USHORT needed_len;
UCHAR *tempptr;
needed_len = INTL_convert_bytes(tdbb, cs1, NULL, 0,
const USHORT needed_len = INTL_convert_bytes(tdbb, cs1, NULL, 0,
cs2, from_buf, from_len, err);
tempptr = (UCHAR *) temp;
UCHAR* tempptr = (UCHAR *) temp;
if (needed_len > length) {
*ptr = FB_NEW_RPT(*tdbb->tdbb_default, needed_len) str();
(*ptr)->str_length = needed_len;
@ -902,6 +888,7 @@ USHORT CVT2_make_string2(const dsc* desc,
/* Not string data, then -- convert value to varying string. */
dsc temp_desc;
MOVE_CLEAR(&temp_desc, sizeof(temp_desc));
temp_desc.dsc_length = length;
temp_desc.dsc_address = (UCHAR *) temp;

View File

@ -243,7 +243,7 @@ int DBG_analyze(int pool_id)
for (p = blocks, end = p + (int) type_MAX, type = 0; p < end;
p++, type++) {
if (p->sum_count)
fields = reinterpret_cast < char **>(dbt_blocks[type]);
fields = reinterpret_cast<char**>(dbt_blocks[type]);
if (!strcmp(*fields, "TRANSACTION") && p->sum_count) {
pool_type = 2;
trans_pool_mem += (total_length / 1024);
@ -270,7 +270,7 @@ int DBG_analyze(int pool_id)
for (p = blocks, end = p + (int) type_MAX, type = 0; p < end; p++, type++)
if (p->sum_count) {
fields = reinterpret_cast < char **>(dbt_blocks[type]);
fields = reinterpret_cast<char**>(dbt_blocks[type]);
for (i = 0; i < 31; name_padded[i++] = ' ');
name_padded[i] = '\0';
for (i = 0; (*fields)[i]; i++)
@ -307,14 +307,11 @@ int DBG_bdbs(void)
* Functional description
*
**************************************/
DBB dbb;
BCB bcb;
DBB dbb = GET_DBB;
dbb = GET_DBB;
bcb = dbb->dbb_bcb;
BCB bcb = dbb->dbb_bcb;
for (unsigned int i = 0; i < bcb->bcb_count; i++)
DBG_block(reinterpret_cast < blk * >(bcb->bcb_rpt[i].bcb_bdb));
DBG_block(bcb->bcb_rpt[i].bcb_bdb);
return TRUE;
}
@ -331,17 +328,15 @@ int DBG_precedence(void)
* Functional description
*
**************************************/
DBB dbb;
BCB bcb;
BDB bdb;
QUE que;
PRE precedence;
Precedence* precedence;
BDB hi_bdb;
BDB lo_bdb;
dbb = GET_DBB;
DBB dbb = GET_DBB;
bcb = dbb->dbb_bcb;
BCB bcb = dbb->dbb_bcb;
for (unsigned int i = 0; i < bcb->bcb_count; i++) {
bdb = bcb->bcb_rpt[i].bcb_bdb;
if (bdb->bdb_flags || bdb->bdb_ast_flags) {
@ -377,7 +372,7 @@ int DBG_precedence(void)
ib_fprintf(dbg_file, "\tdirect higher precedence pages:");
for (que = bdb->bdb_higher.que_forward;
que != &bdb->bdb_higher; que = que->que_forward) {
precedence = BLOCK(que, PRE, pre_higher);
precedence = BLOCK(que, Precedence*, pre_higher);
hi_bdb = precedence->pre_hi;
ib_fprintf(dbg_file, " %"SLONGFORMAT"", hi_bdb->bdb_page);
if (precedence->pre_flags & PRE_cleared)
@ -389,7 +384,7 @@ int DBG_precedence(void)
ib_fprintf(dbg_file, "\tdirect lower precedence pages:");
for (que = bdb->bdb_lower.que_forward; que != &bdb->bdb_lower;
que = que->que_forward) {
precedence = BLOCK(que, PRE, pre_lower);
precedence = BLOCK(que, Precedence*, pre_lower);
lo_bdb = precedence->pre_low;
ib_fprintf(dbg_file, " %"SLONGFORMAT"", lo_bdb->bdb_page);
if (precedence->pre_flags & PRE_cleared)
@ -448,7 +443,7 @@ int DBG_block(BLK block)
ib_fprintf(dbg_file, " -- %s",
node_names[(int) ((jrd_nod*) block)->nod_type]);
prt_fields(reinterpret_cast < char *>(block), fields);
prt_fields(reinterpret_cast<char*>(block), fields);
switch ((enum blk_t) block->blk_type) {
case type_vec:
@ -504,8 +499,8 @@ int DBG_block(BLK block)
break;
case type_pre:
prt_que("Higher", &BLOCK(PRE)->pre_higher);
prt_que("Lower", &BLOCK(PRE)->pre_lower);
prt_que("Higher", &BLOCK(Precedence*)->pre_higher);
prt_que("Lower", &BLOCK(Precedence*)->pre_lower);
break;
case type_fmt:
@ -909,8 +904,8 @@ int DBG_rpb(RPB * rpb)
**************************************/
ib_fprintf(dbg_file, "\n%X\tRECORD PARAMETER BLOCK", rpb);
prt_fields(reinterpret_cast < char *>(rpb), dbt_rpb);
DBG_window(reinterpret_cast < int *>(&rpb->rpb_window));
prt_fields(reinterpret_cast<char*>(rpb), dbt_rpb);
DBG_window(reinterpret_cast<int*>(&rpb->rpb_window));
return TRUE;
}
@ -1006,7 +1001,7 @@ int DBG_window(int *window)
*
**************************************/
ib_fprintf(dbg_file, "\n%X\tWINDOW", window);
prt_fields(reinterpret_cast < char *>(window), dbt_window);
prt_fields(reinterpret_cast<char*>(window), dbt_window);
return TRUE;
}
@ -1240,30 +1235,30 @@ static int rsb_pretty(const Rsb* rsb, int column)
for (const Rsb* const* const end = ptr + rsb->rsb_count * 2; ptr < end;
ptr += 2)
{
DBG_pretty(reinterpret_cast < jrd_nod * >(*ptr), column);
DBG_pretty(reinterpret_cast<jrd_nod*>(*ptr), column);
}
}
else if (rsb->rsb_type != rsb_left_cross) {
for (const Rsb* const* const end = ptr + rsb->rsb_count; ptr < end; ptr++)
{
DBG_pretty(reinterpret_cast < jrd_nod * >(*ptr), column);
DBG_pretty(reinterpret_cast<jrd_nod*>(*ptr), column);
}
}
else {
for (const Rsb* const* const end = ptr + rsb->rsb_count + 1; ptr < end;
ptr++)
{
DBG_pretty(reinterpret_cast < jrd_nod * >(*ptr), column);
DBG_pretty(reinterpret_cast<jrd_nod*>(*ptr), column);
}
}
if (rsb->rsb_next)
DBG_pretty(reinterpret_cast < jrd_nod * >(rsb->rsb_next), column);
DBG_pretty(reinterpret_cast<jrd_nod*>(rsb->rsb_next), column);
return TRUE;
}
void yyerror(const char *string)
void yyerror(const char* string)
{
/**************************************
*

View File

@ -38,4 +38,5 @@ typedef struct symb {
short symb_size;
} *SYMB;
#endif /* JRD_DBG_H */
#endif // JRD_DBG_H

View File

@ -162,24 +162,24 @@ bdb[] = {
},
pre[] = {
"PRECEDENCE",
FLD(PRE, "Flags: %x", pre_flags),
FLD(PRE, "Low: %x", pre_low),
FLD(PRE, "High: %x", pre_hi),
FLD(Precedence*, "Flags: %x", pre_flags),
FLD(Precedence*, "Low: %x", pre_low),
FLD(Precedence*, "High: %x", pre_hi),
0
},
lck[] = {
"LOCK",
FLD(LCK, "Parent: %x", lck_parent),
FLD(LCK, "Object: %x", lck_object),
FLD(LCK, "Type: %x", lck_type),
FLD(LCK, "Physical: %x", lck_physical),
FLD(LCK, "Logical: %x", lck_logical),
FLD(LCK, "Length: %x", lck_length),
FLD(lck*, "Parent: %x", lck_parent),
FLD(lck*, "Object: %x", lck_object),
FLD(lck*, "Type: %x", lck_type),
FLD(lck*, "Physical: %x", lck_physical),
FLD(lck*, "Logical: %x", lck_logical),
FLD(lck*, "Length: %x", lck_length),
0
},
fil[] = {
jrd_file[] = {
"FILE",
FLD(FIL, "File desc: %x", fil_desc),
FLD(jrd_file*, "File desc: %x", fil_desc),
0
},
pgc[] = {
@ -278,11 +278,11 @@ bms[] = {
FLD(BMS, "Max: %x", bms_max),
0
},
dfw[] = {
Deferred_work[] = {
"DEFERRED WORK BLOCK",
FLD(DFW, "type: %d", dfw_type),
FLD(DFW, "next: %x", dfw_next),
FLD(DFW, "name: %s", dfw_name),
FLD(Deferred_work*, "type: %d", dfw_type),
FLD(Deferred_work*, "next: %x", dfw_next),
FLD(Deferred_work*, "name: %s", dfw_name),
0
},
tfb[] = {
@ -300,8 +300,8 @@ str[] = {
},
Dcc[] = {
"DATA COMPRESSION CONTROL",
FLD(DCC, "next: %x", dcc_next),
FLD(DCC, "end: %x", dcc_end),
FLD(Dcc*, "next: %x", dcc_next),
FLD(Dcc*, "end: %x", dcc_end),
0
},
sbm[] = {
@ -323,13 +323,13 @@ smb[] = {
},
blb[] = {
"BLOB",
FLD(BLB, "Relation: %x", blb_relation),
FLD(BLB, "Count: %d", blb_count),
FLD(BLB, "Length: %d", blb_length),
FLD(BLB, "Max seg: %d", blb_max_segment),
FLD(BLB, "Flags: %x", blb_flags),
FLD(BLB, "Trans: %x", blb_transaction),
FLD(BLB, "Next: %x", blb_segment),
FLD(blb*, "Relation: %x", blb_relation),
FLD(blb*, "Count: %d", blb_count),
FLD(blb*, "Length: %d", blb_length),
FLD(blb*, "Max seg: %d", blb_max_segment),
FLD(blb*, "Flags: %x", blb_flags),
FLD(blb*, "Trans: %x", blb_transaction),
FLD(blb*, "Next: %x", blb_segment),
0
},
irb[] = {
@ -357,15 +357,15 @@ static TEXT_PTR sym[] = { "SYMBOL", 0};
static TEXT_PTR fun[] = { "FUNCTION", 0};
static TEXT_PTR irl[] = { "INDEXED RELATIONSHIP", 0};
static TEXT_PTR acc[] = { "ACCESS", 0};
static TEXT_PTR Rsc[] = { "RESOURCE", 0};
static TEXT_PTR Resource[] = { "RESOURCE", 0};
static TEXT_PTR idl[] = { "INDEX LOCK", 0};
static TEXT_PTR sdw[] = { "SHADOW", 0};
static TEXT_PTR Shadow[] = { "SHADOW", 0};
static TEXT_PTR sav[] = { "SAVE POINT", 0};
static TEXT_PTR vct[] = { "VERB", 0};
static TEXT_PTR btb[] = { "BLOCKED THREAD", 0};
static TEXT_PTR blf[] = { "BLOB FILTER", 0};
static TEXT_PTR arr[] = { "ARRAY DESCRIPTION", 0};
static TEXT_PTR map[] = { "MAP BLOCK", 0};
static TEXT_PTR blb_map[] = { "MAP BLOCK", 0};
static TEXT_PTR log[] = { "LOG BLOCK", 0};
static TEXT_PTR dls[] = { "DIR LIST BLOCK", 0};
static TEXT_PTR jrd_prc[] = {
@ -379,7 +379,7 @@ static TEXT_PTR rng[] = { "REFRESH RANGE BLOCK", 0};
static TEXT_PTR tpc[] = { "TIP CACHE BLOCK", 0};
static TEXT_PTR xcp[] = { "EXCEPTION LIST BLOCK", 0};
static TEXT_PTR Opt[] = { "OPTIMIZATION BLOCK", 0};
static TEXT_PTR prf[] = { "PRF", 0};
static TEXT_PTR Prefetch[] = { "PRF", 0};
static TEXT_PTR rse[] = { "RECORD SELECTION EXPRESSION", 0};
static TEXT_PTR lit[] = { "LITERAL", 0};
static TEXT_PTR asb[] = { "ASB", 0};
@ -436,7 +436,7 @@ static TEXT_PTR tdbb[] = {
0
};
static TEXT_PTR svc[] = { "SERVICE MANAGER BLOCK", 0};
static TEXT_PTR lwt[] = { "LATCH WAIT BLOCK", 0};
static TEXT_PTR Latch_wait[] = { "LATCH WAIT BLOCK", 0};
static TEXT_PTR vcx[] = { "VIEW CONTEXT BLOCK", 0};
static TEXT_PTR srpb[] = { "RPB BLOCK", 0};
@ -497,7 +497,7 @@ TEXT* dbt_blocks[] = { 0,
const char* DBT_jrd_type_map(int type)
{
#define BLKDEF(enum_c, str_c, ext) case enum_c: return str_c[0];
switch(type)
switch (type)
{
#include "../jrd/blk.h"
default:

File diff suppressed because it is too large Load Diff

View File

@ -24,14 +24,15 @@
#ifndef JRD_DFW_PROTO_H
#define JRD_DFW_PROTO_H
USHORT DFW_assign_index_type(dfw*, SSHORT, SSHORT);
USHORT DFW_assign_index_type(Deferred_work*, SSHORT, SSHORT);
void DFW_delete_deferred(jrd_tra*, SLONG);
void DFW_merge_work(jrd_tra*, SLONG, SLONG);
void DFW_perform_system_work(void);
void DFW_perform_work(jrd_tra*);
void DFW_perform_post_commit_work(jrd_tra*);
dfw* DFW_post_work(jrd_tra*, enum dfw_t, dsc*, USHORT);
void DFW_post_work_arg(jrd_tra*, dfw*, dsc*, USHORT);
Deferred_work* DFW_post_work(jrd_tra*, enum dfw_t, dsc*, USHORT);
void DFW_post_work_arg(jrd_tra*, Deferred_work*, dsc*, USHORT);
void DFW_update_index(const TEXT*, USHORT, const SelectivityList&);
#endif // JRD_DFW_PROTO_H

View File

@ -74,7 +74,7 @@ bool DLS_get_temp_space(ULONG size, SFB sfb)
#ifdef V4_THREADING
if (!ptr->mdls_mutex_init) {
V4_MUTEX_INIT(ptr->mdls_mutex);
ptr->mdls_mutex_init = TRUE;
ptr->mdls_mutex_init = true;
}
V4_MUTEX_LOCK(ptr->mdls_mutex);
@ -137,7 +137,7 @@ void DLS_put_temp_space(SFB sfb)
}
BOOLEAN API_ROUTINE DLS_add_dir(ULONG size, const TEXT* dir_name)
bool API_ROUTINE DLS_add_dir(ULONG size, const TEXT* dir_name)
{
/**************************************
*
@ -155,7 +155,7 @@ BOOLEAN API_ROUTINE DLS_add_dir(ULONG size, const TEXT* dir_name)
dls* new_dls = (DLS) gds__alloc((SLONG) (sizeof(dls) +
sizeof(TEXT) * strlen(dir_name)));
if (!new_dls)
return FALSE;
return false;
strcpy(new_dls->dls_directory, dir_name);
new_dls->dls_size = size;
@ -171,7 +171,7 @@ BOOLEAN API_ROUTINE DLS_add_dir(ULONG size, const TEXT* dir_name)
if (!mdls->mdls_mutex_init) {
V4_MUTEX_INIT(mdls->mdls_mutex);
mdls->mdls_mutex_init = TRUE;
mdls->mdls_mutex_init = true;
}
V4_MUTEX_LOCK(mdls->mdls_mutex);
@ -195,7 +195,7 @@ BOOLEAN API_ROUTINE DLS_add_dir(ULONG size, const TEXT* dir_name)
V4_MUTEX_UNLOCK(mdls->mdls_mutex);
#endif
return TRUE;
return true;
}

View File

@ -30,7 +30,7 @@
bool DLS_get_temp_space(ULONG, SFB);
void DLS_put_temp_space(SFB);
BOOLEAN API_ROUTINE DLS_add_dir(ULONG, const TEXT*);
bool API_ROUTINE DLS_add_dir(ULONG, const TEXT*);
MDLS* DLS_get_access(void);
#endif // JRD_DLS_PROTO_H

View File

@ -59,12 +59,12 @@ static void complement_key(UCHAR *, int);
static double decompress(SCHAR *);
static void dmp_blob(blob_page*);
static void dmp_data(data_page*);
static void dmp_header(HDR);
static void dmp_header(header_page*);
static void dmp_index(btree_page*, USHORT);
static void dmp_pip(PIP, ULONG);
static void dmp_pointer(pointer_page*);
static void dmp_root(IRT);
static void dmp_transactions(TIP, ULONG);
static void dmp_root(index_root_page*);
static void dmp_transactions(tx_inv_page*, ULONG);
static int dmp_descending = 0;
@ -291,7 +291,7 @@ void DMP_fetched_page(PAG page,
switch (page->pag_type)
{
case pag_header:
dmp_header((HDR) page);
dmp_header((header_page*) page);
break;
case pag_pages:
@ -299,7 +299,7 @@ void DMP_fetched_page(PAG page,
break;
case pag_transactions:
dmp_transactions((TIP) page, sequence);
dmp_transactions((tx_inv_page*) page, sequence);
break;
case pag_pointer:
@ -311,7 +311,7 @@ void DMP_fetched_page(PAG page,
break;
case pag_root:
dmp_root((IRT) page);
dmp_root((index_root_page*) page);
break;
case pag_index:
@ -468,7 +468,7 @@ static double decompress(SCHAR * value)
p = (SCHAR *) & dbl;
if (*value & (1 << 7)) {
*p++ = static_cast < SCHAR > (*value++ ^ (1 << 7));
*p++ = static_cast<SCHAR>(*value++ ^ (1 << 7));
l = 7;
do
*p++ = *value++;
@ -677,7 +677,7 @@ static void dmp_data(data_page* page)
}
static void dmp_header(HDR page)
static void dmp_header(header_page* page)
{
/**************************************
*
@ -988,7 +988,7 @@ static void dmp_pointer(pointer_page* page)
}
static void dmp_root(IRT page)
static void dmp_root(index_root_page* page)
{
/**************************************
*
@ -999,7 +999,7 @@ static void dmp_root(IRT page)
* Functional description
*
**************************************/
irt::irt_repeat * desc;
index_root_page::irt_repeat * desc;
USHORT i, j;
ib_fprintf(dbg_file,
@ -1027,7 +1027,7 @@ static void dmp_root(IRT page)
}
static void dmp_transactions(TIP page, ULONG sequence)
static void dmp_transactions(tx_inv_page* page, ULONG sequence)
{
/**************************************
*

View File

@ -482,7 +482,8 @@ void DPM_create_relation( TDBB tdbb, jrd_rel* relation)
if (relation->rel_id == 0) {
WIN root_window(HEADER_PAGE);
hdr* header = (HDR) CCH_FETCH(tdbb, &root_window, LCK_write, pag_header);
header_page* header =
(header_page*) CCH_FETCH(tdbb, &root_window, LCK_write, pag_header);
CCH_MARK(tdbb, &root_window);
header->hdr_PAGES = window.win_page;
@ -499,7 +500,7 @@ void DPM_create_relation( TDBB tdbb, jrd_rel* relation)
// Therefore, I decided that the root_window in the if() above and this one aren't related.
/* Create an index root page */
WIN root_window(-1);
irt* root = (IRT) DPM_allocate(tdbb, &root_window);
index_root_page* root = (index_root_page*) DPM_allocate(tdbb, &root_window);
root->irt_header.pag_type = pag_root;
root->irt_relation = relation->rel_id;
/*root->irt_count = 0;*/
@ -688,7 +689,8 @@ void DPM_delete( TDBB tdbb, RPB * rpb, SLONG prior_page)
still empty, remove page from relation. */
DECOMPOSE(sequence, dbb->dbb_dp_per_pp, pp_sequence, slot);
retry_after_latch_timeout:
retry_after_latch_timeout:
WIN pwindow(-1);
if (!
(ppage =
@ -858,7 +860,7 @@ void DPM_delete_relation( TDBB tdbb, jrd_rel* relation)
}
BOOLEAN DPM_fetch(TDBB tdbb, RPB * rpb, USHORT lock)
bool DPM_fetch(TDBB tdbb, RPB * rpb, USHORT lock)
{
/**************************************
*
@ -870,8 +872,8 @@ BOOLEAN DPM_fetch(TDBB tdbb, RPB * rpb, USHORT lock)
* Fetch a particular record fragment from page and line numbers.
* Get various header stuff, but don't change the record number.
*
* return: TRUE if the fragment is returned.
* FALSE if the fragment is not found.
* return: true if the fragment is returned.
* false if the fragment is not found.
*
**************************************/
SET_TDBB(tdbb);
@ -889,7 +891,7 @@ BOOLEAN DPM_fetch(TDBB tdbb, RPB * rpb, USHORT lock)
if (!get_header(&rpb->rpb_window, rpb->rpb_line, rpb)) {
CCH_RELEASE(tdbb, &rpb->rpb_window);
return FALSE;
return false;
}
#ifdef VIO_DEBUG
@ -904,7 +906,7 @@ BOOLEAN DPM_fetch(TDBB tdbb, RPB * rpb, USHORT lock)
#endif
rpb->rpb_number = number;
return TRUE;
return true;
}
@ -1245,7 +1247,7 @@ int DPM_get( TDBB tdbb, RPB * rpb, SSHORT lock_type)
ULONG DPM_get_blob(TDBB tdbb,
BLB blob,
blb* blob,
ULONG record_number, USHORT delete_flag, SLONG prior_page)
{
/**************************************
@ -1263,19 +1265,11 @@ ULONG DPM_get_blob(TDBB tdbb,
* a completely separate delete blob call.
*
**************************************/
ATT attachment;
SLONG page_number;
data_page* page;
pointer_page* ppage;
BLH header;
USHORT length;
UCHAR *p, *q;
RPB rpb;
data_page::dpg_repeat* index;
SET_TDBB(tdbb);
DBB dbb = tdbb->tdbb_database;
CHECK_DBB(dbb);
RPB rpb;
rpb.rpb_window.win_flags = WIN_secondary;
#ifdef VIO_DEBUG
@ -1298,34 +1292,38 @@ ULONG DPM_get_blob(TDBB tdbb,
record doesn't exist, or the record isn't a blob, give up and
let somebody else complain. */
if (!(ppage = get_pointer_page(tdbb, blob->blb_relation, &rpb.rpb_window,
pp_sequence, LCK_read))) {
pointer_page* ppage = get_pointer_page(tdbb, blob->blb_relation,
&rpb.rpb_window, pp_sequence, LCK_read);
if (!ppage) {
blob->blb_flags |= BLB_damaged;
return 0UL;
}
if (!(page_number = ppage->ppg_page[slot]))
for (bool one_time = true; one_time; one_time = false)
{
const SLONG page_number = ppage->ppg_page[slot];
if (!page_number)
{
goto punt;
break;
}
page = (data_page*) CCH_HANDOFF(tdbb,
data_page* page = (data_page*) CCH_HANDOFF(tdbb,
&rpb.rpb_window,
page_number,
(SSHORT)((delete_flag) ? LCK_write : LCK_read),
pag_data);
if (line >= page->dpg_count) {
goto punt;
break;
}
index = &page->dpg_rpt[line];
data_page::dpg_repeat* index = &page->dpg_rpt[line];
if (index->dpg_offset == 0) {
goto punt;
break;
}
header = (BLH) ((SCHAR *) page + index->dpg_offset);
blh* header = (BLH) ((SCHAR *) page + index->dpg_offset);
if (!(header->blh_flags & rhd_blob)) {
goto punt;
break;
}
/* We've got the blob header and everything looks ducky. Get the header
@ -1342,7 +1340,8 @@ ULONG DPM_get_blob(TDBB tdbb,
/* Unless this is the only attachment, don't allow the sequential scan
of very large blobs to flush pages used by other attachments. */
if ((attachment = tdbb->tdbb_attachment) &&
att* attachment = tdbb->tdbb_attachment;
if (attachment &&
(attachment != dbb->dbb_attachments || attachment->att_next))
{
/* If the blob has more pages than the page buffer cache then mark
@ -1362,20 +1361,18 @@ ULONG DPM_get_blob(TDBB tdbb,
}
if (header->blh_flags & rhd_damaged) {
blob->blb_flags |= BLB_damaged;
CCH_RELEASE(tdbb, &rpb.rpb_window);
return 0UL;
break;
}
/* Retrieve the data either into page clump (level 0) or page vector (levels
1 and 2). */
length = index->dpg_length - BLH_SIZE;
q = (UCHAR *) header->blh_data;
const USHORT length = index->dpg_length - BLH_SIZE;
const UCHAR* q = (UCHAR *) header->blh_data;
if (blob->blb_level == 0) {
blob->blb_space_remaining = length;
p = blob->blb_data;
UCHAR* p = blob->blb_data;
if (length) {
MOVE_FASTER(q, p, length);
}
@ -1402,8 +1399,7 @@ ULONG DPM_get_blob(TDBB tdbb,
rpb.rpb_line = line;
DPM_delete(tdbb, &rpb, prior_page);
return rpb.rpb_page;
punt:
}
CCH_RELEASE(tdbb, &rpb.rpb_window);
blob->blb_flags |= BLB_damaged;
@ -1411,9 +1407,9 @@ ULONG DPM_get_blob(TDBB tdbb,
}
BOOLEAN DPM_next(TDBB tdbb,
bool DPM_next(TDBB tdbb,
RPB * rpb,
USHORT lock_type, BOOLEAN backwards, BOOLEAN onepage)
USHORT lock_type, bool backwards, bool onepage)
{
/**************************************
*
@ -1464,7 +1460,7 @@ BOOLEAN DPM_next(TDBB tdbb,
DPM_scan_pages(tdbb);
const vcl* vector = rpb->rpb_relation->rel_pages;
if (!vector) {
return FALSE;
return false;
}
const size_t pp_sequence = vector->count();
rpb->rpb_number =
@ -1479,7 +1475,7 @@ BOOLEAN DPM_next(TDBB tdbb,
//line = dbb->dbb_max_records - 1;
}
else {
return FALSE;
return false;
}
}
else {
@ -1502,8 +1498,8 @@ BOOLEAN DPM_next(TDBB tdbb,
/* Find the next pointer page, data page, and record */
while (true) {
const pointer_page* ppage = get_pointer_page(tdbb, rpb->rpb_relation, window, pp_sequence,
LCK_read);
const pointer_page* ppage = get_pointer_page(tdbb, rpb->rpb_relation,
window, pp_sequence, LCK_read);
if (!ppage) {
BUGCHECK(249); /* msg 249 pointer page vanished from DPM_next */
}
@ -1539,9 +1535,8 @@ BOOLEAN DPM_next(TDBB tdbb,
}
}
#endif
const data_page* dpage =
(data_page*) CCH_HANDOFF(tdbb, window, page_number, lock_type,
pag_data);
const data_page* dpage = (data_page*) CCH_HANDOFF(tdbb, window,
page_number, lock_type, pag_data);
if (backwards && line >= dpage->dpg_count) {
line = dpage->dpg_count - 1;
}
@ -1557,7 +1552,7 @@ BOOLEAN DPM_next(TDBB tdbb,
rpb->rpb_number =
(((SLONG) pp_sequence * dbb->dbb_dp_per_pp) +
slot) * dbb->dbb_max_records + line;
return TRUE;
return true;
}
}
@ -1578,7 +1573,7 @@ BOOLEAN DPM_next(TDBB tdbb,
}
if (onepage) {
return FALSE;
return false;
}
if (!
@ -1590,7 +1585,7 @@ BOOLEAN DPM_next(TDBB tdbb,
if (onepage) {
CCH_RELEASE(tdbb, window);
return FALSE;
return false;
}
if (backwards) {
@ -1622,7 +1617,7 @@ BOOLEAN DPM_next(TDBB tdbb,
CCH_RELEASE(tdbb, window);
}
if (flags & ppg_eof || onepage) {
return FALSE;
return false;
}
}
}
@ -1652,7 +1647,7 @@ void DPM_pages(
}
#endif
blk* request = (BLK) CMP_find_request(tdbb, irq_s_pages, IRQ_REQUESTS);
blk* request = CMP_find_request(tdbb, irq_s_pages, IRQ_REQUESTS);
STORE(REQUEST_HANDLE request)
X IN RDB$PAGES X.RDB$RELATION_ID = rel_id;
@ -1662,7 +1657,7 @@ void DPM_pages(
END_STORE
if (!REQUEST(irq_s_pages))
REQUEST(irq_s_pages) = (BLK) request;
REQUEST(irq_s_pages) = request;
}
@ -1773,12 +1768,12 @@ void DPM_scan_pages( TDBB tdbb)
CCH_RELEASE(tdbb, &window);
blk* request = (BLK) CMP_find_request(tdbb, irq_r_pages, IRQ_REQUESTS);
blk* request = CMP_find_request(tdbb, irq_r_pages, IRQ_REQUESTS);
FOR(REQUEST_HANDLE request) X IN RDB$PAGES
if (!REQUEST(irq_r_pages))
REQUEST(irq_r_pages) = (BLK) request;
REQUEST(irq_r_pages) = request;
relation = MET_relation(tdbb, X.RDB$RELATION_ID);
sequence = X.RDB$PAGE_SEQUENCE;
switch (X.RDB$PAGE_TYPE) {
@ -1807,7 +1802,7 @@ void DPM_scan_pages( TDBB tdbb)
END_FOR;
if (!REQUEST(irq_r_pages))
REQUEST(irq_r_pages) = (BLK) request;
REQUEST(irq_r_pages) = request;
}
@ -1896,7 +1891,7 @@ void DPM_store( TDBB tdbb, RPB * rpb, LLS * stack, USHORT type)
}
SLONG DPM_store_blob(TDBB tdbb, BLB blob, REC record)
SLONG DPM_store_blob(TDBB tdbb, blb* blob, REC record)
{
/**************************************
*
@ -1911,6 +1906,7 @@ SLONG DPM_store_blob(TDBB tdbb, BLB blob, REC record)
SET_TDBB(tdbb);
DBB dbb = tdbb->tdbb_database;
CHECK_DBB(dbb);
RPB rpb;
rpb.rpb_window.win_flags = 0;
@ -2503,8 +2499,10 @@ static void extend_relation( TDBB tdbb, jrd_rel* relation, WIN * window)
if (!
(ppage =
get_pointer_page(tdbb, relation, &pp_window, pp_sequence,
LCK_write)))
BUGCHECK(253); /* msg 253 pointer page vanished from extend_relation */
LCK_write)))
{
BUGCHECK(253); /* msg 253 pointer page vanished from extend_relation */
}
SLONG* slots = ppage->ppg_page;
for (slot = 0; slot < ppage->ppg_count; slot++, slots++) {
if (*slots == 0) {
@ -2880,7 +2878,8 @@ static RHD locate_space(
}
const SLONG pp_number = window->win_page;
const UCHAR* bits = (UCHAR *) (ppage->ppg_page + dbb->dbb_dp_per_pp);
for (USHORT slot = ppage->ppg_min_space; slot < ppage->ppg_count; slot++) {
for (USHORT slot = ppage->ppg_min_space; slot < ppage->ppg_count; slot++)
{
const SLONG dp_number = ppage->ppg_page[slot];
if (dp_number && ~bits[slot >> 2] & (1 << ((slot & 3) << 1))) {
CCH_HANDOFF(tdbb, window, dp_number, LCK_write, pag_data);
@ -3132,7 +3131,7 @@ static void store_big_record(
if (control == dcc->dcc_string) {
Dcc* const temp_dcc = dcc;
for (dcc = head_dcc; dcc->dcc_next != temp_dcc;
dcc = dcc->dcc_next);
dcc = dcc->dcc_next); // empty loop body
control = dcc->dcc_string + sizeof(dcc->dcc_string);
}
if ((count = *--control) < 0) {

View File

@ -26,6 +26,7 @@
// fwd. decl.
class blb;
class lls;
struct pag* DPM_allocate(TDBB, struct win*);
void DPM_backout(TDBB, struct rpb *);
@ -35,22 +36,21 @@ void DPM_create_relation(TDBB, struct jrd_rel *);
SLONG DPM_data_pages(TDBB, struct jrd_rel *);
void DPM_delete(TDBB, struct rpb *, SLONG);
void DPM_delete_relation(TDBB, struct jrd_rel *);
BOOLEAN DPM_fetch(TDBB, struct rpb *, USHORT);
bool DPM_fetch(TDBB, struct rpb *, USHORT);
SSHORT DPM_fetch_back(TDBB, struct rpb *, USHORT, SSHORT);
void DPM_fetch_fragment(TDBB, struct rpb *, USHORT);
SINT64 DPM_gen_id(TDBB, SLONG, USHORT, SINT64);
int DPM_get(TDBB, struct rpb *, SSHORT);
ULONG DPM_get_blob(TDBB, blb*, ULONG, USHORT, SLONG);
BOOLEAN DPM_next(TDBB, struct rpb *, USHORT, BOOLEAN,
BOOLEAN);
bool DPM_next(TDBB, struct rpb*, USHORT, bool, bool);
void DPM_pages(TDBB, SSHORT, int, ULONG, SLONG);
SLONG DPM_prefetch_bitmap(struct tdbb *, struct jrd_rel *, struct sbm *,
SLONG);
void DPM_scan_pages(TDBB);
void DPM_store(TDBB, struct rpb *, struct lls **, USHORT);
void DPM_store(TDBB, struct rpb *, lls**, USHORT);
SLONG DPM_store_blob(TDBB, blb*, struct rec *);
void DPM_rewrite_header(TDBB, struct rpb *);
void DPM_update(TDBB, struct rpb *, struct lls **,
void DPM_update(TDBB, struct rpb *, lls**,
class jrd_tra *);
#endif /* JRD_DPM_PROTO_H */
#endif // JRD_DPM_PROTO_H

View File

@ -742,7 +742,7 @@ const BYTE DSC_multiply_blr4_result[DTYPE_TYPE_MAX][DTYPE_TYPE_MAX] = {
};
#ifdef DEV_BUILD
static BOOLEAN validate_dsc_tables(void);
static bool validate_dsc_tables();
#endif
@ -961,7 +961,7 @@ void DSC_get_dtype_name(const dsc* desc, TEXT * buffer, USHORT len)
#ifdef DEV_BUILD
static BOOLEAN validate_dsc_tables(void)
static bool validate_dsc_tables()
{
/**************************************
*
@ -991,7 +991,7 @@ static BOOLEAN validate_dsc_tables(void)
ib_fprintf (ib_stderr, "DSC_add_result [%d][%d] is %d, invalid.\n",
op1, op2, DSC_add_result [op1][op2]);
*/
return FALSE;
return false;
}
/* Addition operator must be communitive */
@ -1002,7 +1002,7 @@ static BOOLEAN validate_dsc_tables(void)
op1, op2, DSC_add_result [op1][op2],
op2, op1, DSC_add_result [op2][op1] );
*/
return FALSE;
return false;
}
/* Difficult to validate Subtraction */
@ -1013,7 +1013,7 @@ static BOOLEAN validate_dsc_tables(void)
ib_fprintf (ib_stderr, "DSC_sub_result [%d][%d] is %d, invalid.\n",
op1, op2, DSC_sub_result [op1][op2]);
*/
return FALSE;
return false;
}
/* Multiplication operator must be commutative */
@ -1025,7 +1025,7 @@ static BOOLEAN validate_dsc_tables(void)
op1, op2, DSC_multiply_result [op1][op2],
op2, op1, DSC_multiply_result [op2][op1]);
*/
return FALSE;
return false;
}
/* Multiplication operator must be communitive */
@ -1038,11 +1038,11 @@ static BOOLEAN validate_dsc_tables(void)
op1, op2, DSC_multiply_blr4_result [op1][op2],
op2, op1, DSC_multiply_blr4_result [op2][op1] );
*/
return FALSE;
return false;
}
}
}
return TRUE;
return true;
}
#endif /* DEV_BUILD */

View File

@ -310,7 +310,7 @@ bool DYN_is_it_sql_role(GBL gbl,
if (ENCODE_ODS(major_version, minor_original) < ODS_9_0)
return found;
BLK request = (BLK) CMP_find_request(tdbb, drq_get_role_nm, DYN_REQUESTS);
BLK request = CMP_find_request(tdbb, drq_get_role_nm, DYN_REQUESTS);
FOR(REQUEST_HANDLE request TRANSACTION_HANDLE gbl->gbl_transaction)
X IN RDB$ROLES WITH
@ -665,7 +665,7 @@ USHORT DYN_get_string(const TEXT** ptr, TEXT* field, USHORT size, bool err_flag)
return length;
}
USHORT DYN_put_blr_blob(GBL gbl, const UCHAR** ptr, BID blob_id)
USHORT DYN_put_blr_blob(GBL gbl, const UCHAR** ptr, bid* blob_id)
{
/**************************************
*
@ -689,7 +689,7 @@ USHORT DYN_put_blr_blob(GBL gbl, const UCHAR** ptr, BID blob_id)
}
try {
BLB blob = BLB_create(tdbb, gbl->gbl_transaction, blob_id);
blb* blob = BLB_create(tdbb, gbl->gbl_transaction, blob_id);
BLB_put_segment(tdbb, blob, p, length);
BLB_close(tdbb, blob);
}
@ -703,7 +703,7 @@ USHORT DYN_put_blr_blob(GBL gbl, const UCHAR** ptr, BID blob_id)
return length;
}
USHORT DYN_put_text_blob(GBL gbl, const UCHAR** ptr, BID blob_id)
USHORT DYN_put_text_blob(GBL gbl, const UCHAR** ptr, bid* blob_id)
{
/**************************************
*
@ -730,7 +730,7 @@ USHORT DYN_put_text_blob(GBL gbl, const UCHAR** ptr, BID blob_id)
const UCHAR* end = NULL;
try {
BLB blob = BLB_create(tdbb, gbl->gbl_transaction, blob_id);
blb* blob = BLB_create(tdbb, gbl->gbl_transaction, blob_id);
for (end = p + length; p < end; p += TEXT_BLOB_LENGTH)
{
@ -954,7 +954,7 @@ static void grant( GBL gbl, const UCHAR** ptr)
try {
request = (BLK)CMP_find_request(tdbb,
request = CMP_find_request(tdbb,
(USHORT)(field[0] ? drq_l_grant1 : drq_l_grant2),
DYN_REQUESTS);
for (const TEXT* pr = privileges; *pr; pr++)
@ -1162,7 +1162,7 @@ static bool grantor_can_grant( GBL gbl,
/* Verify that the input relation exists. */
BLK request = (BLK) CMP_find_request(tdbb, drq_gcg4, DYN_REQUESTS);
BLK request = CMP_find_request(tdbb, drq_gcg4, DYN_REQUESTS);
try {
@ -1196,7 +1196,7 @@ static bool grantor_can_grant( GBL gbl,
bool field_exists = false;
/* SELECT RDB$RELATION_FIELDS failed in grant */
request = (BLK) CMP_find_request(tdbb, drq_gcg5, DYN_REQUESTS);
request = CMP_find_request(tdbb, drq_gcg5, DYN_REQUESTS);
FOR(REQUEST_HANDLE request TRANSACTION_HANDLE gbl->gbl_transaction)
G_FLD IN RDB$RELATION_FIELDS WITH
G_FLD.RDB$RELATION_NAME = relation_name AND
@ -1227,7 +1227,7 @@ static bool grantor_can_grant( GBL gbl,
bool grantor_is_owner = false;
/* SELECT RDB$RELATIONS/RDB$OWNER_NAME failed in grant */
request = (BLK) CMP_find_request(tdbb, drq_gcg2, DYN_REQUESTS);
request = CMP_find_request(tdbb, drq_gcg2, DYN_REQUESTS);
FOR(REQUEST_HANDLE request TRANSACTION_HANDLE gbl->gbl_transaction)
REL IN RDB$RELATIONS WITH
REL.RDB$RELATION_NAME = relation_name AND
@ -1257,7 +1257,7 @@ static bool grantor_can_grant( GBL gbl,
err_num = 185;
/* SELECT RDB$USER_PRIVILEGES failed in grant */
request = (BLK) CMP_find_request(tdbb, drq_gcg1, DYN_REQUESTS);
request = CMP_find_request(tdbb, drq_gcg1, DYN_REQUESTS);
FOR(REQUEST_HANDLE request TRANSACTION_HANDLE gbl->gbl_transaction)
PRV IN RDB$USER_PRIVILEGES WITH
PRV.RDB$USER = UPPERCASE(grantor) AND
@ -1364,7 +1364,7 @@ static bool grantor_can_grant( GBL gbl,
err_num = 186;
/* SELECT RDB$VIEW_RELATIONS/RDB$RELATION_FIELDS/... failed in grant */
request = (BLK) CMP_find_request(tdbb, drq_gcg3, DYN_REQUESTS);
request = CMP_find_request(tdbb, drq_gcg3, DYN_REQUESTS);
FOR(REQUEST_HANDLE request TRANSACTION_HANDLE gbl->gbl_transaction)
G_FLD IN RDB$RELATION_FIELDS CROSS
G_VIEW IN RDB$VIEW_RELATIONS WITH
@ -1466,7 +1466,7 @@ static bool grantor_can_grant_role( TDBB tdbb,
return false;
}
BLK request = (BLK) CMP_find_request(tdbb, drq_get_role_au, DYN_REQUESTS);
BLK request = CMP_find_request(tdbb, drq_get_role_au, DYN_REQUESTS);
// The 'grantor' is not the owner of the ROLE, see if they
// have admin privilege on the role
@ -1673,7 +1673,7 @@ static void revoke_permission(GBL gbl, const UCHAR** ptr)
volatile USHORT old_id, id;
BLK request = (BLK)CMP_find_request(tdbb,
BLK request = CMP_find_request(tdbb,
(USHORT)(field[0] ? drq_e_grant1 : drq_e_grant2),
DYN_REQUESTS);
id = field[0] ? drq_e_grant1 : drq_e_grant2;
@ -1801,7 +1801,7 @@ static void set_field_class_name(GBL gbl, const TEXT* relation, const TEXT* fiel
TDBB tdbb = GET_THREAD_DATA;
DBB dbb = tdbb->tdbb_database;
BLK request = (BLK) CMP_find_request(tdbb, drq_s_f_class, DYN_REQUESTS);
BLK request = CMP_find_request(tdbb, drq_s_f_class, DYN_REQUESTS);
BLK request2 = NULL;
bool unique = false;
@ -1820,7 +1820,7 @@ static void set_field_class_name(GBL gbl, const TEXT* relation, const TEXT* fiel
MET_lookup_generator(tdbb, "RDB$SECURITY_CLASS"), 0, (SINT64) 1));
unique = true;
request2 = (BLK) CMP_find_request(tdbb, drq_s_u_class, DYN_REQUESTS);
request2 = CMP_find_request(tdbb, drq_s_u_class, DYN_REQUESTS);
FOR (REQUEST_HANDLE request2 TRANSACTION_HANDLE gbl->gbl_transaction)
RFR1 IN RDB$RELATION_FIELDS
WITH RFR1.RDB$SECURITY_CLASS = RFR.RDB$SECURITY_CLASS
@ -1865,7 +1865,7 @@ static void store_privilege(GBL gbl,
TDBB tdbb = GET_THREAD_DATA;
DBB dbb = tdbb->tdbb_database;
BLK request = (BLK) CMP_find_request(tdbb, drq_s_grant, DYN_REQUESTS);
BLK request = CMP_find_request(tdbb, drq_s_grant, DYN_REQUESTS);
/* need to unwind our own request here!! SM 27-Sep-96 */

View File

@ -49,8 +49,8 @@ typedef struct gbl
} *GBL;
typedef struct dyn_fld {
DSC dyn_dsc;
BOOLEAN dyn_null_flag;
dsc dyn_dsc;
bool dyn_null_flag;
USHORT dyn_dtype;
USHORT dyn_precision;
USHORT dyn_charlen;

View File

@ -148,7 +148,7 @@ void DYN_define_cache( GBL gbl, const UCHAR** ptr)
bool found = false;
id = drq_l_cache;
request = (BLK) CMP_find_request(tdbb, drq_l_cache, DYN_REQUESTS);
request = CMP_find_request(tdbb, drq_l_cache, DYN_REQUESTS);
FOR(REQUEST_HANDLE request TRANSACTION_HANDLE gbl->gbl_transaction)
FIL IN RDB$FILES WITH FIL.RDB$FILE_FLAGS EQ FILE_cache
found = true;
@ -162,7 +162,7 @@ void DYN_define_cache( GBL gbl, const UCHAR** ptr)
goto dyn_punt_148;
}
request = (BLK) CMP_find_request(tdbb, drq_s_cache, DYN_REQUESTS);
request = CMP_find_request(tdbb, drq_s_cache, DYN_REQUESTS);
id = drq_s_cache;
STORE(REQUEST_HANDLE request TRANSACTION_HANDLE gbl->gbl_transaction)
X IN RDB$FILES
@ -266,7 +266,7 @@ void DYN_define_constraint(GBL gbl,
try {
request = (BLK) CMP_find_request(tdbb, drq_s_rel_con, DYN_REQUESTS);
request = CMP_find_request(tdbb, drq_s_rel_con, DYN_REQUESTS);
id = drq_s_rel_con;
STORE(REQUEST_HANDLE request TRANSACTION_HANDLE gbl->gbl_transaction)
@ -384,7 +384,7 @@ void DYN_define_constraint(GBL gbl,
/* Make sure unique field names were specified for UNIQUE/PRIMARY/FOREIGN */
/* All fields must have the NOT NULL attribute specified for UNIQUE/PRIMARY. */
request = (BLK) CMP_find_request(tdbb, drq_c_unq_nam, DYN_REQUESTS);
request = CMP_find_request(tdbb, drq_c_unq_nam, DYN_REQUESTS);
id = drq_c_unq_nam;
not_null = TRUE;
@ -427,7 +427,7 @@ void DYN_define_constraint(GBL gbl,
/* msg 123: "Field: %s not defined as NOT NULL - can't be used in PRIMARY KEY/UNIQUE constraint definition" */
}
request = (BLK) CMP_find_request(tdbb, drq_n_idx_seg, DYN_REQUESTS);
request = CMP_find_request(tdbb, drq_n_idx_seg, DYN_REQUESTS);
id = drq_n_idx_seg;
FOR(REQUEST_HANDLE request TRANSACTION_HANDLE gbl->gbl_transaction)
@ -451,7 +451,7 @@ void DYN_define_constraint(GBL gbl,
if (foreign_flag == FALSE)
{
request = (BLK) CMP_find_request(tdbb, drq_c_dup_con, DYN_REQUESTS);
request = CMP_find_request(tdbb, drq_c_dup_con, DYN_REQUESTS);
id = drq_c_dup_con;
index_name[0] = 0;
@ -511,7 +511,7 @@ void DYN_define_constraint(GBL gbl,
else
{ /* Foreign key being defined */
request = (BLK) CMP_find_request(tdbb, drq_s_ref_con, DYN_REQUESTS);
request = CMP_find_request(tdbb, drq_s_ref_con, DYN_REQUESTS);
id = drq_s_ref_con;
BLK old_request = NULL;
@ -521,7 +521,7 @@ void DYN_define_constraint(GBL gbl,
old_request = request;
old_id = id;
request =
(BLK) CMP_find_request(tdbb, drq_l_intg_con, DYN_REQUESTS);
CMP_find_request(tdbb, drq_l_intg_con, DYN_REQUESTS);
id = drq_l_intg_con;
FOR(REQUEST_HANDLE request TRANSACTION_HANDLE gbl->gbl_transaction)
@ -640,7 +640,7 @@ void DYN_define_dimension(GBL gbl,
UCHAR verb;
volatile BLK request;
request = (BLK) CMP_find_request(tdbb, drq_s_dims, DYN_REQUESTS);
request = CMP_find_request(tdbb, drq_s_dims, DYN_REQUESTS);
bool b_ending_store = false;
@ -728,7 +728,7 @@ void DYN_define_exception( GBL gbl, const UCHAR** ptr)
DYN_error_punt(false, 212, NULL, NULL, NULL, NULL, NULL);
/* msg 212: "Zero length identifiers not allowed" */
request = (BLK) CMP_find_request(tdbb, drq_s_xcp, DYN_REQUESTS);
request = CMP_find_request(tdbb, drq_s_xcp, DYN_REQUESTS);
bool b_ending_store = false;
@ -804,7 +804,7 @@ void DYN_define_file(GBL gbl,
id = -1;
request = (BLK) CMP_find_request(tdbb, id = drq_l_files, DYN_REQUESTS);
request = CMP_find_request(tdbb, id = drq_l_files, DYN_REQUESTS);
GET_STRING(ptr, temp_f1);
ISC_expand_filename(temp_f1, 0, temp_f);
@ -817,7 +817,7 @@ void DYN_define_file(GBL gbl,
DYN_error_punt(false, 166, NULL, NULL, NULL, NULL, NULL);
END_FOR;
request = (BLK) CMP_find_request(tdbb, id = drq_s_files, DYN_REQUESTS);
request = CMP_find_request(tdbb, id = drq_s_files, DYN_REQUESTS);
STORE(REQUEST_HANDLE request TRANSACTION_HANDLE gbl->gbl_transaction)
X IN RDB$FILES
@ -907,7 +907,7 @@ void DYN_define_difference(GBL gbl,
bool found = false;
id = drq_l_difference;
request = (BLK) CMP_find_request(tdbb, drq_l_difference, DYN_REQUESTS);
request = CMP_find_request(tdbb, drq_l_difference, DYN_REQUESTS);
FOR(REQUEST_HANDLE request TRANSACTION_HANDLE gbl->gbl_transaction)
FIL IN RDB$FILES
if (FIL.RDB$FILE_FLAGS & FILE_difference)
@ -922,7 +922,7 @@ void DYN_define_difference(GBL gbl,
goto dyn_punt_216;
}
request = (BLK) CMP_find_request(tdbb, drq_s_difference, DYN_REQUESTS);
request = CMP_find_request(tdbb, drq_s_difference, DYN_REQUESTS);
id = drq_s_difference;
STORE(REQUEST_HANDLE request TRANSACTION_HANDLE gbl->gbl_transaction)
X IN RDB$FILES
@ -992,7 +992,7 @@ void DYN_define_filter( GBL gbl, const UCHAR** ptr)
DYN_error_punt(false, 212, NULL, NULL, NULL, NULL, NULL);
/* msg 212: "Zero length identifiers not allowed" */
request = (BLK) CMP_find_request(tdbb, drq_s_filters, DYN_REQUESTS);
request = CMP_find_request(tdbb, drq_s_filters, DYN_REQUESTS);
bool b_ending_store = false;
@ -1086,7 +1086,7 @@ void DYN_define_function( GBL gbl, const UCHAR** ptr)
DYN_error_punt(false, 212, NULL, NULL, NULL, NULL, NULL);
/* msg 212: "Zero length identifiers not allowed" */
request = (BLK) CMP_find_request(tdbb, drq_s_funcs, DYN_REQUESTS);
request = CMP_find_request(tdbb, drq_s_funcs, DYN_REQUESTS);
bool b_ending_store = false;
@ -1181,7 +1181,7 @@ void DYN_define_function_arg(GBL gbl, const UCHAR** ptr, TEXT* function_name)
try {
request = (BLK) CMP_find_request(tdbb, drq_s_func_args, DYN_REQUESTS);
request = CMP_find_request(tdbb, drq_s_func_args, DYN_REQUESTS);
STORE(REQUEST_HANDLE request TRANSACTION_HANDLE gbl->gbl_transaction)
X IN RDB$FUNCTION_ARGUMENTS
@ -1311,7 +1311,7 @@ void DYN_define_generator( GBL gbl, const UCHAR** ptr)
DYN_error_punt(false, 212, NULL, NULL, NULL, NULL, NULL);
/* msg 212: "Zero length identifiers not allowed" */
request = (BLK) CMP_find_request(tdbb, drq_s_gens, DYN_REQUESTS);
request = CMP_find_request(tdbb, drq_s_gens, DYN_REQUESTS);
bool b_ending_store = false;
@ -1384,7 +1384,7 @@ void DYN_define_global_field(GBL gbl,
DYN_error_punt(false, 212, NULL, NULL, NULL, NULL, NULL);
/* msg 212: "Zero length identifiers not allowed" */
request = (BLK) CMP_find_request(tdbb, drq_s_gfields, DYN_REQUESTS);
request = CMP_find_request(tdbb, drq_s_gfields, DYN_REQUESTS);
bool b_ending_store = false;
@ -1655,7 +1655,7 @@ void DYN_define_index(GBL gbl,
try {
request = (BLK) CMP_find_request(tdbb, drq_s_indices, DYN_REQUESTS);
request = CMP_find_request(tdbb, drq_s_indices, DYN_REQUESTS);
id = drq_s_indices;
referenced_relation[0] = 0;
@ -1691,7 +1691,7 @@ void DYN_define_index(GBL gbl,
old_request = request;
old_id = id;
request = (BLK) CMP_find_request(tdbb, drq_l_view_idx, DYN_REQUESTS);
request = CMP_find_request(tdbb, drq_l_view_idx, DYN_REQUESTS);
id = drq_l_view_idx;
FOR(REQUEST_HANDLE request TRANSACTION_HANDLE gbl->gbl_transaction)
@ -1714,7 +1714,7 @@ void DYN_define_index(GBL gbl,
old_request = request;
old_id = id;
request = (BLK) CMP_find_request(tdbb, drq_l_lfield, DYN_REQUESTS);
request = CMP_find_request(tdbb, drq_l_lfield, DYN_REQUESTS);
id = drq_l_lfield;
while ((verb = *(*ptr)++) != isc_dyn_end)
@ -1975,8 +1975,7 @@ void DYN_define_index(GBL gbl,
old_request = request;
old_id = id;
request =
(BLK) CMP_find_request(tdbb, drq_s_idx_segs, DYN_REQUESTS);
request = CMP_find_request(tdbb, drq_s_idx_segs, DYN_REQUESTS);
id = drq_s_idx_segs;
while (seg_list) {
str_ = (STR) LLS_POP(&seg_list);
@ -2013,8 +2012,7 @@ void DYN_define_index(GBL gbl,
old_request = request;
old_id = id;
request =
(BLK) CMP_find_request(tdbb, drq_l_unq_idx, DYN_REQUESTS);
request = CMP_find_request(tdbb, drq_l_unq_idx, DYN_REQUESTS);
id = drq_l_unq_idx;
index_name[0] = 0;
@ -2087,8 +2085,7 @@ void DYN_define_index(GBL gbl,
else if (referenced_relation[0]) {
old_request = request;
old_id = id;
request =
(BLK) CMP_find_request(tdbb, drq_l_primary, DYN_REQUESTS);
request = CMP_find_request(tdbb, drq_l_primary, DYN_REQUESTS);
id = drq_l_primary;
FOR(REQUEST_HANDLE request TRANSACTION_HANDLE gbl->gbl_transaction)
@ -2210,7 +2207,7 @@ void DYN_define_local_field(GBL gbl,
try {
request = (BLK) CMP_find_request(tdbb, drq_s_lfields, DYN_REQUESTS);
request = CMP_find_request(tdbb, drq_s_lfields, DYN_REQUESTS);
id = drq_s_lfields;
scflag = lflag = sflag = slflag = clflag = prflag = FALSE;
@ -2399,8 +2396,7 @@ void DYN_define_local_field(GBL gbl,
if (blr) {
BLK old_request = request;
old_id = id;
request =
(BLK) CMP_find_request(tdbb, drq_s_gfields2, DYN_REQUESTS);
request = CMP_find_request(tdbb, drq_s_gfields2, DYN_REQUESTS);
STORE(REQUEST_HANDLE request TRANSACTION_HANDLE gbl->gbl_transaction)
FLD IN RDB$FIELDS
@ -2519,7 +2515,7 @@ void DYN_define_log_file(
{
bool found = false;
id = drq_l_log_files;
request = (BLK) CMP_find_request(tdbb, drq_l_log_files, DYN_REQUESTS);
request = CMP_find_request(tdbb, drq_l_log_files, DYN_REQUESTS);
FOR(REQUEST_HANDLE request TRANSACTION_HANDLE gbl->gbl_transaction)
FIL IN RDB$LOG_FILES
found = true;
@ -2533,7 +2529,7 @@ void DYN_define_log_file(
}
}
request = (BLK) CMP_find_request(tdbb, drq_s_log_files, DYN_REQUESTS);
request = CMP_find_request(tdbb, drq_s_log_files, DYN_REQUESTS);
id = drq_s_log_files;
STORE(REQUEST_HANDLE request TRANSACTION_HANDLE gbl->gbl_transaction)
X IN RDB$LOG_FILES
@ -2655,7 +2651,7 @@ void DYN_define_parameter( GBL gbl, const UCHAR** ptr, TEXT* procedure_name)
DYN_error_punt(false, 212, NULL, NULL, NULL, NULL, NULL);
/* msg 212: "Zero length identifiers not allowed" */
request = (BLK) CMP_find_request(tdbb, drq_s_prms, DYN_REQUESTS);
request = CMP_find_request(tdbb, drq_s_prms, DYN_REQUESTS);
try {
@ -2802,8 +2798,7 @@ void DYN_define_parameter( GBL gbl, const UCHAR** ptr, TEXT* procedure_name)
if (P.RDB$FIELD_SOURCE.NULL) {
/* Need to store dummy global field */
id = drq_s_prm_src;
request2 =
(BLK) CMP_find_request(tdbb, drq_s_prm_src, DYN_REQUESTS);
request2 = CMP_find_request(tdbb, drq_s_prm_src, DYN_REQUESTS);
STORE(REQUEST_HANDLE request2 TRANSACTION_HANDLE gbl->gbl_transaction)
PS IN RDB$FIELDS USING
DYN_UTIL_generate_field_name(tdbb, gbl,
@ -2909,7 +2904,7 @@ void DYN_define_procedure( GBL gbl, const UCHAR** ptr)
id = drq_l_prc_name;
check_unique_name(tdbb, gbl, procedure_name, true);
request = (BLK) CMP_find_request(tdbb, drq_s_prcs, DYN_REQUESTS);
request = CMP_find_request(tdbb, drq_s_prcs, DYN_REQUESTS);
id = drq_s_prcs;
@ -2982,9 +2977,7 @@ void DYN_define_procedure( GBL gbl, const UCHAR** ptr)
/* msg 134: "STORE RDB$PROCEDURES failed" */
for (const TEXT* p = ALL_PROC_PRIVILEGES; *p; p++) {
request =
(BLK) CMP_find_request(tdbb, drq_s_prc_usr_prvs,
DYN_REQUESTS);
request = CMP_find_request(tdbb, drq_s_prc_usr_prvs, DYN_REQUESTS);
id = drq_s_prc_usr_prvs;
STORE(REQUEST_HANDLE request TRANSACTION_HANDLE gbl->gbl_transaction)
@ -3070,7 +3063,7 @@ void DYN_define_relation( GBL gbl, const UCHAR** ptr)
id = drq_l_rel_name;
check_unique_name(tdbb, gbl, relation_name, false);
request = (BLK) CMP_find_request(tdbb, drq_s_rels, DYN_REQUESTS);
request = CMP_find_request(tdbb, drq_s_rels, DYN_REQUESTS);
id = drq_s_rels;
STORE(REQUEST_HANDLE request TRANSACTION_HANDLE gbl->gbl_transaction)
@ -3154,9 +3147,7 @@ void DYN_define_relation( GBL gbl, const UCHAR** ptr)
if (is_a_view) {
BLK old_request = request;
old_id = id;
request =
(BLK) CMP_find_request(tdbb, drq_l_view_rels,
DYN_REQUESTS);
request = CMP_find_request(tdbb, drq_l_view_rels, DYN_REQUESTS);
id = drq_l_view_rels;
FOR(REQUEST_HANDLE request TRANSACTION_HANDLE gbl->gbl_transaction)
@ -3208,8 +3199,7 @@ void DYN_define_relation( GBL gbl, const UCHAR** ptr)
if (sql_prot)
for (const TEXT* p = ALL_PRIVILEGES; *p; p++) {
request =
(BLK) CMP_find_request(tdbb, drq_s_usr_prvs, DYN_REQUESTS);
request = CMP_find_request(tdbb, drq_s_usr_prvs, DYN_REQUESTS);
id = drq_s_usr_prvs;
STORE(REQUEST_HANDLE request TRANSACTION_HANDLE gbl->gbl_transaction)
@ -3338,7 +3328,7 @@ void DYN_define_role( GBL gbl, const UCHAR** ptr)
goto do_err_punt;
}
request = (BLK) CMP_find_request(tdbb, drq_role_gens, DYN_REQUESTS);
request = CMP_find_request(tdbb, drq_role_gens, DYN_REQUESTS);
STORE(REQUEST_HANDLE request TRANSACTION_HANDLE gbl->gbl_transaction)
X IN RDB$ROLES
@ -3394,7 +3384,7 @@ void DYN_define_security_class( GBL gbl, const UCHAR** ptr)
volatile BLK request;
UCHAR verb;
request = (BLK) CMP_find_request(tdbb, drq_s_classes, DYN_REQUESTS);
request = CMP_find_request(tdbb, drq_s_classes, DYN_REQUESTS);
bool b_ending_store = false;
@ -3482,7 +3472,7 @@ void DYN_define_sql_field(GBL gbl,
try {
request = (BLK) CMP_find_request(tdbb, drq_s_sql_lfld, DYN_REQUESTS);
request = CMP_find_request(tdbb, drq_s_sql_lfld, DYN_REQUESTS);
id = drq_s_sql_lfld;
BLK old_request = NULL;
@ -3510,7 +3500,7 @@ void DYN_define_sql_field(GBL gbl,
old_request = request;
old_id = id;
request = (BLK) CMP_find_request(tdbb, drq_s_sql_gfld, DYN_REQUESTS);
request = CMP_find_request(tdbb, drq_s_sql_gfld, DYN_REQUESTS);
id = drq_s_sql_gfld;
STORE(REQUEST_HANDLE request TRANSACTION_HANDLE gbl->gbl_transaction)
@ -3756,7 +3746,7 @@ void DYN_define_shadow( GBL gbl, const UCHAR** ptr)
/* If a shadow set identified by the
shadow number already exists return error. */
request = (BLK) CMP_find_request(tdbb, drq_l_shadow, DYN_REQUESTS);
request = CMP_find_request(tdbb, drq_l_shadow, DYN_REQUESTS);
try {
@ -3844,7 +3834,7 @@ void DYN_define_trigger(GBL gbl,
strcpy(trigger_name, t);
}
request = (BLK) CMP_find_request(tdbb, drq_s_triggers, DYN_REQUESTS);
request = CMP_find_request(tdbb, drq_s_triggers, DYN_REQUESTS);
bool b_ending_store = false;
@ -3993,7 +3983,7 @@ void DYN_define_trigger_msg(GBL gbl, const UCHAR** ptr, const TEXT* trigger_name
volatile BLK request;
UCHAR verb;
request = (BLK) CMP_find_request(tdbb, drq_s_trg_msgs, DYN_REQUESTS);
request = CMP_find_request(tdbb, drq_s_trg_msgs, DYN_REQUESTS);
bool b_ending_store = false;
@ -4077,7 +4067,7 @@ void DYN_define_view_relation( GBL gbl, const UCHAR** ptr, const TEXT* view)
DYN_error_punt(false, 212, NULL, NULL, NULL, NULL, NULL);
/* msg 212: "Zero length identifiers not allowed" */
request = (BLK) CMP_find_request(tdbb, drq_s_view_rels, DYN_REQUESTS);
request = CMP_find_request(tdbb, drq_s_view_rels, DYN_REQUESTS);
id = drq_s_view_rels;
bool b_ending_store = false;
@ -4091,7 +4081,7 @@ void DYN_define_view_relation( GBL gbl, const UCHAR** ptr, const TEXT* view)
volatile SSHORT old_id = id;
volatile BLK old_request = request;
request = (BLK) CMP_find_request(tdbb, drq_e_view_rels, DYN_REQUESTS);
request = CMP_find_request(tdbb, drq_e_view_rels, DYN_REQUESTS);
id = drq_e_view_rels;
FOR(REQUEST_HANDLE request TRANSACTION_HANDLE gbl->gbl_transaction)
@ -4189,7 +4179,7 @@ static void check_unique_name( TDBB tdbb,
try {
request = (BLK) CMP_find_request(tdbb, drq_l_rel_name, DYN_REQUESTS);
request = CMP_find_request(tdbb, drq_l_rel_name, DYN_REQUESTS);
found = false;
FOR(REQUEST_HANDLE request TRANSACTION_HANDLE gbl->gbl_transaction)
@ -4206,7 +4196,7 @@ static void check_unique_name( TDBB tdbb,
goto local_punt_false_132;
}
request = (BLK) CMP_find_request(tdbb, drq_l_prc_name, DYN_REQUESTS);
request = CMP_find_request(tdbb, drq_l_prc_name, DYN_REQUESTS);
found = false;
FOR(REQUEST_HANDLE request TRANSACTION_HANDLE gbl->gbl_transaction)
@ -4262,7 +4252,7 @@ static bool find_field_source(TDBB tdbb,
SET_TDBB(tdbb);
DBB dbb = tdbb->tdbb_database;
request = (BLK) CMP_find_request(tdbb, drq_l_fld_src2, DYN_REQUESTS);
request = CMP_find_request(tdbb, drq_l_fld_src2, DYN_REQUESTS);
/* CVC: It seems the logic of this function was changed over time. It's unlikely
it will cause a failure that leads to call DYN_error_punt(), unless the request finds
@ -4319,12 +4309,12 @@ static bool get_who( TDBB tdbb, GBL gbl, SCHAR* output_name)
SET_TDBB(tdbb);
request = (BLK) CMP_find_request(tdbb, drq_l_user_name, DYN_REQUESTS);
request = CMP_find_request(tdbb, drq_l_user_name, DYN_REQUESTS);
try {
if (!request)
{
request = (BLK) CMP_compile2(tdbb, who_blr, TRUE);
request = CMP_compile2(tdbb, who_blr, TRUE);
}
EXE_start(tdbb, (jrd_req*) request, gbl->gbl_transaction);
EXE_receive(tdbb, (jrd_req*) request, 0, MAX_SQL_IDENTIFIER_SIZE,
@ -4368,7 +4358,7 @@ bool is_it_user_name(GBL gbl, const TEXT* role_name, TDBB tdbb)
can infer there is a user with this name */
request_id = drq_get_user_priv;
request = (BLK) CMP_find_request(tdbb, request_id, DYN_REQUESTS);
request = CMP_find_request(tdbb, request_id, DYN_REQUESTS);
FOR(REQUEST_HANDLE request TRANSACTION_HANDLE gbl->gbl_transaction)
PRIV IN RDB$USER_PRIVILEGES WITH
(PRIV.RDB$USER EQ role_name AND
@ -4392,7 +4382,7 @@ bool is_it_user_name(GBL gbl, const TEXT* role_name, TDBB tdbb)
his privileges on the table */
request_id = drq_get_rel_owner;
request = (BLK) CMP_find_request(tdbb, request_id, DYN_REQUESTS);
request = CMP_find_request(tdbb, request_id, DYN_REQUESTS);
FOR(REQUEST_HANDLE request TRANSACTION_HANDLE gbl->gbl_transaction)
REL IN RDB$RELATIONS WITH
REL.RDB$OWNER_NAME EQ role_name

View File

@ -165,7 +165,7 @@ void DYN_delete_exception( GBL gbl, const UCHAR** ptr)
GET_STRING(ptr, t);
BLK request = (BLK) CMP_find_request(tdbb, drq_e_xcp, DYN_REQUESTS);
BLK request = CMP_find_request(tdbb, drq_e_xcp, DYN_REQUESTS);
bool found = false;
@ -216,7 +216,7 @@ void DYN_delete_filter( GBL gbl, const UCHAR** ptr)
TDBB tdbb = GET_THREAD_DATA;
DBB dbb = tdbb->tdbb_database;
BLK request = (BLK) CMP_find_request(tdbb, drq_e_filters, DYN_REQUESTS);
BLK request = CMP_find_request(tdbb, drq_e_filters, DYN_REQUESTS);
bool found = false;
@ -272,7 +272,7 @@ void DYN_delete_function( GBL gbl, const UCHAR** ptr)
TDBB tdbb = GET_THREAD_DATA;
DBB dbb = tdbb->tdbb_database;
BLK request = (BLK) CMP_find_request(tdbb, drq_e_func_args, DYN_REQUESTS);
BLK request = CMP_find_request(tdbb, drq_e_func_args, DYN_REQUESTS);
id = drq_e_func_args;
bool found = false;
@ -290,7 +290,7 @@ void DYN_delete_function( GBL gbl, const UCHAR** ptr)
if (!DYN_REQUEST(drq_e_func_args))
DYN_REQUEST(drq_e_func_args) = request;
request = (BLK) CMP_find_request(tdbb, drq_e_funcs, DYN_REQUESTS);
request = CMP_find_request(tdbb, drq_e_funcs, DYN_REQUESTS);
id = drq_e_funcs;
found = false;
@ -357,7 +357,7 @@ void DYN_delete_generator(GBL gbl, const UCHAR**ptr)
try {
GET_STRING(ptr, t);
request = (BLK) CMP_find_request(tdbb, drq_e_gens, DYN_REQUESTS);
request = CMP_find_request(tdbb, drq_e_gens, DYN_REQUESTS);
found = false;
@ -408,7 +408,7 @@ void DYN_delete_global_field( GBL gbl, const UCHAR** ptr)
TDBB tdbb = GET_THREAD_DATA;
DBB dbb = tdbb->tdbb_database;
BLK request = (BLK) CMP_find_request(tdbb, drq_l_fld_src, DYN_REQUESTS);
BLK request = CMP_find_request(tdbb, drq_l_fld_src, DYN_REQUESTS);
id = drq_l_fld_src;
bool found = false;
@ -432,7 +432,7 @@ void DYN_delete_global_field( GBL gbl, const UCHAR** ptr)
if (!DYN_REQUEST(drq_l_fld_src))
DYN_REQUEST(drq_l_fld_src) = request;
request = (BLK) CMP_find_request(tdbb, drq_e_gfields, DYN_REQUESTS);
request = CMP_find_request(tdbb, drq_e_gfields, DYN_REQUESTS);
id = drq_e_gfields;
found = false;
@ -492,7 +492,7 @@ void DYN_delete_index( GBL gbl, const UCHAR** ptr)
TDBB tdbb = GET_THREAD_DATA;
DBB dbb = tdbb->tdbb_database;
BLK request = (BLK) CMP_find_request(tdbb, drq_e_indices, DYN_REQUESTS);
BLK request = CMP_find_request(tdbb, drq_e_indices, DYN_REQUESTS);
bool found = false;
@ -595,7 +595,7 @@ void DYN_delete_local_field(
else
GET_STRING(ptr, tbl_nm);
BLK request = (BLK) CMP_find_request(tdbb, drq_l_dep_flds, DYN_REQUESTS);
BLK request = CMP_find_request(tdbb, drq_l_dep_flds, DYN_REQUESTS);
id = drq_l_dep_flds;
bool found;
@ -641,7 +641,7 @@ void DYN_delete_local_field(
** ===============================================================
*/
request = (BLK) CMP_find_request(tdbb, drq_g_rel_constr_nm, DYN_REQUESTS);
request = CMP_find_request(tdbb, drq_g_rel_constr_nm, DYN_REQUESTS);
id = drq_g_rel_constr_nm;
FOR(REQUEST_HANDLE request TRANSACTION_HANDLE gbl->gbl_transaction)
@ -692,7 +692,7 @@ void DYN_delete_local_field(
** ================================================================
*/
request = (BLK) CMP_find_request(tdbb, drq_e_l_idx, DYN_REQUESTS);
request = CMP_find_request(tdbb, drq_e_l_idx, DYN_REQUESTS);
id = drq_e_l_idx;
BLK old_request = NULL;
@ -711,8 +711,7 @@ void DYN_delete_local_field(
old_request = request;
id = drq_l_idx_seg;
request =
(BLK) CMP_find_request(tdbb, drq_l_idx_seg, DYN_REQUESTS);
request = CMP_find_request(tdbb, drq_l_idx_seg, DYN_REQUESTS);
FOR(REQUEST_HANDLE request TRANSACTION_HANDLE gbl->gbl_transaction)
FIRST 1 IDX_SEG IN RDB$INDEX_SEGMENTS
WITH IDX_SEG.RDB$INDEX_NAME EQ IDX.RDB$INDEX_NAME AND
@ -736,7 +735,7 @@ void DYN_delete_local_field(
if (!DYN_REQUEST(drq_e_l_idx))
DYN_REQUEST(drq_e_l_idx) = request;
request = (BLK) CMP_find_request(tdbb, drq_e_lfield, DYN_REQUESTS);
request = CMP_find_request(tdbb, drq_e_lfield, DYN_REQUESTS);
id = drq_e_lfield;
found = false;
@ -806,7 +805,7 @@ void DYN_delete_parameter( GBL gbl, const UCHAR** ptr, TEXT* proc_name)
TDBB tdbb = GET_THREAD_DATA;
DBB dbb = tdbb->tdbb_database;
BLK request = (BLK) CMP_find_request(tdbb, drq_e_prm, DYN_REQUESTS);
BLK request = CMP_find_request(tdbb, drq_e_prm, DYN_REQUESTS);
id = drq_e_prms;
bool found = false;
@ -827,8 +826,7 @@ void DYN_delete_parameter( GBL gbl, const UCHAR** ptr, TEXT* proc_name)
if (!PP.RDB$FIELD_SOURCE.NULL) {
old_request = request;
old_id = id;
request =
(BLK) CMP_find_request(tdbb, drq_d_gfields, DYN_REQUESTS);
request = CMP_find_request(tdbb, drq_d_gfields, DYN_REQUESTS);
id = drq_d_gfields;
FOR(REQUEST_HANDLE request TRANSACTION_HANDLE gbl->gbl_transaction)
@ -897,7 +895,7 @@ void DYN_delete_procedure( GBL gbl, const UCHAR** ptr)
DBB dbb = tdbb->tdbb_database;
tdbb->tdbb_flags |= TDBB_prc_being_dropped;
if (MET_lookup_procedure(tdbb, name, TRUE) == 0)
if (MET_lookup_procedure(tdbb, name, true) == 0)
{
tdbb->tdbb_flags &= ~TDBB_prc_being_dropped;
DYN_error_punt(false, 140, name, NULL, NULL, NULL, NULL);
@ -906,7 +904,7 @@ void DYN_delete_procedure( GBL gbl, const UCHAR** ptr)
tdbb->tdbb_flags &= ~TDBB_prc_being_dropped;
BLK request = (BLK) CMP_find_request(tdbb, drq_e_prms, DYN_REQUESTS);
BLK request = CMP_find_request(tdbb, drq_e_prms, DYN_REQUESTS);
id = drq_e_prms;
bool found = false;
@ -926,8 +924,7 @@ void DYN_delete_procedure( GBL gbl, const UCHAR** ptr)
if (!PP.RDB$FIELD_SOURCE.NULL) {
old_request = request;
old_id = id;
request =
(BLK) CMP_find_request(tdbb, drq_d_gfields, DYN_REQUESTS);
request = CMP_find_request(tdbb, drq_d_gfields, DYN_REQUESTS);
id = drq_d_gfields;
FOR(REQUEST_HANDLE request TRANSACTION_HANDLE gbl->gbl_transaction)
@ -953,7 +950,7 @@ void DYN_delete_procedure( GBL gbl, const UCHAR** ptr)
DYN_REQUEST(drq_e_prms) = request;
}
request = (BLK) CMP_find_request(tdbb, drq_e_prcs, DYN_REQUESTS);
request = CMP_find_request(tdbb, drq_e_prcs, DYN_REQUESTS);
id = drq_e_prcs;
found = false;
@ -981,7 +978,7 @@ void DYN_delete_procedure( GBL gbl, const UCHAR** ptr)
goto dyn_punt_140;
}
request = (BLK) CMP_find_request(tdbb, drq_e_prc_prvs, DYN_REQUESTS);
request = CMP_find_request(tdbb, drq_e_prc_prvs, DYN_REQUESTS);
id = drq_e_prc_prvs;
FOR(REQUEST_HANDLE request TRANSACTION_HANDLE gbl->gbl_transaction)
@ -1059,7 +1056,7 @@ void DYN_delete_relation( GBL gbl, const UCHAR** ptr, const TEXT* relation)
else
GET_STRING(ptr, relation_name);
BLK request = (BLK) CMP_find_request(tdbb, drq_e_rel_con2, DYN_REQUESTS);
BLK request = CMP_find_request(tdbb, drq_e_rel_con2, DYN_REQUESTS);
id = drq_e_rel_con2;
bool found = false;
@ -1083,7 +1080,7 @@ void DYN_delete_relation( GBL gbl, const UCHAR** ptr, const TEXT* relation)
if (!DYN_REQUEST(drq_e_rel_con2))
DYN_REQUEST(drq_e_rel_con2) = request;
request = (BLK) CMP_find_request(tdbb, drq_e_rel_idxs, DYN_REQUESTS);
request = CMP_find_request(tdbb, drq_e_rel_idxs, DYN_REQUESTS);
id = drq_e_rel_idxs;
FOR(REQUEST_HANDLE request TRANSACTION_HANDLE gbl->gbl_transaction)
@ -1099,7 +1096,7 @@ void DYN_delete_relation( GBL gbl, const UCHAR** ptr, const TEXT* relation)
if (!DYN_REQUEST(drq_e_rel_idxs))
DYN_REQUEST(drq_e_rel_idxs) = request;
request = (BLK) CMP_find_request(tdbb, drq_e_trg_msgs2, DYN_REQUESTS);
request = CMP_find_request(tdbb, drq_e_trg_msgs2, DYN_REQUESTS);
id = drq_e_trg_msgs2;
FOR(REQUEST_HANDLE request TRANSACTION_HANDLE gbl->gbl_transaction)
@ -1116,7 +1113,7 @@ void DYN_delete_relation( GBL gbl, const UCHAR** ptr, const TEXT* relation)
if (!DYN_REQUEST(drq_e_trg_msgs2))
DYN_REQUEST(drq_e_trg_msgs2) = request;
request = (BLK) CMP_find_request(tdbb, drq_e_rel_flds, DYN_REQUESTS);
request = CMP_find_request(tdbb, drq_e_rel_flds, DYN_REQUESTS);
id = drq_e_rel_flds;
FOR(REQUEST_HANDLE request TRANSACTION_HANDLE gbl->gbl_transaction)
@ -1138,7 +1135,7 @@ void DYN_delete_relation( GBL gbl, const UCHAR** ptr, const TEXT* relation)
if (!DYN_REQUEST(drq_e_rel_flds))
DYN_REQUEST(drq_e_rel_flds) = request;
request = (BLK) CMP_find_request(tdbb, drq_e_view_rels, DYN_REQUESTS);
request = CMP_find_request(tdbb, drq_e_view_rels, DYN_REQUESTS);
id = drq_e_view_rels;
FOR(REQUEST_HANDLE request TRANSACTION_HANDLE gbl->gbl_transaction)
@ -1152,7 +1149,7 @@ void DYN_delete_relation( GBL gbl, const UCHAR** ptr, const TEXT* relation)
if (!DYN_REQUEST(drq_e_view_rels))
DYN_REQUEST(drq_e_view_rels) = request;
request = (BLK) CMP_find_request(tdbb, drq_e_relation, DYN_REQUESTS);
request = CMP_find_request(tdbb, drq_e_relation, DYN_REQUESTS);
id = drq_e_relation;
found = false;
@ -1177,7 +1174,7 @@ void DYN_delete_relation( GBL gbl, const UCHAR** ptr, const TEXT* relation)
goto dyn_punt_61;
}
request = (BLK) CMP_find_request(tdbb, drq_e_rel_con3, DYN_REQUESTS);
request = CMP_find_request(tdbb, drq_e_rel_con3, DYN_REQUESTS);
id = drq_e_rel_con3;
FOR(REQUEST_HANDLE request TRANSACTION_HANDLE gbl->gbl_transaction)
@ -1197,7 +1194,7 @@ void DYN_delete_relation( GBL gbl, const UCHAR** ptr, const TEXT* relation)
/* Triggers must be deleted after check constraints */
request = (BLK) CMP_find_request(tdbb, drq_e_trigger2, DYN_REQUESTS);
request = CMP_find_request(tdbb, drq_e_trigger2, DYN_REQUESTS);
id = drq_e_trigger2;
found = false;
@ -1213,7 +1210,7 @@ void DYN_delete_relation( GBL gbl, const UCHAR** ptr, const TEXT* relation)
if (!DYN_REQUEST(drq_e_trigger2))
DYN_REQUEST(drq_e_trigger2) = request;
request = (BLK) CMP_find_request(tdbb, drq_e_usr_prvs, DYN_REQUESTS);
request = CMP_find_request(tdbb, drq_e_usr_prvs, DYN_REQUESTS);
id = drq_e_usr_prvs;
FOR(REQUEST_HANDLE request TRANSACTION_HANDLE gbl->gbl_transaction)
@ -1318,7 +1315,7 @@ void DYN_delete_role( GBL gbl, const UCHAR** ptr)
GET_STRING(ptr, role_name);
request = (BLK) CMP_find_request(tdbb, drq_drop_role, DYN_REQUESTS);
request = CMP_find_request(tdbb, drq_drop_role, DYN_REQUESTS);
id = drq_drop_role;
bool del_role_ok = true;
@ -1349,8 +1346,7 @@ void DYN_delete_role( GBL gbl, const UCHAR** ptr)
if (del_role_ok)
{
request =
(BLK) CMP_find_request(tdbb, drq_del_role_1, DYN_REQUESTS);
request = CMP_find_request(tdbb, drq_del_role_1, DYN_REQUESTS);
id = drq_del_role_1;
@ -1459,7 +1455,7 @@ STR file;
files = NULL;
*****/
BLK request = (BLK) CMP_find_request(tdbb, drq_e_shadow, DYN_REQUESTS);
BLK request = CMP_find_request(tdbb, drq_e_shadow, DYN_REQUESTS);
try {
@ -1522,7 +1518,7 @@ void DYN_delete_trigger( GBL gbl, const UCHAR** ptr)
TDBB tdbb = GET_THREAD_DATA;
DBB dbb = tdbb->tdbb_database;
BLK request = (BLK) CMP_find_request(tdbb, drq_e_trg_msgs, DYN_REQUESTS);
BLK request = CMP_find_request(tdbb, drq_e_trg_msgs, DYN_REQUESTS);
id = drq_e_trg_msgs;
bool found = false;
@ -1543,7 +1539,7 @@ void DYN_delete_trigger( GBL gbl, const UCHAR** ptr)
if (!DYN_REQUEST(drq_e_trg_msgs))
DYN_REQUEST(drq_e_trg_msgs) = request;
request = (BLK) CMP_find_request(tdbb, drq_e_trigger, DYN_REQUESTS);
request = CMP_find_request(tdbb, drq_e_trigger, DYN_REQUESTS);
id = drq_e_trigger;
found = false;
@ -1568,7 +1564,7 @@ void DYN_delete_trigger( GBL gbl, const UCHAR** ptr)
/* clear the update flags on the fields if this is the last remaining
trigger that changes a view */
request = (BLK) CMP_find_request(tdbb, drq_l_view_rel2, DYN_REQUESTS);
request = CMP_find_request(tdbb, drq_l_view_rel2, DYN_REQUESTS);
id = drq_l_view_rel2;
found = false;
@ -1589,7 +1585,7 @@ void DYN_delete_trigger( GBL gbl, const UCHAR** ptr)
DYN_REQUEST(drq_l_view_rel2) = request;
if (!found) {
request = (BLK) CMP_find_request(tdbb, drq_m_rel_flds, DYN_REQUESTS);
request = CMP_find_request(tdbb, drq_m_rel_flds, DYN_REQUESTS);
id = drq_m_rel_flds;
FOR(REQUEST_HANDLE request TRANSACTION_HANDLE gbl->gbl_transaction)
@ -1667,7 +1663,7 @@ void DYN_delete_trigger_msg( GBL gbl, const UCHAR** ptr, TEXT* trigger_name)
DYN_error_punt(false, 70, NULL, NULL, NULL, NULL, NULL);
/* msg 70: "TRIGGER NAME expected" */
BLK request = (BLK) CMP_find_request(tdbb, drq_e_trg_msg, DYN_REQUESTS);
BLK request = CMP_find_request(tdbb, drq_e_trg_msg, DYN_REQUESTS);
bool found = false;
@ -1725,7 +1721,7 @@ static bool delete_constraint_records(GBL gbl,
TDBB tdbb = GET_THREAD_DATA;
DBB dbb = tdbb->tdbb_database;
BLK request = (BLK) CMP_find_request(tdbb, drq_e_rel_con, DYN_REQUESTS);
BLK request = CMP_find_request(tdbb, drq_e_rel_con, DYN_REQUESTS);
bool found = false;
@ -1774,7 +1770,7 @@ static bool delete_dimension_records(GBL gbl, const TEXT* field_name)
TDBB tdbb = GET_THREAD_DATA;
DBB dbb = tdbb->tdbb_database;
BLK request = (BLK) CMP_find_request(tdbb, drq_e_dims, DYN_REQUESTS);
BLK request = CMP_find_request(tdbb, drq_e_dims, DYN_REQUESTS);
bool found = false;
@ -1844,7 +1840,7 @@ static void delete_f_key_constraint(TDBB tdbb,
SET_TDBB(tdbb);
DBB dbb = tdbb->tdbb_database;
BLK request = (BLK) CMP_find_request(tdbb, drq_e_rel_const, DYN_REQUESTS);
BLK request = CMP_find_request(tdbb, drq_e_rel_const, DYN_REQUESTS);
try {
@ -1895,7 +1891,7 @@ static void delete_gfield_for_lfield( GBL gbl, const TEXT* lfield_name)
**************************************/
TDBB tdbb = GET_THREAD_DATA;
DBB dbb = tdbb->tdbb_database;
BLK request = (BLK) CMP_find_request(tdbb, drq_e_l_gfld, DYN_REQUESTS);
BLK request = CMP_find_request(tdbb, drq_e_l_gfld, DYN_REQUESTS);
FOR(REQUEST_HANDLE request TRANSACTION_HANDLE gbl->gbl_transaction)
FLD IN RDB$FIELDS
@ -1937,7 +1933,7 @@ static bool delete_index_segment_records( GBL gbl, const TEXT* index_name)
TDBB tdbb = GET_THREAD_DATA;
DBB dbb = tdbb->tdbb_database;
BLK request = (BLK) CMP_find_request(tdbb, drq_e_idx_segs, DYN_REQUESTS);
BLK request = CMP_find_request(tdbb, drq_e_idx_segs, DYN_REQUESTS);
bool found = false;
@ -1984,7 +1980,7 @@ static bool delete_security_class2( GBL gbl, const TEXT* security_class)
TDBB tdbb = GET_THREAD_DATA;
DBB dbb = tdbb->tdbb_database;
BLK request = (BLK) CMP_find_request(tdbb, drq_e_class, DYN_REQUESTS);
BLK request = CMP_find_request(tdbb, drq_e_class, DYN_REQUESTS);
bool found = false;

View File

@ -136,7 +136,7 @@ void DYN_modify_database( GBL gbl, const UCHAR** ptr)
goto dyn_punt_84;
}
request = (BLK) CMP_find_request(tdbb, drq_m_database, DYN_REQUESTS);
request = CMP_find_request(tdbb, drq_m_database, DYN_REQUESTS);
const SSHORT length = gds__vax_integer(s + 1, 2);
SLONG start = gds__vax_integer(s + 3, length);
@ -272,7 +272,7 @@ void DYN_modify_exception( GBL gbl, const UCHAR** ptr)
TDBB tdbb = GET_THREAD_DATA;
DBB dbb = tdbb->tdbb_database;
BLK request = (BLK) CMP_find_request(tdbb, drq_m_xcp, DYN_REQUESTS);
BLK request = CMP_find_request(tdbb, drq_m_xcp, DYN_REQUESTS);
bool found = false;
try {
@ -345,7 +345,7 @@ void DYN_modify_global_field(
TDBB tdbb = GET_THREAD_DATA;
DBB dbb = tdbb->tdbb_database;
BLK request = (BLK) CMP_find_request(tdbb, drq_m_gfield, DYN_REQUESTS);
BLK request = CMP_find_request(tdbb, drq_m_gfield, DYN_REQUESTS);
bool found = false;
dyn_fld* orig_dom = 0;
@ -408,7 +408,7 @@ void DYN_modify_global_field(
orig_dom->dyn_precision = FLD.RDB$FIELD_PRECISION;
orig_dom->dyn_charlen = FLD.RDB$CHARACTER_LENGTH;
orig_dom->dyn_collation = FLD.RDB$COLLATION_ID;
orig_dom->dyn_null_flag = FLD.RDB$NULL_FLAG;
orig_dom->dyn_null_flag = FLD.RDB$NULL_FLAG != 0;
/* If the original field type is an array, force its blr type to blr_blob */
bool has_dimensions = false;
@ -591,7 +591,7 @@ void DYN_modify_global_field(
case isc_dyn_fld_not_null:
nullflg = true;
new_dom->dyn_null_flag = TRUE;
new_dom->dyn_null_flag = true;
break;
case isc_dyn_fld_query_name:
@ -889,7 +889,7 @@ void DYN_modify_index( GBL gbl, const UCHAR** ptr)
TDBB tdbb = GET_THREAD_DATA;
DBB dbb = tdbb->tdbb_database;
BLK request = (BLK) CMP_find_request(tdbb, drq_m_index, DYN_REQUESTS);
BLK request = CMP_find_request(tdbb, drq_m_index, DYN_REQUESTS);
bool found = false;
try {
@ -1045,7 +1045,7 @@ void DYN_modify_local_field(
DYN_execute(gbl, ptr, relation_name, field_name, NULL, NULL, NULL);
}
BLK request = (BLK) CMP_find_request(tdbb, drq_m_lfield, DYN_REQUESTS);
BLK request = CMP_find_request(tdbb, drq_m_lfield, DYN_REQUESTS);
bool found = false;
try {
@ -1174,7 +1174,7 @@ void DYN_modify_procedure( GBL gbl, const UCHAR** ptr)
try {
request = (BLK) CMP_find_request(tdbb, drq_m_prcs, DYN_REQUESTS);
request = CMP_find_request(tdbb, drq_m_prcs, DYN_REQUESTS);
found = false;
FOR(REQUEST_HANDLE request TRANSACTION_HANDLE gbl->gbl_transaction)
@ -1277,7 +1277,7 @@ void DYN_modify_relation( GBL gbl, const UCHAR** ptr)
field_name[0] = 0;
GET_STRING(ptr, name);
BLK request = (BLK) CMP_find_request(tdbb, drq_m_relation, DYN_REQUESTS);
BLK request = CMP_find_request(tdbb, drq_m_relation, DYN_REQUESTS);
bool found = false;
try {
@ -1372,7 +1372,7 @@ void DYN_modify_trigger( GBL gbl, const UCHAR** ptr)
TDBB tdbb = GET_THREAD_DATA;
DBB dbb = tdbb->tdbb_database;
BLK request = (BLK) CMP_find_request(tdbb, drq_m_trigger, DYN_REQUESTS);
BLK request = CMP_find_request(tdbb, drq_m_trigger, DYN_REQUESTS);
bool found = false;
try {
@ -1505,7 +1505,7 @@ void DYN_modify_trigger_msg( GBL gbl, const UCHAR** ptr, TEXT* trigger_name)
TDBB tdbb = GET_THREAD_DATA;
DBB dbb = tdbb->tdbb_database;
BLK request = (BLK) CMP_find_request(tdbb, drq_m_trg_msg, DYN_REQUESTS);
BLK request = CMP_find_request(tdbb, drq_m_trg_msg, DYN_REQUESTS);
try {
@ -1587,7 +1587,7 @@ void DYN_modify_view( GBL gbl, const UCHAR** ptr)
try {
request = (BLK) CMP_find_request(tdbb, drq_m_relation, DYN_REQUESTS);
request = CMP_find_request(tdbb, drq_m_relation, DYN_REQUESTS);
found = false;
FOR(REQUEST_HANDLE request TRANSACTION_HANDLE gbl->gbl_transaction)
@ -1668,7 +1668,7 @@ static void drop_cache( GBL gbl)
TDBB tdbb = GET_THREAD_DATA;
DBB dbb = tdbb->tdbb_database;
BLK request = (BLK) CMP_find_request(tdbb, drq_d_cache, DYN_REQUESTS);
BLK request = CMP_find_request(tdbb, drq_d_cache, DYN_REQUESTS);
bool found = false;
try {
@ -1718,7 +1718,7 @@ static void change_backup_mode( GBL gbl, UCHAR verb)
TDBB tdbb = GET_THREAD_DATA;
DBB dbb = tdbb->tdbb_database;
BLK request = (BLK) CMP_find_request(tdbb, drq_d_difference, DYN_REQUESTS);
BLK request = CMP_find_request(tdbb, drq_d_difference, DYN_REQUESTS);
bool found = false;
try {
@ -1774,7 +1774,7 @@ static void change_backup_mode( GBL gbl, UCHAR verb)
}
if (!found && verb == isc_dyn_begin_backup) try {
request = (BLK) CMP_find_request(tdbb, drq_s_difference, DYN_REQUESTS);
request = CMP_find_request(tdbb, drq_s_difference, DYN_REQUESTS);
STORE(REQUEST_HANDLE request TRANSACTION_HANDLE gbl->gbl_transaction)
X IN RDB$FILES
X.RDB$FILE_NAME.NULL = TRUE;
@ -1831,7 +1831,7 @@ static void drop_log( GBL gbl)
TDBB tdbb = GET_THREAD_DATA;
DBB dbb = tdbb->tdbb_database;
BLK request = (BLK) CMP_find_request(tdbb, drq_d_log, DYN_REQUESTS);
BLK request = CMP_find_request(tdbb, drq_d_log, DYN_REQUESTS);
bool found = false;
try {
@ -2272,7 +2272,7 @@ void DYN_modify_sql_field(GBL gbl,
orig_fld->dyn_precision = FLD.RDB$FIELD_PRECISION;
orig_fld->dyn_charlen = FLD.RDB$CHARACTER_LENGTH;
orig_fld->dyn_collation = FLD.RDB$COLLATION_ID;
orig_fld->dyn_null_flag = FLD.RDB$NULL_FLAG;
orig_fld->dyn_null_flag = FLD.RDB$NULL_FLAG != 0;
strcpy(orig_fld->dyn_fld_source, RFR.RDB$FIELD_SOURCE);
@ -2389,7 +2389,7 @@ void DYN_modify_sql_field(GBL gbl,
case isc_dyn_fld_not_null:
nullflg = true;
new_fld->dyn_null_flag = TRUE;
new_fld->dyn_null_flag = true;
break;
case isc_dyn_fld_dimensions:
@ -2663,7 +2663,7 @@ void get_domain_type(TDBB tdbb, DBB dbb, GBL gbl, DYN_FLD dom_fld)
dom_fld->dyn_precision = FLD.RDB$FIELD_PRECISION;
dom_fld->dyn_charlen = FLD.RDB$CHARACTER_LENGTH;
dom_fld->dyn_collation = FLD.RDB$COLLATION_ID;
dom_fld->dyn_null_flag = FLD.RDB$NULL_FLAG;
dom_fld->dyn_null_flag = FLD.RDB$NULL_FLAG != 0;
END_FOR;
CMP_release(tdbb, (jrd_req*)request);

View File

@ -24,7 +24,7 @@
#ifndef JRD_DYN_PROTO_H
#define JRD_DYN_PROTO_H
void DYN_ddl(struct att*, class jrd_tra*, USHORT, const UCHAR*);
void DYN_ddl(class att*, class jrd_tra*, USHORT, const UCHAR*);
#endif // JRD_DYN_PROTO_H

View File

@ -148,14 +148,14 @@ SINT64 DYN_UTIL_gen_unique_id(TDBB tdbb,
p += sizeof(gen_id_blr2);
req_handle = CMP_compile2(tdbb, reinterpret_cast<const UCHAR*>(blr), TRUE);
}
*request = (BLK)req_handle;
*request = req_handle;
EXE_start(tdbb, req_handle, dbb->dbb_sys_trans);
EXE_receive(tdbb, req_handle, 0, sizeof(value), (UCHAR*)&value);
EXE_unwind(tdbb, req_handle);
*request = NULL;
if (!DYN_REQUEST(id)) {
DYN_REQUEST(id) = (BLK)req_handle;
DYN_REQUEST(id) = req_handle;
}
return value;
@ -196,7 +196,7 @@ void DYN_UTIL_generate_constraint_name( TDBB tdbb, GBL gbl, TEXT* buffer)
"RDB$CONSTRAINT_NAME",
/* cast away volatile - bad */ (BLK*)&request));
request = (BLK) CMP_find_request(tdbb, drq_f_nxt_con, DYN_REQUESTS);
request = CMP_find_request(tdbb, drq_f_nxt_con, DYN_REQUESTS);
id = drq_f_nxt_con;
found = false;
@ -257,7 +257,7 @@ void DYN_UTIL_generate_field_name( TDBB tdbb, GBL gbl, TEXT* buffer)
"RDB$FIELD_NAME",
/* cast away volatile - bad */ (BLK*)&request));
request = (BLK) CMP_find_request(tdbb, drq_f_nxt_fld, DYN_REQUESTS);
request = CMP_find_request(tdbb, drq_f_nxt_fld, DYN_REQUESTS);
id = drq_f_nxt_fld;
found = false;
@ -312,7 +312,7 @@ void DYN_UTIL_generate_field_position(
try {
request = (BLK) CMP_find_request(tdbb, drq_l_fld_pos, DYN_REQUESTS);
request = CMP_find_request(tdbb, drq_l_fld_pos, DYN_REQUESTS);
FOR(REQUEST_HANDLE request)
X IN RDB$RELATION_FIELDS
@ -380,7 +380,7 @@ void DYN_UTIL_generate_index_name(TDBB tdbb,
"RDB$INDEX_NAME",
/* cast away volatile - bad */ (BLK*)&request));
request = (BLK) CMP_find_request(tdbb, drq_f_nxt_idx, DYN_REQUESTS);
request = CMP_find_request(tdbb, drq_f_nxt_idx, DYN_REQUESTS);
id = drq_f_nxt_idx;
found = false;
@ -439,7 +439,7 @@ void DYN_UTIL_generate_trigger_name( TDBB tdbb, GBL gbl, TEXT* buffer)
"RDB$TRIGGER_NAME",
/* cast away volatile - bad */ (BLK*)&request));
request = (BLK) CMP_find_request(tdbb, drq_f_nxt_trg, DYN_REQUESTS);
request = CMP_find_request(tdbb, drq_f_nxt_trg, DYN_REQUESTS);
id = drq_f_nxt_trg;
found = false;
@ -508,7 +508,7 @@ bool DYN_UTIL_get_prot(TDBB tdbb,
* The "(BLK)" cast, casts away volatile AND changes
* type at the same time - bad
*/
DYN_rundown_request( (BLK)request, drq_l_prot_mask);
DYN_rundown_request( (BLK) request, drq_l_prot_mask);
} // try
catch (const std::exception&) {
@ -540,7 +540,7 @@ void DYN_UTIL_store_check_constraints(TDBB tdbb,
SET_TDBB(tdbb);
DBB dbb = tdbb->tdbb_database;
request = (BLK) CMP_find_request(tdbb, drq_s_chk_con, DYN_REQUESTS);
request = CMP_find_request(tdbb, drq_s_chk_con, DYN_REQUESTS);
try {

View File

@ -52,6 +52,8 @@
*/
#if defined(NOT_USED_OR_REPLACED) && defined(__cplusplus)
class att;
class jrd_req;
ENTRYPOINT( "gds_attach_database",
@ -65,7 +67,7 @@ ENTRYPOINT( "gds_attach_database",
PSI5_attach_database,
"_jrd8_attach_database",
IPI_attach_database,
(ISC_STATUS*, SSHORT, const SCHAR*, struct att**, SSHORT,
(ISC_STATUS*, SSHORT, const SCHAR*, att**, SSHORT,
const SCHAR*, const SCHAR*))
ENTRYPOINT( "gds_blob_info",
@ -131,7 +133,7 @@ ENTRYPOINT( "gds_compile_request",
PSI5_compile_request,
"_jrd8_compile_request",
IPI_compile_request,
(ISC_STATUS*, struct att**, struct jrd_req**, SSHORT, const SCHAR*))
(ISC_STATUS*, att**, jrd_req**, SSHORT, const SCHAR*))
ENTRYPOINT( "gds_create_blob",
/**** jrd8_create_blob ***/ y_valve_no_entrypoint,
@ -157,7 +159,7 @@ ENTRYPOINT( "gds_create_database",
/**** PSI5_create_database ***/ y_valve_no_entrypoint,
"_jrd8_create_database",
IPI_create_database,
(ISC_STATUS*, USHORT, const UCHAR*, struct att**, USHORT,
(ISC_STATUS*, USHORT, const UCHAR*, att**, USHORT,
const UCHAR*, USHORT, const UCHAR*))
ENTRYPOINT( "gds_database_info",
@ -171,7 +173,7 @@ ENTRYPOINT( "gds_database_info",
PSI5_database_info,
"_jrd8_database_info",
IPI_database_info,
(ISC_STATUS*, struct att**, SSHORT, const SCHAR*, SSHORT, SCHAR*))
(ISC_STATUS*, att**, SSHORT, const SCHAR*, SSHORT, SCHAR*))
ENTRYPOINT( "gds_detach_database",
jrd8_detach_database,
@ -184,7 +186,7 @@ ENTRYPOINT( "gds_detach_database",
PSI5_detach_database,
"_jrd8_detach_database",
IPI_detach_database,
(ISC_STATUS*, struct att**))
(ISC_STATUS*, att**))
ENTRYPOINT( "gds_get_segment",
jrd8_get_segment,
@ -249,7 +251,7 @@ ENTRYPOINT( "gds_reconnect_transaction",
PSI5_reconnect_transaction,
"_jrd8_reconnect_transaction",
IPI_reconnect_transaction,
(ISC_STATUS*, struct att**, class jrd_tra**, SSHORT, const UCHAR*))
(ISC_STATUS*, att**, class jrd_tra**, SSHORT, const UCHAR*))
ENTRYPOINT( "gds_receive",
jrd8_receive,
@ -262,7 +264,7 @@ ENTRYPOINT( "gds_receive",
PSI5_receive, /* the bridge pipe server will have two less params, but should be OK */
"_jrd8_receive",
IPI_receive,
(ISC_STATUS*, struct jrd_req**, USHORT, USHORT, SCHAR*, SSHORT))
(ISC_STATUS*, jrd_req**, USHORT, USHORT, SCHAR*, SSHORT))
ENTRYPOINT( "gds_release_request",
jrd8_release_request,
@ -275,7 +277,7 @@ ENTRYPOINT( "gds_release_request",
PSI5_release_request,
"_jrd8_release_request",
IPI_release_request,
(ISC_STATUS*, struct jrd_req**))
(ISC_STATUS*, jrd_req**))
ENTRYPOINT( "gds_request_info",
jrd8_request_info,
@ -288,7 +290,7 @@ ENTRYPOINT( "gds_request_info",
PSI5_request_info,
"_jrd8_request_info",
IPI_request_info,
(ISC_STATUS*, struct jrd_req**, SSHORT, SSHORT, const SCHAR*, SSHORT, SCHAR*))
(ISC_STATUS*, jrd_req**, SSHORT, SSHORT, const SCHAR*, SSHORT, SCHAR*))
ENTRYPOINT("gds_rollback_transaction",
jrd8_rollback_transaction,
@ -314,7 +316,7 @@ ENTRYPOINT("gds_send",
PSI5_send,
"_jrd8_send",
IPI_send,
(ISC_STATUS *, struct jrd_req **, USHORT, USHORT, SCHAR *, SSHORT))
(ISC_STATUS *, jrd_req **, USHORT, USHORT, SCHAR *, SSHORT))
ENTRYPOINT("gds_start_and_send",
jrd8_start_and_send,
@ -327,7 +329,7 @@ ENTRYPOINT("gds_start_and_send",
PSI5_start_and_send,
"_jrd8_start_and_send",
IPI_start_and_send,
(ISC_STATUS*, struct jrd_req**, class jrd_tra**, USHORT, USHORT,
(ISC_STATUS*, jrd_req**, class jrd_tra**, USHORT, USHORT,
SCHAR*, SSHORT))
ENTRYPOINT("gds_start_request",
@ -341,7 +343,7 @@ ENTRYPOINT("gds_start_request",
PSI5_start_request,
"_jrd8_start_request",
IPI_start_request,
(ISC_STATUS*, struct jrd_req**, class jrd_tra**, SSHORT))
(ISC_STATUS*, jrd_req**, class jrd_tra**, SSHORT))
ENTRYPOINT( "gds_start_multiple",
jrd8_start_multiple,
@ -393,7 +395,7 @@ ENTRYPOINT("gds_unwind_request",
PSI5_unwind_request,
"_jrd8_unwind_request",
IPI_unwind_request,
(ISC_STATUS*, struct jrd_req**, SSHORT))
(ISC_STATUS*, jrd_req**, SSHORT))
ENTRYPOINT("gds_commit_retaining",
jrd8_commit_retaining,
@ -419,7 +421,7 @@ ENTRYPOINT("gds_que_events",
PSI5_que_events,
"_jrd8_que_events",
IPI_que_events,
(ISC_STATUS*, struct att**, SLONG*, SSHORT, const UCHAR*,
(ISC_STATUS*, att**, SLONG*, SSHORT, const UCHAR*,
FPTR_EVENT_CALLBACK, void*))
ENTRYPOINT("gds_cancel_events",
@ -433,7 +435,7 @@ ENTRYPOINT("gds_cancel_events",
PSI5_cancel_events,
"_jrd8_cancel_events",
IPI_cancel_events,
(ISC_STATUS*, struct att**, SLONG*))
(ISC_STATUS*, att**, SLONG*))
ENTRYPOINT("gds_ddl",
jrd8_ddl,
@ -446,7 +448,7 @@ ENTRYPOINT("gds_ddl",
PSI5_ddl,
"_jrd8_ddl",
IPI_ddl,
(ISC_STATUS*, struct att**, class jrd_tra**,
(ISC_STATUS*, att**, class jrd_tra**,
USHORT, const SCHAR*))
ENTRYPOINT("gds_open_blob2",
@ -460,7 +462,7 @@ ENTRYPOINT("gds_open_blob2",
PSI5_open_blob2,
"_jrd8_open_blob2",
IPI_open_blob2,
(ISC_STATUS*, struct att**, class jrd_tra**, struct blb**,
(ISC_STATUS*, att**, class jrd_tra**, struct blb**,
struct bid*, USHORT, const UCHAR*))
ENTRYPOINT("gds_create_blob2",
@ -474,7 +476,7 @@ ENTRYPOINT("gds_create_blob2",
PSI5_create_blob2,
"_jrd8_create_blob2",
IPI_create_blob2,
(ISC_STATUS*, struct att**, class jrd_tra**, struct blb**,
(ISC_STATUS*, att**, class jrd_tra**, struct blb**,
struct bid*, USHORT, const UCHAR*))
ENTRYPOINT( "gds_get_slice",
@ -488,7 +490,7 @@ ENTRYPOINT( "gds_get_slice",
PSI5_get_slice,
"_jrd8_get_slice",
IPI_get_slice,
(ISC_STATUS*, struct att**, class jrd_tra**, SLONG*, USHORT,
(ISC_STATUS*, att**, class jrd_tra**, SLONG*, USHORT,
const UCHAR*, USHORT, const UCHAR*, SLONG, UCHAR*, SLONG*))
ENTRYPOINT( "gds_put_slice",
@ -502,7 +504,7 @@ ENTRYPOINT( "gds_put_slice",
PSI5_put_slice,
"_jrd8_put_slice",
IPI_put_slice,
(ISC_STATUS*, struct att**, class jrd_tra**, SLONG*, USHORT,
(ISC_STATUS*, att**, class jrd_tra**, SLONG*, USHORT,
const UCHAR*, USHORT, const UCHAR*, SLONG, UCHAR*))
ENTRYPOINT( "gds_seek_blob",
@ -529,7 +531,7 @@ ENTRYPOINT( "isc_transact_request",
/**** PSI5_transact_request ***/ y_valve_no_entrypoint,
"_jrd8_transact_request",
IPI_transact_request,
(ISC_STATUS*, struct att**, class jrd_tra**, USHORT, const SCHAR*,
(ISC_STATUS*, att**, class jrd_tra**, USHORT, const SCHAR*,
USHORT, SCHAR*, USHORT, SCHAR*))
ENTRYPOINT( "isc_drop_database",
@ -543,7 +545,7 @@ ENTRYPOINT( "isc_drop_database",
/**** PSI5_drop_database ***/ y_valve_no_entrypoint,
"_jrd8_drop_database",
IPI_drop_database,
(ISC_STATUS*, struct att**))
(ISC_STATUS*, att**))
/* and the DSQL entry points */
ENTRYPOINT("isc_dsql_allocate_statement",
@ -743,7 +745,7 @@ ENTRYPOINT("isc_service_start", jrd8_service_start,
/**** PSI5_service_start ***/ y_valve_no_entrypoint,
"_jrd8_service_start",
IPI_service_start,
(ISC_STATUS*, struct svc**, ULONG*, USHORT, const SCHAR*))
(ISC_STATUS*, class svc**, ULONG*, USHORT, const SCHAR*))
ENTRYPOINT("isc_rollback_retaining", jrd8_rollback_retaining,
/**** "jrd5_rollback_retaining" ***/ NULL,
@ -765,7 +767,7 @@ ENTRYPOINT("gds_cancel_operation", jrd8_cancel_operation,
/*** PSI5_cancel_operation ***/ y_valve_no_entrypoint,
/*** "_jrd8_cancel_operation" ***/ NULL,
/*** IPI_cancel_operation ***/ y_valve_no_entrypoint,
(ISC_STATUS *, struct att **, USHORT))
(ISC_STATUS *, att**, USHORT))
#else
ENTRYPOINT("gds_cancel_operation",
/*** jrd8_cancel_operation ***/ y_valve_no_entrypoint,
@ -778,7 +780,7 @@ ENTRYPOINT("gds_cancel_operation",
/*** PSI5_cancel_operation ***/ y_valve_no_entrypoint,
/*** "_jrd8_cancel_operation" ***/ NULL,
/*** IPI_cancel_operation ***/ y_valve_no_entrypoint,
(ISC_STATUS *, struct att **, USHORT))
(ISC_STATUS *, att**, USHORT))
#endif
#undef ENTRYPOINT
#else // 0/1

View File

@ -303,7 +303,7 @@ void ERR_log(int facility, int number, const TEXT* message)
#if ( !defined( REQUESTER) && !defined( SUPERCLIENT))
BOOLEAN ERR_post_warning(ISC_STATUS status, ...)
bool ERR_post_warning(ISC_STATUS status, ...)
{
/**************************************
*
@ -317,8 +317,9 @@ BOOLEAN ERR_post_warning(ISC_STATUS status, ...)
**************************************/
va_list args;
int type, len;
ISC_STATUS *status_vector, *q;
ISC_STATUS* q;
int indx = 0, warning_indx = 0;
ISC_STATUS* status_vector;
VA_START(args, status);
status_vector = ((TDBB) GET_THREAD_DATA)->tdbb_status_vector;
@ -350,12 +351,13 @@ BOOLEAN ERR_post_warning(ISC_STATUS status, ...)
break;
case isc_arg_string:
q = reinterpret_cast < ISC_STATUS * >(va_arg(args, TEXT *));
q = reinterpret_cast<ISC_STATUS*>(va_arg(args, TEXT*));
if (strlen((TEXT *) q) >= MAX_ERRSTR_LEN) {
status_vector[(indx - 1)] = isc_arg_cstring;
status_vector[indx++] = MAX_ERRSTR_LEN;
}
status_vector[indx++] = reinterpret_cast < ISC_STATUS > (q);
// TEXT* forced to platform's int and stored as ISC_STATUS !!!
status_vector[indx++] = (ISC_STATUS)(U_IPTR) q;
break;
case isc_arg_interpreted:
@ -366,7 +368,8 @@ BOOLEAN ERR_post_warning(ISC_STATUS status, ...)
len = va_arg(args, int);
status_vector[indx++] =
(ISC_STATUS) (len >= MAX_ERRSTR_LEN) ? MAX_ERRSTR_LEN : len;
status_vector[indx++] = (ISC_STATUS) va_arg(args, TEXT *);
// TEXT* forced to platform's int and stored as ISC_STATUS !!!
status_vector[indx++] = (ISC_STATUS) (U_IPTR) va_arg(args, TEXT*);
break;
case isc_arg_number:
@ -381,11 +384,11 @@ BOOLEAN ERR_post_warning(ISC_STATUS status, ...)
break;
}
status_vector[indx] = isc_arg_end;
return TRUE;
return true;
}
else {
/* not enough free space */
return FALSE;
return false;
}
}
#endif

View File

@ -36,7 +36,7 @@ typedef enum idx_e {
idx_e_foreign
} IDX_E;
BOOLEAN ERR_post_warning(ISC_STATUS, ...);
bool ERR_post_warning(ISC_STATUS, ...);
void ERR_assert(const TEXT*, int);
void ERR_bugcheck(int);
void ERR_bugcheck_msg(const TEXT*);

View File

@ -85,7 +85,7 @@
static EVH acquire(void);
static FRB alloc_global(UCHAR type, ULONG length, BOOLEAN recurse);
static FRB alloc_global(UCHAR type, ULONG length, bool recurse);
static SLONG create_process(void);
static void delete_event(EVNT);
static void delete_process(SLONG);
@ -106,7 +106,7 @@ static void probe_processes(void);
static void punt(const TEXT*);
static void release(void);
static void remove_que(SRQ *);
static BOOLEAN request_completed(EVT_REQ);
static bool request_completed(EVT_REQ);
static ISC_STATUS return_ok(ISC_STATUS *);
#ifdef MULTI_THREAD
static void THREAD_ROUTINE watcher_thread(void *);
@ -183,7 +183,7 @@ SLONG EVENT_create_session(ISC_STATUS * status_vector)
create_process();
ACQUIRE;
SES session = (SES) alloc_global(type_ses, (SLONG) sizeof(ses), FALSE);
SES session = (SES) alloc_global(type_ses, (SLONG) sizeof(ses), false);
PRB process = (PRB) ABS_PTR(EVENT_process_offset);
session->ses_process = EVENT_process_offset;
@ -416,7 +416,7 @@ SLONG EVENT_que(ISC_STATUS* status_vector,
// Allocate request block
ACQUIRE;
EVT_REQ request = (EVT_REQ) alloc_global(type_req, sizeof(evt_req), FALSE);
EVT_REQ request = (EVT_REQ) alloc_global(type_req, sizeof(evt_req), false);
SES session = (SES) ABS_PTR(session_id);
insert_tail(&session->ses_requests, &request->req_requests);
request->req_session = session_id;
@ -482,7 +482,7 @@ SLONG EVENT_que(ISC_STATUS* status_vector,
}
else {
interest =
(RINT) alloc_global(type_rint, (SLONG) sizeof(rint), FALSE);
(RINT) alloc_global(type_rint, (SLONG) sizeof(rint), false);
event = (EVNT) ABS_PTR(event_offset);
insert_tail(&event->evnt_interests, &interest->rint_interests);
interest->rint_event = event_offset;
@ -526,7 +526,6 @@ static EVH acquire(void)
**************************************/
int mutex_state;
EVH header = NULL;
#ifdef MULTI_THREAD
if (mutex_state = ISC_mutex_lock(MUTEX))
mutex_bugcheck("mutex lock", mutex_state);
@ -570,9 +569,10 @@ static EVH acquire(void)
}
#endif /* WIN_NT */
EVH header = NULL;
#if (!(defined SUPERSERVER) && (defined HAVE_MMAP))
ISC_STATUS_ARRAY status_vector;
header = (evh*) ISC_remap_file(status_vector, &EVENT_data, length, FALSE);
header = (evh*) ISC_remap_file(status_vector, &EVENT_data, length, false);
#endif
if (!header) {
RELEASE;
@ -591,7 +591,7 @@ static EVH acquire(void)
}
static FRB alloc_global(UCHAR type, ULONG length, BOOLEAN recurse)
static FRB alloc_global(UCHAR type, ULONG length, bool recurse)
{
/**************************************
*
@ -613,7 +613,7 @@ static FRB alloc_global(UCHAR type, ULONG length, BOOLEAN recurse)
for (ptr = &EVENT_header->evh_free; (free = (FRB) ABS_PTR(*ptr)) && *ptr;
ptr = &free->frb_next)
{
const SLONG tail = free->frb_header.hdr_length - length;
const SLONG tail = free->hdr_length - length;
if (tail >= 0 && (!best || tail < best_tail)) {
best = ptr;
best_tail = tail;
@ -653,17 +653,17 @@ static FRB alloc_global(UCHAR type, ULONG length, BOOLEAN recurse)
#if !((defined SUPERSERVER) && (defined HAVE_MMAP))
ISC_STATUS_ARRAY status_vector;
header =
reinterpret_cast < EVH >
(ISC_remap_file(status_vector, &EVENT_data, ev_length, TRUE));
reinterpret_cast<EVH>
(ISC_remap_file(status_vector, &EVENT_data, ev_length, true));
#endif
if (header) {
free = (FRB) ((UCHAR *) header + old_length);
/**
free->frb_header.hdr_length = EVENT_EXTEND_SIZE - sizeof (struct evh);
free->hdr_length = EVENT_EXTEND_SIZE - sizeof (struct evh);
**/
free->frb_header.hdr_length =
free->hdr_length =
EVENT_data.sh_mem_length_mapped - old_length;
free->frb_header.hdr_type = type_frb;
free->hdr_type = type_frb;
free->frb_next = 0;
EVENT_header = header;
@ -676,7 +676,7 @@ static FRB alloc_global(UCHAR type, ULONG length, BOOLEAN recurse)
process->prb_flags &= ~PRB_remap_over;
#endif /* WIN_NT */
return alloc_global(type, length, TRUE);
return alloc_global(type, length, true);
}
}
@ -691,14 +691,14 @@ static FRB alloc_global(UCHAR type, ULONG length, BOOLEAN recurse)
if (best_tail < (SLONG) sizeof(frb))
*best = free->frb_next;
else {
free->frb_header.hdr_length -= length;
free = (FRB) ((UCHAR *) free + free->frb_header.hdr_length);
free->frb_header.hdr_length = length;
free->hdr_length -= length;
free = (FRB) ((UCHAR *) free + free->hdr_length);
free->hdr_length = length;
}
memset((UCHAR*) free + sizeof(hdr), 0,
free->frb_header.hdr_length - sizeof(hdr));
free->frb_header.hdr_type = type;
memset((UCHAR*) free + sizeof(event_hdr), 0,
free->hdr_length - sizeof(event_hdr));
free->hdr_type = type;
return free;
}
@ -720,7 +720,7 @@ static SLONG create_process(void)
return EVENT_process_offset;
ACQUIRE;
PRB process = (PRB) alloc_global(type_prb, (SLONG) sizeof(prb), FALSE);
PRB process = (PRB) alloc_global(type_prb, (SLONG) sizeof(prb), false);
insert_tail(&EVENT_header->evh_processes, &process->prb_processes);
QUE_INIT(process->prb_sessions);
EVENT_process_offset = REL_PTR(process);
@ -747,7 +747,7 @@ static SLONG create_process(void)
#ifdef MULTI_THREAD
if (gds__thread_start
(reinterpret_cast < FPTR_INT_VOID_PTR > (watcher_thread), NULL,
(reinterpret_cast<FPTR_INT_VOID_PTR>(watcher_thread), NULL,
THREAD_medium, THREAD_blast, 0))
ERR_bugcheck_msg("cannot start thread");
#endif
@ -1076,8 +1076,6 @@ static void exit_handler(void* arg)
* Cleanup on exit.
*
**************************************/
ISC_STATUS_ARRAY local_status;
if (EVENT_process_offset) {
if (EVENT_header->evh_current_process != EVENT_process_offset)
ACQUIRE;
@ -1088,6 +1086,8 @@ static void exit_handler(void* arg)
while (acquire_count > 0)
RELEASE;
ISC_STATUS_ARRAY local_status;
#ifndef SERVER
#ifdef SOLARIS_MT
ISC_unmap_object(local_status, &EVENT_data, (UCHAR**)&EVENT_process,
@ -1147,7 +1147,7 @@ static void free_global(FRB block)
FRB prior = NULL;
PTR offset = REL_PTR(block);
block->frb_header.hdr_type = type_frb;
block->hdr_type = type_frb;
for (ptr = &EVENT_header->evh_free; (free = (FRB) ABS_PTR(*ptr)) && *ptr;
prior = free, ptr = &free->frb_next)
@ -1158,7 +1158,7 @@ static void free_global(FRB block)
if (offset <= 0 || offset > EVENT_header->evh_length ||
(prior
&& (UCHAR*) block < (UCHAR*) prior + prior->frb_header.hdr_length))
&& (UCHAR*) block < (UCHAR*) prior + prior->hdr_length))
{
punt("free_global: bad block");
return;
@ -1171,21 +1171,17 @@ static void free_global(FRB block)
/* Try to merge free block with next block */
if (free
&& (SCHAR *) block + block->frb_header.hdr_length ==
(SCHAR *) free)
if (free && (SCHAR *) block + block->hdr_length == (SCHAR *) free)
{
block->frb_header.hdr_length += free->frb_header.hdr_length;
block->hdr_length += free->hdr_length;
block->frb_next = free->frb_next;
}
/* Next, try to merge the free block with the prior block */
if (prior
&& (SCHAR *) prior + prior->frb_header.hdr_length ==
(SCHAR *) block)
if (prior && (SCHAR *) prior + prior->hdr_length == (SCHAR *) block)
{
prior->frb_header.hdr_length += block->frb_header.hdr_length;
prior->hdr_length += block->hdr_length;
prior->frb_next = block->frb_next;
}
}
@ -1253,9 +1249,9 @@ static void init(void* arg, SH_MEM shmem_data, bool initialize)
#endif
FRB free = (FRB) ((UCHAR*) EVENT_header + sizeof(evh));
free->frb_header.hdr_length =
free->hdr_length =
EVENT_data.sh_mem_length_mapped - sizeof(evh);
free->frb_header.hdr_type = type_frb;
free->hdr_type = type_frb;
free->frb_next = 0;
EVENT_header->evh_free = (UCHAR *) free - (UCHAR *) EVENT_header;
@ -1296,7 +1292,7 @@ static EVNT make_event(USHORT length, const TEXT* string, SLONG parent_offset)
*
**************************************/
EVNT event =
(EVNT) alloc_global(type_evnt, (SLONG) (sizeof(evnt) + length), FALSE);
(EVNT) alloc_global(type_evnt, (SLONG) (sizeof(evnt) + length), false);
insert_tail(&EVENT_header->evh_events, &event->evnt_events);
QUE_INIT(event->evnt_interests);
@ -1392,7 +1388,8 @@ static void probe_processes(void)
const SLONG process_offset = REL_PTR(process);
if (process_offset != EVENT_process_offset &&
!ISC_check_process_existence(process->prb_process_id,
process->prb_process_uid[0], FALSE)) {
process->prb_process_uid[0], false))
{
que = (SRQ *) ABS_PTR(que->srq_backward);
delete_process(process_offset);
}
@ -1478,7 +1475,7 @@ static void remove_que(SRQ* node)
}
static BOOLEAN request_completed(EVT_REQ request)
static bool request_completed(EVT_REQ request)
{
/**************************************
*
@ -1495,10 +1492,10 @@ static BOOLEAN request_completed(EVT_REQ request)
interest = (RINT) ABS_PTR(next);
EVNT event = (EVNT) ABS_PTR(interest->rint_event);
if (interest->rint_count <= event->evnt_count)
return TRUE;
return true;
}
return FALSE;
return false;
}
@ -1544,9 +1541,10 @@ static int validate(void)
for (offset = sizeof(evh); offset < EVENT_header->evh_length;
offset += block->hdr_length)
{
HDR* block = (HDR *) ABS_PTR(offset);
event_hdr* block = (event_hdr*) ABS_PTR(offset);
if (!block->hdr_length || !block->hdr_type
|| block->hdr_type >= type_max) {
|| block->hdr_type >= type_max)
{
punt("bad block length or type");
break;
}
@ -1626,3 +1624,4 @@ static void THREAD_ROUTINE watcher_thread(void *dummy)
}
#endif

View File

@ -86,32 +86,34 @@ typedef struct evh {
#define type_ses 7 /* Session */
#define type_max 8
typedef struct hdr
struct event_hdr // CVC: previous clash with ods.h's hdr
{
SLONG hdr_length; /* Length of block */
UCHAR hdr_type; /* Type of block */
} HDR;
};
/* Free blocks */
typedef struct frb
struct frb : public event_hdr
{
HDR frb_header;
//event_hdr frb_header;
SLONG frb_next; /* Next block */
} *FRB;
};
typedef frb *FRB;
/* Process blocks */
typedef struct prb
struct prb : public event_hdr
{
HDR prb_header;
//event_hdr prb_header;
SRQ prb_processes; /* Process que owned by header */
SRQ prb_sessions; /* Sessions within process */
SLONG prb_process_id; /* Process id */
SLONG prb_process_uid[2]; /* Process UID (apollo) */
event_t prb_event[1]; /* Event on which to wait */
USHORT prb_flags;
} *PRB;
};
typedef prb *PRB;
#define PRB_wakeup 1 /* Schedule a wakeup for process */
#define PRB_pending 2 /* Wakeup has been requested, and is dangling */
@ -121,8 +123,8 @@ typedef struct prb
/* Session block */
typedef struct ses {
HDR ses_header;
struct ses : public event_hdr {
//event_hdr ses_header;
SRQ ses_sessions; /* Sessions within process */
SRQ ses_requests; /* Outstanding requests */
PTR ses_interests; /* Historical interests */
@ -130,14 +132,15 @@ typedef struct ses {
#ifdef MULTI_THREAD
USHORT ses_flags;
#endif
} *SES;
};
typedef ses *SES;
#define SES_delivering 1 /* Watcher thread is delivering an event */
/* Event block */
typedef struct evnt {
HDR evnt_header;
struct evnt : public event_hdr {
//event_hdr evnt_header;
SRQ evnt_events; /* System event que (owned by header) */
SRQ evnt_interests; /* Que of request interests in event */
PTR evnt_hash_collision; /* Hash table collision pointer */
@ -145,12 +148,13 @@ typedef struct evnt {
SLONG evnt_count; /* Current event count */
USHORT evnt_length; /* Length of event name */
TEXT evnt_name[1]; /* Event name */
} *EVNT;
};
typedef evnt *EVNT;
/* Request block */
typedef struct evt_req {
HDR req_header;
struct evt_req : public event_hdr {
//event_hdr req_header;
SRQ req_requests; /* Request que owned by session block */
PTR req_process; /* Parent process block */
PTR req_session; /* Parent session block */
@ -158,18 +162,20 @@ typedef struct evt_req {
FPTR_EVENT_CALLBACK req_ast; /* Asynchronous routine */
void *req_ast_arg; /* Argument for ast */
SLONG req_request_id; /* Request id, dummy */
} *EVT_REQ;
};
typedef evt_req *EVT_REQ;
/* Request interest block */
typedef struct rint {
HDR rint_header;
struct rint : public event_hdr {
//event_hdr rint_header;
SRQ rint_interests; /* Que owned by event */
PTR rint_event; /* Event of interest */
PTR rint_request; /* Request of interest */
PTR rint_next; /* Next interest of request */
SLONG rint_count; /* Threshhold count */
} *RINT;
};
typedef rint *RINT;
#define EPB_version1 1

View File

@ -19,7 +19,7 @@
*
* All Rights Reserved.
* Contributor(s): ______________________________________.
* $Id: evl.cpp,v 1.62 2004-02-02 11:01:33 robocop Exp $
* $Id: evl.cpp,v 1.63 2004-02-20 06:42:59 robocop Exp $
*/
/*
@ -160,12 +160,12 @@ static dsc* record_version(TDBB, const jrd_nod*, VLU);
static bool reject_duplicate(const UCHAR*, const UCHAR*, void*);
static dsc* scalar(TDBB, jrd_nod*, VLU);
static SSHORT sleuth(TDBB, jrd_nod*, dsc*, dsc*);
static BOOLEAN nc_sleuth_check(TextType, USHORT, const UCHAR*, const UCHAR*,
static bool nc_sleuth_check(TextType, USHORT, const UCHAR*, const UCHAR*,
const UCHAR*, const UCHAR*);
static BOOLEAN nc_sleuth_class(TextType, USHORT, const UCHAR*, const UCHAR*, UCHAR);
static BOOLEAN wc_sleuth_check(TextType, USHORT, const UCS2_CHAR*, const UCS2_CHAR*,
static bool nc_sleuth_class(TextType, USHORT, const UCHAR*, const UCHAR*, UCHAR);
static bool wc_sleuth_check(TextType, USHORT, const UCS2_CHAR*, const UCS2_CHAR*,
const UCS2_CHAR*, const UCS2_CHAR*);
static BOOLEAN wc_sleuth_class(TextType, USHORT, const UCS2_CHAR*, const UCS2_CHAR*,
static bool wc_sleuth_class(TextType, USHORT, const UCS2_CHAR*, const UCS2_CHAR*,
UCS2_CHAR);
static SSHORT string_boolean(TDBB, jrd_nod*, dsc*, dsc*, bool);
static SSHORT string_function(TDBB, jrd_nod*, SSHORT, const UCHAR*, SSHORT, const UCHAR*, USHORT, bool);
@ -366,8 +366,7 @@ SBM* EVL_bitmap(TDBB tdbb, jrd_nod* node)
{
inv* impure = (INV) ((SCHAR *) tdbb->tdbb_request + node->nod_impure);
BTR_evaluate(tdbb,
reinterpret_cast <
irb * >(node->nod_arg[e_idx_retrieval]),
reinterpret_cast<irb*>(node->nod_arg[e_idx_retrieval]),
&impure->inv_bitmap);
return &impure->inv_bitmap;
}
@ -1056,7 +1055,7 @@ dsc* EVL_expr(TDBB tdbb, jrd_nod* node)
impure->vlu_desc.dsc_dtype = dtype_long;
impure->vlu_desc.dsc_scale = ISC_TIME_SECONDS_PRECISION_SCALE;
impure->vlu_desc.dsc_address =
reinterpret_cast < UCHAR * >(&impure->vlu_misc.vlu_long);
reinterpret_cast<UCHAR*>(&impure->vlu_misc.vlu_long);
impure->vlu_desc.dsc_length = sizeof(ULONG);
*(ULONG *) impure->vlu_desc.dsc_address =
times.tm_sec * ISC_TIME_SECONDS_PRECISION +
@ -1540,8 +1539,7 @@ USHORT EVL_group(TDBB tdbb, Rsb* rsb, jrd_nod* node, USHORT state)
if (request->req_flags & req_null)
impure->vlu_desc.dsc_address = NULL;
else
EVL_make_value(tdbb, desc,
reinterpret_cast < vlu * >(impure));
EVL_make_value(tdbb, desc, impure);
}
}
@ -1571,8 +1569,7 @@ USHORT EVL_group(TDBB tdbb, Rsb* rsb, jrd_nod* node, USHORT state)
goto break_out;
}
else {
EVL_make_value(tdbb, desc,
reinterpret_cast < vlu * >(impure));
EVL_make_value(tdbb, desc, impure);
if (!vtemp.vlu_desc.dsc_address
|| MOV_compare(&vtemp.vlu_desc, desc))
{
@ -1602,8 +1599,14 @@ USHORT EVL_group(TDBB tdbb, Rsb* rsb, jrd_nod* node, USHORT state)
++impure->vlux_count;
if (!impure->vlu_desc.dsc_dtype)
{
EVL_make_value(tdbb, desc,
reinterpret_cast<vlu*>(&impure->vlu_desc));
EVL_make_value(tdbb, desc, impure);
// It was reinterpret_cast<vlu*>(&impure->vlu_desc));
// but vlu_desc is the first member of vlu and vlux
// derives from vlu and vlu doesn't derive from anything
// and it doesn't contain virtuals.
// Thus, &vlux->vlu_desc == &vlu->vlu_desc == &vlux
// Delete this comment or restore the original code
// when this reasoning has been validated, please.
break;
}
const SLONG result =
@ -1616,7 +1619,7 @@ USHORT EVL_group(TDBB tdbb, Rsb* rsb, jrd_nod* node, USHORT state)
(from->nod_type == nod_agg_min ||
from->nod_type == nod_agg_min_indexed)))
{
EVL_make_value(tdbb, desc, reinterpret_cast<vlu*>(impure));
EVL_make_value(tdbb, desc, impure);
}
/* if a max or min has been mapped to an index, then the first record is the eof */
@ -1635,7 +1638,7 @@ USHORT EVL_group(TDBB tdbb, Rsb* rsb, jrd_nod* node, USHORT state)
if (request->req_flags & req_null)
break;
++impure->vlux_count;
add(desc, from, reinterpret_cast < vlu * >(impure));
add(desc, from, impure);
break;
case nod_agg_total2:
@ -1644,7 +1647,7 @@ USHORT EVL_group(TDBB tdbb, Rsb* rsb, jrd_nod* node, USHORT state)
if (request->req_flags & req_null)
break;
++impure->vlux_count;
add2(desc, from, reinterpret_cast < vlu * >(impure));
add2(desc, from, impure);
break;
case nod_agg_count2:
@ -1871,7 +1874,7 @@ void EVL_make_value(TDBB tdbb, const dsc* desc, VLU value)
const USHORT length =
MOV_get_string_ptr(&from, &ttype, &address,
reinterpret_cast < vary * >(temp),
reinterpret_cast<vary*>(temp),
sizeof(temp));
/* Allocate a string block of sufficient size. */
@ -2057,7 +2060,7 @@ USHORT EVL_mb_sleuth_merge(TDBB tdbb,
len2 = obj.to_wc(pp2, len2, control, control_bytes, &err_code, &err_pos);
const USHORT ret_val = EVL_wc_sleuth_merge(tdbb, obj, pp1, len1, pp2, len2,
reinterpret_cast < UCS2_CHAR * >(combined),
reinterpret_cast<UCS2_CHAR*>(combined),
combined_bytes);
if (pp1 != buffer1)
@ -3005,8 +3008,8 @@ static void compute_agg_distinct(TDBB tdbb, jrd_nod* node)
while (true) {
UCHAR* data;
SORT_get(tdbb->tdbb_status_vector,
reinterpret_cast < SCB > (asb_impure->iasb_sort_handle),
reinterpret_cast < ULONG ** >(&data)
reinterpret_cast<SCB>(asb_impure->iasb_sort_handle),
reinterpret_cast<ULONG**>(&data)
#ifdef SCROLLABLE_CURSORS
, RSE_get_forward
#endif
@ -3014,7 +3017,7 @@ static void compute_agg_distinct(TDBB tdbb, jrd_nod* node)
if (data == NULL) {
/* we are done, close the sort */
SORT_fini(reinterpret_cast < SCB > (asb_impure->iasb_sort_handle),
SORT_fini(reinterpret_cast<SCB>(asb_impure->iasb_sort_handle),
tdbb->tdbb_attachment);
asb_impure->iasb_sort_handle = NULL;
break;
@ -3025,13 +3028,13 @@ static void compute_agg_distinct(TDBB tdbb, jrd_nod* node)
case nod_agg_total_distinct:
case nod_agg_average_distinct:
++impure->vlux_count;
add(desc, node, reinterpret_cast < vlu * >(impure));
add(desc, node, impure);
break;
case nod_agg_total_distinct2:
case nod_agg_average_distinct2:
++impure->vlux_count;
add2(desc, node, reinterpret_cast < vlu * >(impure));
add2(desc, node, impure);
break;
case nod_agg_count_distinct:
@ -3092,7 +3095,7 @@ static dsc* concatenate(TDBB tdbb, jrd_nod* node, VLU impure)
USHORT ttype1;
USHORT length1 =
MOV_get_string_ptr(value1, &ttype1, &address1,
reinterpret_cast < vary * >(temp1),
reinterpret_cast<vary*>(temp1),
sizeof(temp1));
/* value2 will be converted to the same text type as value1 */
@ -3107,7 +3110,7 @@ static dsc* concatenate(TDBB tdbb, jrd_nod* node, VLU impure)
str* temp3 = NULL;
USHORT length2 =
MOV_make_string2(value2, ttype1, &address2,
reinterpret_cast < vary * >(temp2),
reinterpret_cast<vary*>(temp2),
sizeof(temp2), &temp3);
dsc desc;
@ -3241,8 +3244,8 @@ static dsc* eval_statistical(TDBB tdbb, jrd_nod* node, VLU impure)
}
SLONG count = 0;
blk* rsb = (BLK) node->nod_arg[e_stat_rsb];
RSE_open(tdbb, reinterpret_cast < struct Rsb *>(rsb));
Rsb* rsb = (Rsb*) (BLK) node->nod_arg[e_stat_rsb];
RSE_open(tdbb, rsb);
/* Handle each variety separately */
@ -3250,8 +3253,7 @@ static dsc* eval_statistical(TDBB tdbb, jrd_nod* node, VLU impure)
{
case nod_count:
flag = 0;
while (RSE_get_record(tdbb, reinterpret_cast<struct Rsb*>(rsb),
g_RSE_get_mode))
while (RSE_get_record(tdbb, rsb, g_RSE_get_mode))
{
++impure->vlu_misc.vlu_long;
}
@ -3259,8 +3261,7 @@ static dsc* eval_statistical(TDBB tdbb, jrd_nod* node, VLU impure)
case nod_count2:
flag = 0;
while (RSE_get_record(tdbb, reinterpret_cast<struct Rsb*>(rsb),
g_RSE_get_mode))
while (RSE_get_record(tdbb, rsb, g_RSE_get_mode))
{
value = EVL_expr(tdbb, node->nod_arg[e_stat_value]);
if (!(request->req_flags & req_null)) {
@ -3271,8 +3272,7 @@ static dsc* eval_statistical(TDBB tdbb, jrd_nod* node, VLU impure)
case nod_min:
case nod_max:
while (RSE_get_record(tdbb, reinterpret_cast<struct Rsb*>(rsb),
g_RSE_get_mode))
while (RSE_get_record(tdbb, rsb, g_RSE_get_mode))
{
value = EVL_expr(tdbb, node->nod_arg[e_stat_value]);
if (request->req_flags & req_null) {
@ -3290,8 +3290,7 @@ static dsc* eval_statistical(TDBB tdbb, jrd_nod* node, VLU impure)
break;
case nod_from:
if (RSE_get_record(tdbb, reinterpret_cast<struct Rsb*>(rsb),
g_RSE_get_mode))
if (RSE_get_record(tdbb, rsb, g_RSE_get_mode))
{
desc = EVL_expr(tdbb, node->nod_arg[e_stat_value]);
}
@ -3307,8 +3306,7 @@ static dsc* eval_statistical(TDBB tdbb, jrd_nod* node, VLU impure)
case nod_average: /* total or average with dialect-1 semantics */
case nod_total:
while (RSE_get_record(tdbb, reinterpret_cast<struct Rsb*>(rsb),
g_RSE_get_mode))
while (RSE_get_record(tdbb, rsb, g_RSE_get_mode))
{
desc = EVL_expr(tdbb, node->nod_arg[e_stat_value]);
if (request->req_flags & req_null) {
@ -3337,8 +3335,7 @@ static dsc* eval_statistical(TDBB tdbb, jrd_nod* node, VLU impure)
break;
case nod_average2: /* average with dialect-3 semantics */
while (RSE_get_record(tdbb, reinterpret_cast<struct Rsb*>(rsb),
g_RSE_get_mode))
while (RSE_get_record(tdbb, rsb, g_RSE_get_mode))
{
desc = EVL_expr(tdbb, node->nod_arg[e_stat_value]);
if (request->req_flags & req_null)
@ -3385,7 +3382,7 @@ static dsc* eval_statistical(TDBB tdbb, jrd_nod* node, VLU impure)
/* Close stream and return value */
RSE_close(tdbb, reinterpret_cast < struct Rsb *>(rsb));
RSE_close(tdbb, rsb);
request->req_flags &= ~req_null;
request->req_flags |= flag;
@ -3427,7 +3424,7 @@ static SINT64 get_day_fraction(const dsc* d)
result.dsc_flags = 0;
result.dsc_sub_type = 0;
result.dsc_length = sizeof(double);
result.dsc_address = reinterpret_cast < UCHAR * >(&result_days);
result.dsc_address = reinterpret_cast<UCHAR*>(&result_days);
/* Convert the input number to a double */
CVT_move(d, &result, ERR_post);
@ -3510,7 +3507,7 @@ static SINT64 get_timestamp_to_isc_ticks(const dsc* d)
result.dsc_flags = 0;
result.dsc_sub_type = 0;
result.dsc_length = sizeof(GDS_TIMESTAMP);
result.dsc_address = reinterpret_cast < UCHAR * >(&result_timestamp);
result.dsc_address = reinterpret_cast<UCHAR*>(&result_timestamp);
CVT_move(d, &result, ERR_post);
@ -3570,7 +3567,7 @@ static dsc* lock_record(TDBB tdbb, jrd_nod* node, VLU impure)
USHORT lock_level;
Rsb* rsb;
RPB* rpb;
LCK lock = NULL;
lck* lock = NULL;
SET_TDBB(tdbb);
@ -3643,12 +3640,6 @@ static dsc* lock_relation(TDBB tdbb, jrd_nod* node, VLU impure)
* pointing to the lock handle.
*
**************************************/
dsc* desc;
USHORT lock_level;
jrd_nod* relation_node;
jrd_rel* relation;
LCK lock = NULL;
SET_TDBB(tdbb);
DEV_BLKCHK(node, type_nod);
@ -3661,15 +3652,16 @@ static dsc* lock_relation(TDBB tdbb, jrd_nod* node, VLU impure)
/* get the locking level */
desc = EVL_expr(tdbb, node->nod_arg[e_lockrel_level]);
lock_level = (USHORT) MOV_get_long(desc, 0);
dsc* desc = EVL_expr(tdbb, node->nod_arg[e_lockrel_level]);
const USHORT lock_level = (USHORT) MOV_get_long(desc, 0);
if (lock_level > LCK_EX)
ERR_post(isc_bad_lock_level, isc_arg_number, (SLONG) lock_level, 0);
/* perform the actual lock (or unlock) */
relation_node = node->nod_arg[e_lockrel_relation];
relation = (jrd_rel*) relation_node->nod_arg[e_rel_relation];
jrd_nod* relation_node = node->nod_arg[e_lockrel_relation];
jrd_rel* relation = (jrd_rel*) relation_node->nod_arg[e_rel_relation];
lck* lock = NULL;
if (!lock_level)
RLCK_unlock_relation(0, relation);
else
@ -3681,9 +3673,6 @@ static dsc* lock_relation(TDBB tdbb, jrd_nod* node, VLU impure)
impure->vlu_misc.vlu_long = (ULONG) lock;
#else
{
ATT att;
ULONG slot;
SET_TDBB(tdbb);
/* The lock pointer can't be stored in a ULONG. Therefore we must
@ -3692,8 +3681,9 @@ static dsc* lock_relation(TDBB tdbb, jrd_nod* node, VLU impure)
an index into this vector. When the user releases a lock, its
slot in the vector is zeroed and it becomes available for reuse. */
att = tdbb->tdbb_attachment;
slot = ALL_get_free_object(tdbb->tdbb_database->dbb_permanent,
ATT att = tdbb->tdbb_attachment;
const ULONG slot =
ALL_get_free_object(tdbb->tdbb_database->dbb_permanent,
&att->att_lck_quick_ref, 50);
att->att_lck_quick_ref->vec_object[slot] = lock;
impure->vlu_misc.vlu_long = slot;
@ -4288,9 +4278,12 @@ static dsc* scalar(TDBB tdbb, jrd_nod* node, VLU impure)
BLB_scalar(tdbb,
request->req_transaction,
reinterpret_cast < bid * >(desc->dsc_address),
reinterpret_cast<bid*>(desc->dsc_address),
list->nod_count,
subscripts, reinterpret_cast < vlu * >(&impure->vlu_desc));
subscripts, impure);
// It was subscripts, reinterpret_cast<vlu*>(&impure->vlu_desc));
// but vlu_desc is the first member of vlu and impure is already
// of type vlu*, so this cast seems nonsense.
return &impure->vlu_desc;
}
@ -4368,7 +4361,7 @@ static SSHORT sleuth(TDBB tdbb, jrd_nod* node, dsc* desc1, dsc* desc2)
blb* blob =
BLB_open(tdbb, tdbb->tdbb_request->req_transaction,
reinterpret_cast < bid * >(desc1->dsc_address));
reinterpret_cast<bid*>(desc1->dsc_address));
ret_val = FALSE;
while (!(blob->blb_flags & BLB_eof))
@ -4433,13 +4426,13 @@ static SSHORT string_boolean(TDBB tdbb, jrd_nod* node, dsc* desc1, dsc* desc2, b
if (!computed_invariant) {
l2 =
MOV_make_string2(desc2, type1, &p2,
reinterpret_cast < vary * >(temp2),
reinterpret_cast<vary*>(temp2),
TEMP_SIZE(temp2), &match_str);
}
l1 =
MOV_get_string_ptr(desc1, &xtype1, &p1,
reinterpret_cast < vary * >(temp1),
reinterpret_cast<vary*>(temp1),
TEMP_SIZE(temp1));
fb_assert(xtype1 == type1);
@ -4457,7 +4450,7 @@ static SSHORT string_boolean(TDBB tdbb, jrd_nod* node, dsc* desc1, dsc* desc2, b
if (!computed_invariant) {
l2 =
MOV_make_string2(desc2, type1, &p2,
reinterpret_cast < vary * >(temp2),
reinterpret_cast<vary*>(temp2),
TEMP_SIZE(temp2), &match_str);
}
}
@ -4465,19 +4458,19 @@ static SSHORT string_boolean(TDBB tdbb, jrd_nod* node, dsc* desc1, dsc* desc2, b
type1 = ttype_none; /* Do byte matching */
if (!computed_invariant) {
l2 =
MOV_get_string(desc2, &p2, reinterpret_cast < vary * >(temp2),
MOV_get_string(desc2, &p2, reinterpret_cast<vary*>(temp2),
TEMP_SIZE(temp2));
}
}
blb* blob =
BLB_open(tdbb, request->req_transaction, reinterpret_cast<bid*>(desc1->dsc_address));
blb* blob = BLB_open(tdbb, request->req_transaction,
reinterpret_cast<bid*>(desc1->dsc_address));
/* Performs the string_function on each segment of the blob until
a positive result is obtained */
ret_val = FALSE;
switch(node->nod_type) {
switch (node->nod_type) {
case nod_starts:
{
Firebird::StartsEvaluator<UCHAR> evaluator(p2, l2);
@ -4510,7 +4503,7 @@ static SSHORT string_boolean(TDBB tdbb, jrd_nod* node, dsc* desc1, dsc* desc2, b
break;
}
const USHORT l3 = MOV_make_string(dsc,
type1, &q1, (VARY *) temp3,
type1, &q1, (vary*) temp3,
TEMP_SIZE(temp3));
if (!l3)
ERR_post(isc_like_escape_invalid, 0);
@ -4661,7 +4654,7 @@ static SSHORT string_function(
return FALSE;
}
const USHORT l3 = MOV_make_string(dsc,
ttype, &q1, (VARY *) temp3,
ttype, &q1, (vary*) temp3,
TEMP_SIZE(temp3));
if (!l3)
ERR_post(isc_like_escape_invalid, 0);
@ -4739,8 +4732,8 @@ static dsc* substring(
{
/* Source string is a blob, things get interesting. */
BLB blob = BLB_open(tdbb, tdbb->tdbb_request->req_transaction,
reinterpret_cast<BID>(value->dsc_address));
blb* blob = BLB_open(tdbb, tdbb->tdbb_request->req_transaction,
reinterpret_cast<bid*>(value->dsc_address));
if (!blob->blb_length || blob->blb_length <= offset)
{
desc.dsc_length = 0;
@ -4777,7 +4770,7 @@ static dsc* substring(
desc.dsc_length =
MOV_get_string_ptr(value, &ttype, &desc.dsc_address,
reinterpret_cast < vary * >(temp), sizeof(temp));
reinterpret_cast<vary*>(temp), sizeof(temp));
INTL_ASSIGN_TTYPE(&desc, ttype);
/* CVC: Why bother? If the offset is greater or equal than the length in bytes,
@ -4881,7 +4874,7 @@ static dsc* upcase(TDBB tdbb, const dsc* value, VLU impure)
dsc desc;
desc.dsc_length =
MOV_get_string_ptr(value, &ttype, &desc.dsc_address,
reinterpret_cast < vary * >(temp), sizeof(temp));
reinterpret_cast<vary*>(temp), sizeof(temp));
desc.dsc_dtype = dtype_text;
INTL_ASSIGN_TTYPE(&desc, ttype);
EVL_make_value(tdbb, &desc, impure);

View File

@ -262,7 +262,7 @@ USHORT SLEUTH_MERGE_NAME(TDBB tdbb_dummy,
}
static BOOLEAN SLEUTH_AUX(
static bool SLEUTH_AUX(
TextType obj,
USHORT flags,
const SLEUTHTYPE* search,
@ -295,67 +295,79 @@ const SLEUTHTYPE* match, const SLEUTHTYPE* end_match)
c = COND_UPPER(obj, c);
if (match >= end_match || *match != GDML_MATCH_ANY) {
if (search >= end_search)
return FALSE;
return false;
d = *search++;
if (c != COND_UPPER(obj, d))
return FALSE;
return false;
}
else {
++match;
for (;;)
if (SLEUTH_AUX
(obj, flags, search, end_search, match,
end_match)) return TRUE;
(obj, flags, search, end_search, match, end_match))
{
return true;
}
else if (search < end_search) {
d = *search++;
if (c != COND_UPPER(obj, d))
return FALSE;
return false;
}
else
return FALSE;
return false;
}
}
else if (c == GDML_MATCH_ONE)
if (match >= end_match || *match != GDML_MATCH_ANY) {
if (search >= end_search)
return FALSE;
return false;
search++;
}
else {
if (++match >= end_match)
return TRUE;
return true;
for (;;)
if (SLEUTH_AUX
(obj, flags, search, end_search, match,
end_match)) return TRUE;
end_match))
{
return true;
}
else if (++search >= end_search)
return FALSE;
return false;
}
else if (c == GDML_CLASS_START) {
const SLEUTHTYPE* const char_class = match;
while (*match++ != GDML_CLASS_END) {
if (match >= end_match)
return FALSE;
return false;
}
const SLEUTHTYPE* const end_class = match - 1;
if (match >= end_match || *match != GDML_MATCH_ANY) {
if (!SLEUTH_CLASS_NAME
(obj, flags, char_class, end_class, *search++))
return FALSE;
{
return false;
}
}
else {
++match;
for (;;)
if (SLEUTH_AUX
(obj, flags, search, end_search, match,
end_match)) return TRUE;
end_match))
{
return true;
}
else if (search < end_search) {
if (!SLEUTH_CLASS_NAME
(obj, flags, char_class, end_class, *search++))
return FALSE;
{
return false;
}
}
else
return FALSE;
return false;
}
}
else if (c == GDML_FLAG_SET) {
@ -371,13 +383,13 @@ const SLEUTHTYPE* match, const SLEUTHTYPE* end_match)
}
if (search < end_search)
return FALSE;
return false;
return TRUE;
return true;
}
static BOOLEAN SLEUTH_CLASS_NAME(
static bool SLEUTH_CLASS_NAME(
TextType obj,
USHORT flags,
const SLEUTHTYPE* char_class,
@ -400,19 +412,19 @@ static BOOLEAN SLEUTH_CLASS_NAME(
fb_assert(end_class != NULL);
fb_assert(char_class <= end_class);
USHORT result = TRUE;
bool result = true;
character = COND_UPPER(obj, character);
if (*char_class == GDML_NOT) {
++char_class;
result = FALSE;
result = false;
}
while (char_class < end_class) {
const SLEUTHTYPE c = *char_class++;
if (c == GDML_QUOTE) {
if (*char_class++ == character)
return TRUE;
return true;
}
else if (*char_class == GDML_RANGE) {
char_class += 2;
@ -423,7 +435,7 @@ static BOOLEAN SLEUTH_CLASS_NAME(
return result;
}
return (result) ? FALSE : TRUE;
return !result;
}

View File

@ -32,7 +32,7 @@
* Contributor(s):
*
*
* $Id: evl_string.h,v 1.6 2004-01-28 07:50:32 robocop Exp $
* $Id: evl_string.h,v 1.7 2004-02-20 06:42:59 robocop Exp $
*
*/
@ -304,7 +304,7 @@ LikeEvaluator<CharType>::LikeEvaluator(
}
// percent sign
if (c == sql_match_any) {
switch(item->type) {
switch (item->type) {
case piSearch:
case piEscapedString:
patternItems.grow(patternItems.getCount()+1);
@ -319,7 +319,7 @@ LikeEvaluator<CharType>::LikeEvaluator(
}
// underscore
if (c == sql_match_one) {
switch(item->type) {
switch (item->type) {
case piSearch:
case piEscapedString:
patternItems.grow(patternItems.getCount()+1);
@ -437,7 +437,7 @@ bool LikeEvaluator<CharType>::processNextChunk(const CharType* data, SSHORT data
{
BranchItem *current_branch = &branches[branch_number];
PatternItem *current_pattern = current_branch->pattern;
switch(current_pattern->type) {
switch (current_pattern->type) {
case piDirectMatch:
if (data[data_pos] != current_pattern->str.data[current_branch->offset]) {
// Terminate matching branch

View File

@ -148,7 +148,7 @@ static jrd_nod* erase(TDBB, jrd_nod*, SSHORT);
static void execute_looper(TDBB, jrd_req*, jrd_tra*, enum jrd_req::req_s);
static void exec_sql(TDBB, jrd_req*, DSC *);
static void execute_procedure(TDBB, jrd_nod*);
static jrd_req* execute_triggers(TDBB, TRIG_VEC *, REC, REC, enum jrd_req::req_ta);
static jrd_req* execute_triggers(TDBB, trig_vec**, REC, REC, enum jrd_req::req_ta);
static jrd_nod* looper(TDBB, jrd_req*, jrd_nod*);
static jrd_nod* modify(TDBB, jrd_nod*, SSHORT);
static jrd_nod* receive_msg(TDBB, jrd_nod*);
@ -171,7 +171,7 @@ inline void PreModifyEraseTriggers(TDBB, trig_vec**, SSHORT, RPB*, REC, jrd_req:
#ifdef PC_ENGINE
static jrd_nod* find(TDBB, jrd_nod*);
static jrd_nod* find_dbkey(TDBB, jrd_nod*);
static LCK implicit_record_lock(jrd_tra*, RPB *);
static lck* implicit_record_lock(jrd_tra*, RPB *);
static jrd_nod* release_bookmark(TDBB, jrd_nod*);
static jrd_nod* set_bookmark(TDBB, jrd_nod*);
static jrd_nod* set_index(TDBB, jrd_nod*);
@ -215,7 +215,7 @@ static SLONG memory_count = 0;
#define RECORD_LOCK_CHECK_INTERVAL 10
#ifdef PC_ENGINE
// TMN: RAII class for LCK. Unlocks the LCK on destruction.
// TMN: RAII class for lck. Unlocks the lck on destruction.
class LCK_RAII_wrapper
{
LCK_RAII_wrapper() : l(0) {}
@ -224,9 +224,9 @@ class LCK_RAII_wrapper
RLCK_unlock_record_implicit(l, 0);
}
}
void assign(LCK lock) { l = lck; }
void assign(lck* lock) { l = lock; }
LCK l;
lck* l;
private:
LCK_RAII_wrapper(const LCK_RAII_wrapper&); // no impl.
@ -1064,12 +1064,12 @@ static void cleanup_rpb(TDBB tdbb, RPB *rpb)
}
else if (desc->dsc_dtype == dtype_varying)
{
VARY* vary = reinterpret_cast<VARY*>(p);
vary* varying = reinterpret_cast<vary*>(p);
USHORT length = desc->dsc_length - sizeof(USHORT);
if (length > vary->vary_length)
if (length > varying->vary_length)
{
p = reinterpret_cast<UCHAR*>(vary->vary_string + vary->vary_length);
length -= vary->vary_length;
p = reinterpret_cast<UCHAR*>(varying->vary_string + varying->vary_length);
length -= varying->vary_length;
do {
*p++ = 0;
} while (--length);
@ -1189,14 +1189,13 @@ static jrd_nod* erase(TDBB tdbb, jrd_nod* node, SSHORT which_trig)
rpb,
NULL,
transaction,
reinterpret_cast <
blk *
>(tdbb->tdbb_default), FALSE)))
reinterpret_cast<blk*>(tdbb->tdbb_default),
FALSE)))
{
ERR_post(isc_deadlock, isc_arg_gds, isc_update_conflict, 0);
}
VIO_data(tdbb, rpb,
reinterpret_cast < blk * >(tdbb->tdbb_request->req_pool));
reinterpret_cast<blk*>(tdbb->tdbb_request->req_pool));
/* If record is present, and the transaction is read committed,
* make sure the record has not been updated. Also, punt after
@ -1225,7 +1224,7 @@ static jrd_nod* erase(TDBB tdbb, jrd_nod* node, SSHORT which_trig)
{
/* check whether record locking is turned on */
LCK record_locking = RLCK_record_locking(relation);
lck* record_locking = RLCK_record_locking(relation);
if (record_locking->lck_physical != LCK_PR)
{
/* get an implicit lock on the record */
@ -1246,7 +1245,7 @@ static jrd_nod* erase(TDBB tdbb, jrd_nod* node, SSHORT which_trig)
which_trig, rpb, 0, jrd_req::req_trigger_delete);
if (relation->rel_file)
EXT_erase(rpb, reinterpret_cast < int *>(transaction));
EXT_erase(rpb, reinterpret_cast<int*>(transaction));
else if (!relation->rel_view_rse)
VIO_erase(tdbb, rpb, transaction);
@ -1380,7 +1379,7 @@ static void exec_sql(TDBB tdbb, jrd_req* request, DSC* dsc)
* Execute a string as SQL operator.
*
**************************************/
vary* v = reinterpret_cast <vary*> (
vary* v = reinterpret_cast<vary*>(
FB_NEW(*tdbb->tdbb_transaction->tra_pool) char[BUFFER_LARGE + sizeof(vary)]);
v->vary_length = BUFFER_LARGE;
ISC_STATUS_ARRAY local;
@ -1500,11 +1499,11 @@ static void execute_procedure(TDBB tdbb, jrd_nod* node)
EXE_start(tdbb, proc_request, transaction);
if (in_message) {
EXE_send(tdbb, proc_request, 0, in_msg_length,
reinterpret_cast < UCHAR * >(in_msg));
reinterpret_cast<UCHAR*>(in_msg));
}
EXE_receive(tdbb, proc_request, 1, out_msg_length,
reinterpret_cast < UCHAR * >(out_msg));
reinterpret_cast<UCHAR*>(out_msg));
/* Clean up all savepoints started during execution of the
procedure */
@ -1553,7 +1552,7 @@ static void execute_procedure(TDBB tdbb, jrd_nod* node)
static jrd_req* execute_triggers(TDBB tdbb,
TRIG_VEC* triggers,
trig_vec** triggers,
REC old_rec,
REC new_rec,
enum jrd_req::req_ta trigger_action)
@ -1583,7 +1582,7 @@ static jrd_req* execute_triggers(TDBB tdbb,
SET_TDBB(tdbb);
jrd_tra* transaction = tdbb->tdbb_request->req_transaction;
TRIG_VEC vector = *triggers;
trig_vec* vector = *triggers;
jrd_req* result = NULL;
try
@ -1750,7 +1749,7 @@ static jrd_nod* find_dbkey(TDBB tdbb, jrd_nod* node)
#ifdef PC_ENGINE
static LCK implicit_record_lock(jrd_tra* transaction, RPB * rpb)
static lck* implicit_record_lock(jrd_tra* transaction, RPB * rpb)
{
/**************************************
*
@ -1771,7 +1770,7 @@ static LCK implicit_record_lock(jrd_tra* transaction, RPB * rpb)
DEV_BLKCHK(transaction, type_tra);
jrd_rel* relation = rpb->rpb_relation;
LCK record_locking = relation->rel_record_locking;
lck* record_locking = relation->rel_record_locking;
/* occasionally we should check whether we really still need to
do record locking; this is defined as RECORD_LOCK_CHECK_INTERVAL--
@ -1785,7 +1784,7 @@ static LCK implicit_record_lock(jrd_tra* transaction, RPB * rpb)
return NULL;
}
LCK lock = RLCK_lock_record_implicit(transaction, rpb, LCK_SW, 0, 0);
lck* lock = RLCK_lock_record_implicit(transaction, rpb, LCK_SW, 0, 0);
if (!lock) {
ERR_post(isc_record_lock, 0);
}
@ -2557,8 +2556,8 @@ static jrd_nod* looper(TDBB tdbb, jrd_req* request, jrd_nod* in_node)
case nod_exec_into:
{
class ExecuteStatement* impure =
(class ExecuteStatement*)
ExecuteStatement* impure =
(ExecuteStatement*)
((SCHAR *) request + node->nod_impure);
switch (request->req_operation) {
case jrd_req::req_evaluate:
@ -2582,7 +2581,7 @@ static jrd_nod* looper(TDBB tdbb, jrd_req* request, jrd_nod* in_node)
case nod_post:
{
DFW work = DFW_post_work(transaction, dfw_post_event,
Deferred_work* work = DFW_post_work(transaction, dfw_post_event,
EVL_expr(tdbb, node->nod_arg[0]), 0);
if (node->nod_arg[1])
DFW_post_work_arg(transaction, work,
@ -2703,7 +2702,7 @@ static jrd_nod* looper(TDBB tdbb, jrd_req* request, jrd_nod* in_node)
desc = EVL_expr(tdbb, node->nod_arg[e_rellock_lock]);
#if SIZEOF_VOID_P != 8
RLCK_release_lock(*(LCK *) desc->dsc_address);
RLCK_release_lock(*(lck**) desc->dsc_address);
#else
{
att* attachment = tdbb->tdbb_attachment;
@ -2712,7 +2711,7 @@ static jrd_nod* looper(TDBB tdbb, jrd_req* request, jrd_nod* in_node)
const ULONG slot = *(ULONG *) desc->dsc_address;
vec* vector = attachment->att_lck_quick_ref;
if (vector && slot < vector->vec_count) {
lock = (LCK) vector->vec_object[slot];
lock = (lck*) vector->vec_object[slot];
}
RLCK_release_lock(lock);
vector->vec_object[slot] = NULL;
@ -2923,7 +2922,8 @@ static jrd_nod* modify(TDBB tdbb, jrd_nod* node, SSHORT which_trig)
org_rpb,
NULL,
transaction,
reinterpret_cast<BLK>(tdbb->tdbb_default), FALSE)))
reinterpret_cast<blk*>(tdbb->tdbb_default),
FALSE)))
{
ERR_post(isc_deadlock, isc_arg_gds, isc_update_conflict, 0);
}
@ -3657,7 +3657,7 @@ static void set_error(TDBB tdbb, const xcp_repeat* exception, jrd_nod* msg_node)
* and jump to handle error accordingly.
*
**************************************/
TEXT name[32], relation_name[32], *s, *r;
TEXT name[32], relation_name[32];
TEXT message[XCP_MESSAGE_LENGTH + 1], temp[XCP_MESSAGE_LENGTH + 1];
SET_TDBB(tdbb);
@ -3683,7 +3683,7 @@ static void set_error(TDBB tdbb, const xcp_repeat* exception, jrd_nod* msg_node)
length = MOV_make_string(desc,
ttype_none,
&string,
reinterpret_cast<VARY*>(temp),
reinterpret_cast<vary*>(temp),
sizeof(temp));
length = MIN(length, sizeof(message) - 1);
@ -3703,6 +3703,8 @@ static void set_error(TDBB tdbb, const xcp_repeat* exception, jrd_nod* msg_node)
}
message[length] = 0;
const TEXT* s;
switch (exception->xcp_type) {
case xcp_sql_code:
ERR_post(isc_sqlerr, isc_arg_number, exception->xcp_code, 0);
@ -3713,7 +3715,7 @@ static void set_error(TDBB tdbb, const xcp_repeat* exception, jrd_nod* msg_node)
request->req_trg_name);
// const CAST
s = (name[0]) ? name : (TEXT*) "";
r = (relation_name[0]) ? relation_name : (TEXT*) "";
const TEXT* r = (relation_name[0]) ? relation_name : (TEXT*) "";
ERR_post(exception->xcp_code,
isc_arg_string, ERR_cstring(s),
isc_arg_string, ERR_cstring(r), 0);
@ -3890,7 +3892,7 @@ static jrd_nod* store(TDBB tdbb, jrd_nod* node, SSHORT which_trig)
cleanup_rpb(tdbb, rpb);
if (relation->rel_file) {
EXT_store(rpb, reinterpret_cast < int *>(transaction));
EXT_store(rpb, reinterpret_cast<int*>(transaction));
}
else if (!relation->rel_view_rse)
{
@ -4179,7 +4181,7 @@ static void validate(TDBB tdbb, jrd_nod* list)
const USHORT length = MOV_make_string(EVL_expr(tdbb, node),
ttype_dynamic,
&value,
reinterpret_cast<VARY*>(temp),
reinterpret_cast<vary*>(temp),
sizeof(temp));
if (request->req_flags & req_null ||

View File

@ -106,7 +106,7 @@ class rse : public jrd_node_base
public:
USHORT rse_count;
USHORT rse_jointype; /* inner, left, full */
BOOLEAN rse_writelock;
bool rse_writelock;
Rsb* rse_rsb;
jrd_nod* rse_first;
jrd_nod* rse_skip;
@ -126,7 +126,7 @@ typedef rse* RSE;
#define rse_singular 2 /* flags rse-type node as from a singleton select */
#define rse_variant 4 /* flags rse as variant (not invariant?) */
#define rse_delta (sizeof(struct rse)-sizeof(struct jrd_nod))/sizeof(((jrd_nod*) NULL)->nod_arg[0])
#define rse_delta (sizeof(class rse)-sizeof(jrd_nod))/sizeof(((jrd_nod*) NULL)->nod_arg[0])
// Types of nulls placement for each column in sort order
#define rse_nulls_default 0
@ -144,7 +144,7 @@ public:
};
typedef lit* LIT;
#define lit_delta ((sizeof(struct lit) - sizeof(struct jrd_nod) - sizeof(SINT64)) / sizeof(jrd_nod**))
#define lit_delta ((sizeof(class lit) - sizeof(jrd_nod) - sizeof(SINT64)) / sizeof(jrd_nod**))
/* Aggregate Sort Block (for DISTINCT aggregates) */
@ -164,7 +164,7 @@ public:
};
typedef asb* ASB;
#define asb_delta ((sizeof(struct asb) - sizeof(struct jrd_nod)) / sizeof (jrd_nod**))
#define asb_delta ((sizeof(class asb) - sizeof(jrd_nod)) / sizeof (jrd_nod**))
/* Various structures in the impure area */
@ -538,13 +538,13 @@ struct csb_repeat
struct jrd_rel* csb_relation;
struct str* csb_alias; /* SQL alias name for this instance of relation */
struct jrd_prc* csb_procedure;
class jrd_prc* csb_procedure;
struct jrd_rel* csb_view; /* parent view */
struct idx* csb_idx; /* Packed description of indices */
struct str* csb_idx_allocation; /* Memory allocated to hold index descriptions */
jrd_nod* csb_message; /* Msg for send/receive */
struct fmt* csb_format; /* Default fmt for stream */
class fmt* csb_format; /* Default fmt for stream */
struct sbm* csb_fields; /* Fields referenced */
float csb_cardinality; /* Cardinality of relation */
jrd_nod* csb_plan; /* user-specified plan for this relation */
@ -590,13 +590,13 @@ public:
jrd_nod* csb_node;
struct acc* csb_access; /* Access items to be checked */
struct vec* csb_variables; /* Vector of variables, if any */
class Rsc* csb_resources; /* Resources (relations and indexes) */
struct lls* csb_dependencies; /* objects this request depends upon */
Firebird::Array<class Rsb*> csb_fors; /* stack of fors */
Firebird::Array<struct jrd_nod*> csb_invariants; /* stack of invariant nodes */
Firebird::Array<struct jrd_node_base*> csb_current_nodes; /* rse's and other invariant candidates within whose scope we are */
class Resource* csb_resources; /* Resources (relations and indexes) */
class lls* csb_dependencies; /* objects this request depends upon */
Firebird::Array<Rsb*> csb_fors; /* stack of fors */
Firebird::Array<jrd_nod*> csb_invariants; /* stack of invariant nodes */
Firebird::Array<jrd_node_base*> csb_current_nodes; /* rse's and other invariant candidates within whose scope we are */
#ifdef SCROLLABLE_CURSORS
struct rse* csb_current_rse; /* this holds the rse currently being processed;
rse* csb_current_rse; /* this holds the rse currently being processed;
unlike the current_rses stack, it references any expanded view rse */
#endif
jrd_nod* csb_async_message; /* asynchronous message to send to request */
@ -667,5 +667,5 @@ public:
#define XCP_MESSAGE_LENGTH 78 // must correspond to the size of
// RDB$EXCEPTIONS.RDB$MESSAGE
#endif /* JRD_EXE_H */
#endif // JRD_EXE_H

View File

@ -24,15 +24,16 @@
#ifndef JRD_EXE_PROTO_H
#define JRD_EXE_PROTO_H
class jrd_req;
void EXE_assignment(TDBB, struct jrd_nod*);
struct jrd_req* EXE_find_request(TDBB, struct jrd_req *, bool);
void EXE_receive(TDBB, struct jrd_req*, USHORT, USHORT, UCHAR*);
void EXE_send(TDBB, struct jrd_req *, USHORT, USHORT, UCHAR *);
void EXE_start(TDBB, struct jrd_req *, class jrd_tra *);
void EXE_unwind(TDBB, struct jrd_req *);
jrd_req* EXE_find_request(TDBB, jrd_req *, bool);
void EXE_receive(TDBB, jrd_req*, USHORT, USHORT, UCHAR*);
void EXE_send(TDBB, jrd_req*, USHORT, USHORT, UCHAR *);
void EXE_start(TDBB, jrd_req*, class jrd_tra *);
void EXE_unwind(TDBB, jrd_req*);
#ifdef SCROLLABLE_CURSORS
void EXE_seek(TDBB, struct jrd_req *, USHORT, ULONG);
void EXE_seek(TDBB, jrd_req*, USHORT, ULONG);
#endif
#ifdef PC_ENGINE
@ -41,4 +42,5 @@ void EXE_mark_crack(TDBB, Rsb*, USHORT);
#endif
#endif /* JRD_EXE_PROTO_H */
#endif // JRD_EXE_PROTO_H

View File

@ -71,7 +71,7 @@ IB_FILE *ext_fopen(const char *filename, const char *mode) {
if (!iExternalFileDirectoryList.IsPathInList(filename))
ERR_post(isc_conf_access_denied,
isc_arg_string, "external file",
isc_arg_string, ERR_cstring(const_cast <TEXT *>(filename)),
isc_arg_string, ERR_cstring(filename),
isc_arg_end);
return ib_fopen(filename, mode);
@ -184,8 +184,7 @@ EXT EXT_file(jrd_rel* relation, const TEXT * file_name, SLONG * description)
ERR_post(isc_io_error,
isc_arg_string, "ib_fopen",
isc_arg_string,
ERR_cstring(reinterpret_cast <
char *>(file->ext_filename)),
ERR_cstring(reinterpret_cast<const char*>(file->ext_filename)),
isc_arg_gds, isc_io_open_err, SYS_ERR, errno, 0);
}
else {
@ -255,7 +254,7 @@ int EXT_get(Rsb* rsb)
ERR_post(isc_io_error,
isc_arg_string, "ib_fseek",
isc_arg_string,
ERR_cstring(reinterpret_cast < char *>(file->ext_filename)),
ERR_cstring(reinterpret_cast<const char*>(file->ext_filename)),
isc_arg_gds, isc_io_open_err, SYS_ERR, errno, 0);
}
@ -501,7 +500,7 @@ void EXT_store(RPB * rpb, int *transaction)
|| (ib_fseek((IB_FILE *) file->ext_ifi, (SLONG) 0, 2) != 0))
{
ERR_post(isc_io_error, isc_arg_string, "ib_fseek", isc_arg_string,
ERR_cstring(reinterpret_cast < char *>(file->ext_filename)),
ERR_cstring(reinterpret_cast<const char*>(file->ext_filename)),
isc_arg_gds, isc_io_open_err, SYS_ERR, errno, 0);
}
for (; l--; ++p)

View File

@ -61,7 +61,7 @@ typedef struct dls {
typedef struct mdls {
DLS mdls_dls; /* Pointer to the directory list */
BOOLEAN mdls_mutex_init;
bool mdls_mutex_init;
MUTX_T mdls_mutex[1]; /* Mutex for directory list. Must
be locked before list operations */
} MDLS;

View File

@ -306,7 +306,7 @@ ISC_STATUS filter_format(USHORT action, ctl* control)
length = control->ctl_buffer_length;
control->ctl_segment_length = length;
move(temp2, reinterpret_cast < char *>(control->ctl_buffer), length);
move(temp2, reinterpret_cast<char*>(control->ctl_buffer), length);
return FB_SUCCESS;
}
@ -444,7 +444,7 @@ ISC_STATUS filter_runtime(USHORT action, ctl* control)
}
control->ctl_segment_length = length;
move(line, reinterpret_cast < char *>(control->ctl_buffer),
move(line, reinterpret_cast<char*>(control->ctl_buffer),
control->ctl_segment_length);
return status;
@ -1187,7 +1187,7 @@ static ISC_STATUS string_filter(USHORT action, ctl* control)
if (length > control->ctl_buffer_length)
length = control->ctl_buffer_length;
move(string->tmp_string + (USHORT) control->ctl_data[2],
reinterpret_cast < char *>(control->ctl_buffer), length);
reinterpret_cast<char*>(control->ctl_buffer), length);
control->ctl_data[2] += length;
if (control->ctl_data[2] == string->tmp_length) {
control->ctl_data[1] = (IPTR) string->tmp_next;

View File

@ -43,7 +43,7 @@
*
*/
/*
$Id: flu.cpp,v 1.44 2004-02-08 18:47:44 skidder Exp $
$Id: flu.cpp,v 1.45 2004-02-20 06:43:00 robocop Exp $
*/
#include "firebird.h"
@ -745,7 +745,7 @@ NSModule ISC_link_with_module (
NSCreateObjectFileImageFromFile(fileName, &image);
if (retVal != NSObjectFileImageSuccess)
{
switch(retVal)
switch (retVal)
{
case NSObjectFileImageFailure:
/*printf("object file setup failure");*/
@ -869,7 +869,7 @@ static MOD search_for_module(TEXT* module_name, TEXT* name, bool ShowAccessError
if (ShowAccessError) {
ERR_post(isc_conf_access_denied,
isc_arg_string, "UDF library",
isc_arg_string, ERR_cstring(const_cast <TEXT *>(absolute_module.c_str())),
isc_arg_string, ERR_cstring(absolute_module.c_str()),
isc_arg_end);
}
return NULL;

View File

@ -30,7 +30,7 @@
* 2003.08.10 Claudio Valderrama: Fix SF Bugs #544132 and #728839.
*/
/*
$Id: fun.epp,v 1.35 2004-01-28 07:50:32 robocop Exp $
$Id: fun.epp,v 1.36 2004-02-20 06:43:00 robocop Exp $
*/
#include "firebird.h"
@ -86,23 +86,23 @@ double MTH$CVT_D_G(), MTH$CVT_G_D();
typedef struct blob_t {
// SSHORT(*blob_get_segment) ();
SSHORT (*blob_get_segment) (BLB, UCHAR*, USHORT, USHORT*);
SSHORT (*blob_get_segment) (blb*, UCHAR*, USHORT, USHORT*);
// int* blob_handle;
void* blob_handle;
SLONG blob_number_segments;
SLONG blob_max_segment;
SLONG blob_total_length;
// void (*blob_put_segment) ();
void (*blob_put_segment) (BLB, const UCHAR*, USHORT);
void (*blob_put_segment) (blb*, const UCHAR*, USHORT);
// SLONG(*blob_seek) ();
SLONG (*blob_seek) (BLB, USHORT, SLONG);
SLONG (*blob_seek) (blb*, USHORT, SLONG);
} *BLOB;
static SSHORT blob_get_segment(BLB, UCHAR*, USHORT, USHORT*);
static void blob_put_segment(BLB, const UCHAR*, USHORT);
static SLONG blob_lseek(BLB, USHORT, SLONG);
static SSHORT blob_get_segment(blb*, UCHAR*, USHORT, USHORT*);
static void blob_put_segment(blb*, const UCHAR*, USHORT);
static SLONG blob_lseek(blb*, USHORT, SLONG);
static SLONG get_scalar_array(fun_repeat*, DSC*, SAD, LLS*);
@ -121,11 +121,11 @@ void FUN_evaluate(FUN function, jrd_nod* node, VLU value)
SLONG args[MAX_UDF_ARGUMENTS + 1];
UCHAR temp[800];
str* temp_string;
TDBB tdbb = GET_THREAD_DATA;
// Start by constructing argument list
str* temp_string;
UCHAR* temp_ptr;
if (function->fun_temp_length < sizeof(temp))
@ -142,7 +142,7 @@ void FUN_evaluate(FUN function, jrd_nod* node, VLU value)
temp_string =
FB_NEW_RPT(*tdbb->tdbb_default,
function->fun_temp_length + DOUBLE_ALIGN - 1) str;
MOVE_CLEAR(temp_string->str_data, temp_string->str_length);
MOVE_CLEAR(temp_string->str_data, temp_string->str_length); // useless, as noted by NS
temp_ptr = (UCHAR *) FB_ALIGN((U_IPTR) temp_string->str_data, DOUBLE_ALIGN);
}
@ -434,7 +434,7 @@ void FUN_evaluate(FUN function, jrd_nod* node, VLU value)
{
blob =
BLB_create(tdbb, tdbb->tdbb_request->req_transaction,
(BID) &value->vlu_misc);
(bid*) &value->vlu_misc);
return_blob_struct = blob_desc;
}
else
@ -453,7 +453,7 @@ void FUN_evaluate(FUN function, jrd_nod* node, VLU value)
isc_arg_gds, isc_blobnotsup,
isc_arg_string, "conversion", 0);
}
blob_id = *(BID) input->dsc_address;
blob_id = *(bid*) input->dsc_address;
}
blob = BLB_open(tdbb,
tdbb->tdbb_request->req_transaction,
@ -580,7 +580,7 @@ void FUN_evaluate(FUN function, jrd_nod* node, VLU value)
case dtype_long:
if (return_dsc)
{
switch(return_dsc->dsc_dtype)
switch (return_dsc->dsc_dtype)
{
case dtype_short:
value->vlu_misc.vlu_long = *(SSHORT *) temp_ptr;
@ -610,7 +610,7 @@ void FUN_evaluate(FUN function, jrd_nod* node, VLU value)
case dtype_int64:
if (return_dsc)
{
switch(return_dsc->dsc_dtype)
switch (return_dsc->dsc_dtype)
{
case dtype_short:
value->vlu_misc.vlu_int64 = *(SSHORT *) temp_ptr;
@ -659,7 +659,7 @@ void FUN_evaluate(FUN function, jrd_nod* node, VLU value)
temp_desc = value->vlu_desc;
temp_desc.dsc_address = temp_ptr;
temp_desc.dsc_length =
reinterpret_cast<VARY *>(temp_ptr)->vary_length + sizeof(USHORT);
reinterpret_cast<vary*>(temp_ptr)->vary_length + sizeof(USHORT);
MOV_move(&temp_desc, &value->vlu_desc);
break;
@ -708,7 +708,7 @@ void FUN_evaluate(FUN function, jrd_nod* node, VLU value)
while (blob_stack)
{
BLB_close(tdbb, (BLB)LLS_POP(&blob_stack));
BLB_close(tdbb, (blb*)LLS_POP(&blob_stack));
}
while (array_stack)
@ -757,9 +757,7 @@ void FUN_fini( TDBB tdbb)
* Unregister interest in external function modules.
*
**************************************/
DBB dbb;
dbb = tdbb->tdbb_database;
DBB dbb = tdbb->tdbb_database;
while (dbb->dbb_modules)
FLU_unregister_module((MOD) LLS_POP(&dbb->dbb_modules));
@ -781,7 +779,7 @@ void FUN_init(void)
}
FUN FUN_lookup_function(TEXT * name, bool ShowAccessError)
FUN FUN_lookup_function(const TEXT* name, bool ShowAccessError)
{
/**************************************
*
@ -793,28 +791,14 @@ FUN FUN_lookup_function(TEXT * name, bool ShowAccessError)
* Lookup function by name.
*
**************************************/
TDBB tdbb;
DBB dbb;
BLK request_fun, request_arg;
FUN function, prior;
SYM symbol;
STR string;
STR exception_msg;
TEXT *p;
MOD module;
LLS stack;
USHORT count, args, l;
ULONG length;
fun_repeat *tail, temp[MAX_UDF_ARGUMENTS + 1];
tdbb = GET_THREAD_DATA;
dbb = tdbb->tdbb_database;
TDBB tdbb = GET_THREAD_DATA;
DBB dbb = tdbb->tdbb_database;
/* Start by looking for already defined symbol */
#ifdef V4_THREADING
V4_JRD_MUTEX_LOCK(dbb->dbb_mutexes + DBB_MUTX_udf);
#endif
for (symbol = SYM_lookup(name); symbol; symbol = symbol->sym_homonym)
for (SYM symbol = SYM_lookup(name); symbol; symbol = symbol->sym_homonym)
{
if (symbol->sym_type == SYM_fun) {
#ifdef V4_THREADING
@ -824,25 +808,26 @@ FUN FUN_lookup_function(TEXT * name, bool ShowAccessError)
}
}
prior = NULL;
fun_repeat temp[MAX_UDF_ARGUMENTS + 1];
FUN prior = NULL;
request_fun = (BLK) CMP_find_request(tdbb, irq_l_functions, IRQ_REQUESTS);
request_arg = (BLK) CMP_find_request(tdbb, irq_l_args, IRQ_REQUESTS);
blk* request_fun = CMP_find_request(tdbb, irq_l_functions, IRQ_REQUESTS);
blk* request_arg = CMP_find_request(tdbb, irq_l_args, IRQ_REQUESTS);
FOR(REQUEST_HANDLE request_fun) X IN RDB$FUNCTIONS
WITH X.RDB$FUNCTION_NAME EQ name
if (!REQUEST(irq_l_functions))
REQUEST(irq_l_functions) = request_fun;
count = args = 0;
USHORT count = 0, args = 0;
MOVE_CLEAR(temp, (SLONG) sizeof(temp));
length = 0;
ULONG length = 0;
FOR(REQUEST_HANDLE request_arg) Y IN RDB$FUNCTION_ARGUMENTS
WITH Y.RDB$FUNCTION_NAME EQ X.RDB$FUNCTION_NAME
SORTED BY Y.RDB$ARGUMENT_POSITION
if (!REQUEST(irq_l_args))
REQUEST(irq_l_args) = request_arg;
tail = temp + Y.RDB$ARGUMENT_POSITION;
fun_repeat* tail = temp + Y.RDB$ARGUMENT_POSITION;
tail->fun_mechanism = (FUN_T) Y.RDB$MECHANISM;
count = MAX(count, Y.RDB$ARGUMENT_POSITION);
DSC_make_descriptor(&tail->fun_desc, Y.RDB$FIELD_TYPE,
@ -855,12 +840,12 @@ FUN FUN_lookup_function(TEXT * name, bool ShowAccessError)
if (Y.RDB$ARGUMENT_POSITION != X.RDB$RETURN_ARGUMENT)
++args;
l = FB_ALIGN(tail->fun_desc.dsc_length, DOUBLE_ALIGN);
USHORT l = FB_ALIGN(tail->fun_desc.dsc_length, DOUBLE_ALIGN);
if (tail->fun_desc.dsc_dtype == dtype_blob)
l = sizeof(blob_t);
length += l;
END_FOR;
function = FB_NEW_RPT(*dbb->dbb_permanent, count + 1) fun;
FUN function = FB_NEW_RPT(*dbb->dbb_permanent, count + 1) fun;
function->fun_count = count;
function->fun_args = args;
function->fun_return_arg = X.RDB$RETURN_ARGUMENT;
@ -868,6 +853,8 @@ FUN FUN_lookup_function(TEXT * name, bool ShowAccessError)
function->fun_temp_length = length;
MOVE_FAST(temp, function->fun_rpt,
(count + 1) * sizeof(fun_repeat));
TEXT* p;
#ifndef WIN_NT /* NT allows blanks in file paths */
for (p = X.RDB$MODULE_NAME; *p && *p != ' '; p++);
*p = 0;
@ -878,7 +865,7 @@ FUN FUN_lookup_function(TEXT * name, bool ShowAccessError)
/* Prepare the exception message to be used in case this function ever
causes an exception. This is done at this time to save us from preparing
(thus allocating) this message every time the function is called. */
exception_msg =
str* exception_msg =
FB_NEW_RPT(*dbb->dbb_permanent,
strlen(EXCEPTION_MESSAGE) + strlen(name) +
strlen(X.RDB$ENTRYPOINT) +
@ -891,9 +878,11 @@ FUN FUN_lookup_function(TEXT * name, bool ShowAccessError)
ISC_lookup_entrypoint(X.RDB$MODULE_NAME, X.RDB$ENTRYPOINT,
ISC_EXT_LIB_PATH_ENV, ShowAccessError);
if ( (module = FLU_lookup_module(X.RDB$MODULE_NAME)) ) {
MOD module = FLU_lookup_module(X.RDB$MODULE_NAME);
if (module) {
/* Register interest in the module by database. */
lls* stack;
for (stack = dbb->dbb_modules; stack; stack = stack->lls_next)
if (module == (MOD) stack->lls_object)
break;
@ -909,9 +898,7 @@ FUN FUN_lookup_function(TEXT * name, bool ShowAccessError)
}
else
{
JrdMemoryPool *old_pool;
old_pool = tdbb->tdbb_default;
JrdMemoryPool* old_pool = tdbb->tdbb_default;
tdbb->tdbb_default = dbb->dbb_permanent;
LLS_PUSH(module, &dbb->dbb_modules);
tdbb->tdbb_default = old_pool;
@ -932,13 +919,14 @@ FUN FUN_lookup_function(TEXT * name, bool ShowAccessError)
else
{
prior = function;
function->fun_symbol = symbol = FB_NEW(*dbb->dbb_permanent) sym;
symbol->sym_object = (BLK) function;
string = FB_NEW_RPT(*dbb->dbb_permanent, strlen(name)) str;
SYM new_symbol = FB_NEW(*dbb->dbb_permanent) sym;
function->fun_symbol = new_symbol;
new_symbol->sym_object = (BLK) function;
str* string = FB_NEW_RPT(*dbb->dbb_permanent, strlen(name)) str;
strcpy((char*)string->str_data, name);
symbol->sym_string = (TEXT *) string->str_data;
symbol->sym_type = SYM_fun;
SYM_insert(symbol);
new_symbol->sym_string = (TEXT *) string->str_data;
new_symbol->sym_type = SYM_fun;
SYM_insert(new_symbol);
}
END_FOR;
@ -980,12 +968,14 @@ FUN FUN_resolve(Csb* csb, FUN function, jrd_nod* args)
jrd_nod** ptr;
fun_repeat* tail;
for (ptr = args->nod_arg, tail = function->fun_rpt + 1; ptr < end;
ptr++, tail++) {
ptr++, tail++)
{
CMP_get_desc(tdbb, csb, *ptr, &arg);
if ((SSHORT) abs(tail->fun_mechanism) == FUN_descriptor)
score += 10;
else if (tail->fun_desc.dsc_dtype == dtype_blob ||
arg.dsc_dtype == dtype_blob) {
arg.dsc_dtype == dtype_blob)
{
score = 0;
break;
}
@ -1004,7 +994,7 @@ FUN FUN_resolve(Csb* csb, FUN function, jrd_nod* args)
}
static SLONG blob_lseek( BLB blob, USHORT mode, SLONG offset)
static SLONG blob_lseek( blb* blob, USHORT mode, SLONG offset)
{
/**************************************
*
@ -1016,18 +1006,15 @@ static SLONG blob_lseek( BLB blob, USHORT mode, SLONG offset)
* lseek a a blob segement. Return the offset
*
**************************************/
SLONG return_offset;
/* add thread enter and thread_exit wrappers */
THREAD_ENTER;
return_offset = BLB_lseek(blob, mode, offset);
const SLONG return_offset = BLB_lseek(blob, mode, offset);
THREAD_EXIT;
return (return_offset);
}
static void blob_put_segment( BLB blob, const UCHAR* buffer, USHORT length)
static void blob_put_segment( blb* blob, const UCHAR* buffer, USHORT length)
{
/**************************************
*
@ -1039,20 +1026,18 @@ static void blob_put_segment( BLB blob, const UCHAR* buffer, USHORT length)
* Put segment into a blob. Return nothing
*
**************************************/
TDBB tdbb;
/* As this is a call-back from a UDF, must reacquire the
engine mutex */
THREAD_ENTER;
tdbb = GET_THREAD_DATA;
TDBB tdbb = GET_THREAD_DATA;
BLB_put_segment(tdbb, blob, buffer, length);
THREAD_EXIT;
}
static SSHORT blob_get_segment(
BLB blob,
blb* blob,
UCHAR* buffer,
USHORT length, USHORT* return_length)
{
@ -1070,11 +1055,9 @@ static SSHORT blob_get_segment(
* -1 -- Current segment is incomplete.
*
**************************************/
TDBB tdbb;
/* add thread enter and thread_exit wrappers */
THREAD_ENTER;
tdbb = GET_THREAD_DATA;
TDBB tdbb = GET_THREAD_DATA;
*return_length = BLB_get_segment(tdbb, blob, buffer, length);
THREAD_EXIT;
@ -1105,42 +1088,39 @@ static SLONG get_scalar_array(fun_repeat* arg,
* Return length of array desc.
*
**************************************/
TDBB tdbb;
BLB blob;
ADS array_desc;
SLONG stuff[ADS_LEN(16) / 4], n;
UCHAR *data, *temp;
DSC from, to;
USHORT dimensions;
ads::ads_repeat *tail1;
sad::sad_repeat *tail2, *end;
tdbb = GET_THREAD_DATA;
TDBB tdbb = GET_THREAD_DATA;
/* Get first the array descriptor, then the array */
array_desc = (ADS) stuff;
blob = BLB_get_array(tdbb,
SLONG stuff[ADS_LEN(16) / 4];
ads* array_desc = (ads*) stuff;
blb* blob = BLB_get_array(tdbb,
tdbb->tdbb_request->req_transaction,
(BID)value->dsc_address,
(bid*)value->dsc_address,
array_desc);
data = FB_NEW(*getDefaultMemoryPool()) UCHAR[array_desc->ads_total_length];
UCHAR* data =
FB_NEW(*getDefaultMemoryPool()) UCHAR[array_desc->ads_total_length];
BLB_get_data(tdbb, blob, data, array_desc->ads_total_length);
dimensions = array_desc->ads_dimensions;
const USHORT dimensions = array_desc->ads_dimensions;
/* Convert array, if necessary */
to = arg->fun_desc;
from = array_desc->ads_rpt[0].ads_desc;
dsc to = arg->fun_desc;
dsc from = array_desc->ads_rpt[0].ads_desc;
if (to.dsc_dtype != from.dsc_dtype ||
to.dsc_scale != from.dsc_scale || to.dsc_length != from.dsc_length) {
n = array_desc->ads_count;
to.dsc_address = temp = FB_NEW(*getDefaultMemoryPool()) UCHAR[(SLONG) to.dsc_length * n];
to.dsc_scale != from.dsc_scale || to.dsc_length != from.dsc_length)
{
SLONG n = array_desc->ads_count;
UCHAR* temp = FB_NEW(*getDefaultMemoryPool()) UCHAR[(SLONG) to.dsc_length * n];
to.dsc_address = temp;
from.dsc_address = data;
for (; n; --n, to.dsc_address += to.dsc_length,
from.dsc_address += array_desc->ads_element_length)
MOV_move(&from, &to);
{
MOV_move(&from, &to);
}
delete[] data;
data = temp;
}
@ -1152,8 +1132,11 @@ static SLONG get_scalar_array(fun_repeat* arg,
scalar_desc->sad_desc.dsc_address = data;
scalar_desc->sad_dimensions = dimensions;
for (tail2 = scalar_desc->sad_rpt, end = tail2 + dimensions, tail1 =
array_desc->ads_rpt; tail2 < end; ++tail1, ++tail2) {
const ads::ads_repeat* tail1 = array_desc->ads_rpt;
sad::sad_repeat* tail2 = scalar_desc->sad_rpt;
for (const sad::sad_repeat* const end = tail2 + dimensions; tail2 < end;
++tail1, ++tail2)
{
tail2->sad_upper = tail1->ads_upper;
tail2->sad_lower = tail1->ads_lower;
}

View File

@ -1,7 +1,7 @@
/*
* PROGRAM: JRD Access Method
* MODULE: fun_proto.h
* DESCRIPTION: Prototype header file for fun.c
* DESCRIPTION: Prototype header file for fun.cpp
*
* The contents of this file are subject to the Interbase Public
* License Version 1.0 (the "License"); you may not use this file
@ -24,18 +24,11 @@
#ifndef JRD_FUN_PROTO_H
#define JRD_FUN_PROTO_H
#ifdef __cplusplus
extern "C" {
#endif
void FUN_evaluate(fun*, jrd_nod*, vlu*);
void FUN_fini(tdbb*);
void FUN_init(void);
fun* FUN_lookup_function(TEXT*, bool ShowAccessError);
fun* FUN_lookup_function(const TEXT*, bool ShowAccessError);
fun* FUN_resolve(class Csb*, fun*, jrd_nod*);
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif // JRD_FUN_PROTO_H

View File

@ -1367,7 +1367,7 @@ SSHORT API_ROUTINE gds__msg_lookup(void* handle,
TEXT* p = getenv("ISC_MSGS");
if (p == NULL ||
(status =
gds__msg_open(reinterpret_cast < void **>(&message), p)))
gds__msg_open(reinterpret_cast<void**>(&message), p)))
{
TEXT translated_msg_file[sizeof(MSG_FILE_LANG) + LOCALE_MAX + 1];
@ -1386,7 +1386,7 @@ SSHORT API_ROUTINE gds__msg_lookup(void* handle,
sprintf(translated_msg_file, MSG_FILE_LANG, p);
gds__prefix_msg(msg_file, translated_msg_file);
status =
gds__msg_open(reinterpret_cast < void **>(&message),
gds__msg_open(reinterpret_cast<void**>(&message),
msg_file);
}
else
@ -1396,7 +1396,7 @@ SSHORT API_ROUTINE gds__msg_lookup(void* handle,
gds__prefix_msg(msg_file, MSG_FILE);
status =
gds__msg_open(reinterpret_cast < void **>(&message),
gds__msg_open(reinterpret_cast<void**>(&message),
msg_file);
}
gds__free((SLONG *) msg_file);

View File

@ -38,13 +38,13 @@
#ifdef SUPERSERVER
#define fb_assert(ex) {if (!(ex)){gds__log (FB_GDS_ASSERT_FAILURE_STRING, __FILE__, __LINE__); abort();}}
#define fb_assert_continue(ex) {if (!(ex)){gds__log (FB_GDS_ASSERT_FAILURE_STRING, __FILE__, __LINE__);}}
#define fb_assert(ex) {if (!(ex)) {gds__log (FB_GDS_ASSERT_FAILURE_STRING, __FILE__, __LINE__); abort();}}
#define fb_assert_continue(ex) {if (!(ex)) {gds__log (FB_GDS_ASSERT_FAILURE_STRING, __FILE__, __LINE__);}}
#else // !SUPERSERVER
#define fb_assert(ex) {if (!(ex)){ib_fprintf (ib_stderr, FB_GDS_ASSERT_FAILURE_STRING, __FILE__, __LINE__); abort();}}
#define fb_assert_continue(ex) {if (!(ex)){ib_fprintf (ib_stderr, FB_GDS_ASSERT_FAILURE_STRING, __FILE__, __LINE__);}}
#define fb_assert(ex) {if (!(ex)) {ib_fprintf (ib_stderr, FB_GDS_ASSERT_FAILURE_STRING, __FILE__, __LINE__); abort();}}
#define fb_assert_continue(ex) {if (!(ex)) {ib_fprintf (ib_stderr, FB_GDS_ASSERT_FAILURE_STRING, __FILE__, __LINE__);}}
#endif // SUPERSERVER

View File

@ -111,8 +111,8 @@ STR GRANT_realloc_acl(STR start_ptr,
*
**************************************/
ULONG old_offset = (ULONG) (*write_ptr - start_ptr->str_data);
ULONG realloc_length = *buffer_length + ACL_BUFFER_SIZE;
const ULONG old_offset = (ULONG) (*write_ptr - start_ptr->str_data);
const ULONG realloc_length = *buffer_length + ACL_BUFFER_SIZE;
/* realloc the new length, ERR_punt incase of no memory */
@ -129,7 +129,7 @@ STR GRANT_realloc_acl(STR start_ptr,
}
bool GRANT_privileges( TDBB tdbb, SSHORT phase, DFW work,
bool GRANT_privileges( TDBB tdbb, SSHORT phase, Deferred_work* work,
jrd_tra*) // unused param, makes dfw.epp happy
{
/**************************************
@ -330,7 +330,7 @@ static void define_default_class(
DPM_gen_id(tdbb, MET_lookup_generator(tdbb, DEFAULT_CLASS), 0,
(SINT64) 1));
blk* request = (BLK) CMP_find_request(tdbb, irq_grant7, IRQ_REQUESTS);
blk* request = CMP_find_request(tdbb, irq_grant7, IRQ_REQUESTS);
FOR(REQUEST_HANDLE request)
REL IN RDB$RELATIONS
@ -376,13 +376,10 @@ static void delete_security_class( TDBB tdbb, TEXT * s_class)
* Delete a security class.
*
**************************************/
DBB dbb;
BLK handle;
SET_TDBB(tdbb);
dbb = tdbb->tdbb_database;
DBB dbb = tdbb->tdbb_database;
handle = NULL;
BLK handle = NULL;
FOR(REQUEST_HANDLE handle)
CLS IN RDB$SECURITY_CLASSES
@ -410,9 +407,7 @@ static void finish_security_class(UCHAR** acl_ptr,
* in a wildcard for any public privileges.
*
**************************************/
UCHAR *acl;
acl = *acl_ptr;
UCHAR* acl = *acl_ptr;
if (public_priv) {
CHECK_AND_MOVE(acl, ACL_id_list, *start_ptr, length_ptr);
@ -438,16 +433,12 @@ static USHORT get_public_privs(
* Get public privileges for a particular object.
*
**************************************/
DBB dbb;
BLK request;
USHORT public_priv;
SET_TDBB(tdbb);
dbb = tdbb->tdbb_database;
DBB dbb = tdbb->tdbb_database;
public_priv = 0;
USHORT public_priv = 0;
request = (BLK) CMP_find_request(tdbb, irq_grant5, IRQ_REQUESTS);
BLK request = CMP_find_request(tdbb, irq_grant5, IRQ_REQUESTS);
FOR(REQUEST_HANDLE request)
PRV IN RDB$USER_PRIVILEGES
@ -496,7 +487,7 @@ static void get_object_info(
*view = false;
if (obj_type == obj_relation) {
blk* request = (BLK) CMP_find_request(tdbb, irq_grant1, IRQ_REQUESTS);
blk* request = CMP_find_request(tdbb, irq_grant1, IRQ_REQUESTS);
FOR(REQUEST_HANDLE request)
REL IN RDB$RELATIONS WITH
@ -517,7 +508,7 @@ static void get_object_info(
REQUEST(irq_grant1) = request;
}
else {
blk* request = (BLK) CMP_find_request(tdbb, irq_grant9, IRQ_REQUESTS);
blk* request = CMP_find_request(tdbb, irq_grant9, IRQ_REQUESTS);
FOR(REQUEST_HANDLE request)
REL IN RDB$PROCEDURES WITH
@ -558,21 +549,16 @@ static void get_user_privs(TDBB tdbb,
* Get privileges for a particular object.
*
**************************************/
DBB dbb;
BLK request;
UCHAR *acl;
TEXT user[32];
USHORT priv;
SSHORT user_type;
SET_TDBB(tdbb);
dbb = tdbb->tdbb_database;
DBB dbb = tdbb->tdbb_database;
acl = *acl_ptr;
UCHAR* acl = *acl_ptr;
TEXT user[32];
user[0] = 0;
user_type = -2;
SSHORT user_type = -2;
USHORT priv = 0;
request = (BLK) CMP_find_request(tdbb, irq_grant2, IRQ_REQUESTS);
BLK request = CMP_find_request(tdbb, irq_grant2, IRQ_REQUESTS);
FOR(REQUEST_HANDLE request)
PRV IN RDB$USER_PRIVILEGES
@ -583,7 +569,8 @@ static void get_user_privs(TDBB tdbb,
PRV.RDB$FIELD_NAME MISSING
SORTED BY PRV.RDB$USER, PRV.RDB$USER_TYPE
if (!REQUEST(irq_grant2)) REQUEST(irq_grant2) = request;
if (!REQUEST(irq_grant2))
REQUEST(irq_grant2) = request;
fb_utils::fb_exact_name_limit(PRV.RDB$USER, sizeof(PRV.RDB$USER));
if (strcmp(PRV.RDB$USER, user) || PRV.RDB$USER_TYPE != user_type)
@ -633,10 +620,7 @@ static void grant_user(UCHAR** acl_ptr,
* Grant privileges to a particular user.
*
**************************************/
UCHAR *acl;
UCHAR length;
acl = *acl_ptr;
UCHAR* acl = *acl_ptr;
CHECK_AND_MOVE(acl, ACL_id_list, *start_ptr, length_ptr);
switch (user_type) {
@ -669,7 +653,7 @@ static void grant_user(UCHAR** acl_ptr,
}
length = strlen(user);
const UCHAR length = strlen(user);
CHECK_AND_MOVE(acl, (UCHAR) length, *start_ptr, length_ptr);
if (length) {
CHECK_ACL_BOUND(acl, *start_ptr, length_ptr, length);
@ -697,9 +681,7 @@ static void grant_views(
* Grant privileges to all views.
*
**************************************/
UCHAR *acl;
acl = *acl_ptr;
UCHAR* acl = *acl_ptr;
CHECK_AND_MOVE(acl, ACL_id_list, *start_ptr, length_ptr);
CHECK_AND_MOVE(acl, id_views, *start_ptr, length_ptr);
@ -723,15 +705,10 @@ static void purge_default_class( TEXT * object_name, SSHORT obj_type)
* default security class for this relation.
*
**************************************/
TDBB tdbb;
DBB dbb;
BLK request;
DSC desc;
TDBB tdbb = GET_THREAD_DATA;
DBB dbb = tdbb->tdbb_database;
tdbb = GET_THREAD_DATA;
dbb = tdbb->tdbb_database;
request = (BLK) CMP_find_request(tdbb, irq_grant8, IRQ_REQUESTS);
BLK request = CMP_find_request(tdbb, irq_grant8, IRQ_REQUESTS);
FOR(REQUEST_HANDLE request)
REL IN RDB$RELATIONS
@ -752,6 +729,7 @@ static void purge_default_class( TEXT * object_name, SSHORT obj_type)
if (!REQUEST(irq_grant8))
REQUEST(irq_grant8) = request;
dsc desc;
desc.dsc_dtype = dtype_text;
desc.dsc_sub_type = 0;
desc.dsc_scale = 0;
@ -782,7 +760,6 @@ TEXT * relation_name, TEXT * owner, USHORT public_priv, ULONG * length_ptr)
* security class to be effective.
*
**************************************/
DBB dbb;
BLK request, request2;
TEXT field_name[32], user[32], s_class[32];
UCHAR *field_acl, *relation_acl;
@ -803,7 +780,7 @@ TEXT * relation_name, TEXT * owner, USHORT public_priv, ULONG * length_ptr)
SET_TDBB(tdbb);
dbb = tdbb->tdbb_database;
DBB dbb = tdbb->tdbb_database;
try {
@ -832,7 +809,7 @@ TEXT * relation_name, TEXT * owner, USHORT public_priv, ULONG * length_ptr)
user[0] = 0;
aggregate_public = public_priv;
request = (BLK) CMP_find_request(tdbb, irq_grant6, IRQ_REQUESTS);
request = CMP_find_request(tdbb, irq_grant6, IRQ_REQUESTS);
request2 = NULL;
FOR(REQUEST_HANDLE request)
@ -1069,7 +1046,7 @@ static void save_security_class(TDBB tdbb,
BLB_put_segment(tdbb, blob, buffer, length);
BLB_close(tdbb, blob);
blk* request = (BLK) CMP_find_request(tdbb, irq_grant3, IRQ_REQUESTS);
blk* request = CMP_find_request(tdbb, irq_grant3, IRQ_REQUESTS);
bool found = false;
FOR(REQUEST_HANDLE request)
@ -1087,7 +1064,7 @@ static void save_security_class(TDBB tdbb,
REQUEST(irq_grant3) = request;
if (!found) {
request = (BLK) CMP_find_request(tdbb, irq_grant4, IRQ_REQUESTS);
request = CMP_find_request(tdbb, irq_grant4, IRQ_REQUESTS);
STORE(REQUEST_HANDLE request)
CLS IN RDB$SECURITY_CLASSES
@ -1114,9 +1091,7 @@ static USHORT trans_sql_priv( TEXT * privileges)
* Map a SQL privilege letter into an internal privilege bit.
*
**************************************/
USHORT priv;
priv = 0;
USHORT priv = 0;
switch (UPPER7(privileges[0])) {
case 'S':
@ -1162,10 +1137,8 @@ static SLONG squeeze_acl(UCHAR* acl_base,
*
**************************************/
UCHAR *dup_acl;
UCHAR *acl;
UCHAR *dest, *source;
SLONG privilege = 0;
USHORT hit = FALSE;
UCHAR c;
int length;
UCHAR l;
@ -1173,76 +1146,78 @@ static SLONG squeeze_acl(UCHAR* acl_base,
/* Make sure that this half-finished acl looks good enough to process. */
**acl_ptr = 0;
acl = acl_base;
UCHAR* acl = acl_base;
if (*acl++ != ACL_version)
BUGCHECK(160); /* msg 160 wrong ACL version */
bool hit = false;
while ( (c = *acl++) )
switch (c) {
case ACL_id_list:
dup_acl = acl - 1;
hit = TRUE;
hit = true;
while ( (c = *acl++) ) {
switch (c) {
case id_person:
if (user_type != obj_user)
hit = FALSE;
hit = false;
if (check_string((TEXT*)acl, user))
hit = FALSE;
hit = false;
break;
case id_sql_role:
if (user_type != obj_sql_role)
hit = FALSE;
hit = false;
if (check_string((TEXT*)acl, user))
hit = FALSE;
hit = false;
break;
case id_view:
if (user_type != obj_view)
hit = FALSE;
hit = false;
if (check_string((TEXT*)acl, user))
hit = FALSE;
hit = false;
break;
case id_procedure:
if (user_type != obj_procedure)
hit = FALSE;
hit = false;
if (check_string((TEXT*)acl, user))
hit = FALSE;
hit = false;
break;
case id_trigger:
if (user_type != obj_trigger)
hit = FALSE;
hit = false;
if (check_string((TEXT*)acl, user))
hit = FALSE;
hit = false;
break;
case id_project:
case id_organization:
hit = FALSE;
hit = false;
// CVC: What's the idea of calling a function whose only
// result is boolean without checking it?
check_string((TEXT*)acl, user);
break;
case id_views:
hit = FALSE;
hit = false;
break;
case id_node:
case id_user:
hit = FALSE;
hit = false;
for (l = *acl++; l; acl++, l--);
break;
case id_group:
if (user_type != obj_user_group)
hit = FALSE;
hit = false;
if (check_string((TEXT*)acl, user))
hit = FALSE;
hit = false;
break;
default:
@ -1336,11 +1311,10 @@ static bool check_string( const TEXT* acl, const TEXT* string)
* return true.
*
**************************************/
USHORT l;
/* JPN: Since Kanji User names are not allowed, No need to fix this UPPER loop. */
if ( (l = *acl++) )
USHORT l = *acl++;
if (l)
do {
const TEXT c1 = *acl++;
const TEXT c2 = *string++;

View File

@ -24,7 +24,7 @@
#ifndef JRD_GRANT_PROTO_H
#define JRD_GRANT_PROTO_H
bool GRANT_privileges(TDBB, SSHORT, struct dfw*, jrd_tra*);
bool GRANT_privileges(TDBB, SSHORT, class Deferred_work*, jrd_tra*);
STR GRANT_realloc_acl(STR, UCHAR **, ULONG *);
#endif // JRD_GRANT_PROTO_H

View File

@ -129,8 +129,8 @@ void IDX_check_access(TDBB tdbb, Csb* csb, jrd_rel* view, jrd_rel* relation,
referenced_window.win_page =
get_root_page(tdbb, referenced_relation);
referenced_window.win_flags = 0;
irt* referenced_root =
(IRT) CCH_FETCH(tdbb, &referenced_window, LCK_read, pag_root);
index_root_page* referenced_root =
(index_root_page*) CCH_FETCH(tdbb, &referenced_window, LCK_read, pag_root);
IDX referenced_idx;
if (!BTR_description
(referenced_relation, referenced_root, &referenced_idx,
@ -277,17 +277,18 @@ void IDX_create_index(
/* Loop thru the relation computing index keys. If there are old versions,
find them, too. */
BOOLEAN cancel = FALSE;
bool cancel = false;
KEY key;
while (!cancel && DPM_next(tdbb, &primary, LCK_read, FALSE, FALSE)) {
while (!cancel && DPM_next(tdbb, &primary, LCK_read, false, false)) {
if (transaction && !VIO_garbage_collect(tdbb, &primary, transaction))
continue;
if (primary.rpb_flags & rpb_deleted)
CCH_RELEASE(tdbb, &primary.rpb_window);
else {
primary.rpb_record = gc_record;
// JrdMemoryPool and its parent MemoryPool are unrelated to blk.
VIO_data(tdbb, &primary,
reinterpret_cast < BLK > (dbb->dbb_permanent));
reinterpret_cast<BLK>(dbb->dbb_permanent));
gc_record = primary.rpb_record;
LLS_PUSH(primary.rpb_record, &stack);
}
@ -299,7 +300,7 @@ void IDX_create_index(
break; /* must be garbage collected */
secondary.rpb_record = NULL;
VIO_data(tdbb, &secondary,
reinterpret_cast < BLK > (tdbb->tdbb_default));
reinterpret_cast<BLK>(tdbb->tdbb_default));
LLS_PUSH(secondary.rpb_record, &stack);
secondary.rpb_page = secondary.rpb_b_page;
secondary.rpb_line = secondary.rpb_b_line;
@ -408,7 +409,7 @@ void IDX_create_index(
#ifdef SUPERSERVER
if (--tdbb->tdbb_quantum < 0 && !tdbb->tdbb_inhibit)
cancel = JRD_reschedule(tdbb, 0, false);
cancel = JRD_reschedule(tdbb, 0, false) == TRUE;
#endif
}
@ -450,8 +451,6 @@ IDB IDX_create_index_block(TDBB tdbb, jrd_rel* relation, USHORT id)
* lock block for the specified index.
*
**************************************/
LCK lock;
SET_TDBB(tdbb);
DBB dbb = tdbb->tdbb_database;
CHECK_DBB(dbb);
@ -468,7 +467,8 @@ IDB IDX_create_index_block(TDBB tdbb, jrd_rel* relation, USHORT id)
any modification to the index so that the cached information
about the index will be discarded */
index_block->idb_lock = lock = FB_NEW_RPT(*dbb->dbb_permanent, 0) lck;
lck* lock = FB_NEW_RPT(*dbb->dbb_permanent, 0) lck;
index_block->idb_lock = lock;
lock->lck_parent = dbb->dbb_lock;
lock->lck_dbb = dbb;
lock->lck_key.lck_long = index_block->idb_id;
@ -523,11 +523,11 @@ void IDX_delete_indices(TDBB tdbb, jrd_rel* relation)
SET_TDBB(tdbb);
WIN window(relation->rel_index_root);
IRT root = (IRT) CCH_FETCH(tdbb, &window, LCK_write, pag_root);
index_root_page* root = (index_root_page*) CCH_FETCH(tdbb, &window, LCK_write, pag_root);
for (i = 0; i < root->irt_count; i++) {
BTR_delete_index(tdbb, &window, i);
root = (IRT) CCH_FETCH(tdbb, &window, LCK_write, pag_root);
root = (index_root_page*) CCH_FETCH(tdbb, &window, LCK_write, pag_root);
}
CCH_RELEASE(tdbb, &window);
@ -599,7 +599,7 @@ void IDX_garbage_collect(TDBB tdbb, RPB * rpb, LLS going, LLS staying)
insertion.iib_key = &key1;
WIN window(rpb->rpb_relation->rel_index_root);
IRT root = (IRT) CCH_FETCH(tdbb, &window, LCK_read, pag_root);
index_root_page* root = (index_root_page*) CCH_FETCH(tdbb, &window, LCK_read, pag_root);
for (USHORT i = 0; i < root->irt_count; i++) {
if (BTR_description(rpb->rpb_relation, root, &idx, i)) {
@ -636,7 +636,7 @@ void IDX_garbage_collect(TDBB tdbb, RPB * rpb, LLS going, LLS staying)
/* Get rid of index node */
BTR_remove(tdbb, &window, &insertion);
root = (IRT) CCH_FETCH(tdbb, &window, LCK_read, pag_root);
root = (index_root_page*) CCH_FETCH(tdbb, &window, LCK_read, pag_root);
if (stack1->lls_next)
BTR_description(rpb->rpb_relation, root, &idx, i);
}
@ -890,8 +890,8 @@ static IDX_E check_duplicates(
{
if (rpb.rpb_number != insertion->iib_number
&& VIO_get_current(tdbb, &rpb, insertion->iib_transaction,
reinterpret_cast < BLK > (tdbb->tdbb_default),
record_idx->idx_flags & idx_foreign))
reinterpret_cast<BLK>(tdbb->tdbb_default),
(record_idx->idx_flags & idx_foreign) != 0))
{
// dimitr: we shouldn't ignore status exceptions which take place
// inside the lock manager. Namely, they are: isc_deadlock,
@ -1067,7 +1067,7 @@ static IDX_E check_partner_index(
/* get the index root page for the partner relation */
WIN window(get_root_page(tdbb, partner_relation));
IRT root = (IRT) CCH_FETCH(tdbb, &window, LCK_read, pag_root);
index_root_page* root = (index_root_page*) CCH_FETCH(tdbb, &window, LCK_read, pag_root);
/* get the description of the partner index */
@ -1204,7 +1204,7 @@ static int index_block_flush(void *ast_object)
SET_THREAD_DATA;
LCK lock = index_block->idb_lock;
lck* lock = index_block->idb_lock;
if (lock->lck_attachment) {
tdbb->tdbb_database = lock->lck_attachment->att_database;
@ -1346,7 +1346,7 @@ static void signal_index_deletion(TDBB tdbb, jrd_rel* relation, USHORT id)
*
**************************************/
IDB index_block;
LCK lock = NULL;
lck* lock = NULL;
SET_TDBB(tdbb);

View File

@ -30,7 +30,7 @@
void IDX_check_access(TDBB, class Csb *, struct jrd_rel *, struct jrd_rel *,
struct jrd_fld *);
class jrd_fld*);
void IDX_create_index(TDBB, struct jrd_rel*, struct idx*, const TEXT*,
USHORT*, class jrd_tra*, SelectivityList&);
struct idb* IDX_create_index_block(TDBB, struct jrd_rel *, USHORT);
@ -38,8 +38,8 @@ void IDX_delete_index(TDBB, struct jrd_rel *, USHORT);
void IDX_delete_indices(TDBB, struct jrd_rel *);
enum idx_e IDX_erase(TDBB, struct rpb *, class jrd_tra *, struct jrd_rel **,
USHORT *);
void IDX_garbage_collect(TDBB, struct rpb *, struct lls *,
struct lls *);
void IDX_garbage_collect(TDBB, struct rpb *, class lls*,
class lls*);
enum idx_e IDX_modify(struct tdbb *, struct rpb *, struct rpb *,
class jrd_tra *, struct jrd_rel **, USHORT *);
enum idx_e IDX_modify_check_constraints(TDBB, struct rpb *, struct rpb *,

View File

@ -197,8 +197,7 @@ int INF_database_info(const SCHAR* items,
* Process requests for database info.
*
**************************************/
FIL file;
SCHAR item, buffer[256];
SCHAR buffer[256];
SCHAR site[256];
SSHORT length, l;
SLONG id;
@ -220,7 +219,8 @@ int INF_database_info(const SCHAR* items,
while (items < end_items && *items != isc_info_end) {
SCHAR* p = buffer;
switch ((item = *items++)) {
SCHAR item = *items++;
switch (item) {
case isc_info_end:
break;
@ -291,12 +291,12 @@ int INF_database_info(const SCHAR* items,
break;
case isc_info_wal_recv_ckpt_fname:
/* Get the information from the header or wal page */
// WAL obsolete
length = 0;
break;
case isc_info_wal_recv_ckpt_poffset:
/* Get the information from the header or wal page */
// WAL obsolete
length = 0;
break;
@ -479,7 +479,7 @@ int INF_database_info(const SCHAR* items,
case isc_info_forced_writes:
if (!header_refreshed)
{
file = dbb->dbb_file;
const jrd_file* file = dbb->dbb_file;
PAG_header(file->fil_string, file->fil_length);
header_refreshed = true;
}
@ -494,7 +494,7 @@ int INF_database_info(const SCHAR* items,
id < transaction->tra_number; id++)
{
if (TRA_snapshot_state(tdbb, transaction, id) == tra_limbo &&
TRA_wait(tdbb, transaction, id, TRUE) == tra_limbo)
TRA_wait(tdbb, transaction, id, true) == tra_limbo)
{
length = INF_convert(id, buffer);
if (!
@ -710,7 +710,7 @@ int INF_database_info(const SCHAR* items,
case isc_info_oldest_transaction:
if (!header_refreshed)
{
file = dbb->dbb_file;
const jrd_file* file = dbb->dbb_file;
PAG_header(file->fil_string, file->fil_length);
header_refreshed = true;
}
@ -720,7 +720,7 @@ int INF_database_info(const SCHAR* items,
case isc_info_oldest_active:
if (!header_refreshed)
{
file = dbb->dbb_file;
const jrd_file* file = dbb->dbb_file;
PAG_header(file->fil_string, file->fil_length);
header_refreshed = true;
}
@ -730,7 +730,7 @@ int INF_database_info(const SCHAR* items,
case isc_info_oldest_snapshot:
if (!header_refreshed)
{
file = dbb->dbb_file;
const jrd_file* file = dbb->dbb_file;
PAG_header(file->fil_string, file->fil_length);
header_refreshed = true;
}
@ -740,7 +740,7 @@ int INF_database_info(const SCHAR* items,
case isc_info_next_transaction:
if (!header_refreshed)
{
file = dbb->dbb_file;
const jrd_file* file = dbb->dbb_file;
PAG_header(file->fil_string, file->fil_length);
header_refreshed = true;
}
@ -832,8 +832,6 @@ int INF_request_info(const jrd_req* request,
*
**************************************/
jrd_nod* node;
const fmt* format;
SCHAR item;
SSHORT state;
USHORT length = 0;
@ -844,7 +842,8 @@ int INF_request_info(const jrd_req* request,
SCHAR* buffer_ptr = buffer;
while (items < end_items && *items != isc_info_end) {
switch ((item = *items++)) {
SCHAR item = *items++;
switch (item) {
case isc_info_end:
break;
@ -932,7 +931,7 @@ int INF_request_info(const jrd_req* request,
INF_convert((IPTR) node->nod_arg[e_msg_number],
buffer_ptr);
else {
format = (fmt*) node->nod_arg[e_msg_format];
const fmt* format = (fmt*) node->nod_arg[e_msg_format];
length = INF_convert(format->fmt_length, buffer_ptr);
}
break;
@ -977,14 +976,15 @@ int INF_transaction_info(const jrd_tra* transaction,
* Process requests for blob info.
*
**************************************/
SCHAR item, buffer[128];
SCHAR buffer[128];
SSHORT length;
const SCHAR* const end_items = items + item_length;
const SCHAR* const end = info + output_length;
while (items < end_items && *items != isc_info_end) {
switch ((item = *items++)) {
SCHAR item = *items++;
switch (item) {
case isc_info_end:
break;
@ -1020,15 +1020,10 @@ static USHORT get_counts(USHORT count_id, SCHAR* buffer, USHORT length)
* Return operation counts for relation.
*
**************************************/
TDBB tdbb;
SLONG n;
vcl::iterator ptr;
USHORT relation_id;
VCL vector;
TDBB tdbb = GET_THREAD_DATA;
tdbb = GET_THREAD_DATA;
if (!(vector = tdbb->tdbb_attachment->att_counts[count_id]))
vcl* vector = tdbb->tdbb_attachment->att_counts[count_id];
if (!vector)
return 0;
// CVC: This function was receiving UCHAR* but to avoid all the casts
@ -1037,12 +1032,16 @@ static USHORT get_counts(USHORT count_id, SCHAR* buffer, USHORT length)
UCHAR* p = reinterpret_cast<UCHAR*>(buffer);
const UCHAR* const end = p + length - 6;
for (relation_id = 0, ptr = vector->begin();
USHORT relation_id = 0;
for (vcl::iterator ptr = vector->begin();
relation_id < vector->count() && p < end; ++relation_id)
if (n = *ptr++) {
{
const SLONG n = *ptr++;
if (n) {
STUFF_WORD(p, relation_id);
p += INF_convert(n, reinterpret_cast < char *>(p));
p += INF_convert(n, reinterpret_cast<char*>(p));
}
}
return p - reinterpret_cast<UCHAR*>(buffer);
}

View File

@ -24,14 +24,18 @@
#ifndef JRD_INF_PROTO_H
#define JRD_INF_PROTO_H
int INF_blob_info(const struct blb*, const SCHAR*, const SSHORT,
class jrd_req;
class jrd_tra;
class blb;
int INF_blob_info(const blb*, const SCHAR*, const SSHORT,
SCHAR*, const SSHORT);
USHORT INF_convert(SLONG, SCHAR*);
int INF_database_info(const SCHAR*, const SSHORT, SCHAR*, const SSHORT);
SCHAR* INF_put_item(SCHAR, USHORT, const SCHAR*, SCHAR*, const SCHAR*);
int INF_request_info(const struct jrd_req*, const SCHAR*, const SSHORT,
int INF_request_info(const jrd_req*, const SCHAR*, const SSHORT,
SCHAR*, const SSHORT);
int INF_transaction_info(const class jrd_tra*, const SCHAR*, const SSHORT,
int INF_transaction_info(const jrd_tra*, const SCHAR*, const SSHORT,
SCHAR*, const SSHORT);
#endif // JRD_INF_PROTO_H

View File

@ -783,7 +783,8 @@ void INI_update_database()
version but not the update. */
WIN window(HEADER_PAGE);
hdr* header = (HDR) CCH_FETCH(tdbb, &window, LCK_write, pag_header);
header_page* header =
(header_page*) CCH_FETCH(tdbb, &window, LCK_write, pag_header);
CCH_MARK(tdbb, &window);
/* Only minor upgrades can occur within a major ODS, define which one

View File

@ -661,7 +661,6 @@ static FPTR_SHORT lookup_init_function(
#endif
/* Still not found, check if there is a UDF in the database defined the right way */
FUN function_block;
USHORT argcount;
char entry[48];
@ -684,7 +683,8 @@ static FPTR_SHORT lookup_init_function(
break;
}
INTL_TRACE(("INTL: trying user fn %s\n", entry));
if ( (function_block = FUN_lookup_function((TEXT*)entry, false)) ) {
FUN function_block = FUN_lookup_function(entry, false);
if (function_block) {
INTL_TRACE(("INTL: found a user fn, validating\n"));
if ((function_block->fun_count == argcount) &&
(function_block->fun_args == argcount) &&
@ -1094,17 +1094,17 @@ int INTL_convert_string(dsc* to, const dsc* from, FPTR_ERROR err)
to_len =
INTL_convert_bytes(tdbb, to_cs,
reinterpret_cast<UCHAR*>(((VARY *) to->dsc_address)->vary_string),
reinterpret_cast<UCHAR*>(((vary*) to->dsc_address)->vary_string),
to_size, from_cs, from_ptr, from_len, err);
((VARY *) to->dsc_address)->vary_length = to_len;
((vary*) to->dsc_address)->vary_length = to_len;
from_fill = 0; /* Convert_bytes handles source truncation */
}
else {
/* binary string can always be converted TO by byte-copy */
to_len = MIN(from_len, to_size);
from_fill = from_len - to_len;
((VARY *) p)->vary_length = to_len;
p = reinterpret_cast<UCHAR*>(((VARY *) p)->vary_string);
((vary*) p)->vary_length = to_len;
p = reinterpret_cast<UCHAR*>(((vary*) p)->vary_string);
if (to_len)
do
*p++ = *q++;
@ -1488,7 +1488,6 @@ int INTL_str_to_upper(TDBB tdbb, DSC * pString)
* Given an input string, convert it to uppercase
*
**************************************/
USHORT len;
UCHAR *src, *dest;
UCHAR buffer[MAX_KEY];
USHORT ttype;
@ -1498,9 +1497,9 @@ int INTL_str_to_upper(TDBB tdbb, DSC * pString)
fb_assert(pString != NULL);
fb_assert(pString->dsc_address != NULL);
len =
USHORT len =
CVT_get_string_ptr(pString, &ttype, &src,
reinterpret_cast < vary * >(buffer),
reinterpret_cast<vary*>(buffer),
sizeof(buffer), ERR_post);
switch (ttype) {
case ttype_binary:

View File

@ -42,15 +42,16 @@ typedef USHORT UNICODE;
typedef USHORT fss_wchar_t;
typedef int fss_size_t;
typedef struct {
struct Byte_Mask_Table
{
int cmask;
int cval;
int shift;
SLONG lmask;
SLONG lval;
} Tab;
};
static const Tab tab[] = {
static const Byte_Mask_Table tab[] = {
{ 0x80, 0x00, 0 * 6, 0x7F, 0 }, /* 1 byte sequence */
{ 0xE0, 0xC0, 1 * 6, 0x7FF, 0x80 }, /* 2 byte sequence */
{ 0xF0, 0xE0, 2 * 6, 0xFFFF, 0x800 }, /* 3 byte sequence */
@ -62,19 +63,15 @@ static const Tab tab[] = {
static fss_size_t fss_mbtowc(fss_wchar_t* p, const UCHAR* s, fss_size_t n)
{
SLONG l;
int c0, c, nc;
Tab *t;
if (s == 0)
return 0;
nc = 0;
int nc = 0;
if (n <= nc)
return -1;
c0 = *s & 0xff;
l = c0;
for (t = const_cast < Tab * >(tab); t->cmask; t++) {
const int c0 = *s & 0xff;
SLONG l = c0;
for (const Byte_Mask_Table* t = tab; t->cmask; t++) {
nc++;
if ((c0 & t->cmask) == t->cval) {
l &= t->lmask;
@ -86,7 +83,7 @@ static fss_size_t fss_mbtowc(fss_wchar_t* p, const UCHAR* s, fss_size_t n)
if (n <= nc)
return -1;
s++;
c = (*s ^ 0x80) & 0xFF;
const int c = (*s ^ 0x80) & 0xFF;
if (c & 0xC0)
return -1;
l = (l << 6) | c;
@ -96,19 +93,15 @@ static fss_size_t fss_mbtowc(fss_wchar_t* p, const UCHAR* s, fss_size_t n)
static fss_size_t fss_wctomb(UCHAR * s, fss_wchar_t wc)
{
SLONG l;
int c, nc;
Tab *t;
if (s == 0)
return 0;
l = wc;
nc = 0;
for (t = const_cast < Tab * >(tab); t->cmask; t++) {
SLONG l = wc;
int nc = 0;
for (const Byte_Mask_Table* t = tab; t->cmask; t++) {
nc++;
if (l <= t->lmask) {
c = t->shift;
int c = t->shift;
*s = t->cval | (l >> c);
while (c > 0) {
c -= 6;
@ -156,10 +149,6 @@ static USHORT internal_fss_to_unicode(CSCONVERT obj,
SSHORT * err_code,
USHORT * err_position)
{
UNICODE *start;
USHORT src_start = src_len;
fss_size_t res;
fb_assert(src_ptr != NULL || dest_ptr == NULL);
fb_assert(err_code != NULL);
fb_assert(err_position != NULL);
@ -171,10 +160,10 @@ static USHORT internal_fss_to_unicode(CSCONVERT obj,
if (dest_ptr == NULL)
return (src_len * 2); /* All single byte narrow characters */
start = dest_ptr;
src_start = src_len;
const UNICODE* const start = dest_ptr;
const USHORT src_start = src_len;
while ((src_len) && (dest_len >= sizeof(*dest_ptr))) {
res = fss_mbtowc(dest_ptr, src_ptr, src_len);
const fss_size_t res = fss_mbtowc(dest_ptr, src_ptr, src_len);
if (res == -1) {
*err_code = CS_BAD_INPUT;
break;
@ -199,11 +188,8 @@ USHORT internal_unicode_to_fss(CSCONVERT obj,
SSHORT * err_code,
USHORT * err_position)
{
UCHAR *start;
USHORT src_start = unicode_len;
const USHORT src_start = unicode_len;
UCHAR tmp_buffer[6];
UCHAR *p;
fss_size_t res;
fb_assert(unicode_str != NULL || fss_str == NULL);
fb_assert(err_code != NULL);
@ -217,10 +203,10 @@ USHORT internal_unicode_to_fss(CSCONVERT obj,
if (fss_str == NULL)
return ((unicode_len + 1) / 2 * 3); /* worst case - all han character input */
start = fss_str;
const UCHAR* const start = fss_str;
while ((fss_len) && (unicode_len >= sizeof(*unicode_str))) {
/* Convert the wide character into temp buffer */
res = fss_wctomb(tmp_buffer, *unicode_str);
fss_size_t res = fss_wctomb(tmp_buffer, *unicode_str);
if (res == -1) {
*err_code = CS_BAD_INPUT;
break;
@ -231,7 +217,7 @@ USHORT internal_unicode_to_fss(CSCONVERT obj,
break;
}
/* copy the converted bytes into the destination */
p = tmp_buffer;
const UCHAR* p = tmp_buffer;
for (; res; res--, fss_len--)
*fss_str++ = *p++;
unicode_len -= sizeof(*unicode_str);
@ -259,9 +245,7 @@ static SSHORT internal_str_copy(
* Note: dest may equal src.
*
**************************************/
UCHAR *pStart;
pStart = dest;
const UCHAR* const pStart = dest;
while (inLen-- && outLen--) {
*dest++ = *src++;
}
@ -300,11 +284,8 @@ static USHORT internal_string_to_key(
* Functional description
*
**************************************/
UCHAR *pStart;
UCHAR pad_char;
pStart = dest;
pad_char = *obj->texttype_collation_table;
const UCHAR* const pStart = dest;
const UCHAR pad_char = *obj->texttype_collation_table;
while (inLen-- && outLen--)
*dest++ = *src++;
@ -332,47 +313,44 @@ static SSHORT internal_compare(
* Functional description
*
**************************************/
SSHORT fill;
UCHAR pad;
pad = (obj->texttype_type == ttype_binary) ? 0 : ' ';
fill = length1 - length2;
const UCHAR pad = (obj->texttype_type == ttype_binary) ? 0 : ' ';
SSHORT fill = length1 - length2;
if (length1 >= length2) {
if (length2)
do
do {
if (*p1++ != *p2++)
if (p1[-1] > p2[-1])
return 1;
else
return -1;
while (--length2);
} while (--length2);
if (fill > 0)
do
do {
if (*p1++ != pad)
if (p1[-1] > pad)
return 1;
else
return -1;
while (--fill);
} while (--fill);
return 0;
}
if (length1)
do
do {
if (*p1++ != *p2++)
if (p1[-1] > p2[-1])
return 1;
else
return -1;
while (--length1);
} while (--length1);
do
do {
if (*p2++ != pad)
if (pad > p2[-1])
return 1;
else
return -1;
while (++fill);
} while (++fill);
return 0;
}
@ -516,7 +494,7 @@ static SSHORT internal_str_to_upper(
* Note: dest may equal src.
*
**************************************/
UCHAR* pStart = dest;
const UCHAR* const pStart = dest;
while (inLen-- && outLen--) {
*dest++ = UPPER7(*src);
src++;
@ -553,9 +531,6 @@ static USHORT wc_to_nc(CSCONVERT obj, NCHAR * pDest, USHORT nDest, /* byte count
* Functional description
*
**************************************/
NCHAR *pStart;
UCS2_CHAR *pStart_src;
fb_assert(obj != NULL);
fb_assert((pSrc != NULL) || (pDest == NULL));
fb_assert(err_code != NULL);
@ -564,8 +539,10 @@ static USHORT wc_to_nc(CSCONVERT obj, NCHAR * pDest, USHORT nDest, /* byte count
*err_code = 0;
if (pDest == NULL) /* length estimate needed? */
return ((nSrc + 1) / 2);
pStart = pDest;
pStart_src = pSrc;
const NCHAR* const pStart = pDest;
const UCS2_CHAR* const pStart_src = pSrc;
while (nDest && nSrc >= sizeof(*pSrc)) {
if (*pSrc >= 256) {
*err_code = CS_CONVERT_ERROR;
@ -599,9 +576,6 @@ static USHORT mb_to_wc(CSCONVERT obj, UCS2_CHAR * pDest, USHORT nDest, /* byte c
* byte stream.
*
*************************************/
UCS2_CHAR *pStart;
MBCHAR *pStart_src;
fb_assert(obj != NULL);
fb_assert((pSrc != NULL) || (pDest == NULL));
fb_assert(err_code != NULL);
@ -610,8 +584,9 @@ static USHORT mb_to_wc(CSCONVERT obj, UCS2_CHAR * pDest, USHORT nDest, /* byte c
*err_code = 0;
if (pDest == NULL) /* length estimate needed? */
return (nSrc);
pStart = pDest;
pStart_src = pSrc;
const UCS2_CHAR* const pStart = pDest;
const MBCHAR* const pStart_src = pSrc;
while (nDest > 1 && nSrc > 1) {
*pDest++ = *pSrc * 256 + *(pSrc + 1);
pSrc += 2;
@ -642,9 +617,6 @@ static USHORT wc_to_mb(CSCONVERT obj, MBCHAR * pDest, USHORT nDest, /* byte coun
* byte stream.
*
*************************************/
MBCHAR *pStart;
UCS2_CHAR *pStart_src;
fb_assert(obj != NULL);
fb_assert((pSrc != NULL) || (pDest == NULL));
fb_assert(err_code != NULL);
@ -653,8 +625,9 @@ static USHORT wc_to_mb(CSCONVERT obj, MBCHAR * pDest, USHORT nDest, /* byte coun
*err_code = 0;
if (pDest == NULL) /* length estimate needed? */
return (nSrc);
pStart = pDest;
pStart_src = pSrc;
const MBCHAR* const pStart = pDest;
const UCS2_CHAR* const pStart_src = pSrc;
while (nDest > 1 && nSrc > 1) {
*pDest++ = *pSrc / 256;
*pDest++ = *pSrc++ % 256;
@ -833,9 +806,6 @@ static USHORT cvt_ascii_to_unicode(CSCONVERT obj, UCS2_CHAR * pDest, USHORT nDes
* Byte values >= 128 create BAD_INPUT
*
*************************************/
UCS2_CHAR *pStart;
UCHAR *pStart_src;
fb_assert(obj != NULL);
fb_assert((pSrc != NULL) || (pDest == NULL));
fb_assert(err_code != NULL);
@ -843,8 +813,9 @@ static USHORT cvt_ascii_to_unicode(CSCONVERT obj, UCS2_CHAR * pDest, USHORT nDes
*err_code = 0;
if (pDest == NULL) /* length estimate needed? */
return (2 * nSrc);
pStart = pDest;
pStart_src = pSrc;
const UCS2_CHAR* const pStart = pDest;
const UCHAR* const pStart_src = pSrc;
while (nDest >= sizeof(*pDest) && nSrc >= sizeof(*pSrc)) {
if (*pSrc > 127) {
*err_code = CS_BAD_INPUT;
@ -878,9 +849,6 @@ static USHORT cvt_unicode_to_ascii(CSCONVERT obj, NCHAR * pDest, USHORT nDest, /
* Byte values >= 128 create CONVERT_ERROR
*
*************************************/
NCHAR *pStart;
UCS2_CHAR *pStart_src;
fb_assert(obj != NULL);
fb_assert((pSrc != NULL) || (pDest == NULL));
fb_assert(err_code != NULL);
@ -888,8 +856,9 @@ static USHORT cvt_unicode_to_ascii(CSCONVERT obj, NCHAR * pDest, USHORT nDest, /
*err_code = 0;
if (pDest == NULL) /* length estimate needed? */
return (nSrc / 2);
pStart = pDest;
pStart_src = pSrc;
const NCHAR* const pStart = pDest;
const UCS2_CHAR* const pStart_src = pSrc;
while (nDest >= sizeof(*pDest) && nSrc >= sizeof(*pSrc)) {
if (*pSrc > 127) {
*err_code = CS_CONVERT_ERROR;
@ -923,9 +892,6 @@ static USHORT cvt_none_to_unicode(CSCONVERT obj, UCS2_CHAR * pDest, USHORT nDest
* Byte values >= 128 create CONVERT ERROR
*
*************************************/
UCS2_CHAR *pStart;
UCHAR *pStart_src;
fb_assert(obj != NULL);
fb_assert((pSrc != NULL) || (pDest == NULL));
fb_assert(err_code != NULL);
@ -933,8 +899,9 @@ static USHORT cvt_none_to_unicode(CSCONVERT obj, UCS2_CHAR * pDest, USHORT nDest
*err_code = 0;
if (pDest == NULL) /* length estimate needed? */
return (2 * nSrc);
pStart = pDest;
pStart_src = pSrc;
const UCS2_CHAR* const pStart = pDest;
const UCHAR* const pStart_src = pSrc;
while (nDest >= sizeof(*pDest) && nSrc >= sizeof(*pSrc)) {
if (*pSrc > 127) {
*err_code = CS_CONVERT_ERROR;
@ -973,9 +940,6 @@ static USHORT cvt_utffss_to_ascii(CSCONVERT obj, UCHAR * pDest, USHORT nDest, /*
* routine does double duty.
*
*************************************/
UCHAR *pStart;
UCHAR *pStart_src;
fb_assert(obj != NULL);
fb_assert((pSrc != NULL) || (pDest == NULL));
fb_assert(err_code != NULL);
@ -983,8 +947,9 @@ static USHORT cvt_utffss_to_ascii(CSCONVERT obj, UCHAR * pDest, USHORT nDest, /*
*err_code = 0;
if (pDest == NULL) /* length estimate needed? */
return (nSrc);
pStart = pDest;
pStart_src = pSrc;
const UCHAR* const pStart = pDest;
const UCHAR* const pStart_src = pSrc;
while (nDest >= sizeof(*pDest) && nSrc >= sizeof(*pSrc)) {
if (*pSrc > 127) {
/* In the cvt_ascii_to_utffss case this should be CS_BAD_INPUT */
@ -1175,7 +1140,9 @@ FPTR_SHORT INTL_builtin_lookup(USHORT objtype, SSHORT parm1, SSHORT parm2) {
case type_csconvert:
if (((parm1 == CS_ASCII) && (parm2 == CS_UNICODE_FSS)) ||
((parm2 == CS_ASCII) && (parm1 == CS_UNICODE_FSS)))
{
return (FPTR_SHORT)cvt_ascii_utf_init;
}
/* converting FROM NONE to UNICODE has a short cut
* - it's treated like ASCII */

View File

@ -151,14 +151,14 @@ public:
(tt->texttype_fn_mbtowc)))(tt,a,b,c);
}
bool like(class tdbb* tdbb, const UCHAR* s, SSHORT sl, const UCHAR* p, SSHORT pl, SSHORT escape)
bool like(struct tdbb* tdbb, const UCHAR* s, SSHORT sl, const UCHAR* p, SSHORT pl, SSHORT escape)
{
fb_assert(tt);
fb_assert(tt->texttype_fn_like);
return reinterpret_cast<FPTR_LIKE>(tt->texttype_fn_like)(tdbb,tt,s,sl,p,pl,escape);
}
void *like_create(class tdbb* tdbb, const UCHAR* p, SSHORT pl, SSHORT escape)
void *like_create(struct tdbb* tdbb, const UCHAR* p, SSHORT pl, SSHORT escape)
{
fb_assert(tt);
fb_assert(tt->texttype_fn_like_create);
@ -186,21 +186,21 @@ public:
reinterpret_cast<FPTR_LIKE_DESTROY>(tt->texttype_fn_like_destroy)(object);
}
bool like_process(class tdbb* tdbb, void* object, const UCHAR* s, SSHORT sl)
bool like_process(struct tdbb* tdbb, void* object, const UCHAR* s, SSHORT sl)
{
fb_assert(tt);
fb_assert(tt->texttype_fn_like_process);
return reinterpret_cast<FPTR_LIKE_PROCESS>(tt->texttype_fn_like_process)(tdbb,tt,object,s,sl);
}
bool contains(class tdbb* tdbb, const UCHAR* s, SSHORT sl, const UCHAR* p, SSHORT pl)
bool contains(struct tdbb* tdbb, const UCHAR* s, SSHORT sl, const UCHAR* p, SSHORT pl)
{
fb_assert(tt);
fb_assert(tt->texttype_fn_contains);
return reinterpret_cast<FPTR_CONTAINS>(tt->texttype_fn_contains)(tdbb,tt,s,sl,p,pl);
}
void *contains_create(class tdbb* tdbb, const UCHAR* p, SSHORT pl)
void *contains_create(struct tdbb* tdbb, const UCHAR* p, SSHORT pl)
{
fb_assert(tt);
fb_assert(tt->texttype_fn_contains_create);
@ -228,24 +228,24 @@ public:
reinterpret_cast<FPTR_CONTAINS_DESTROY>(tt->texttype_fn_contains_destroy)(object);
}
bool contains_process(class tdbb* tdbb, void* object, const UCHAR* s, SSHORT sl)
bool contains_process(struct tdbb* tdbb, void* object, const UCHAR* s, SSHORT sl)
{
fb_assert(tt);
fb_assert(tt->texttype_fn_contains_process);
return reinterpret_cast<FPTR_CONTAINS_PROCESS>(tt->texttype_fn_contains_process)(tdbb,tt,object,s,sl);
}
USHORT matches(class tdbb* tdbb, const UCHAR* a, SSHORT b, const UCHAR* c, SSHORT d)
USHORT matches(struct tdbb* tdbb, const UCHAR* a, SSHORT b, const UCHAR* c, SSHORT d)
{
fb_assert(tt);
fb_assert(tt->texttype_fn_matches);
return (*(reinterpret_cast<
USHORT (*)(class tdbb*, TextType, const UCHAR*, short, const UCHAR*, short)>
USHORT (*)(struct tdbb*, TextType, const UCHAR*, short, const UCHAR*, short)>
(tt->texttype_fn_matches)))
(tdbb,tt,a,b,c,d);
}
USHORT sleuth_check(class tdbb* tdbb, USHORT a,
USHORT sleuth_check(struct tdbb* tdbb, USHORT a,
const UCHAR* b,
USHORT c,
const UCHAR* d,
@ -254,12 +254,12 @@ public:
fb_assert(tt);
fb_assert(tt->texttype_fn_sleuth_check);
return (*(reinterpret_cast<
USHORT(*)(class tdbb*, TextType, USHORT, const UCHAR*, USHORT, const UCHAR*, USHORT)>
USHORT(*)(struct tdbb*, TextType, USHORT, const UCHAR*, USHORT, const UCHAR*, USHORT)>
(tt->texttype_fn_sleuth_check)))
(tdbb,tt,a,b,c,d,e);
}
USHORT sleuth_merge(class tdbb* tdbb, const UCHAR* a,
USHORT sleuth_merge(struct tdbb* tdbb, const UCHAR* a,
USHORT b,
const UCHAR* c,
USHORT d,
@ -269,7 +269,7 @@ public:
fb_assert(tt);
fb_assert(tt->texttype_fn_sleuth_merge);
return (*(reinterpret_cast<
USHORT(*)(class tdbb*, TextType, const UCHAR*, USHORT, const UCHAR*, USHORT, UCHAR*, USHORT)>
USHORT(*)(struct tdbb*, TextType, const UCHAR*, USHORT, const UCHAR*, USHORT, UCHAR*, USHORT)>
(tt->texttype_fn_sleuth_merge)))
(tdbb,tt,a,b,c,d,e,f);
}

View File

@ -1,6 +1,6 @@
/*
* PROGRAM: JRD Access Method
* MODULE: inuse.c
* MODULE: inuse.cpp
* DESCRIPTION: Keep track of objects that are in use
*
* The contents of this file are subject to the Interbase Public
@ -33,10 +33,10 @@ static void init(void);
static IUO free_list = NULL;
static MUTX_T inuse_mutex[1];
static BOOLEAN initialized = FALSE;
static bool initialized = false;
BOOLEAN INUSE_cleanup(IUO inuse, void (*cleanup_routine) ())
bool INUSE_cleanup(IUO inuse, void (*cleanup_routine) ())
{
/**************************************
*
@ -47,32 +47,29 @@ BOOLEAN INUSE_cleanup(IUO inuse, void (*cleanup_routine) ())
* Functional description
* Cleanup an in-use structure. If any
* objects are found to be non-NULL,
* call the cleanup routine. Return TRUE
* call the cleanup routine. Return true
* if there was something to do.
*
**************************************/
void **ptr, **end;
BOOLEAN needed_cleaning;
IUO secondary_inuse;
needed_cleaning = FALSE;
secondary_inuse = inuse->iuo_next;
bool needed_cleaning = false;
IUO secondary_inuse = inuse->iuo_next;
do {
ptr = inuse->iuo_object;
for (end = ptr + inuse->iuo_in_use_count; ptr < end; ptr++)
void** ptr = inuse->iuo_object;
for (const void* const* const end = ptr + inuse->iuo_in_use_count;
ptr < end; ptr++)
{
if (*ptr) {
reinterpret_cast <
void (*) (void *) >(*cleanup_routine) (*ptr);
needed_cleaning = TRUE;
needed_cleaning = true;
}
}
inuse->iuo_in_use_count = 0;
} while (inuse = inuse->iuo_next);
if (secondary_inuse) {
IUO *secondary_end_ptr;
for (secondary_end_ptr = &secondary_inuse->iuo_next;
*secondary_end_ptr;)
IUO* secondary_end_ptr = &secondary_inuse->iuo_next;
while (*secondary_end_ptr)
secondary_end_ptr = &(*secondary_end_ptr)->iuo_next;
THD_MUTEX_LOCK(inuse_mutex);
*secondary_end_ptr = free_list;
@ -105,7 +102,7 @@ void INUSE_clear(IUO inuse)
}
BOOLEAN INUSE_insert(IUO inuse, void *new_object, BOOLEAN dup_flag)
bool INUSE_insert(IUO inuse, void *new_object, bool dup_flag)
{
/**************************************
*
@ -115,35 +112,36 @@ BOOLEAN INUSE_insert(IUO inuse, void *new_object, BOOLEAN dup_flag)
*
* Functional description
* Insert an object into an in-use structure.
* If dup_flag is TRUE, then duplicate entries
* are permitted. If it is FALSE, then a
* If dup_flag is true, then duplicate entries
* are permitted. If it is false, then a
* duplicate entry will not be inserted.
* Return TRUE if the object was inserted.
* Return true if the object was inserted.
*
**************************************/
void **ptr, **end;
ptr = inuse->iuo_object;
for (end = ptr + inuse->iuo_in_use_count; ptr < end; ptr++)
// "end" moves backwards in this loop.
void** ptr = inuse->iuo_object;
for (const void* const* end = ptr + inuse->iuo_in_use_count;
ptr < end; ptr++)
{
if (!*ptr) {
if (!dup_flag)
while (ptr < --end)
if (*end == new_object)
return FALSE;
return false;
*ptr = new_object;
return TRUE;
return true;
}
else if (!dup_flag && *ptr == new_object)
return FALSE;
return false;
}
if (inuse->iuo_in_use_count >= FB_NELEM(inuse->iuo_object)) {
IUO new_inuse;
#ifdef DEV_BUILD
gds__log("in-use block overflow. secondary block allocated.");
#endif
THD_MUTEX_LOCK(inuse_mutex);
if (new_inuse = free_list) {
IUO new_inuse = free_list;
if (new_inuse) {
free_list = new_inuse->iuo_next;
THD_MUTEX_UNLOCK(inuse_mutex);
}
@ -153,7 +151,7 @@ BOOLEAN INUSE_insert(IUO inuse, void *new_object, BOOLEAN dup_flag)
/* FREE: at process exit, by cleanup handler cleanup() in this module */
if (!new_inuse) { /* NOMEM: */
DEV_REPORT("INUSE_insert: out of memory");
return FALSE; /* error handling too difficult */
return false; /* error handling too difficult */
}
}
INUSE_clear(new_inuse);
@ -163,11 +161,11 @@ BOOLEAN INUSE_insert(IUO inuse, void *new_object, BOOLEAN dup_flag)
inuse->iuo_object[inuse->iuo_in_use_count++] = new_object;
return TRUE;
return true;
}
BOOLEAN INUSE_remove(IUO inuse, void *old_object, BOOLEAN dup_flag)
bool INUSE_remove(IUO inuse, void* old_object, bool dup_flag)
{
/**************************************
*
@ -177,26 +175,27 @@ BOOLEAN INUSE_remove(IUO inuse, void *old_object, BOOLEAN dup_flag)
*
* Functional description
* Remove an object from an in-use structure.
* If dup_flag is TRUE, remove every occurrence
* If dup_flag is true, remove every occurrence
* of the object. Otherwise, only remove the
* first. Return TRUE if an object was removed.
* first. Return true if an object was removed.
*
**************************************/
void **ptr, **end;
BOOLEAN removed;
removed = FALSE;
bool removed = false;
do {
ptr = inuse->iuo_object;
for (end = ptr + inuse->iuo_in_use_count; ptr < end; ptr++)
// "end" moves backwards here
void** ptr = inuse->iuo_object;
for (const void* const* end = ptr + inuse->iuo_in_use_count;
ptr < end; ptr++)
{
if (*ptr == old_object) {
*ptr = NULL;
if (ptr + 1 == end)
while (!*(--end) && --inuse->iuo_in_use_count);
if (!dup_flag)
return TRUE;
removed = TRUE;
return true;
removed = true;
}
}
} while (inuse = inuse->iuo_next);
return removed;
@ -214,17 +213,15 @@ static void cleanup(void *arg)
* Functional description
*
**************************************/
IUO iuo;
THD_MUTEX_DESTROY(inuse_mutex);
while (free_list) {
iuo = free_list;
IUO iuo = free_list;
free_list = iuo->iuo_next;
gds__free(iuo);
}
initialized = FALSE;
initialized = false;
}
@ -246,7 +243,7 @@ static void init(void)
if (!initialized) {
THD_MUTEX_INIT(inuse_mutex);
gds__register_cleanup(cleanup, 0);
initialized = TRUE;
initialized = true;
}
THD_GLOBAL_MUTEX_UNLOCK;
}

View File

@ -1,7 +1,7 @@
/*
* PROGRAM: JRD Access Method
* MODULE: inuse_proto.h
* DESCRIPTION: Prototype header file for inuse.c
* DESCRIPTION: Prototype header file for inuse.cpp
*
* The contents of this file are subject to the Interbase Public
* License Version 1.0 (the "License"); you may not use this file
@ -24,9 +24,10 @@
#ifndef JRD_INUSE_PROTO_H
#define JRD_INUSE_PROTO_H
BOOLEAN INUSE_cleanup(struct iuo *, FPTR_VOID);
void INUSE_clear(struct iuo *);
BOOLEAN INUSE_insert(struct iuo *, void *, BOOLEAN);
BOOLEAN INUSE_remove(struct iuo *, void *, BOOLEAN);
bool INUSE_cleanup(struct iuo*, FPTR_VOID);
void INUSE_clear(struct iuo*);
bool INUSE_insert(struct iuo*, void*, bool);
bool INUSE_remove(struct iuo*, void*, bool);
#endif // JRD_INUSE_PROTO_H

View File

@ -36,7 +36,7 @@
*
*/
/*
$Id: isc.cpp,v 1.44 2003-11-26 11:15:32 aafemt Exp $
$Id: isc.cpp,v 1.45 2004-02-20 06:43:00 robocop Exp $
*/
#ifdef DARWIN
#define _STLP_CCTYPE
@ -64,14 +64,15 @@ $Id: isc.cpp,v 1.44 2003-11-26 11:15:32 aafemt Exp $
#include "../jrd/fil.h"
#include "../jrd/dls_proto.h"
static BOOLEAN dls_init = FALSE;
#if defined(SUPERSERVER) || !defined(SUPERCLIENT)
static BOOLEAN dls_flag = FALSE;
#endif
static BOOLEAN fdls_init = FALSE;
#ifdef SUPERSERVER
static BOOLEAN fdls_flag = FALSE;
#endif
// I can't find where these are used.
//static BOOLEAN dls_init = FALSE;
//#if defined(SUPERSERVER) || !defined(SUPERCLIENT)
//static BOOLEAN dls_flag = FALSE;
//#endif
//static BOOLEAN fdls_init = FALSE;
//#ifdef SUPERSERVER
//static BOOLEAN fdls_flag = FALSE;
//#endif
/* End of temporary file management specific stuff */
@ -203,9 +204,9 @@ void ISC_ast_exit(void)
#endif
int ISC_check_process_existence(SLONG pid,
bool ISC_check_process_existence(SLONG pid,
SLONG xl_pid,
USHORT super_user)
bool super_user)
{
/**************************************
*
@ -223,14 +224,14 @@ int ISC_check_process_existence(SLONG pid,
#define CHECK_EXIST
return (kill((int) pid, 0) == -1 &&
(errno == ESRCH
|| (super_user && errno == EPERM)) ? FALSE : TRUE);
|| (super_user && errno == EPERM)) ? false : true);
#endif
#ifdef VMS
#define CHECK_EXIST
ULONG item = JPI$_PID;
return (lib$getjpi(&item, &pid, NULL, NULL, NULL, NULL) == SS$_NONEXPR) ?
FALSE : TRUE;
false : true;
#endif
#ifdef WIN_NT
@ -238,14 +239,14 @@ int ISC_check_process_existence(SLONG pid,
if (!handle && GetLastError() != ERROR_ACCESS_DENIED)
{
return FALSE;
return false;
}
CloseHandle(handle);
#endif
#ifndef CHECK_EXIST
return TRUE;
return true;
#else
#undef CHECK_EXIST
#endif
@ -266,8 +267,6 @@ int ISC_expand_logical_once(const TEXT* file_name,
* Expand a logical name. If it doesn't exist, return 0.
*
**************************************/
USHORT l;
ITM items[2];
struct dsc$descriptor_s desc1, desc2;
if (!file_length)
@ -276,6 +275,8 @@ int ISC_expand_logical_once(const TEXT* file_name,
ISC_make_desc(file_name, &desc1, file_length);
ISC_make_desc(LOGICAL_NAME_TABLE, &desc2, sizeof(LOGICAL_NAME_TABLE) - 1);
USHORT l;
ITM items[2];
items[0].itm_length = 256;
items[0].itm_code = LNM$_STRING;
items[0].itm_buffer = expanded_name;
@ -302,7 +303,7 @@ int ISC_expand_logical_once(const TEXT* file_name,
#if (defined SOLARIS || defined SCO_EV)
#define GET_HOST
TEXT *INTERNAL_API_ROUTINE ISC_get_host(TEXT * string, USHORT length)
TEXT *INTERNAL_API_ROUTINE ISC_get_host(TEXT* string, USHORT length)
{
/**************************************
*
@ -328,7 +329,7 @@ TEXT *INTERNAL_API_ROUTINE ISC_get_host(TEXT * string, USHORT length)
#ifdef VMS
#define GET_HOST
TEXT *INTERNAL_API_ROUTINE ISC_get_host(TEXT * string, USHORT length)
TEXT *INTERNAL_API_ROUTINE ISC_get_host(TEXT* string, USHORT length)
{
/**************************************
*
@ -361,7 +362,7 @@ TEXT *INTERNAL_API_ROUTINE ISC_get_host(TEXT * string, USHORT length)
#ifdef WIN_NT
#define GET_HOST
TEXT *INTERNAL_API_ROUTINE ISC_get_host(TEXT * string, USHORT length)
TEXT *INTERNAL_API_ROUTINE ISC_get_host(TEXT* string, USHORT length)
{
/**************************************
*
@ -390,7 +391,7 @@ TEXT *INTERNAL_API_ROUTINE ISC_get_host(TEXT * string, USHORT length)
#endif
#ifndef GET_HOST
TEXT *INTERNAL_API_ROUTINE ISC_get_host(TEXT * string, USHORT length)
TEXT *INTERNAL_API_ROUTINE ISC_get_host(TEXT* string, USHORT length)
{
/**************************************
*
@ -504,15 +505,14 @@ int INTERNAL_API_ROUTINE ISC_get_user(
*
**************************************/
SLONG privileges[2];
USHORT uic[2], len0, len1, len2;
USHORT uic[2];
TEXT user_name[256];
TEXT* p = 0;
if (user_string && *user_string) {
const TEXT* q = user_string;
TEXT* p;
for (p = user_name; (*p = *q++) && *p != '.'; p++);
*p = 0;
p = user_name;
uic[0] = uic[1] = -1;
if (*q) {
uic[1] = atoi(q);
@ -531,6 +531,7 @@ int INTERNAL_API_ROUTINE ISC_get_user(
}
}
else {
USHORT len0, len1, len2;
ITM items[4];
items[0].itm_code = JPI$_UIC;
items[0].itm_length = sizeof(uic);
@ -550,7 +551,7 @@ int INTERNAL_API_ROUTINE ISC_get_user(
items[3].itm_code = 0;
items[3].itm_length = 0;
SLONG status = sys$getjpiw(NULL, NULL, NULL, items, NULL, NULL, NULL);
const SLONG status = sys$getjpiw(NULL, NULL, NULL, items, NULL, NULL, NULL);
if (!(status & 1)) {
len1 = 0;
@ -560,7 +561,7 @@ int INTERNAL_API_ROUTINE ISC_get_user(
user_name[len1] = 0;
if (name) {
for (p = user_name; *p && *p != ' ';)
for (const TEXT* p = user_name; *p && *p != ' ';)
*name++ = *p++;
*name = 0;
}
@ -1201,13 +1202,11 @@ SLONG ISC_get_user_group_id(const TEXT* user_group_name)
#endif /* end of ifdef UNIX */
#ifdef WIN_NT
// Returns the type of OS. TRUE for NT,
// FALSE for the 16-bit based ones (9x/ME, ...).
// Returns the type of OS: true for NT,
// false for the 16-bit based ones (9x/ME, ...).
//
BOOLEAN ISC_is_WinNT()
bool ISC_is_WinNT()
{
OSVERSIONINFO OsVersionInfo;
// thread safe??? :-)
if (!os_type)
{
@ -1215,7 +1214,8 @@ BOOLEAN ISC_is_WinNT()
/* The first time this routine is called we use the Windows API
call GetVersion to determine whether Windows/NT or Chicago
is running. */
OSVERSIONINFO OsVersionInfo;
OsVersionInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
if (GetVersionEx((LPOSVERSIONINFO) & OsVersionInfo))
{
@ -1225,7 +1225,7 @@ BOOLEAN ISC_is_WinNT()
}
return (os_type != 2) ? TRUE : FALSE;
return (os_type != 2);
}
//____________________________________________________________

View File

@ -194,9 +194,9 @@ static void share_name_from_unc(TEXT*, const TEXT*, LPREMOTE_NAME_INFO);
#ifndef NO_NFS
#if (defined AIX || defined AIX_PPC)
static BOOLEAN get_mounts(MNT *, TEXT *, TEXT **, int *);
static bool get_mounts(MNT *, TEXT *, TEXT **, int *);
#else
static BOOLEAN get_mounts(MNT *, TEXT *, IB_FILE *);
static bool get_mounts(MNT *, TEXT *, IB_FILE *);
#endif
#endif
@ -727,8 +727,8 @@ int ISC_expand_filename(const TEXT* file_name,
TEXT *p, *q, *end, temp[MAXPATHLEN], device[4];
USHORT length = 0;
USHORT dtype;
BOOLEAN fully_qualified_path = FALSE;
BOOLEAN drive_letter_present = FALSE;
bool fully_qualified_path = false;
bool drive_letter_present = false;
if (!file_length)
file_length = strlen(file_name);
@ -758,13 +758,13 @@ int ISC_expand_filename(const TEXT* file_name,
if (q - temp != 1)
return file_length;
device[0] = temp[0];
drive_letter_present = TRUE;
drive_letter_present = true;
strcpy(device + 1, ":\\");
dtype = GetDriveType(device);
if (dtype <= 1)
return file_length;
if (*(q + 1) == '/' || *(q + 1) == '\\')
fully_qualified_path = TRUE;
fully_qualified_path = true;
}
/* Translate forward slashes to back slashes */
@ -782,7 +782,7 @@ int ISC_expand_filename(const TEXT* file_name,
return file_length;
}
else if (temp[0] == '\\' || temp[0] == '/')
fully_qualified_path = TRUE;
fully_qualified_path = true;
/* Expand the file name */
@ -1308,7 +1308,7 @@ static void expand_share_name(TEXT* share_name)
#ifndef NO_NFS
#if (defined AIX || defined AIX_PPC)
#define GET_MOUNTS
static BOOLEAN get_mounts(
static bool get_mounts(
MNT * mount,
TEXT * mnt_buffer, TEXT ** buffer, int *count)
{
@ -1332,16 +1332,16 @@ static BOOLEAN get_mounts(
a buffer for it, and finally get it. */
if (mntctl(MCTL_QUERY, sizeof(SLONG), mnt_buffer) != 0)
return FALSE;
return false;
l = *(SLONG *) mnt_buffer;
/* FREE: in get_mounts() */
if (!(*buffer = gds__alloc((SLONG) l)) ||
(*count = mntctl(MCTL_QUERY, l, *buffer)) <= 0)
return FALSE; /* NOMEM: */
return false; /* NOMEM: */
}
else if (!*count)
return FALSE;
return false;
for (i = --(*count), p = *buffer; i--;)
p += ((struct vmount *) p)->vmt_length;
@ -1376,14 +1376,14 @@ static BOOLEAN get_mounts(
mount->mnt_path = p;
}
return TRUE;
return true;
}
#endif // (defined AIX || defined AIX_PPC)
#if defined(HAVE_GETMNTENT) && !defined(SOLARIS)
#define GET_MOUNTS
#if defined(GETMNTENT_TAKES_TWO_ARGUMENTS) /* SYSV stylish */
static BOOLEAN get_mounts(MNT * mount, TEXT * buffer, IB_FILE * file)
static bool get_mounts(MNT * mount, TEXT * buffer, IB_FILE * file)
{
/**************************************
*
@ -1422,13 +1422,13 @@ static BOOLEAN get_mounts(MNT * mount, TEXT * buffer, IB_FILE * file)
mount->mnt_path = p;
while ((*p++ = *q++) != 0);
mount->mnt_mount = mptr->mnt_mountp;
return TRUE;
return true;
}
else
return FALSE;
return false;
}
#else // !GETMNTENT_TAKES_TWO_ARGUMENTS
static BOOLEAN get_mounts(MNT * mount, TEXT * buffer, IB_FILE * file)
static bool get_mounts(MNT * mount, TEXT * buffer, IB_FILE * file)
{
/**************************************
*
@ -1468,17 +1468,17 @@ static BOOLEAN get_mounts(MNT * mount, TEXT * buffer, IB_FILE * file)
mount->mnt_path = p;
while (*p++ = *q++);
mount->mnt_mount = mptr->mnt_dir;
return TRUE;
return true;
}
return FALSE;
return false;
}
#endif // GETMNTENT_TAKES_TWO_ARGUMENTS
#endif // HAVE_GETMNTENT && !SOLARIS
#ifdef SCO_UNIX
#define GET_MOUNTS
static BOOLEAN get_mounts(MNT * mount, TEXT * buffer, IB_FILE * file)
static bool get_mounts(MNT * mount, TEXT * buffer, IB_FILE * file)
{
/**************************************
*
@ -1532,15 +1532,15 @@ static BOOLEAN get_mounts(MNT * mount, TEXT * buffer, IB_FILE * file)
mount->mnt_mount = p;
q = mount_point;
while (*p++ = *q++);
return TRUE;
return true;
}
return FALSE;
return false;
}
#endif // SCO_UNIX
#ifndef GET_MOUNTS
static BOOLEAN get_mounts(MNT * mount, TEXT * buffer, IB_FILE * file)
static bool get_mounts(MNT * mount, TEXT * buffer, IB_FILE * file)
{
/**************************************
*
@ -1600,10 +1600,10 @@ static BOOLEAN get_mounts(MNT * mount, TEXT * buffer, IB_FILE * file)
mount->mnt_mount = p;
q = mount_point;
while (*p++ = *q++);
return TRUE;
return true;
}
return FALSE;
return false;
}
#endif // GET_MOUNTS

View File

@ -28,7 +28,7 @@
void ISC_ast_enter(void);
void ISC_ast_exit(void);
int ISC_check_process_existence(SLONG, SLONG, USHORT);
bool ISC_check_process_existence(SLONG, SLONG, bool);
void ISC_get_config(TEXT *, struct ipccfg *);
int ISC_set_config(TEXT *, struct ipccfg *);
TEXT* INTERNAL_API_ROUTINE ISC_get_host(TEXT *, USHORT);
@ -50,7 +50,7 @@ void ISC_wake_init(void);
#endif
#ifdef WIN_NT
BOOLEAN ISC_is_WinNT(void);
bool ISC_is_WinNT();
struct _SECURITY_ATTRIBUTES* ISC_get_security_desc(void);
/* Disabled. Not found anywhere.
TEXT* ISC_prefix_interbase(TEXT*, TEXT*);

View File

@ -44,7 +44,7 @@ int ISC_event_post(struct event_t *);
int ISC_event_wait(SSHORT, struct event_t **, SLONG *, SLONG, FPTR_VOID_PTR, void *);
#ifdef WIN_NT
void* ISC_make_signal(BOOLEAN, BOOLEAN, int, int);
void* ISC_make_signal(bool, bool, int, int);
#endif /* WIN_NT */
typedef void (*FPTR_INIT_GLOBAL_REGION)(void*, struct sh_mem*, bool);
@ -67,20 +67,21 @@ BOOLEAN ISC_unmap_object(ISC_STATUS *, SH_MEM, UCHAR **, SLONG);
#ifdef SUPERSERVER
#ifdef UNIX
void ISC_exception_post(ULONG, TEXT *);
void ISC_exception_post(ULONG, const TEXT*);
void ISC_sync_signals_set(void);
void ISC_sync_signals_reset(void);
#endif /* UNIX */
#ifdef WIN_NT
ULONG ISC_exception_post(ULONG, TEXT *);
ULONG ISC_exception_post(ULONG, const TEXT*);
#endif /* WIN_NT */
#endif /* SUPERSERVER */
UCHAR* ISC_remap_file(ISC_STATUS *, struct sh_mem *, SLONG, USHORT);
UCHAR* ISC_remap_file(ISC_STATUS *, struct sh_mem *, SLONG, bool);
void ISC_reset_timer(FPTR_VOID_PTR, void *, SLONG *, void **);
void ISC_set_timer(SLONG, FPTR_VOID_PTR, void *, SLONG *, void **);
void ISC_unmap_file(ISC_STATUS *, struct sh_mem *, USHORT);
#endif // JRD_ISC_S_PROTO_H

File diff suppressed because it is too large Load Diff

View File

@ -298,7 +298,7 @@ typedef struct dpb
USHORT dpb_wal_action;
SLONG dpb_sweep_interval;
ULONG dpb_page_buffers;
BOOLEAN dpb_set_page_buffers;
bool dpb_set_page_buffers;
ULONG dpb_buffers;
USHORT dpb_debug;
USHORT dpb_verify;
@ -324,15 +324,15 @@ typedef struct dpb
TEXT* dpb_lc_messages;
TEXT* dpb_lc_ctype;
USHORT dpb_single_user;
BOOLEAN dpb_overwrite;
BOOLEAN dpb_sec_attach;
BOOLEAN dpb_disable_wal;
bool dpb_overwrite;
bool dpb_sec_attach;
bool dpb_disable_wal;
SLONG dpb_connect_timeout;
SLONG dpb_dummy_packet_interval;
SSHORT dpb_db_readonly;
BOOLEAN dpb_set_db_readonly;
BOOLEAN dpb_gfix_attach;
BOOLEAN dpb_gstat_attach;
bool dpb_db_readonly;
bool dpb_set_db_readonly;
bool dpb_gfix_attach;
bool dpb_gstat_attach;
TEXT* dpb_gbak_attach;
TEXT* dpb_working_directory;
USHORT dpb_sql_dialect;
@ -340,12 +340,12 @@ typedef struct dpb
TEXT* dpb_set_db_charset;
} DPB;
static BLB check_blob(TDBB, ISC_STATUS*, BLB*);
static blb* check_blob(TDBB, ISC_STATUS*, blb**);
static ISC_STATUS check_database(TDBB, ATT, ISC_STATUS*);
static void cleanup(void*);
static ISC_STATUS commit(ISC_STATUS*, jrd_tra**, const bool);
static STR copy_string(const TEXT*, const USHORT);
static bool drop_files(const fil*);
static bool drop_files(const jrd_file*);
static ISC_STATUS error(ISC_STATUS*);
static void find_intl_charset(TDBB, ATT, const DPB*);
static jrd_tra* find_transaction(TDBB, jrd_tra*, ISC_STATUS);
@ -369,7 +369,7 @@ static DBB init(TDBB, ISC_STATUS*, const TEXT*, bool);
static ISC_STATUS prepare(TDBB, jrd_tra*, ISC_STATUS*, USHORT, const UCHAR*);
static void release_attachment(ATT);
static ISC_STATUS return_success(TDBB);
static BOOLEAN rollback(TDBB, jrd_tra*, ISC_STATUS*, const bool);
static bool rollback(TDBB, jrd_tra*, ISC_STATUS*, const bool);
static void shutdown_database(DBB, const bool);
static void strip_quotes(const TEXT*, TEXT*);
@ -392,7 +392,7 @@ static ULONG num_attached = 0;
#if !defined(REQUESTER)
int debug;
IHNDL internal_db_handles = 0;
ihndl* internal_db_handles = 0;
#endif // !REQUESTER
@ -502,7 +502,7 @@ static void SET_TDBB(TDBB& tdbb)
#define DBL_QUOTE '\042'
#define SINGLE_QUOTE '\''
#define BUFFER_LENGTH128 128
BOOLEAN invalid_client_SQL_dialect = FALSE;
bool invalid_client_SQL_dialect = false;
#define GDS_ATTACH_DATABASE jrd8_attach_database
#define GDS_BLOB_INFO jrd8_blob_info
@ -767,7 +767,7 @@ ISC_STATUS GDS_ATTACH_DATABASE(ISC_STATUS* user_status,
SBM_init();
dbb->dbb_file =
PIO_open(dbb, expanded_name, length_expanded,
options.dpb_trace, 0, file_name, file_length);
options.dpb_trace != 0, NULL, file_name, file_length);
SHUT_init(dbb);
PAG_header(file_name, file_length);
INI_init2();
@ -834,7 +834,7 @@ ISC_STATUS GDS_ATTACH_DATABASE(ISC_STATUS* user_status,
isc_arg_gds, isc_valid_client_dialects,
isc_arg_string, "1, or 3", 0);
}
invalid_client_SQL_dialect = FALSE;
invalid_client_SQL_dialect = false;
if (options.dpb_role_name)
{
@ -964,7 +964,7 @@ ISC_STATUS GDS_ATTACH_DATABASE(ISC_STATUS* user_status,
bool internal = false;
for (IHNDL ihandle = internal_db_handles;
for (ihndl* ihandle = internal_db_handles;
ihandle;
ihandle = ihandle->ihndl_next)
{
@ -1278,7 +1278,7 @@ ISC_STATUS GDS_ATTACH_DATABASE(ISC_STATUS* user_status,
ISC_STATUS GDS_BLOB_INFO(ISC_STATUS* user_status,
BLB* blob_handle,
blb** blob_handle,
SSHORT item_length,
const SCHAR* items,
SSHORT buffer_length,
@ -1323,7 +1323,7 @@ ISC_STATUS GDS_BLOB_INFO(ISC_STATUS* user_status,
}
ISC_STATUS GDS_CANCEL_BLOB(ISC_STATUS * user_status, BLB * blob_handle)
ISC_STATUS GDS_CANCEL_BLOB(ISC_STATUS * user_status, blb** blob_handle)
{
/**************************************
*
@ -1472,7 +1472,7 @@ ISC_STATUS GDS_CANCEL_OPERATION(ISC_STATUS * user_status,
#endif
ISC_STATUS GDS_CLOSE_BLOB(ISC_STATUS * user_status, BLB * blob_handle)
ISC_STATUS GDS_CLOSE_BLOB(ISC_STATUS * user_status, blb** blob_handle)
{
/**************************************
*
@ -1617,8 +1617,8 @@ ISC_STATUS GDS_COMPILE(ISC_STATUS* user_status,
ISC_STATUS GDS_CREATE_BLOB2(ISC_STATUS* user_status,
ATT* db_handle,
jrd_tra** tra_handle,
BLB* blob_handle,
BID blob_id,
blb** blob_handle,
bid* blob_id,
USHORT bpb_length,
const UCHAR* bpb)
{
@ -1633,7 +1633,7 @@ ISC_STATUS GDS_CREATE_BLOB2(ISC_STATUS* user_status,
*
**************************************/
jrd_tra* transaction;
BLB blob;
blb* blob;
struct tdbb thd_context;
api_entry_point_init(user_status);
@ -1755,7 +1755,7 @@ ISC_STATUS GDS_CREATE_DATABASE(ISC_STATUS* user_status,
TEXT* opt_ptr = opt_buffer;
DPB options;
get_options(dpb, dpb_length, &opt_ptr, DPB_EXPAND_BUFFER, &options);
if (invalid_client_SQL_dialect == FALSE && options.dpb_sql_dialect == 99) {
if (!invalid_client_SQL_dialect && options.dpb_sql_dialect == 99) {
options.dpb_sql_dialect = 0;
}
@ -1865,7 +1865,7 @@ ISC_STATUS GDS_CREATE_DATABASE(ISC_STATUS* user_status,
bool internal = false;
for (IHNDL ihandle = internal_db_handles;
for (ihndl* ihandle = internal_db_handles;
ihandle;
ihandle = ihandle->ihndl_next)
{
@ -1894,8 +1894,8 @@ ISC_STATUS GDS_CREATE_DATABASE(ISC_STATUS* user_status,
return user_status[1];
}
dbb->dbb_file =
PIO_create(dbb, expanded_name, length_expanded, options.dpb_overwrite != 0);
const fil* first_dbb_file = dbb->dbb_file;
PIO_create(dbb, expanded_name, length_expanded, options.dpb_overwrite);
const jrd_file* first_dbb_file = dbb->dbb_file;
if (options.dpb_set_page_buffers)
dbb->dbb_page_buffers = options.dpb_page_buffers;
CCH_init(tdbb, (ULONG) options.dpb_buffers);
@ -2372,16 +2372,16 @@ ISC_STATUS GDS_DROP_DATABASE(ISC_STATUS * user_status, ATT * handle)
isc_arg_string, "drop",
isc_arg_string, "database",
isc_arg_string,
ERR_cstring((SCHAR*) tdbb->tdbb_attachment->att_filename->str_data), 0);
ERR_cstring((const SCHAR*) tdbb->tdbb_attachment->att_filename->str_data), 0);
if (attachment->att_flags & ATT_shutdown)
ERR_post(isc_shutdown, isc_arg_string,
ERR_cstring((SCHAR*) tdbb->tdbb_attachment->att_filename->str_data), 0);
ERR_cstring((const SCHAR*) tdbb->tdbb_attachment->att_filename->str_data), 0);
if (!CCH_exclusive(tdbb, LCK_PW, WAIT_PERIOD))
ERR_post(isc_lock_timeout, isc_arg_gds, isc_obj_in_use,
isc_arg_string,
ERR_cstring((SCHAR*) tdbb->tdbb_attachment->att_filename->str_data), 0);
ERR_cstring((const SCHAR*) tdbb->tdbb_attachment->att_filename->str_data), 0);
JRD_SS_MUTEX_LOCK;
#if defined(V4_THREADING) && !defined(SUPERSERVER)
@ -2413,7 +2413,7 @@ ISC_STATUS GDS_DROP_DATABASE(ISC_STATUS * user_status, ATT * handle)
lock and start dropping files. */
WIN window(HEADER_PAGE);
hdr* header = (HDR) CCH_FETCH(tdbb, &window, LCK_write, pag_header);
header_page* header = (header_page*) CCH_FETCH(tdbb, &window, LCK_write, pag_header);
CCH_MARK_MUST_WRITE(tdbb, &window);
header->hdr_ods_version = 0;
CCH_RELEASE(tdbb, &window);
@ -2444,8 +2444,8 @@ ISC_STATUS GDS_DROP_DATABASE(ISC_STATUS * user_status, ATT * handle)
#if defined(V4_THREADING) && !defined(SUPERSERVER)
V4_JRD_MUTEX_UNLOCK(databases_mutex);
#endif
const fil* file = dbb->dbb_file;
const sdw* shadow = dbb->dbb_shadow;
const jrd_file* file = dbb->dbb_file;
const Shadow* shadow = dbb->dbb_shadow;
tdbb->tdbb_default = NULL;
@ -2497,7 +2497,7 @@ ISC_STATUS GDS_DROP_DATABASE(ISC_STATUS * user_status, ATT * handle)
ISC_STATUS GDS_GET_SEGMENT(ISC_STATUS * user_status,
BLB * blob_handle,
blb** blob_handle,
USHORT * length,
USHORT buffer_length,
UCHAR * buffer)
@ -2605,7 +2605,7 @@ ISC_STATUS GDS_GET_SLICE(ISC_STATUS* user_status,
else
*return_length = BLB_get_slice(tdbb,
transaction,
reinterpret_cast<BID>(array_id),
reinterpret_cast<bid*>(array_id),
sdl,
param_length,
reinterpret_cast<const SLONG*>(param),
@ -2623,8 +2623,8 @@ ISC_STATUS GDS_GET_SLICE(ISC_STATUS* user_status,
ISC_STATUS GDS_OPEN_BLOB2(ISC_STATUS* user_status,
ATT* db_handle,
jrd_tra** tra_handle,
BLB* blob_handle,
BID blob_id,
blb** blob_handle,
bid* blob_id,
USHORT bpb_length,
const UCHAR* bpb)
{
@ -2716,7 +2716,7 @@ ISC_STATUS GDS_PREPARE(ISC_STATUS * user_status,
ISC_STATUS GDS_PUT_SEGMENT(ISC_STATUS* user_status,
BLB* blob_handle,
blb** blob_handle,
USHORT buffer_length,
const UCHAR* buffer)
{
@ -2800,7 +2800,7 @@ ISC_STATUS GDS_PUT_SLICE(ISC_STATUS* user_status,
find_transaction(tdbb, *tra_handle, isc_segstr_wrong_db);
BLB_put_slice(tdbb,
transaction,
reinterpret_cast<BID>(array_id),
reinterpret_cast<bid*>(array_id),
sdl,
param_length,
reinterpret_cast<const SLONG*>(param), slice_length, slice);
@ -2849,7 +2849,7 @@ ISC_STATUS GDS_QUE_EVENTS(ISC_STATUS* user_status,
try
{
DBB dbb = tdbb->tdbb_database;
LCK lock = dbb->dbb_lock;
lck* lock = dbb->dbb_lock;
att* attachment = tdbb->tdbb_attachment;
if (!attachment->att_event_session &&
@ -3162,7 +3162,7 @@ ISC_STATUS GDS_ROLLBACK(ISC_STATUS * user_status, jrd_tra** tra_handle)
ISC_STATUS GDS_SEEK_BLOB(ISC_STATUS * user_status,
BLB * blob_handle,
blb** blob_handle,
SSHORT mode,
SLONG offset,
SLONG * result)
@ -3265,7 +3265,7 @@ ISC_STATUS GDS_SEND(ISC_STATUS * user_status,
ISC_STATUS GDS_SERVICE_ATTACH(ISC_STATUS* user_status,
USHORT service_length,
const TEXT* service_name,
SVC* svc_handle,
svc** svc_handle,
USHORT spb_length,
const SCHAR* spb)
{
@ -3304,7 +3304,7 @@ ISC_STATUS GDS_SERVICE_ATTACH(ISC_STATUS* user_status,
}
ISC_STATUS GDS_SERVICE_DETACH(ISC_STATUS* user_status, SVC* svc_handle)
ISC_STATUS GDS_SERVICE_DETACH(ISC_STATUS* user_status, svc** svc_handle)
{
/**************************************
*
@ -3344,7 +3344,7 @@ ISC_STATUS GDS_SERVICE_DETACH(ISC_STATUS* user_status, SVC* svc_handle)
ISC_STATUS GDS_SERVICE_QUERY(ISC_STATUS* user_status,
SVC* svc_handle,
svc** svc_handle,
ULONG* reserved,
USHORT send_item_length,
const SCHAR* send_items,
@ -3420,7 +3420,7 @@ ISC_STATUS GDS_SERVICE_QUERY(ISC_STATUS* user_status,
ISC_STATUS GDS_SERVICE_START(ISC_STATUS* user_status,
SVC* svc_handle,
svc** svc_handle,
ULONG* reserved,
USHORT spb_length,
const SCHAR* spb)
@ -4160,7 +4160,7 @@ void JRD_mutex_lock(MUTX mutex)
*
**************************************/
TDBB tdbb = get_thread_data();
INUSE_insert(&tdbb->tdbb_mutexes, (void *) mutex, TRUE);
INUSE_insert(&tdbb->tdbb_mutexes, (void *) mutex, true);
THD_MUTEX_LOCK(mutex);
}
@ -4179,7 +4179,7 @@ void JRD_mutex_unlock(MUTX mutex)
*
**************************************/
TDBB tdbb = get_thread_data();
INUSE_remove(&tdbb->tdbb_mutexes, (void *) mutex, FALSE);
INUSE_remove(&tdbb->tdbb_mutexes, (void *) mutex, false);
THD_MUTEX_UNLOCK(mutex);
}
@ -4306,7 +4306,7 @@ BOOLEAN JRD_reschedule(TDBB tdbb, SLONG quantum, bool punt)
attachment->att_flags & ATT_shutdown)
{
if (punt) {
CCH_unwind(tdbb, FALSE);
CCH_unwind(tdbb, false);
ERR_post(isc_shutdown, 0);
}
else {
@ -4335,7 +4335,7 @@ BOOLEAN JRD_reschedule(TDBB tdbb, SLONG quantum, bool punt)
{
attachment->att_flags &= ~ATT_cancel_raise;
if (punt) {
CCH_unwind(tdbb, FALSE);
CCH_unwind(tdbb, false);
ERR_post(isc_cancelled, 0);
}
else {
@ -4374,12 +4374,14 @@ void JRD_restore_context(void)
*
**************************************/
TDBB tdbb = get_thread_data();
BOOLEAN cleaned_up;
cleaned_up =
bool cleaned_up =
INUSE_cleanup(&tdbb->tdbb_mutexes, (FPTR_VOID) THD_mutex_unlock);
// Logical OR would use short circuit boolean: function may not be called.
// Left as bitwise OR. Condition may be reversed to use logical OR.
cleaned_up |=
INUSE_cleanup(&tdbb->tdbb_rw_locks, (FPTR_VOID) THD_wlck_unlock);
/* Charlie will fill this in
cleaned_up |= INUSE_cleanup (&tdbb->tdbb_pages, (FPTR_VOID) CCH_?);
*/
@ -4485,7 +4487,7 @@ void jrd_vtof(const char* string, char* field, SSHORT length)
}
}
static BLB check_blob(TDBB tdbb, ISC_STATUS* user_status, BLB* blob_handle)
static blb* check_blob(TDBB tdbb, ISC_STATUS* user_status, blb** blob_handle)
{
/**************************************
*
@ -4722,7 +4724,7 @@ static STR copy_string(const TEXT* ptr, const USHORT length)
}
static bool drop_files(const fil* file)
static bool drop_files(const jrd_file* file)
{
/**************************************
*
@ -4905,9 +4907,9 @@ static void get_options(const UCHAR* dpb,
options->dpb_buffers = JRD_cache_default;
options->dpb_sweep_interval = -1;
options->dpb_overwrite = TRUE;
options->dpb_overwrite = true;
options->dpb_sql_dialect = 99;
invalid_client_SQL_dialect = FALSE;
invalid_client_SQL_dialect = false;
const UCHAR* p = dpb;
const UCHAR* const end_dpb = p + dpb_length;
@ -4981,7 +4983,7 @@ static void get_options(const UCHAR* dpb,
{
ERR_post(isc_bad_dpb_content, 0);
}
options->dpb_set_page_buffers = TRUE;
options->dpb_set_page_buffers = true;
break;
case isc_dpb_num_buffers:
@ -5206,11 +5208,11 @@ static void get_options(const UCHAR* dpb,
}
case isc_dpb_overwrite:
options->dpb_overwrite = (BOOLEAN) get_parameter(&p);
options->dpb_overwrite = get_parameter(&p) != 0;
break;
case isc_dpb_sec_attach:
options->dpb_sec_attach = (BOOLEAN) get_parameter(&p);
options->dpb_sec_attach = get_parameter(&p) != 0;
options->dpb_buffers = 50;
dbb->dbb_flags |= DBB_security_db;
break;
@ -5220,19 +5222,19 @@ static void get_options(const UCHAR* dpb,
break;
case isc_dpb_gstat_attach:
options->dpb_gstat_attach = TRUE;
options->dpb_gstat_attach = true;
l = *p++;
p += l;
break;
case isc_dpb_gfix_attach:
options->dpb_gfix_attach = TRUE;
options->dpb_gfix_attach = true;
l = *p++;
p += l;
break;
case isc_dpb_disable_wal:
options->dpb_disable_wal = TRUE;
options->dpb_disable_wal = true;
l = *p++;
p += l;
break;
@ -5248,7 +5250,7 @@ static void get_options(const UCHAR* dpb,
case isc_dpb_sql_dialect:
options->dpb_sql_dialect = (USHORT) get_parameter(&p);
if (options->dpb_sql_dialect > SQL_DIALECT_V6)
invalid_client_SQL_dialect = TRUE;
invalid_client_SQL_dialect = true;
break;
case isc_dpb_set_db_sql_dialect:
@ -5256,8 +5258,8 @@ static void get_options(const UCHAR* dpb,
break;
case isc_dpb_set_db_readonly:
options->dpb_set_db_readonly = TRUE;
options->dpb_db_readonly = (SSHORT) get_parameter(&p);
options->dpb_set_db_readonly = true;
options->dpb_db_readonly = get_parameter(&p) != 0;
break;
case isc_dpb_set_db_charset:
@ -5669,14 +5671,14 @@ static void release_attachment(ATT attachment)
{
if (*lock)
{
LCK_release(tdbb, (LCK)(*lock));
LCK_release(tdbb, (lck*)(*lock));
delete *lock;
}
}
delete lock_vector;
}
LCK record_lock;
lck* record_lock;
for (record_lock = attachment->att_record_locks; record_lock;
record_lock = record_lock->lck_att_next)
{
@ -5777,7 +5779,7 @@ static ISC_STATUS return_success(TDBB tdbb)
}
static BOOLEAN rollback(TDBB tdbb,
static bool rollback(TDBB tdbb,
jrd_tra* next,
ISC_STATUS* status_vector,
const bool retaining_flag)
@ -5920,10 +5922,10 @@ static void shutdown_database(DBB dbb, const bool release_pools)
USHORT i;
for (i = 0; i < DBB_MUTX_max; i++) {
INUSE_remove(&tdbb->tdbb_mutexes, dbb->dbb_mutexes + i, TRUE);
INUSE_remove(&tdbb->tdbb_mutexes, dbb->dbb_mutexes + i, true);
}
for (i = 0; i < DBB_WLCK_max; i++) {
INUSE_remove(&tdbb->tdbb_rw_locks, dbb->dbb_rw_locks + i, TRUE);
INUSE_remove(&tdbb->tdbb_rw_locks, dbb->dbb_rw_locks + i, true);
}
THD_MUTEX_DESTROY_N(dbb->dbb_mutexes, DBB_MUTX_max);
@ -6053,21 +6055,19 @@ TEXT* JRD_num_attachments(TEXT* const buf, USHORT buf_len, USHORT flag,
for (DBB dbb = databases; dbb; dbb = dbb->dbb_next) {
#ifdef WIN_NT
struct fil* files;
struct dls* dirs;
struct scb* scb;
struct sfb* sfb;
/* Get drive letters for db files */
if (flag == JRD_info_drivemask)
for (files = dbb->dbb_file; files; files = files->fil_next)
{
for (jrd_file* files = dbb->dbb_file; files; files = files->fil_next)
ExtractDriveLetter(files->fil_string, &drive_mask);
}
#endif
if (!(dbb->dbb_flags & (DBB_bugcheck | DBB_not_in_use | DBB_security_db)) &&
!(dbb->dbb_ast_flags & DBB_shutdown
&& dbb->dbb_ast_flags & DBB_shutdown_locks)) {
&& dbb->dbb_ast_flags & DBB_shutdown_locks))
{
num_dbs++;
if (flag == JRD_info_dbnames) {
if (dbfp == NULL) {
@ -6106,7 +6106,7 @@ TEXT* JRD_num_attachments(TEXT* const buf, USHORT buf_len, USHORT flag,
if (flag == JRD_info_drivemask) {
MDLS* ptr = DLS_get_access();
for (dirs = ptr->mdls_dls; dirs; dirs = dirs->dls_next) {
for (dls* dirs = ptr->mdls_dls; dirs; dirs = dirs->dls_next) {
ExtractDriveLetter(dirs->dls_directory, &drive_mask);
}
}
@ -6115,6 +6115,9 @@ TEXT* JRD_num_attachments(TEXT* const buf, USHORT buf_len, USHORT flag,
if (flag == JRD_info_drivemask)
{
// Fix those rogue definitions!
struct scb* scb;
struct sfb* sfb;
for (scb = attach->att_active_sorts; scb; scb = scb->scb_next)
{
for (sfb = scb->scb_sfb; sfb; sfb = sfb->sfb_next)
@ -6489,7 +6492,7 @@ static bool verify_database_name(const TEXT* name, ISC_STATUS* status)
// CVC: Using STATUS to hold pointer to literal string!
status[3] = reinterpret_cast<ISC_STATUS>("database");
status[4] = isc_arg_string;
status[5] = reinterpret_cast<ISC_STATUS>(ERR_cstring(name));
status[5] = (ISC_STATUS)(U_IPTR) ERR_cstring(name);
status[6] = isc_arg_end;
return false;
}

View File

@ -96,7 +96,13 @@
// fwd. decl.
class vec;
class tdbb;
struct tdbb;
class att;
class jrd_tra;
class jrd_req;
class lck;
class jrd_file;
class fmt;
class dbb : private pool_alloc<type_dbb>
@ -114,7 +120,7 @@ public:
// permanent memory pool, the entire delete() operation needs
// to complete _before_ the permanent pool is deleted, or else
// risk an aborted engine.
static void deleteDbb(dbb *toDelete)
static void deleteDbb(dbb* toDelete)
{
if (toDelete == 0)
return;
@ -123,24 +129,24 @@ public:
JrdMemoryPool::noDbbDeletePool(perm);
}
class dbb *dbb_next; /* Next database block in system */
class att *dbb_attachments; /* Active attachments */
dbb* dbb_next; /* Next database block in system */
att *dbb_attachments; /* Active attachments */
struct bcb *dbb_bcb; /* Buffer control block */
vec* dbb_relations; /* relation vector */
vec* dbb_procedures; /* scanned procedures */
struct lck *dbb_lock; /* granddaddy lock */
class jrd_tra *dbb_sys_trans; /* system transaction */
struct fil *dbb_file; /* files for I/O operations */
struct sdw *dbb_shadow; /* shadow control block */
struct lck *dbb_shadow_lock; /* lock for synchronizing addition of shadows */
lck* dbb_lock; /* granddaddy lock */
jrd_tra* dbb_sys_trans; /* system transaction */
jrd_file* dbb_file; /* files for I/O operations */
class Shadow* dbb_shadow; /* shadow control block */
lck* dbb_shadow_lock; /* lock for synchronizing addition of shadows */
SLONG dbb_shadow_sync_count; /* to synchronize changes to shadows */
struct lck *dbb_retaining_lock; /* lock for preserving commit retaining snapshot */
lck* dbb_retaining_lock; /* lock for preserving commit retaining snapshot */
struct plc *dbb_connection; /* connection block */
struct pgc *dbb_pcontrol; /* page control */
class vcl *dbb_t_pages; /* pages number for transactions */
class vcl *dbb_gen_id_pages; /* known pages for gen_id */
struct blf *dbb_blob_filters; /* known blob filters */
struct lls *dbb_modules; /* external function/filter modules */
class lls *dbb_modules; /* external function/filter modules */
MUTX_T *dbb_mutexes; /* DBB block mutexes */
WLCK_T *dbb_rw_locks; /* DBB block read/write locks */
REC_MUTX_T dbb_sp_rec_mutex; /* Recursive mutex for accessing/updating stored procedure metadata */
@ -174,7 +180,6 @@ public:
USHORT dbb_next_pool_id;
vec* dbb_internal; /* internal requests */
vec* dbb_dyn_req; /* internal dyn requests */
// struct jrn *dbb_journal; /* journal block */
SLONG dbb_oldest_active; /* Cached "oldest active" transaction */
SLONG dbb_oldest_transaction; /* Cached "oldest interesting" transaction */
@ -193,7 +198,7 @@ public:
event_t dbb_gc_event_init[1]; /* Event for initialization garbage collector */
event_t dbb_gc_event_fini[1]; /* Event for finalization garbage collector */
#endif
class att *dbb_update_attachment; /* Attachment with update in process */
att *dbb_update_attachment; /* Attachment with update in process */
class btb *dbb_update_que; /* Attachments waiting for update */
class btb *dbb_free_btbs; /* Unused btb blocks */
@ -214,7 +219,7 @@ public:
crypt_routine dbb_encrypt; /* External encryption routine */
crypt_routine dbb_decrypt; /* External decryption routine */
class map *dbb_blob_map; /* mapping of blobs for REPLAY */
class blb_map *dbb_blob_map; /* mapping of blobs for REPLAY */
struct log *dbb_log; /* log file for REPLAY */
Firebird::vector<class TextType*> dbb_text_objects; /* intl text type descriptions */
Firebird::vector<class CharSetContainer*> dbb_charsets; /* intl character set descriptions */
@ -369,7 +374,6 @@ typedef dbb* DBB;
#define VAL_MAX_ERROR 25
//
// the attachment block; one is created for each attachment to a database
//
@ -407,15 +411,15 @@ public:
att_counts[0] = 0;
}*/
class dbb* att_database; // Parent databasea block
dbb* att_database; // Parent databasea block
att* att_next; // Next attachment to database
att* att_blocking; // Blocking attachment, if any
class usr* att_user; // User identification
class jrd_tra* att_transactions; // Transactions belonging to attachment
class jrd_tra* att_dbkey_trans; // transaction to control db-key scope
struct jrd_req* att_requests; // Requests belonging to attachment
jrd_tra* att_transactions; // Transactions belonging to attachment
jrd_tra* att_dbkey_trans; // transaction to control db-key scope
jrd_req* att_requests; // Requests belonging to attachment
struct scb* att_active_sorts; // Active sorts
struct lck* att_id_lock; // Attachment lock (if any)
lck* att_id_lock; // Attachment lock (if any)
SLONG att_attachment_id; // Attachment ID
SLONG att_lock_owner_handle; // Handle for the lock manager
SLONG att_event_session; // Event session id, if any
@ -424,13 +428,13 @@ public:
class vcl* att_counts[DBB_max_count];
vec* att_relation_locks; // explicit persistent locks for relations
struct bkm* att_bookmarks; // list of bookmarks taken out using this attachment
struct lck* att_record_locks; // explicit or implicit record locks taken out during attachment
lck* att_record_locks; // explicit or implicit record locks taken out during attachment
vec* att_bkm_quick_ref; // correspondence table of bookmarks
vec* att_lck_quick_ref; // correspondence table of locks
ULONG att_flags; // Flags describing the state of the attachment
SSHORT att_charset; // user's charset specified in dpb
class str* att_lc_messages; // attachment's preference for message natural language
struct lck* att_long_locks; // outstanding two phased locks
lck* att_long_locks; // outstanding two phased locks
vec* att_compatibility_table; // hash table of compatible locks
class vcl* att_val_errors;
class str* att_working_directory; // Current working directory is cached
@ -483,12 +487,12 @@ class jrd_prc : public pool_alloc_rpt<SCHAR, type_prc>
USHORT prc_outputs;
struct jrd_nod *prc_input_msg;
struct jrd_nod *prc_output_msg;
struct fmt *prc_input_fmt;
struct fmt *prc_output_fmt;
struct fmt *prc_format;
fmt* prc_input_fmt;
fmt* prc_output_fmt;
fmt* prc_format;
vec* prc_input_fields; /* vector of field blocks */
vec* prc_output_fields; /* vector of field blocks */
struct jrd_req *prc_request; /* compiled procedure request */
jrd_req *prc_request; /* compiled procedure request */
class str *prc_security_name; /* pointer to security class name for procedure */
USHORT prc_use_count; /* requests compiled with procedure */
SSHORT prc_int_use_count; /* number of procedures compiled with procedure, set and
@ -496,7 +500,7 @@ class jrd_prc : public pool_alloc_rpt<SCHAR, type_prc>
no code should rely on value of this field
(it will usually be 0)
*/
struct lck *prc_existence_lock; /* existence lock, if any */
lck* prc_existence_lock; /* existence lock, if any */
class str *prc_name; /* pointer to ascic name */
USHORT prc_alter_count; /* No. of times the procedure was altered */
};
@ -546,21 +550,20 @@ typedef struct frgn {
} *FRGN;
// Relation trigger definition
typedef struct trig {
struct trig {
class str* blr; // BLR code
jrd_req* request; // Compiled request. Gets filled on first invocation
bool compile_in_progress;
BOOLEAN sys_trigger;
bool sys_trigger;
USHORT flags; // Flags as they are in RDB$TRIGGERS table
class jrd_rel* relation; // Trigger parent relation
class str* name; // Trigger name
void compile(tdbb* _tdbb); // Ensure that trigger is compiled
BOOLEAN release(tdbb* _tdbb); // Try to free trigger request
} *TRIG;
};
typedef Firebird::vector<trig> trig_vec;
typedef trig_vec* TRIG_VEC;
/* Relation block; one is created for each relation referenced
in the database, though it is not really filled out until
@ -569,15 +572,15 @@ typedef trig_vec* TRIG_VEC;
class jrd_rel : public pool_alloc<type_rel>
{
public:
USHORT rel_id;
USHORT rel_flags;
USHORT rel_current_fmt; /* Current format number */
UCHAR rel_length; /* length of ascii relation name */
struct fmt *rel_current_format; /* Current record format */
USHORT rel_id;
USHORT rel_flags;
USHORT rel_current_fmt; /* Current format number */
UCHAR rel_length; /* length of ascii relation name */
fmt* rel_current_format; /* Current record format */
TEXT* rel_name; /* pointer to ascii relation name */
vec* rel_formats; /* Known record formats */
TEXT *rel_owner_name; /* pointer to ascii owner */
class vcl *rel_pages; /* vector of pointer page numbers */
TEXT* rel_owner_name; /* pointer to ascii owner */
class vcl* rel_pages; /* vector of pointer page numbers */
vec* rel_fields; /* vector of field blocks */
struct rse *rel_view_rse; /* view record select expression */
@ -599,9 +602,9 @@ public:
USHORT rel_sweep_count; /* sweep and/or garbage collector threads active */
SSHORT rel_scan_count; /* concurrent sequential scan count */
struct lck *rel_existence_lock; /* existence lock, if any */
struct lck *rel_interest_lock; /* interest lock to ensure compatibility of relation and record locks */
struct lck *rel_record_locking; /* lock to start record locking on relation */
lck* rel_existence_lock; /* existence lock, if any */
lck* rel_interest_lock; /* interest lock to ensure compatibility of relation and record locks */
lck* rel_record_locking; /* lock to start record locking on relation */
ULONG rel_explicit_locks; /* count of records explicitly locked in relation */
ULONG rel_read_locks; /* count of records read locked in relation (implicit or explicit) */
@ -616,8 +619,8 @@ public:
trig_vec *rel_post_modify; /* Post-operation modify trigger */
trig_vec *rel_pre_store; /* Pre-operation store trigger */
trig_vec *rel_post_store; /* Post-operation store trigger */
struct prim rel_primary_dpnds; /* foreign dependencies on this relation's primary key */
struct frgn rel_foreign_refs; /* foreign references to other relations' primary keys */
prim rel_primary_dpnds; /* foreign dependencies on this relation's primary key */
frgn rel_foreign_refs; /* foreign references to other relations' primary keys */
};
#define REL_scanned 1 /* Field expressions scanned (or being scanned) */
@ -660,11 +663,11 @@ class jrd_fld : public pool_alloc_rpt<SCHAR, type_fld>
class idb : public pool_alloc<type_idb>
{
public:
struct idb* idb_next;
idb* idb_next;
struct jrd_nod* idb_expression; /* node tree for index expression */
struct jrd_req* idb_expression_request; /* request in which index expression is evaluated */
jrd_req* idb_expression_request; /* request in which index expression is evaluated */
struct dsc idb_expression_desc; /* descriptor for expression result */
struct lck* idb_lock; /* lock to synchronize changes to index */
lck* idb_lock; /* lock to synchronize changes to index */
UCHAR idb_id;
};
typedef idb *IDB;
@ -675,12 +678,12 @@ typedef idb *IDB;
class vcx: public pool_alloc<type_vcx>
{
public:
class vcx *vcx_next;
class str *vcx_context_name;
class str *vcx_relation_name;
vcx* vcx_next;
class str* vcx_context_name;
class str* vcx_relation_name;
USHORT vcx_context;
};
typedef vcx *VCX;
typedef vcx* VCX;
/* general purpose vector */
@ -692,9 +695,13 @@ public:
typedef typename Firebird::vector<T>::const_iterator const_iterator;
static vec_base* newVector(MemoryPool& p, int len)
{ return FB_NEW(p) vec_base<T,TYPE>(p, len); }
{
return FB_NEW(p) vec_base<T, TYPE>(p, len);
}
static vec_base* newVector(MemoryPool& p, const vec_base& base)
{ return FB_NEW(p) vec_base<T,TYPE>(p, base); }
{
return FB_NEW(p) vec_base<T, TYPE>(p, base);
}
// CVC: THis should be size_t instead of ULONG for maximum portability.
ULONG count() const { return vector.size(); }
@ -728,17 +735,21 @@ class vec : public vec_base<BlkPtr, type_vec>
{
public:
static vec* newVector(MemoryPool& p, int len)
{ return FB_NEW(p) vec(p, len); }
{
return FB_NEW(p) vec(p, len);
}
static vec* newVector(MemoryPool& p, const vec& base)
{ return FB_NEW(p) vec(p, base); }
{
return FB_NEW(p) vec(p, base);
}
static vec* newVector(MemoryPool& p, vec* base, int len)
{
if (!base)
base = FB_NEW(p) vec(p, len);
else if (len > (int) base->count())
base->resize(len);
return base;
}
{
if (!base)
base = FB_NEW(p) vec(p, len);
else if (len > (int) base->count())
base->resize(len);
return base;
}
private:
vec(MemoryPool& p, int len) : vec_base<BlkPtr, type_vec>(p, len) {}
@ -750,17 +761,21 @@ class vcl : public vec_base<SLONG, type_vcl>
{
public:
static vcl* newVector(MemoryPool& p, int len)
{ return FB_NEW(p) vcl(p, len); }
{
return FB_NEW(p) vcl(p, len);
}
static vcl* newVector(MemoryPool& p, const vcl& base)
{ return FB_NEW(p) vcl(p, base); }
{
return FB_NEW(p) vcl(p, base);
}
static vcl* newVector(MemoryPool& p, vcl* base, int len)
{
if (!base)
base = FB_NEW(p) vcl(p, len);
else if (len > (int) base->count())
base->resize(len);
return base;
}
{
if (!base)
base = FB_NEW(p) vcl(p, len);
else if (len > (int) base->count())
base->resize(len);
return base;
}
private:
vcl(MemoryPool& p, int len) : vec_base<SLONG, type_vcl>(p, len) {}
@ -838,9 +853,9 @@ typedef str *STR;
// Transaction element block
//
typedef struct teb {
ATT *teb_database;
att** teb_database;
int teb_tpb_length;
UCHAR *teb_tpb;
UCHAR* teb_tpb;
} TEB;
/* Blocking Thread Block */
@ -920,8 +935,8 @@ typedef struct tdbb
struct thdd tdbb_thd_data;
dbb* tdbb_database;
att* tdbb_attachment;
class jrd_tra* tdbb_transaction;
struct jrd_req* tdbb_request;
jrd_tra* tdbb_transaction;
jrd_req* tdbb_request;
JrdMemoryPool* tdbb_default;
ISC_STATUS* tdbb_status_vector;
void* tdbb_setjmp;
@ -949,11 +964,11 @@ typedef struct tdbb
/* List of internal database handles */
typedef struct ihndl
struct ihndl
{
struct ihndl* ihndl_next;
void* ihndl_object;
} *IHNDL;
ihndl* ihndl_next;
void* ihndl_object;
};
/* Threading macros */
@ -1052,7 +1067,7 @@ extern TDBB gdbb;
#if !defined(REQUESTER)
extern int debug;
extern IHNDL internal_db_handles;
extern ihndl* internal_db_handles;
#endif /* REQUESTER */

View File

@ -43,100 +43,105 @@
extern "C" {
#endif
class att;
class jrd_tra;
class blb;
class jrd_req;
class svc;
ISC_STATUS jrd8_attach_database(ISC_STATUS*, SSHORT, const TEXT*,
struct att**, SSHORT,
att**, SSHORT,
const UCHAR*, const TEXT*);
ISC_STATUS jrd8_blob_info(ISC_STATUS*, struct blb**, SSHORT,
ISC_STATUS jrd8_blob_info(ISC_STATUS*, blb**, SSHORT,
const SCHAR*, SSHORT, SCHAR*);
ISC_STATUS jrd8_cancel_blob(ISC_STATUS *, struct blb **);
ISC_STATUS jrd8_cancel_events(ISC_STATUS *, struct att **, SLONG *);
ISC_STATUS jrd8_cancel_blob(ISC_STATUS *, blb **);
ISC_STATUS jrd8_cancel_events(ISC_STATUS *, att **, SLONG *);
#ifdef CANCEL_OPERATION
#define CANCEL_disable 1
#define CANCEL_enable 2
#define CANCEL_raise 3
ISC_STATUS jrd8_cancel_operation(ISC_STATUS *, struct att **,
ISC_STATUS jrd8_cancel_operation(ISC_STATUS *, att **,
USHORT);
#endif
ISC_STATUS jrd8_close_blob(ISC_STATUS *, struct blb **);
ISC_STATUS jrd8_commit_transaction(ISC_STATUS *, class jrd_tra **);
ISC_STATUS jrd8_commit_retaining(ISC_STATUS *, class jrd_tra **);
ISC_STATUS jrd8_compile_request(ISC_STATUS*, struct att**,
struct jrd_req**,
ISC_STATUS jrd8_close_blob(ISC_STATUS *, blb **);
ISC_STATUS jrd8_commit_transaction(ISC_STATUS *, jrd_tra **);
ISC_STATUS jrd8_commit_retaining(ISC_STATUS *, jrd_tra **);
ISC_STATUS jrd8_compile_request(ISC_STATUS*, att**,
jrd_req**,
SSHORT, const SCHAR*);
ISC_STATUS jrd8_create_blob2(ISC_STATUS*, struct att**,
class jrd_tra**, struct blb**,
ISC_STATUS jrd8_create_blob2(ISC_STATUS*, att**,
jrd_tra**, blb**,
struct bid*, USHORT, const UCHAR*);
ISC_STATUS jrd8_create_database(ISC_STATUS*, USHORT, const TEXT*,
struct att**, USHORT,
att**, USHORT,
const UCHAR*, USHORT,
const TEXT*);
ISC_STATUS jrd8_database_info(ISC_STATUS*, struct att**, SSHORT,
ISC_STATUS jrd8_database_info(ISC_STATUS*, att**, SSHORT,
const SCHAR*, SSHORT, SCHAR*);
ISC_STATUS jrd8_ddl(ISC_STATUS*, struct att**, class jrd_tra**,
ISC_STATUS jrd8_ddl(ISC_STATUS*, att**, jrd_tra**,
USHORT, const SCHAR*);
ISC_STATUS jrd8_detach_database(ISC_STATUS *, struct att **);
ISC_STATUS jrd8_drop_database(ISC_STATUS *, struct att **);
ISC_STATUS jrd8_get_segment(ISC_STATUS *, struct blb **, USHORT *,
ISC_STATUS jrd8_detach_database(ISC_STATUS *, att **);
ISC_STATUS jrd8_drop_database(ISC_STATUS *, att **);
ISC_STATUS jrd8_get_segment(ISC_STATUS *, blb **, USHORT *,
USHORT, UCHAR *);
ISC_STATUS jrd8_get_slice(ISC_STATUS*, struct att**,
class jrd_tra**, SLONG*, USHORT,
ISC_STATUS jrd8_get_slice(ISC_STATUS*, att**,
jrd_tra**, SLONG*, USHORT,
const UCHAR*, USHORT, const UCHAR*, SLONG,
UCHAR*, SLONG*);
ISC_STATUS jrd8_open_blob2(ISC_STATUS*, struct att**,
class jrd_tra**, struct blb**,
ISC_STATUS jrd8_open_blob2(ISC_STATUS*, att**,
jrd_tra**, blb**,
struct bid*, USHORT, const UCHAR*);
ISC_STATUS jrd8_prepare_transaction(ISC_STATUS *, class jrd_tra **,
ISC_STATUS jrd8_prepare_transaction(ISC_STATUS *, jrd_tra **,
USHORT, UCHAR *);
ISC_STATUS jrd8_put_segment(ISC_STATUS*, struct blb**, USHORT,
ISC_STATUS jrd8_put_segment(ISC_STATUS*, blb**, USHORT,
const UCHAR*);
ISC_STATUS jrd8_put_slice(ISC_STATUS*, struct att**,
class jrd_tra**, SLONG*, USHORT,
ISC_STATUS jrd8_put_slice(ISC_STATUS*, att**,
jrd_tra**, SLONG*, USHORT,
const UCHAR*, USHORT, const UCHAR*, SLONG,
UCHAR*);
ISC_STATUS jrd8_que_events(ISC_STATUS*, struct att**, SLONG*,
ISC_STATUS jrd8_que_events(ISC_STATUS*, att**, SLONG*,
SSHORT, const UCHAR*,
FPTR_EVENT_CALLBACK, void*);
ISC_STATUS jrd8_receive(ISC_STATUS *, struct jrd_req **, USHORT, USHORT,
ISC_STATUS jrd8_receive(ISC_STATUS *, jrd_req**, USHORT, USHORT,
SCHAR *, SSHORT);
ISC_STATUS jrd8_reconnect_transaction(ISC_STATUS*, struct att**,
class jrd_tra**, SSHORT,
ISC_STATUS jrd8_reconnect_transaction(ISC_STATUS*, att**,
jrd_tra**, SSHORT,
const UCHAR*);
ISC_STATUS jrd8_release_request(ISC_STATUS *, struct jrd_req **);
ISC_STATUS jrd8_request_info(ISC_STATUS*, struct jrd_req**, SSHORT,
ISC_STATUS jrd8_release_request(ISC_STATUS *, jrd_req**);
ISC_STATUS jrd8_request_info(ISC_STATUS*, jrd_req**, SSHORT,
SSHORT, const SCHAR*, SSHORT, SCHAR*);
ISC_STATUS jrd8_rollback_transaction(ISC_STATUS *, class jrd_tra **);
ISC_STATUS jrd8_rollback_retaining(ISC_STATUS *, class jrd_tra **);
ISC_STATUS jrd8_seek_blob(ISC_STATUS *, struct blb **, SSHORT,
ISC_STATUS jrd8_rollback_transaction(ISC_STATUS *, jrd_tra **);
ISC_STATUS jrd8_rollback_retaining(ISC_STATUS *, jrd_tra **);
ISC_STATUS jrd8_seek_blob(ISC_STATUS *, blb **, SSHORT,
SLONG, SLONG *);
ISC_STATUS jrd8_send(ISC_STATUS *, struct jrd_req **, USHORT, USHORT,
ISC_STATUS jrd8_send(ISC_STATUS *, jrd_req**, USHORT, USHORT,
SCHAR *, SSHORT);
ISC_STATUS jrd8_service_attach(ISC_STATUS*, USHORT, const SCHAR*,
struct svc**, USHORT, const SCHAR*);
ISC_STATUS jrd8_service_detach(ISC_STATUS *, struct svc **);
ISC_STATUS jrd8_service_query(ISC_STATUS*, struct svc**, ULONG*,
svc**, USHORT, const SCHAR*);
ISC_STATUS jrd8_service_detach(ISC_STATUS *, svc **);
ISC_STATUS jrd8_service_query(ISC_STATUS*, svc**, ULONG*,
USHORT, const SCHAR*,
USHORT, const SCHAR*,
USHORT, SCHAR*);
ISC_STATUS jrd8_service_start(ISC_STATUS*, struct svc**, ULONG*,
ISC_STATUS jrd8_service_start(ISC_STATUS*, svc**, ULONG*,
USHORT, const SCHAR*);
ISC_STATUS jrd8_start_and_send(ISC_STATUS *, struct jrd_req **,
class jrd_tra **, USHORT, USHORT,
ISC_STATUS jrd8_start_and_send(ISC_STATUS *, jrd_req**,
jrd_tra **, USHORT, USHORT,
SCHAR *, SSHORT);
ISC_STATUS jrd8_start_request(ISC_STATUS *, struct jrd_req **,
class jrd_tra **, SSHORT);
ISC_STATUS jrd8_start_multiple(ISC_STATUS *, class jrd_tra **, USHORT,
ISC_STATUS jrd8_start_request(ISC_STATUS *, jrd_req**,
jrd_tra **, SSHORT);
ISC_STATUS jrd8_start_multiple(ISC_STATUS *, jrd_tra **, USHORT,
struct teb *);
ISC_STATUS jrd8_start_transaction(ISC_STATUS *, class jrd_tra **,
ISC_STATUS jrd8_start_transaction(ISC_STATUS *, jrd_tra **,
SSHORT, ...);
ISC_STATUS jrd8_transaction_info(ISC_STATUS*, class jrd_tra**,
ISC_STATUS jrd8_transaction_info(ISC_STATUS*, jrd_tra**,
SSHORT, const SCHAR*, SSHORT,
SCHAR*);
ISC_STATUS jrd8_transact_request(ISC_STATUS*, struct att**,
class jrd_tra**, USHORT, const SCHAR*,
ISC_STATUS jrd8_transact_request(ISC_STATUS*, att**,
jrd_tra**, USHORT, const SCHAR*,
USHORT, SCHAR*, USHORT,
SCHAR*);
ISC_STATUS jrd8_unwind_request(ISC_STATUS *, struct jrd_req **, SSHORT);
ISC_STATUS jrd8_unwind_request(ISC_STATUS *, jrd_req**, SSHORT);
void jrd_vtof(const char*, char*, SSHORT);
#ifdef SERVER_SHUTDOWN
@ -149,7 +154,7 @@ ULONG JRD_shutdown_all();
#endif /* SERVER_SHUTDOWN */
void JRD_set_cache_default(ULONG *);
void JRD_blocked(struct att *, struct btb **);
void JRD_blocked(att *, struct btb **);
void JRD_mutex_lock(struct mutx_t *);
void JRD_mutex_unlock(struct mutx_t *);
BOOLEAN JRD_reschedule(struct tdbb*, SLONG, bool);

View File

@ -62,24 +62,24 @@
static void bug_lck(TEXT*);
#ifdef MULTI_THREAD
static void check_lock(LCK, USHORT);
static void check_lock(lck*, USHORT);
#endif
static BOOLEAN compatible(LCK, LCK, USHORT);
static void enqueue(TDBB, LCK, USHORT, SSHORT);
static bool compatible(lck*, lck*, USHORT);
static void enqueue(TDBB, lck*, USHORT, SSHORT);
static int external_ast(void*);
#ifdef MULTI_THREAD
static LCK find_block(LCK, USHORT);
static lck* find_block(lck*, USHORT);
#endif
static USHORT hash_func(UCHAR *, USHORT);
static void hash_allocate(LCK);
static LCK hash_get_lock(LCK, USHORT *, LCK **);
static void hash_insert_lock(LCK);
static BOOLEAN hash_remove_lock(LCK, LCK *);
static void internal_ast(LCK);
static BOOLEAN internal_compatible(LCK, LCK, USHORT);
static void internal_dequeue(TDBB, LCK);
static USHORT internal_downgrade(TDBB, LCK);
static bool internal_enqueue(TDBB, LCK, USHORT, SSHORT, bool);
static USHORT hash_func(const UCHAR*, USHORT);
static void hash_allocate(lck*);
static lck* hash_get_lock(lck*, USHORT *, lck***);
static void hash_insert_lock(lck*);
static bool hash_remove_lock(lck*, lck**);
static void internal_ast(lck*);
static bool internal_compatible(lck*, lck*, USHORT);
static void internal_dequeue(TDBB, lck*);
static USHORT internal_downgrade(TDBB, lck*);
static bool internal_enqueue(TDBB, lck*, USHORT, SSHORT, bool);
/* globals and macros */
@ -137,7 +137,7 @@ static const UCHAR compatibility[] = {
#define COMPATIBLE(st1, st2) compatibility [st1 * LCK_max + st2]
#define LOCK_HASH_SIZE 19
inline void ENQUEUE(TDBB tdbb, LCK lock, USHORT level, SSHORT wait)
inline void ENQUEUE(TDBB tdbb, lck* lock, USHORT level, SSHORT wait)
{
if (lock->lck_compatible)
internal_enqueue (tdbb, lock, level, wait, false);
@ -145,14 +145,14 @@ inline void ENQUEUE(TDBB tdbb, LCK lock, USHORT level, SSHORT wait)
enqueue (tdbb, lock, level, wait);
}
inline bool CONVERT(TDBB tdbb, LCK lock, USHORT level, SSHORT wait, ISC_STATUS* status)
inline bool CONVERT(TDBB tdbb, lck* lock, USHORT level, SSHORT wait, ISC_STATUS* status)
{
return (lock->lck_compatible) ?
internal_enqueue (tdbb, lock, level, wait, true) :
LOCK_convert (lock->lck_id, level, wait, lock->lck_ast, lock->lck_object, status);
}
inline void DEQUEUE(TDBB tdbb, LCK lock)
inline void DEQUEUE(TDBB tdbb, lck* lock)
{
if (lock->lck_compatible)
internal_dequeue (tdbb, lock);
@ -160,7 +160,7 @@ inline void DEQUEUE(TDBB tdbb, LCK lock)
LOCK_deq (lock->lck_id);
}
inline USHORT DOWNGRADE(TDBB tdbb, LCK lock, ISC_STATUS* status)
inline USHORT DOWNGRADE(TDBB tdbb, lck* lock, ISC_STATUS* status)
{
return (lock->lck_compatible) ?
internal_downgrade (tdbb, lock) :
@ -211,7 +211,7 @@ void LCK_ast_enable() {
LOCK_ast_enable();
}
void LCK_assert(TDBB tdbb, LCK lock)
void LCK_assert(TDBB tdbb, lck* lock)
{
/**************************************
*
@ -239,7 +239,7 @@ void LCK_assert(TDBB tdbb, LCK lock)
}
bool LCK_convert(TDBB tdbb, LCK lock, USHORT level, SSHORT wait)
bool LCK_convert(TDBB tdbb, lck* lock, USHORT level, SSHORT wait)
{
/**************************************
*
@ -281,7 +281,7 @@ bool LCK_convert(TDBB tdbb, LCK lock, USHORT level, SSHORT wait)
#ifdef MULTI_THREAD
int LCK_convert_non_blocking(TDBB tdbb, LCK lock, USHORT level, SSHORT wait)
int LCK_convert_non_blocking(TDBB tdbb, lck* lock, USHORT level, SSHORT wait)
{
/**************************************
*
@ -293,14 +293,10 @@ int LCK_convert_non_blocking(TDBB tdbb, LCK lock, USHORT level, SSHORT wait)
* Convert an existing lock.
*
**************************************/
ATT attachment;
ISC_STATUS *status;
DBB dbb;
fb_assert(LCK_CHECK_LOCK(lock));
SET_TDBB(tdbb);
dbb = lock->lck_dbb;
DBB dbb = lock->lck_dbb;
lock->lck_attachment = tdbb->tdbb_attachment;
if (!wait || !gds__thread_enable(FALSE))
@ -309,8 +305,8 @@ int LCK_convert_non_blocking(TDBB tdbb, LCK lock, USHORT level, SSHORT wait)
/* Save context and checkout from the scheduler */
check_lock(lock, level);
status = tdbb->tdbb_status_vector;
attachment = tdbb->tdbb_attachment;
ISC_STATUS* status = tdbb->tdbb_status_vector;
att* attachment = tdbb->tdbb_attachment;
AST_DISABLE;
/* SuperServer: Do Not release engine here, it creates a race
@ -352,7 +348,7 @@ int LCK_convert_non_blocking(TDBB tdbb, LCK lock, USHORT level, SSHORT wait)
#else
int LCK_convert_non_blocking(TDBB tdbb, LCK lock, USHORT level, SSHORT wait)
int LCK_convert_non_blocking(TDBB tdbb, lck* lock, USHORT level, SSHORT wait)
{
/**************************************
*
@ -374,7 +370,7 @@ int LCK_convert_non_blocking(TDBB tdbb, LCK lock, USHORT level, SSHORT wait)
#endif
int LCK_convert_opt(TDBB tdbb, LCK lock, USHORT level)
int LCK_convert_opt(TDBB tdbb, lck* lock, USHORT level)
{
/**************************************
*
@ -386,14 +382,11 @@ int LCK_convert_opt(TDBB tdbb, LCK lock, USHORT level)
* Assert a lock if the parent is not locked in exclusive mode.
*
**************************************/
USHORT old_level;
DBB dbb;
SET_TDBB(tdbb);
fb_assert(LCK_CHECK_LOCK(lock));
old_level = lock->lck_logical;
const USHORT old_level = lock->lck_logical;
lock->lck_logical = level;
dbb = lock->lck_dbb;
DBB dbb = lock->lck_dbb;
if (dbb->dbb_ast_flags & DBB_assert_locks) {
lock->lck_logical = old_level;
@ -406,7 +399,7 @@ int LCK_convert_opt(TDBB tdbb, LCK lock, USHORT level)
#ifndef VMS
int LCK_downgrade(TDBB tdbb, LCK lock)
int LCK_downgrade(TDBB tdbb, lck* lock)
{
/**************************************
*
@ -418,18 +411,15 @@ int LCK_downgrade(TDBB tdbb, LCK lock)
* Downgrade a lock.
*
**************************************/
ISC_STATUS *status;
USHORT level;
fb_assert(LCK_CHECK_LOCK(lock));
SET_TDBB(tdbb);
status = tdbb->tdbb_status_vector;
ISC_STATUS* status = tdbb->tdbb_status_vector;
fb_assert(LCK_CHECK_LOCK(lock));
if (lock->lck_id && lock->lck_physical != LCK_none) {
level = DOWNGRADE(tdbb, lock, status);
const USHORT level = DOWNGRADE(tdbb, lock, status);
if (!lock->lck_compatible)
lock->lck_physical = lock->lck_logical = level;
}
@ -455,13 +445,11 @@ void LCK_fini(TDBB tdbb, enum lck_owner_t owner_type)
* Check out with lock manager.
*
**************************************/
DBB dbb;
ATT attachment;
SLONG *owner_handle_ptr;
SLONG* owner_handle_ptr = 0;
SET_TDBB(tdbb);
dbb = tdbb->tdbb_database;
attachment = tdbb->tdbb_attachment;
DBB dbb = tdbb->tdbb_database;
att* attachment = tdbb->tdbb_attachment;
switch (owner_type) {
case LCK_OWNER_process:
@ -546,14 +534,12 @@ void LCK_init(TDBB tdbb, enum lck_owner_t owner_type)
* Initialize the locking stuff for the given owner.
*
**************************************/
DBB dbb;
ATT attachment;
SLONG owner_id;
SLONG *owner_handle_ptr;
SLONG* owner_handle_ptr = 0;
SET_TDBB(tdbb);
dbb = tdbb->tdbb_database;
attachment = tdbb->tdbb_attachment;
DBB dbb = tdbb->tdbb_database;
att* attachment = tdbb->tdbb_attachment;
switch (owner_type) {
case LCK_OWNER_process:
@ -577,7 +563,8 @@ void LCK_init(TDBB tdbb, enum lck_owner_t owner_type)
}
if (LOCK_init(tdbb->tdbb_status_vector, TRUE,
owner_id, owner_type, owner_handle_ptr)) {
owner_id, owner_type, owner_handle_ptr))
{
if (tdbb->tdbb_status_vector[1] == isc_lockmanerr)
dbb->dbb_flags |= DBB_bugcheck;
ERR_punt();
@ -585,7 +572,7 @@ void LCK_init(TDBB tdbb, enum lck_owner_t owner_type)
}
int LCK_lock(TDBB tdbb, LCK lock, USHORT level, SSHORT wait)
int LCK_lock(TDBB tdbb, lck* lock, USHORT level, SSHORT wait)
{
/**************************************
*
@ -609,6 +596,7 @@ int LCK_lock(TDBB tdbb, LCK lock, USHORT level, SSHORT wait)
ENQUEUE(tdbb, lock, level, wait);
fb_assert(LCK_CHECK_LOCK(lock));
if (!lock->lck_id)
{
if (!wait ||
status[1] == isc_deadlock ||
status[1] == isc_lock_conflict || status[1] == isc_lock_timeout)
@ -620,6 +608,7 @@ int LCK_lock(TDBB tdbb, LCK lock, USHORT level, SSHORT wait)
dbb->dbb_flags |= DBB_bugcheck;
ERR_punt();
}
}
if (!lock->lck_compatible)
lock->lck_physical = lock->lck_logical = level;
@ -629,7 +618,7 @@ int LCK_lock(TDBB tdbb, LCK lock, USHORT level, SSHORT wait)
}
int LCK_lock_non_blocking(TDBB tdbb, LCK lock, USHORT level, SSHORT wait)
int LCK_lock_non_blocking(TDBB tdbb, lck* lock, USHORT level, SSHORT wait)
{
/**************************************
*
@ -643,14 +632,12 @@ int LCK_lock_non_blocking(TDBB tdbb, LCK lock, USHORT level, SSHORT wait)
*
**************************************/
#ifdef MULTI_THREAD
ATT attachment;
LCK next;
fb_assert(LCK_CHECK_LOCK(lock));
SET_TDBB(tdbb);
DBB dbb = lock->lck_dbb;
lock->lck_attachment = attachment = tdbb->tdbb_attachment;
att* attachment = tdbb->tdbb_attachment;
lock->lck_attachment = attachment;
/* Don't bother for the non-wait or non-multi-threading case */
@ -719,7 +706,8 @@ int LCK_lock_non_blocking(TDBB tdbb, LCK lock, USHORT level, SSHORT wait)
lock->lck_prior = NULL;
attachment->att_long_locks = lock;
if (next = lock->lck_next)
lck* next = lock->lck_next;
if (next)
next->lck_prior = lock;
fb_assert(LCK_CHECK_LOCK(lock));
@ -735,7 +723,7 @@ int LCK_lock_non_blocking(TDBB tdbb, LCK lock, USHORT level, SSHORT wait)
}
int LCK_lock_opt(TDBB tdbb, LCK lock, USHORT level, SSHORT wait)
int LCK_lock_opt(TDBB tdbb, lck* lock, USHORT level, SSHORT wait)
{
/**************************************
*
@ -764,7 +752,7 @@ int LCK_lock_opt(TDBB tdbb, LCK lock, USHORT level, SSHORT wait)
#ifndef VMS
SLONG LCK_query_data(LCK parent, enum lck_t lock_type, USHORT aggregate)
SLONG LCK_query_data(lck* parent, enum lck_t lock_type, USHORT aggregate)
{
/**************************************
*
@ -785,7 +773,7 @@ SLONG LCK_query_data(LCK parent, enum lck_t lock_type, USHORT aggregate)
#endif
SLONG LCK_read_data(LCK lock)
SLONG LCK_read_data(lck* lock)
{
/**************************************
*
@ -797,19 +785,17 @@ SLONG LCK_read_data(LCK lock)
* Read the data associated with a lock.
*
**************************************/
SLONG data;
LCK parent;
fb_assert(LCK_CHECK_LOCK(lock));
#ifdef VMS
if (!LCK_lock(NULL, lock, LCK_null, LCK_NO_WAIT))
return 0;
data = LOCK_read_data(lock->lck_id);
const SLONG data = LOCK_read_data(lock->lck_id);
LCK_release(lock);
#else
data = LOCK_read_data2(
(parent = lock->lck_parent) ? parent->lck_id : 0,
lck* parent = lock->lck_parent;
const SLONG data = LOCK_read_data2(
parent ? parent->lck_id : 0,
lock->lck_type,
(UCHAR *) & lock->lck_key,
lock->lck_length, lock->lck_owner_handle);
@ -820,7 +806,7 @@ SLONG LCK_read_data(LCK lock)
}
void LCK_release(TDBB tdbb, LCK lock)
void LCK_release(TDBB tdbb, lck* lock)
{
/**************************************
*
@ -849,8 +835,8 @@ void LCK_release(TDBB tdbb, LCK lock)
#ifdef MULTI_THREAD
LCK next = lock->lck_next;
LCK prior = lock->lck_prior;
lck* next = lock->lck_next;
lck* prior = lock->lck_prior;
if (prior) {
fb_assert(prior->lck_next == lock);
@ -877,7 +863,7 @@ void LCK_release(TDBB tdbb, LCK lock)
}
void LCK_re_post(LCK lock)
void LCK_re_post(lck* lock)
{
/**************************************
*
@ -904,7 +890,7 @@ void LCK_re_post(LCK lock)
}
void LCK_write_data(LCK lock, SLONG data)
void LCK_write_data(lck* lock, SLONG data)
{
/**************************************
*
@ -946,7 +932,7 @@ static void bug_lck(TEXT* string)
#ifdef MULTI_THREAD
static void check_lock(LCK lock, USHORT level)
static void check_lock(lck* lock, USHORT level)
{
/**************************************
*
@ -960,7 +946,7 @@ static void check_lock(LCK lock, USHORT level)
* the lock manager for it.
*
**************************************/
LCK next;
lck* next;
fb_assert(LCK_CHECK_LOCK(lock));
while (next = find_block(lock, level))
@ -969,7 +955,7 @@ static void check_lock(LCK lock, USHORT level)
#endif
static BOOLEAN compatible(LCK lock1, LCK lock2, USHORT level2)
static bool compatible(lck* lock1, lck* lock2, USHORT level2)
{
/**************************************
*
@ -992,24 +978,28 @@ static BOOLEAN compatible(LCK lock1, LCK lock2, USHORT level2)
if (lock1->lck_compatible &&
lock2->lck_compatible &&
lock1->lck_compatible == lock2->lck_compatible) {
lock1->lck_compatible == lock2->lck_compatible)
{
/* check for a second level of compatibility as well:
if a second level was specified, the locks must
also be compatible at the second level */
if (!lock1->lck_compatible2 ||
!lock2->lck_compatible2 ||
lock1->lck_compatible2 == lock2->lck_compatible2) return TRUE;
lock1->lck_compatible2 == lock2->lck_compatible2)
{
return true;
}
}
if (COMPATIBLE(lock1->lck_logical, level2))
return TRUE;
return true;
return FALSE;
return false;
}
static void enqueue(TDBB tdbb, LCK lock, USHORT level, SSHORT wait)
static void enqueue(TDBB tdbb, lck* lock, USHORT level, SSHORT wait)
{
/**************************************
*
@ -1021,15 +1011,13 @@ static void enqueue(TDBB tdbb, LCK lock, USHORT level, SSHORT wait)
* Submit a lock to the lock manager.
*
**************************************/
LCK parent;
SET_TDBB(tdbb);
fb_assert(LCK_CHECK_LOCK(lock));
lck* parent = lock->lck_parent;
lock->lck_id = LOCK_enq(lock->lck_id,
(parent = lock->lck_parent) ? parent->lck_id : 0,
parent ? parent->lck_id : 0,
lock->lck_type,
(UCHAR *) & lock->lck_key,
lock->lck_length,
@ -1076,7 +1064,7 @@ static int external_ast(void* lock_void)
#ifdef MULTI_THREAD
static LCK find_block(LCK lock, USHORT level)
static lck* find_block(lck* lock, USHORT level)
{
/**************************************
*
@ -1090,29 +1078,27 @@ static LCK find_block(LCK lock, USHORT level)
* locking lock, otherwise return NULL.
*
**************************************/
LCK next;
SCHAR *p1, *p2, *end;
DBB dbb;
ATT attachment;
fb_assert(LCK_CHECK_LOCK(lock));
dbb = lock->lck_dbb;
DBB dbb = lock->lck_dbb;
if (!(attachment = lock->lck_attachment))
att* attachment = lock->lck_attachment;
if (!attachment)
return NULL;
end = lock->lck_key.lck_string + lock->lck_length;
const char* const end = lock->lck_key.lck_string + lock->lck_length;
for (next = attachment->att_long_locks; next; next = next->lck_next)
for (lck* next = attachment->att_long_locks; next; next = next->lck_next)
if (lock->lck_type == next->lck_type &&
lock->lck_parent && next->lck_parent &&
(lock->lck_parent->lck_id == next->lck_parent->lck_id) &&
lock->lck_length == next->lck_length &&
lock->lck_attachment != next->lck_attachment &&
!compatible(next, lock, level)) {
for (p1 = lock->lck_key.lck_string, p2 = next->lck_key.lck_string;
p1 < end && *p1++ == *p2++;);
!compatible(next, lock, level))
{
const char* p1 = lock->lck_key.lck_string;
const char* p2 = next->lck_key.lck_string;
while (p1 < end && *p1++ == *p2++); // empty body
if (p1[-1] == p2[-1])
return next;
}
@ -1122,7 +1108,7 @@ static LCK find_block(LCK lock, USHORT level)
#endif
static USHORT hash_func(UCHAR * value, USHORT length)
static USHORT hash_func(const UCHAR* value, USHORT length)
{
/**************************************
*
@ -1135,17 +1121,15 @@ static USHORT hash_func(UCHAR * value, USHORT length)
* on the passed key.
*
**************************************/
ULONG hash_value;
UCHAR *p, *q;
USHORT l;
/* Hash the value, preserving its distribution
as much as possible */
hash_value = 0;
q = value;
ULONG hash_value = 0;
UCHAR* p = 0;
const UCHAR* q = value;
for (l = 0, q = value; l < length; l++) {
for (USHORT l = 0; l < length; l++) {
if (!(l & 3))
p = (UCHAR *) & hash_value;
*p++ = *q++;
@ -1155,7 +1139,7 @@ static USHORT hash_func(UCHAR * value, USHORT length)
}
static void hash_allocate(LCK lock)
static void hash_allocate(lck* lock)
{
/**************************************
*
@ -1168,21 +1152,19 @@ static void hash_allocate(LCK lock)
* compatible locks.
*
**************************************/
DBB dbb;
ATT att;
fb_assert(LCK_CHECK_LOCK(lock));
dbb = lock->lck_dbb;
DBB dbb = lock->lck_dbb;
if ( (att = lock->lck_attachment) ) {
att->att_compatibility_table =
att* attachment = lock->lck_attachment;
if (attachment) {
attachment->att_compatibility_table =
vec::newVector(*dbb->dbb_permanent, LOCK_HASH_SIZE);
}
}
static LCK hash_get_lock(LCK lock, USHORT * hash_slot, LCK ** prior)
static lck* hash_get_lock(lck* lock, USHORT * hash_slot, lck*** prior)
{
/**************************************
*
@ -1198,45 +1180,46 @@ static LCK hash_get_lock(LCK lock, USHORT * hash_slot, LCK ** prior)
* if requested.
*
**************************************/
LCK match, collision;
SCHAR *p, *q;
SSHORT l;
USHORT hash_value;
ATT att;
fb_assert(LCK_CHECK_LOCK(lock));
if (!(att = lock->lck_attachment))
ATT att = lock->lck_attachment;
if (!att)
return NULL;
if (!att->att_compatibility_table)
hash_allocate(lock);
hash_value = hash_func((UCHAR *) & lock->lck_key, lock->lck_length);
const USHORT hash_value =
hash_func((UCHAR *) & lock->lck_key, lock->lck_length);
if (hash_slot)
*hash_slot = hash_value;
/* if no collisions found, we're done */
if (!(match = (LCK) (*att->att_compatibility_table)[hash_value]))
lck* match = (lck*) (*att->att_compatibility_table)[hash_value];
if (!match)
return NULL;
if (prior)
*prior =
(LCK *) & (*att->att_compatibility_table)[hash_value];
(lck**) & (*att->att_compatibility_table)[hash_value];
/* look for an identical lock */
fb_assert(LCK_CHECK_LOCK(match));
for (collision = match; collision; collision = collision->lck_collision) {
for (lck* collision = match; collision; collision = collision->lck_collision)
{
fb_assert(LCK_CHECK_LOCK(collision));
if (collision->lck_parent && lock->lck_parent &&
collision->lck_parent->lck_id == lock->lck_parent->lck_id &&
collision->lck_type == lock->lck_type &&
collision->lck_length == lock->lck_length) {
collision->lck_length == lock->lck_length)
{
/* check that the keys are the same */
p = lock->lck_key.lck_string;
q = collision->lck_key.lck_string;
const char* p = lock->lck_key.lck_string;
const char* q = collision->lck_key.lck_string;
SSHORT l;
for (l = lock->lck_length; l; l--)
if (*p++ != *q++)
break;
@ -1252,7 +1235,7 @@ static LCK hash_get_lock(LCK lock, USHORT * hash_slot, LCK ** prior)
}
static void hash_insert_lock(LCK lock)
static void hash_insert_lock(lck* lock)
{
/**************************************
*
@ -1265,20 +1248,19 @@ static void hash_insert_lock(LCK lock)
* compatibility lock table.
*
**************************************/
LCK identical;
USHORT hash_slot;
ATT att;
fb_assert(LCK_CHECK_LOCK(lock));
if (!(att = lock->lck_attachment))
ATT att = lock->lck_attachment;
if (!att)
return;
/* if no identical is returned, place it in the collision list */
if (!(identical = hash_get_lock(lock, &hash_slot, 0))) {
USHORT hash_slot;
lck* identical = hash_get_lock(lock, &hash_slot, 0);
if (!identical) {
lock->lck_collision =
(LCK) (*att->att_compatibility_table)[hash_slot];
(lck*) (*att->att_compatibility_table)[hash_slot];
(*att->att_compatibility_table)[hash_slot] = (BLK) lock;
return;
}
@ -1290,7 +1272,7 @@ static void hash_insert_lock(LCK lock)
}
static BOOLEAN hash_remove_lock(LCK lock, LCK * match)
static bool hash_remove_lock(lck* lock, lck** match)
{
/**************************************
*
@ -1300,16 +1282,16 @@ static BOOLEAN hash_remove_lock(LCK lock, LCK * match)
*
* Functional description
* Remove the passed lock from the hash table.
* Return TRUE if this is the last such identical
* Return true if this is the last such identical
* lock removed. Also return the first matching
* locking found.
*
**************************************/
LCK next, last, *prior;
fb_assert(LCK_CHECK_LOCK(lock));
if (!(next = hash_get_lock(lock, 0, &prior))) {
lck** prior;
lck* next = hash_get_lock(lock, 0, &prior);
if (!next) {
/* set lck_compatible to NULL to make sure we don't
try to release the lock again in bugchecking */
@ -1326,13 +1308,14 @@ static BOOLEAN hash_remove_lock(LCK lock, LCK * match)
if (lock->lck_identical) {
lock->lck_identical->lck_collision = lock->lck_collision;
*prior = lock->lck_identical;
return FALSE;
return false;
}
else {
*prior = lock->lck_collision;
return TRUE;
return true;
}
lck* last = 0;
for (; next; last = next, next = next->lck_identical)
if (next == lock)
break;
@ -1343,11 +1326,11 @@ static BOOLEAN hash_remove_lock(LCK lock, LCK * match)
}
last->lck_identical = next->lck_identical;
return FALSE;
return false;
}
static void internal_ast(LCK lock)
static void internal_ast(lck* lock)
{
/**************************************
*
@ -1365,14 +1348,13 @@ static void internal_ast(LCK lock)
* on our own process.
*
**************************************/
LCK match, next;
fb_assert(LCK_CHECK_LOCK(lock));
/* go through the list, saving the next lock in the list
in case the current one gets deleted in the ast */
for (match = hash_get_lock(lock, 0, 0); match; match = next) {
lck* next;
for (lck* match = hash_get_lock(lock, 0, 0); match; match = next) {
next = match->lck_identical;
/* don't deliver the ast to any locks which are already compatible */
@ -1388,7 +1370,7 @@ static void internal_ast(LCK lock)
static BOOLEAN internal_compatible(LCK match, LCK lock, USHORT level)
static bool internal_compatible(lck* match, lck* lock, USHORT level)
{
/**************************************
*
@ -1399,15 +1381,15 @@ static BOOLEAN internal_compatible(LCK match, LCK lock, USHORT level)
* Functional description
* See if there are any incompatible locks
* in the list of locks held by this process.
* If there are none, return TRUE to indicate
* If there are none, return true to indicate
* that the lock is compatible.
*
**************************************/
LCK next;
fb_assert(LCK_CHECK_LOCK(match));
fb_assert(LCK_CHECK_LOCK(lock));
lck* next;
/* first check if there are any locks which are
incompatible which do not have blocking asts;
if so, there is no chance of getting a compatible
@ -1415,7 +1397,7 @@ static BOOLEAN internal_compatible(LCK match, LCK lock, USHORT level)
for (next = match; next; next = next->lck_identical)
if (!next->lck_ast && !compatible(next, lock, level))
return FALSE;
return false;
/* now deliver the blocking asts, attempting to gain
compatibility by getting everybody to downgrade */
@ -1426,13 +1408,13 @@ static BOOLEAN internal_compatible(LCK match, LCK lock, USHORT level)
for (next = match; next; next = next->lck_identical)
if (!compatible(next, match, level))
return FALSE;
return false;
return TRUE;
return true;
}
static void internal_dequeue(TDBB tdbb, LCK lock)
static void internal_dequeue(TDBB tdbb, lck* lock)
{
/**************************************
*
@ -1446,14 +1428,13 @@ static void internal_dequeue(TDBB tdbb, LCK lock)
* the lock needs to be downgraded.
*
**************************************/
LCK match;
SET_TDBB(tdbb);
fb_assert(LCK_CHECK_LOCK(lock));
fb_assert(lock->lck_compatible);
/* if this is the last identical lock in the hash table, release it */
lck* match;
if (hash_remove_lock(lock, &match)) {
if (!LOCK_deq(lock->lck_id))
bug_lck("LOCK_deq() failed in lck:internal_dequeue");
@ -1468,7 +1449,7 @@ static void internal_dequeue(TDBB tdbb, LCK lock)
}
static USHORT internal_downgrade(TDBB tdbb, LCK first)
static USHORT internal_downgrade(TDBB tdbb, lck* first)
{
/**************************************
*
@ -1482,16 +1463,16 @@ static USHORT internal_downgrade(TDBB tdbb, LCK first)
* highest logical level.
*
**************************************/
LCK lock;
USHORT level = LCK_none;
SET_TDBB(tdbb);
fb_assert(LCK_CHECK_LOCK(first));
fb_assert(first->lck_compatible);
lck* lock;
/* find the highest required lock level */
USHORT level = LCK_none;
for (lock = first; lock; lock = lock->lck_identical)
level = MAX(level, lock->lck_logical);
@ -1516,7 +1497,7 @@ static USHORT internal_downgrade(TDBB tdbb, LCK first)
static bool internal_enqueue(
TDBB tdbb,
LCK lock,
lck* lock,
USHORT level,
SSHORT wait, bool convert_flg)
{
@ -1536,18 +1517,16 @@ static bool internal_enqueue(
* itself upward.
*
**************************************/
LCK match, update;
ISC_STATUS *status;
fb_assert(LCK_CHECK_LOCK(lock));
fb_assert(lock->lck_compatible);
SET_TDBB(tdbb);
status = tdbb->tdbb_status_vector;
ISC_STATUS* status = tdbb->tdbb_status_vector;
/* look for an identical lock */
if ( (match = hash_get_lock(lock, 0, 0)) ) {
lck* match = hash_get_lock(lock, 0, 0);
if (match) {
/* if there are incompatible locks for which
there are no blocking asts defined, give up */
@ -1578,7 +1557,7 @@ static bool internal_enqueue(
{
return false;
}
for (update = match; update; update = update->lck_identical)
for (lck* update = match; update; update = update->lck_identical)
update->lck_physical = level;
}

View File

@ -103,7 +103,7 @@ public:
class blk* lck_owner; /* Logical owner block (transaction, etc.) */
class blk* lck_compatible; /* Enter into internal_enqueue() and treat as compatible */
class blk* lck_compatible2; /* Sub-level for internal compatibility */
struct att* lck_attachment; /* Attachment that owns lock */
class att* lck_attachment; /* Attachment that owns lock */
struct btb* lck_blocked_threads; /* Threads blocked by lock */
lock_ast_t lck_ast; /* Blocking AST routine */
SLONG lck_id; /* Lock id from lock manager */
@ -118,8 +118,8 @@ public:
SCHAR lck_string[1];
SLONG lck_long;
} lck_key;
SCHAR lck_tail[1]; /* Makes the allocater happy */
SCHAR lck_tail[1]; /* Makes the allocator happy */
};
typedef lck *LCK;
#endif /* JRD_LCK_H */
#endif // JRD_LCK_H

View File

@ -26,23 +26,24 @@
#include "../jrd/lck.h"
void LCK_assert(TDBB, struct lck *);
bool LCK_convert(TDBB, struct lck *, USHORT, SSHORT);
int LCK_convert_non_blocking(TDBB, struct lck *, USHORT, SSHORT);
int LCK_convert_opt(TDBB, struct lck *, USHORT);
int LCK_downgrade(TDBB, struct lck *);
void LCK_assert(TDBB, lck*);
bool LCK_convert(TDBB, lck*, USHORT, SSHORT);
int LCK_convert_non_blocking(TDBB, lck*, USHORT, SSHORT);
int LCK_convert_opt(TDBB, lck*, USHORT);
int LCK_downgrade(TDBB, lck*);
void LCK_fini(TDBB, enum lck_owner_t);
SLONG LCK_get_owner_handle(TDBB, enum lck_t);
void LCK_init(TDBB, enum lck_owner_t);
int LCK_lock(TDBB, struct lck *, USHORT, SSHORT);
int LCK_lock_non_blocking(TDBB, struct lck *, USHORT, SSHORT);
int LCK_lock_opt(TDBB, struct lck *, USHORT, SSHORT);
SLONG LCK_query_data(struct lck *, enum lck_t, USHORT);
SLONG LCK_read_data(struct lck *);
void LCK_release(TDBB, struct lck *);
void LCK_re_post(struct lck *);
void LCK_write_data(struct lck *, SLONG);
int LCK_lock(TDBB, lck*, USHORT, SSHORT);
int LCK_lock_non_blocking(TDBB, lck*, USHORT, SSHORT);
int LCK_lock_opt(TDBB, lck*, USHORT, SSHORT);
SLONG LCK_query_data(lck*, enum lck_t, USHORT);
SLONG LCK_read_data(lck*);
void LCK_release(TDBB, lck*);
void LCK_re_post(lck*);
void LCK_write_data(lck*, SLONG);
void LCK_ast_inhibit();
void LCK_ast_enable();
#endif // JRD_LCK_PROTO_H

View File

@ -32,10 +32,11 @@
class lls : public pool_alloc<type_lls>
{
public:
BLK lls_object;
struct lls *lls_next;
public:
BLK lls_object;
lls* lls_next;
};
typedef lls *LLS;
#endif /* JRD_LLS_H */
#endif // JRD_LLS_H

View File

@ -54,7 +54,7 @@ This is currently removed as
This is a valuable function to re-activate in the product, but
until it is I've #ifdef'ed it out under REPLAY_OSRI_API_CALLS_SUBSYSTEM.
I've also embedded the notes on how it works into log.c so they
I've also embedded the notes on how it works into log.cpp so they
can serve as a reference to a future completion of implementation.
Not reviewed, removal & documentation only
@ -200,7 +200,6 @@ void LOG_call(enum log_t call_type, ...)
* bugs in a production environment.
*
**************************************/
SCHAR *arg_type;
SSHORT number;
SLONG long_number;
SCHAR *pointer;
@ -220,7 +219,8 @@ void LOG_call(enum log_t call_type, ...)
pop the arguments off the call stack and put
them into the log file */
for (arg_type = arg_types1[(int) call_type]; *arg_type; arg_type++)
for (const char* arg_type = arg_types1[(int) call_type]; *arg_type; arg_type++)
{
switch (*arg_type) {
case 'o':
case 's':
@ -270,6 +270,7 @@ void LOG_call(enum log_t call_type, ...)
default:
error("argument type not known");
}
}
va_end(ptr);
@ -352,7 +353,7 @@ void LOG_fini(void)
*
**************************************/
DBB dbb = GET_DBB;
LOG log;
fblog* log;
if (dbb && (log = dbb->dbb_log)) {
if (log->log_file) {
log_flush();
@ -432,7 +433,7 @@ static void log_char(SCHAR c)
**************************************/
DBB dbb = GET_DBB;
LOG log = dbb->dbb_log;
fblog* log = dbb->dbb_log;
*log->log_ptr++ = c;
/* this log flush could be done in the middle of an OSRI
@ -462,7 +463,7 @@ static void log_flush(void)
**************************************/
DBB dbb = GET_DBB;
LOG log = dbb->dbb_log;
fblog* log = dbb->dbb_log;
if (!(log->log_ptr - log->log_buffer))
return;
@ -602,11 +603,12 @@ static void open_log(const TEXT* file_name, SSHORT file_length,
if (!log_file)
error("can't open log file");
else {
LOG log = FB_NEW(*dbb->dbb_permanent) log();
fblog* log = FB_NEW(*dbb->dbb_permanent) fblog();
dbb->dbb_log = log;
log->log_file = log_file;
log->log_string = FB_NEW_RPT(*dbb->dbb_permanent, LOG_BUFFER_LENGTH) str();
log->log_ptr = log->log_buffer = log->log_string->str_data;
}
}
#endif /* REPLAY_OSRI_API_CALLS_SUBSYSTEM */
#endif // REPLAY_OSRI_API_CALLS_SUBSYSTEM

Some files were not shown because too many files have changed in this diff Show More