mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-22 20:43:02 +01:00
Fix some warnings from GCC/Linux build. Some of them were subtle errors
This commit is contained in:
parent
e2d7fb0850
commit
c64f31b712
@ -192,7 +192,7 @@ return (0);
|
|||||||
|
|
||||||
Error:
|
Error:
|
||||||
|
|
||||||
printf ("SQLCODE=%ld\n", SQLCODE);
|
printf ("SQLCODE=%ld\n", (long)SQLCODE);
|
||||||
isc_print_status (gds__status);
|
isc_print_status (gds__status);
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
@ -268,7 +268,7 @@ return (0);
|
|||||||
|
|
||||||
Error:
|
Error:
|
||||||
|
|
||||||
printf ("SQLCODE=%ld\n", SQLCODE);
|
printf ("SQLCODE=%ld\n", (long)SQLCODE);
|
||||||
isc_print_status (gds__status);
|
isc_print_status (gds__status);
|
||||||
|
|
||||||
return (1);
|
return (1);
|
||||||
@ -342,7 +342,7 @@ return (0);
|
|||||||
|
|
||||||
Error:
|
Error:
|
||||||
|
|
||||||
printf ("SQLCODE=%ld\n", SQLCODE);
|
printf ("SQLCODE=%ld\n", (long)SQLCODE);
|
||||||
isc_print_status (gds__status);
|
isc_print_status (gds__status);
|
||||||
|
|
||||||
return (1);
|
return (1);
|
||||||
@ -402,7 +402,7 @@ return (0);
|
|||||||
|
|
||||||
Error:
|
Error:
|
||||||
|
|
||||||
printf ("SQLCODE=%ld\n", SQLCODE);
|
printf ("SQLCODE=%ld\n", (long)SQLCODE);
|
||||||
isc_print_status (gds__status);
|
isc_print_status (gds__status);
|
||||||
|
|
||||||
return (1);
|
return (1);
|
||||||
|
@ -1270,7 +1270,7 @@ static bool write_header(DESC handle,
|
|||||||
UCHAR* q = tdgbl->mvol_io_volume;
|
UCHAR* q = tdgbl->mvol_io_volume;
|
||||||
// CVC: Warning, do we want sizeof(int) or sizeof(some_abstract_FB_type)???
|
// CVC: Warning, do we want sizeof(int) or sizeof(some_abstract_FB_type)???
|
||||||
// It seems to me we want sizeof(ULONG) for safety. => Done.
|
// It seems to me we want sizeof(ULONG) for safety. => Done.
|
||||||
for (int i = 0; i < sizeof(ULONG); i++)
|
for (size_t i = 0; i < sizeof(ULONG); i++)
|
||||||
{
|
{
|
||||||
*q++ = *p++;
|
*q++ = *p++;
|
||||||
}
|
}
|
||||||
|
@ -1524,7 +1524,7 @@ ISC_STATUS GDS_DSQL_SET_CURSOR_CPP( ISC_STATUS* user_status,
|
|||||||
}
|
}
|
||||||
else // not quoted name
|
else // not quoted name
|
||||||
{
|
{
|
||||||
int i;
|
size_t i;
|
||||||
for (i = 0; i < sizeof(cursor) - 1 // PJPG 20001013
|
for (i = 0; i < sizeof(cursor) - 1 // PJPG 20001013
|
||||||
&& input_cursor[i] // PJPG 20001013
|
&& input_cursor[i] // PJPG 20001013
|
||||||
&& input_cursor[i] != ' '; ++i) // PJPG 20001013
|
&& input_cursor[i] != ' '; ++i) // PJPG 20001013
|
||||||
|
@ -4290,9 +4290,10 @@ static bool long_int(dsql_nod* string,
|
|||||||
*
|
*
|
||||||
*************************************/
|
*************************************/
|
||||||
|
|
||||||
for (const char* p = ((dsql_str*) string)->str_data; classes[*p] & CHR_DIGIT; p++)
|
for (const char* p = ((dsql_str*) string)->str_data;
|
||||||
|
classes[static_cast<UCHAR>(*p)] & CHR_DIGIT; p++)
|
||||||
{
|
{
|
||||||
if (!(classes[*p] & CHR_DIGIT)) {
|
if (!(classes[static_cast<UCHAR>(*p)] & CHR_DIGIT)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4526,9 +4527,9 @@ static bool short_int(dsql_nod* string,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (char* p = ((dsql_str*) string)->str_data; classes[*p] & CHR_DIGIT; p++)
|
for (char* p = ((dsql_str*) string)->str_data; classes[static_cast<UCHAR>(*p)] & CHR_DIGIT; p++)
|
||||||
{
|
{
|
||||||
if (!(classes[*p] & CHR_DIGIT)) {
|
if (!(classes[static_cast<UCHAR>(*p)] & CHR_DIGIT)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4745,7 +4746,7 @@ int LexerState::yylex (
|
|||||||
* to become the name of the character set
|
* to become the name of the character set
|
||||||
*/
|
*/
|
||||||
char* p = string;
|
char* p = string;
|
||||||
for (; ptr < end && classes[*ptr] & CHR_IDENT; ptr++)
|
for (; ptr < end && classes[static_cast<UCHAR>(*ptr)] & CHR_IDENT; ptr++)
|
||||||
{
|
{
|
||||||
if (ptr >= end)
|
if (ptr >= end)
|
||||||
return -1;
|
return -1;
|
||||||
@ -4865,7 +4866,7 @@ int LexerState::yylex (
|
|||||||
fb_assert(ptr <= end);
|
fb_assert(ptr <= end);
|
||||||
|
|
||||||
if ((tok_class & CHR_DIGIT) ||
|
if ((tok_class & CHR_DIGIT) ||
|
||||||
((c == '.') && (ptr < end) && (classes[*ptr] & CHR_DIGIT)))
|
((c == '.') && (ptr < end) && (classes[static_cast<UCHAR>(*ptr)] & CHR_DIGIT)))
|
||||||
{
|
{
|
||||||
/* The following variables are used to recognize kinds of numbers. */
|
/* The following variables are used to recognize kinds of numbers. */
|
||||||
|
|
||||||
@ -5027,7 +5028,7 @@ int LexerState::yylex (
|
|||||||
{
|
{
|
||||||
char* p = string;
|
char* p = string;
|
||||||
check_copy_incr(p, UPPER (c), string);
|
check_copy_incr(p, UPPER (c), string);
|
||||||
for (; ptr < end && classes[*ptr] & CHR_IDENT; ptr++)
|
for (; ptr < end && classes[static_cast<UCHAR>(*ptr)] & CHR_IDENT; ptr++)
|
||||||
{
|
{
|
||||||
if (ptr >= end)
|
if (ptr >= end)
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -517,7 +517,7 @@ static SSHORT get_next_token(
|
|||||||
|
|
||||||
if (char_class & CHR_LETTER) {
|
if (char_class & CHR_LETTER) {
|
||||||
*p++ = UPPER(c);
|
*p++ = UPPER(c);
|
||||||
for (; s < stmt_end && classes[*s] & CHR_IDENT && p < token_end; s++) {
|
for (; s < stmt_end && (classes[static_cast<UCHAR>(*s)] & CHR_IDENT) && p < token_end; s++) {
|
||||||
*p++ = UPPER(*s);
|
*p++ = UPPER(*s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
//
|
//
|
||||||
// All Rights Reserved.
|
// All Rights Reserved.
|
||||||
// Contributor(s): ______________________________________.
|
// Contributor(s): ______________________________________.
|
||||||
// $Id: gpre.cpp,v 1.53 2004-03-01 04:57:37 skidder Exp $
|
// $Id: gpre.cpp,v 1.54 2004-03-12 07:00:22 skidder Exp $
|
||||||
// Revision 1.2 2000/11/16 15:54:29 fsg
|
// Revision 1.2 2000/11/16 15:54:29 fsg
|
||||||
// Added new switch -verbose to gpre that will dump
|
// Added new switch -verbose to gpre that will dump
|
||||||
// parsed lines to stderr
|
// parsed lines to stderr
|
||||||
@ -284,15 +284,15 @@ int main(int argc, char* argv[])
|
|||||||
classes[i] = CHR_DIGIT | CHR_IDENT;
|
classes[i] = CHR_DIGIT | CHR_IDENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
classes['_'] = CHR_LETTER | CHR_IDENT | CHR_INTRODUCER;
|
classes[static_cast<UCHAR>('_')] = CHR_LETTER | CHR_IDENT | CHR_INTRODUCER;
|
||||||
classes['$'] = CHR_IDENT;
|
classes[static_cast<UCHAR>('$')] = CHR_IDENT;
|
||||||
classes[' '] = CHR_WHITE;
|
classes[static_cast<UCHAR>(' ')] = CHR_WHITE;
|
||||||
classes['\t'] = CHR_WHITE;
|
classes[static_cast<UCHAR>('\t')] = CHR_WHITE;
|
||||||
classes['\n'] = CHR_WHITE;
|
classes[static_cast<UCHAR>('\n')] = CHR_WHITE;
|
||||||
classes['\r'] = CHR_WHITE;
|
classes[static_cast<UCHAR>('\r')] = CHR_WHITE;
|
||||||
classes['\''] = CHR_QUOTE;
|
classes[static_cast<UCHAR>('\'')] = CHR_QUOTE;
|
||||||
classes['\"'] = CHR_DBLQUOTE;
|
classes[static_cast<UCHAR>('\"')] = CHR_DBLQUOTE;
|
||||||
classes['#'] = CHR_IDENT;
|
classes[static_cast<UCHAR>('#')] = CHR_IDENT;
|
||||||
|
|
||||||
// zorch 0 through 7 in the fortran label vector
|
// zorch 0 through 7 in the fortran label vector
|
||||||
|
|
||||||
@ -1290,7 +1290,7 @@ TOK CPR_token()
|
|||||||
static bool all_digits(const char* str1)
|
static bool all_digits(const char* str1)
|
||||||
{
|
{
|
||||||
for (; *str1; str1++)
|
for (; *str1; str1++)
|
||||||
if (!(classes[*str1] & CHR_DIGIT))
|
if (!(classes[static_cast<UCHAR>(*str1)] & CHR_DIGIT))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -34,6 +34,7 @@ namespace Firebird {
|
|||||||
class StringsBuffer {
|
class StringsBuffer {
|
||||||
public:
|
public:
|
||||||
virtual char* alloc(const char* string, size_t length) = 0;
|
virtual char* alloc(const char* string, size_t length) = 0;
|
||||||
|
virtual ~StringsBuffer() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <size_t BUFFER_SIZE>
|
template <size_t BUFFER_SIZE>
|
||||||
@ -44,7 +45,6 @@ public:
|
|||||||
memset(buffer, 0, BUFFER_SIZE);
|
memset(buffer, 0, BUFFER_SIZE);
|
||||||
buffer_ptr = buffer;
|
buffer_ptr = buffer;
|
||||||
}
|
}
|
||||||
//virtual ~CircularStringsBuffer() {};
|
|
||||||
virtual char* alloc(const char* string, size_t length) {
|
virtual char* alloc(const char* string, size_t length) {
|
||||||
// fb_assert(length+1 < BUFFER_SIZE);
|
// fb_assert(length+1 < BUFFER_SIZE);
|
||||||
// If there isn't any more room in the buffer, start at the beginning again
|
// If there isn't any more room in the buffer, start at the beginning again
|
||||||
|
@ -6561,7 +6561,7 @@ static int process_statement(const TEXT* string,
|
|||||||
if (count_is == count_type)
|
if (count_is == count_type)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
ISQL_msg_get(REC_COUNT, rec_count_msg, (TEXT*) count, NULL, NULL,
|
ISQL_msg_get(REC_COUNT, rec_count_msg, (TEXT*)(IPTR) count, NULL, NULL,
|
||||||
NULL, NULL);
|
NULL, NULL);
|
||||||
// Records affected: %ld
|
// Records affected: %ld
|
||||||
sprintf(Print_buffer, "%s%s", rec_count_msg, NEWLINE);
|
sprintf(Print_buffer, "%s%s", rec_count_msg, NEWLINE);
|
||||||
@ -6999,7 +6999,7 @@ static int process_statement(const TEXT* string,
|
|||||||
// Record count printed here upon request
|
// Record count printed here upon request
|
||||||
|
|
||||||
if (Docount) {
|
if (Docount) {
|
||||||
ISQL_msg_get(REC_COUNT, rec_count_msg, (TEXT*) lines, NULL, NULL,
|
ISQL_msg_get(REC_COUNT, rec_count_msg, (TEXT*)(IPTR) lines, NULL, NULL,
|
||||||
NULL, NULL);
|
NULL, NULL);
|
||||||
// Total returned: %ld
|
// Total returned: %ld
|
||||||
sprintf(Print_buffer, "%s%s", rec_count_msg, NEWLINE);
|
sprintf(Print_buffer, "%s%s", rec_count_msg, NEWLINE);
|
||||||
|
@ -104,7 +104,7 @@ class Buffer_desc : public pool_alloc<type_bdb>
|
|||||||
SSHORT bdb_scan_count; /* concurrent sequential scans */
|
SSHORT bdb_scan_count; /* concurrent sequential scans */
|
||||||
USHORT bdb_write_direction; /* Where to write buffer */
|
USHORT bdb_write_direction; /* Where to write buffer */
|
||||||
ULONG bdb_difference_page; /* Number of page in difference file */
|
ULONG bdb_difference_page; /* Number of page in difference file */
|
||||||
SLONG bdb_diff_generation; /* Number of backup/restore cycle for
|
SLONG bdb_diff_generation; /* Number of backup lock/unlock (NBAK) cycle for
|
||||||
this database in current process.
|
this database in current process.
|
||||||
Used in CS only. */
|
Used in CS only. */
|
||||||
thread_db* bdb_shared[BDB_max_shared]; /* threads holding shared latches */
|
thread_db* bdb_shared[BDB_max_shared]; /* threads holding shared latches */
|
||||||
|
@ -111,7 +111,8 @@ rel_MAX} RIDS;
|
|||||||
((((d1).dsc_dtype==dtype_sql_time)&&((d2).dsc_dtype==dtype_sql_date)) || \
|
((((d1).dsc_dtype==dtype_sql_time)&&((d2).dsc_dtype==dtype_sql_date)) || \
|
||||||
(((d2).dsc_dtype==dtype_sql_time)&&((d1).dsc_dtype==dtype_sql_date)))
|
(((d2).dsc_dtype==dtype_sql_time)&&((d1).dsc_dtype==dtype_sql_date)))
|
||||||
|
|
||||||
#define REQ_TAIL sizeof (((jrd_req*) NULL)->req_rpb[0])
|
// size of req_rpb[0]
|
||||||
|
#define REQ_TAIL sizeof (rpb)
|
||||||
#define MAP_LENGTH 256
|
#define MAP_LENGTH 256
|
||||||
|
|
||||||
/* RITTER - changed HP10 to HPUX */
|
/* RITTER - changed HP10 to HPUX */
|
||||||
|
@ -49,7 +49,7 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
$Id: common.h,v 1.107 2004-03-09 00:17:02 skidder Exp $
|
$Id: common.h,v 1.108 2004-03-12 07:00:46 skidder Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef JRD_COMMON_H
|
#ifndef JRD_COMMON_H
|
||||||
@ -872,8 +872,8 @@ typedef struct
|
|||||||
|
|
||||||
#define JRD_BUGCHK 15 /* facility code for bugcheck messages */
|
#define JRD_BUGCHK 15 /* facility code for bugcheck messages */
|
||||||
#ifndef OFFSET
|
#ifndef OFFSET
|
||||||
#define OFFSET(struct,fld) ((IPTR) &((struct) NULL)->fld)
|
#define OFFSET(struct,fld) ((size_t) &((struct) NULL)->fld)
|
||||||
#define OFFSETA(struct,fld) ((IPTR) ((struct) NULL)->fld)
|
#define OFFSETA(struct,fld) ((size_t) ((struct) NULL)->fld)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef ODS_ALIGNMENT
|
#ifndef ODS_ALIGNMENT
|
||||||
|
@ -198,7 +198,7 @@ static blb* setup_triggers(thread_db*, jrd_rel*, bool, trig_vec**, blb*);
|
|||||||
static void setup_trigger_details(thread_db*, jrd_rel*, blb*, trig_vec**, const TEXT*,
|
static void setup_trigger_details(thread_db*, jrd_rel*, blb*, trig_vec**, const TEXT*,
|
||||||
const TEXT*, bool);
|
const TEXT*, bool);
|
||||||
//static void setup_trigger_details(thread_db*, jrd_rel*, blb*, VEC *, UCHAR *, UCHAR *, BOOLEAN);
|
//static void setup_trigger_details(thread_db*, jrd_rel*, blb*, VEC *, UCHAR *, UCHAR *, BOOLEAN);
|
||||||
static bool shadow_defined(thread_db*);
|
//static bool shadow_defined(thread_db*);
|
||||||
static bool validate_text_type (thread_db*, ISC_STATUS *, TFB);
|
static bool validate_text_type (thread_db*, ISC_STATUS *, TFB);
|
||||||
|
|
||||||
static const UCHAR nonnull_validation_blr[] =
|
static const UCHAR nonnull_validation_blr[] =
|
||||||
@ -4224,7 +4224,7 @@ static bool scan_relation(thread_db* tdbb, SSHORT phase, Deferred_work* work,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef NOT_USED_OR_REPLACED
|
||||||
static bool shadow_defined(thread_db* tdbb)
|
static bool shadow_defined(thread_db* tdbb)
|
||||||
{
|
{
|
||||||
/**************************************
|
/**************************************
|
||||||
@ -4254,6 +4254,7 @@ static bool shadow_defined(thread_db* tdbb)
|
|||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
static void setup_array(thread_db* tdbb, blb* blob, const TEXT* field_name, USHORT n,
|
static void setup_array(thread_db* tdbb, blb* blob, const TEXT* field_name, USHORT n,
|
||||||
|
@ -613,7 +613,7 @@ static FRB alloc_global(UCHAR type, ULONG length, bool recurse)
|
|||||||
for (ptr = &EVENT_header->evh_free; (free = (FRB) ABS_PTR(*ptr)) && *ptr;
|
for (ptr = &EVENT_header->evh_free; (free = (FRB) ABS_PTR(*ptr)) && *ptr;
|
||||||
ptr = &free->frb_next)
|
ptr = &free->frb_next)
|
||||||
{
|
{
|
||||||
const SLONG tail = free->hdr_length - length;
|
const SLONG tail = free->frb_header.hdr_length - length;
|
||||||
if (tail >= 0 && (!best || tail < best_tail)) {
|
if (tail >= 0 && (!best || tail < best_tail)) {
|
||||||
best = ptr;
|
best = ptr;
|
||||||
best_tail = tail;
|
best_tail = tail;
|
||||||
@ -659,11 +659,11 @@ static FRB alloc_global(UCHAR type, ULONG length, bool recurse)
|
|||||||
if (header) {
|
if (header) {
|
||||||
free = (FRB) ((UCHAR *) header + old_length);
|
free = (FRB) ((UCHAR *) header + old_length);
|
||||||
/**
|
/**
|
||||||
free->hdr_length = EVENT_EXTEND_SIZE - sizeof (struct evh);
|
free->frb_header.hdr_length = EVENT_EXTEND_SIZE - sizeof (struct evh);
|
||||||
**/
|
**/
|
||||||
free->hdr_length =
|
free->frb_header.hdr_length =
|
||||||
EVENT_data.sh_mem_length_mapped - old_length;
|
EVENT_data.sh_mem_length_mapped - old_length;
|
||||||
free->hdr_type = type_frb;
|
free->frb_header.hdr_type = type_frb;
|
||||||
free->frb_next = 0;
|
free->frb_next = 0;
|
||||||
|
|
||||||
EVENT_header = header;
|
EVENT_header = header;
|
||||||
@ -691,14 +691,14 @@ static FRB alloc_global(UCHAR type, ULONG length, bool recurse)
|
|||||||
if (best_tail < (SLONG) sizeof(frb))
|
if (best_tail < (SLONG) sizeof(frb))
|
||||||
*best = free->frb_next;
|
*best = free->frb_next;
|
||||||
else {
|
else {
|
||||||
free->hdr_length -= length;
|
free->frb_header.hdr_length -= length;
|
||||||
free = (FRB) ((UCHAR *) free + free->hdr_length);
|
free = (FRB) ((UCHAR *) free + free->frb_header.hdr_length);
|
||||||
free->hdr_length = length;
|
free->frb_header.hdr_length = length;
|
||||||
}
|
}
|
||||||
|
|
||||||
memset((UCHAR*) free + sizeof(event_hdr), 0,
|
memset((UCHAR*) free + sizeof(event_hdr), 0,
|
||||||
free->hdr_length - sizeof(event_hdr));
|
free->frb_header.hdr_length - sizeof(event_hdr));
|
||||||
free->hdr_type = type;
|
free->frb_header.hdr_type = type;
|
||||||
|
|
||||||
return free;
|
return free;
|
||||||
}
|
}
|
||||||
@ -1147,7 +1147,7 @@ static void free_global(FRB block)
|
|||||||
|
|
||||||
FRB prior = NULL;
|
FRB prior = NULL;
|
||||||
PTR offset = REL_PTR(block);
|
PTR offset = REL_PTR(block);
|
||||||
block->hdr_type = type_frb;
|
block->frb_header.hdr_type = type_frb;
|
||||||
|
|
||||||
for (ptr = &EVENT_header->evh_free; (free = (FRB) ABS_PTR(*ptr)) && *ptr;
|
for (ptr = &EVENT_header->evh_free; (free = (FRB) ABS_PTR(*ptr)) && *ptr;
|
||||||
prior = free, ptr = &free->frb_next)
|
prior = free, ptr = &free->frb_next)
|
||||||
@ -1158,7 +1158,7 @@ static void free_global(FRB block)
|
|||||||
|
|
||||||
if (offset <= 0 || offset > EVENT_header->evh_length ||
|
if (offset <= 0 || offset > EVENT_header->evh_length ||
|
||||||
(prior
|
(prior
|
||||||
&& (UCHAR*) block < (UCHAR*) prior + prior->hdr_length))
|
&& (UCHAR*) block < (UCHAR*) prior + prior->frb_header.hdr_length))
|
||||||
{
|
{
|
||||||
punt("free_global: bad block");
|
punt("free_global: bad block");
|
||||||
return;
|
return;
|
||||||
@ -1171,17 +1171,17 @@ static void free_global(FRB block)
|
|||||||
|
|
||||||
/* Try to merge free block with next block */
|
/* Try to merge free block with next block */
|
||||||
|
|
||||||
if (free && (SCHAR *) block + block->hdr_length == (SCHAR *) free)
|
if (free && (SCHAR *) block + block->frb_header.hdr_length == (SCHAR *) free)
|
||||||
{
|
{
|
||||||
block->hdr_length += free->hdr_length;
|
block->frb_header.hdr_length += free->frb_header.hdr_length;
|
||||||
block->frb_next = free->frb_next;
|
block->frb_next = free->frb_next;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Next, try to merge the free block with the prior block */
|
/* Next, try to merge the free block with the prior block */
|
||||||
|
|
||||||
if (prior && (SCHAR *) prior + prior->hdr_length == (SCHAR *) block)
|
if (prior && (SCHAR *) prior + prior->frb_header.hdr_length == (SCHAR *) block)
|
||||||
{
|
{
|
||||||
prior->hdr_length += block->hdr_length;
|
prior->frb_header.hdr_length += block->frb_header.hdr_length;
|
||||||
prior->frb_next = block->frb_next;
|
prior->frb_next = block->frb_next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1249,9 +1249,9 @@ static void init(void* arg, SH_MEM shmem_data, bool initialize)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
FRB free = (FRB) ((UCHAR*) EVENT_header + sizeof(evh));
|
FRB free = (FRB) ((UCHAR*) EVENT_header + sizeof(evh));
|
||||||
free->hdr_length =
|
free->frb_header.hdr_length =
|
||||||
EVENT_data.sh_mem_length_mapped - sizeof(evh);
|
EVENT_data.sh_mem_length_mapped - sizeof(evh);
|
||||||
free->hdr_type = type_frb;
|
free->frb_header.hdr_type = type_frb;
|
||||||
free->frb_next = 0;
|
free->frb_next = 0;
|
||||||
|
|
||||||
EVENT_header->evh_free = (UCHAR *) free - (UCHAR *) EVENT_header;
|
EVENT_header->evh_free = (UCHAR *) free - (UCHAR *) EVENT_header;
|
||||||
@ -1539,11 +1539,11 @@ static int validate(void)
|
|||||||
SLONG offset;
|
SLONG offset;
|
||||||
|
|
||||||
for (offset = sizeof(evh); offset < EVENT_header->evh_length;
|
for (offset = sizeof(evh); offset < EVENT_header->evh_length;
|
||||||
offset += block->hdr_length)
|
offset += block->frb_header.hdr_length)
|
||||||
{
|
{
|
||||||
event_hdr* block = (event_hdr*) ABS_PTR(offset);
|
event_hdr* block = (event_hdr*) ABS_PTR(offset);
|
||||||
if (!block->hdr_length || !block->hdr_type
|
if (!block->frb_header.hdr_length || !block->frb_header.hdr_type
|
||||||
|| block->hdr_type >= type_max)
|
|| block->frb_header.hdr_type >= type_max)
|
||||||
{
|
{
|
||||||
punt("bad block length or type");
|
punt("bad block length or type");
|
||||||
break;
|
break;
|
||||||
@ -1553,7 +1553,7 @@ static int validate(void)
|
|||||||
next_free = 0;
|
next_free = 0;
|
||||||
else if (offset > next_free)
|
else if (offset > next_free)
|
||||||
punt("bad free chain");
|
punt("bad free chain");
|
||||||
if (block->hdr_type == type_frb) {
|
if (block->frb_header.hdr_type == type_frb) {
|
||||||
next_free = ((FRB) block)->frb_next;
|
next_free = ((FRB) block)->frb_next;
|
||||||
if (next_free >= EVENT_header->evh_length)
|
if (next_free >= EVENT_header->evh_length)
|
||||||
punt("bad frb_next");
|
punt("bad frb_next");
|
||||||
|
@ -94,18 +94,18 @@ struct event_hdr // CVC: previous clash with ods.h's hdr
|
|||||||
|
|
||||||
/* Free blocks */
|
/* Free blocks */
|
||||||
|
|
||||||
struct frb : public event_hdr
|
struct frb
|
||||||
{
|
{
|
||||||
//event_hdr frb_header;
|
event_hdr frb_header;
|
||||||
SLONG frb_next; /* Next block */
|
SLONG frb_next; /* Next block */
|
||||||
};
|
};
|
||||||
typedef frb *FRB;
|
typedef frb *FRB;
|
||||||
|
|
||||||
/* Process blocks */
|
/* Process blocks */
|
||||||
|
|
||||||
struct prb : public event_hdr
|
struct prb
|
||||||
{
|
{
|
||||||
//event_hdr prb_header;
|
event_hdr prb_header;
|
||||||
SRQ prb_processes; /* Process que owned by header */
|
SRQ prb_processes; /* Process que owned by header */
|
||||||
SRQ prb_sessions; /* Sessions within process */
|
SRQ prb_sessions; /* Sessions within process */
|
||||||
SLONG prb_process_id; /* Process id */
|
SLONG prb_process_id; /* Process id */
|
||||||
@ -123,8 +123,8 @@ typedef prb *PRB;
|
|||||||
|
|
||||||
/* Session block */
|
/* Session block */
|
||||||
|
|
||||||
struct ses : public event_hdr {
|
struct ses {
|
||||||
//event_hdr ses_header;
|
event_hdr ses_header;
|
||||||
SRQ ses_sessions; /* Sessions within process */
|
SRQ ses_sessions; /* Sessions within process */
|
||||||
SRQ ses_requests; /* Outstanding requests */
|
SRQ ses_requests; /* Outstanding requests */
|
||||||
PTR ses_interests; /* Historical interests */
|
PTR ses_interests; /* Historical interests */
|
||||||
@ -139,8 +139,8 @@ typedef ses *SES;
|
|||||||
|
|
||||||
/* Event block */
|
/* Event block */
|
||||||
|
|
||||||
struct evnt : public event_hdr {
|
struct evnt {
|
||||||
//event_hdr evnt_header;
|
event_hdr evnt_header;
|
||||||
SRQ evnt_events; /* System event que (owned by header) */
|
SRQ evnt_events; /* System event que (owned by header) */
|
||||||
SRQ evnt_interests; /* Que of request interests in event */
|
SRQ evnt_interests; /* Que of request interests in event */
|
||||||
PTR evnt_hash_collision; /* Hash table collision pointer */
|
PTR evnt_hash_collision; /* Hash table collision pointer */
|
||||||
@ -153,8 +153,8 @@ typedef evnt *EVNT;
|
|||||||
|
|
||||||
/* Request block */
|
/* Request block */
|
||||||
|
|
||||||
struct evt_req : public event_hdr {
|
struct evt_req {
|
||||||
//event_hdr req_header;
|
event_hdr req_header;
|
||||||
SRQ req_requests; /* Request que owned by session block */
|
SRQ req_requests; /* Request que owned by session block */
|
||||||
PTR req_process; /* Parent process block */
|
PTR req_process; /* Parent process block */
|
||||||
PTR req_session; /* Parent session block */
|
PTR req_session; /* Parent session block */
|
||||||
@ -167,8 +167,8 @@ typedef evt_req *EVT_REQ;
|
|||||||
|
|
||||||
/* Request interest block */
|
/* Request interest block */
|
||||||
|
|
||||||
struct rint : public event_hdr {
|
struct rint {
|
||||||
//event_hdr rint_header;
|
event_hdr rint_header;
|
||||||
SRQ rint_interests; /* Que owned by event */
|
SRQ rint_interests; /* Que owned by event */
|
||||||
PTR rint_event; /* Event of interest */
|
PTR rint_event; /* Event of interest */
|
||||||
PTR rint_request; /* Request of interest */
|
PTR rint_request; /* Request of interest */
|
||||||
|
@ -142,7 +142,6 @@ SLONG status_xcp::as_sqlcode() const
|
|||||||
return gds__sqlcode(status);
|
return gds__sqlcode(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void assign_xcp_message(thread_db*, STR*, const TEXT*);
|
|
||||||
static void cleanup_rpb(thread_db*, RPB *);
|
static void cleanup_rpb(thread_db*, RPB *);
|
||||||
static jrd_nod* erase(thread_db*, jrd_nod*, SSHORT);
|
static jrd_nod* erase(thread_db*, jrd_nod*, SSHORT);
|
||||||
static void execute_looper(thread_db*, jrd_req*, jrd_tra*, enum jrd_req::req_s);
|
static void execute_looper(thread_db*, jrd_req*, jrd_tra*, enum jrd_req::req_s);
|
||||||
@ -992,30 +991,6 @@ void EXE_unwind(thread_db* tdbb, jrd_req* request)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void assign_xcp_message(thread_db* tdbb, STR* xcp_msg, const TEXT* msg)
|
|
||||||
{
|
|
||||||
/**************************************
|
|
||||||
*
|
|
||||||
* a s s i g n _ x c p _ m e s s a g e
|
|
||||||
*
|
|
||||||
**************************************
|
|
||||||
*
|
|
||||||
* Functional description
|
|
||||||
* Copy an exception message into XCP structure.
|
|
||||||
*
|
|
||||||
**************************************/
|
|
||||||
SET_TDBB(tdbb);
|
|
||||||
|
|
||||||
if (msg)
|
|
||||||
{
|
|
||||||
const USHORT len = strlen(msg);
|
|
||||||
*xcp_msg = FB_NEW_RPT(*tdbb->tdbb_default, len + 1) str();
|
|
||||||
(*xcp_msg)->str_length = len;
|
|
||||||
memcpy((*xcp_msg)->str_data, msg, len + 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* CVC: Moved to its own routine, originally in store(). */
|
/* CVC: Moved to its own routine, originally in store(). */
|
||||||
static void cleanup_rpb(thread_db* tdbb, RPB *rpb)
|
static void cleanup_rpb(thread_db* tdbb, RPB *rpb)
|
||||||
{
|
{
|
||||||
|
@ -134,7 +134,8 @@ typedef rse* RSE;
|
|||||||
#define rse_singular 2 /* flags rse-type node as from a singleton select */
|
#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_variant 4 /* flags rse as variant (not invariant?) */
|
||||||
|
|
||||||
#define rse_delta (sizeof(class rse)-sizeof(jrd_nod))/sizeof(((jrd_nod*) NULL)->nod_arg[0])
|
// Number of nodes may fit into nod_arg of normal node to get to rse_relation
|
||||||
|
#define rse_delta (sizeof(class rse)-sizeof(jrd_nod))/sizeof(jrd_nod*)
|
||||||
|
|
||||||
// Types of nulls placement for each column in sort order
|
// Types of nulls placement for each column in sort order
|
||||||
#define rse_nulls_default 0
|
#define rse_nulls_default 0
|
||||||
|
@ -933,7 +933,7 @@ static jrd_file* seek_file(jrd_file* file, Buffer_desc* bdb, UINT64* offset,
|
|||||||
lseek_offset = page;
|
lseek_offset = page;
|
||||||
lseek_offset *= dbb->dbb_page_size;
|
lseek_offset *= dbb->dbb_page_size;
|
||||||
|
|
||||||
if (lseek_offset != LSEEK_OFFSET_CAST lseek_offset)
|
if (lseek_offset != (UINT64) LSEEK_OFFSET_CAST lseek_offset)
|
||||||
{
|
{
|
||||||
unix_error("lseek", file, isc_io_32bit_exceeded_err, status_vector);
|
unix_error("lseek", file, isc_io_32bit_exceeded_err, status_vector);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -205,7 +205,8 @@ public:
|
|||||||
};
|
};
|
||||||
typedef jrd_req* JRD_REQ; // CVC: Scheduled for termination, don't use the uppercase type!!!
|
typedef jrd_req* JRD_REQ; // CVC: Scheduled for termination, don't use the uppercase type!!!
|
||||||
|
|
||||||
#define REQ_SIZE (sizeof (jrd_req) - sizeof (((JRD_REQ) NULL)->req_rpb[0]))
|
// Size of request without rpb items at the tail. Used to calculate impure area size
|
||||||
|
#define REQ_SIZE (sizeof (jrd_req) - sizeof (rpb))
|
||||||
|
|
||||||
/* Flags for req_flags */
|
/* Flags for req_flags */
|
||||||
#define req_active 0x1L
|
#define req_active 0x1L
|
||||||
|
@ -43,7 +43,7 @@ static const struct
|
|||||||
{type_MIN , 0, 0},
|
{type_MIN , 0, 0},
|
||||||
{type_vec , sizeof(rem_vec) , sizeof(((rem_vec*) NULL)->vec_object[0])},
|
{type_vec , sizeof(rem_vec) , sizeof(((rem_vec*) NULL)->vec_object[0])},
|
||||||
{type_rdb , sizeof(rdb) , 0},
|
{type_rdb , sizeof(rdb) , 0},
|
||||||
{type_fmt , sizeof(rem_fmt) , sizeof(((rem_fmt*) NULL)->fmt_desc[0])},
|
{type_fmt , sizeof(rem_fmt) , sizeof(dsc/*((rem_fmt*) NULL)->fmt_desc[0]*/)},
|
||||||
{type_rrq , sizeof(rrq) , sizeof(((rrq*) NULL)->rrq_rpt [0])},
|
{type_rrq , sizeof(rrq) , sizeof(((rrq*) NULL)->rrq_rpt [0])},
|
||||||
{type_rtr , sizeof(rtr) , 0},
|
{type_rtr , sizeof(rtr) , 0},
|
||||||
{type_str , sizeof(rem_str) , 1}, // random string block
|
{type_str , sizeof(rem_str) , 1}, // random string block
|
||||||
|
@ -1,108 +0,0 @@
|
|||||||
/*
|
|
||||||
* PROGRAM: JRD Access Method
|
|
||||||
* MODULE: divorce.c
|
|
||||||
* DESCRIPTION: Divorce process from controlling terminal
|
|
||||||
*
|
|
||||||
* The contents of this file are subject to the Interbase Public
|
|
||||||
* License Version 1.0 (the "License"); you may not use this file
|
|
||||||
* except in compliance with the License. You may obtain a copy
|
|
||||||
* of the License at http://www.Inprise.com/IPL.html
|
|
||||||
*
|
|
||||||
* Software distributed under the License is distributed on an
|
|
||||||
* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express
|
|
||||||
* or implied. See the License for the specific language governing
|
|
||||||
* rights and limitations under the License.
|
|
||||||
*
|
|
||||||
* The Original Code was created by Inprise Corporation
|
|
||||||
* and its predecessors. Portions created by Inprise Corporation are
|
|
||||||
* Copyright (C) Inprise Corporation.
|
|
||||||
*
|
|
||||||
* All Rights Reserved.
|
|
||||||
* Contributor(s): ______________________________________.
|
|
||||||
*
|
|
||||||
* 2002.10.29 Sean Leyne - Removed obsolete "Netware" port
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef SUPERSERVER
|
|
||||||
#define FD_SETSIZE 256
|
|
||||||
#endif /* SUPERSERVER */
|
|
||||||
|
|
||||||
#include "firebird.h"
|
|
||||||
#include <sys/ioctl.h>
|
|
||||||
#include <sys/param.h>
|
|
||||||
#include <sys/types.h>
|
|
||||||
#ifdef _AIX
|
|
||||||
#include <sys/select.h>
|
|
||||||
#endif
|
|
||||||
#include "../jrd/common.h"
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef NBBY
|
|
||||||
#define NBBY 8
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef NFDBITS
|
|
||||||
#define NFDBITS (sizeof(SLONG) * NBBY)
|
|
||||||
#define FD_SET(n, p) ((p)->fds_bits[(n)/NFDBITS] |= (1 << ((n) % NFDBITS)))
|
|
||||||
#define FD_CLR(n, p) ((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS)))
|
|
||||||
#define FD_ISSET(n, p) ((p)->fds_bits[(n)/NFDBITS] & (1 << ((n) % NFDBITS)))
|
|
||||||
#define FD_ZERO(p) bzero((SCHAR *)(p), sizeof(*(p)))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
void divorce_terminal( fd_set* mask)
|
|
||||||
{
|
|
||||||
/**************************************
|
|
||||||
*
|
|
||||||
* d i v o r c e _ t e r m i n a l
|
|
||||||
*
|
|
||||||
**************************************
|
|
||||||
*
|
|
||||||
* Functional description
|
|
||||||
* Clean up everything in preparation to become an independent
|
|
||||||
* process. Close all files except for marked by the input mask.
|
|
||||||
*
|
|
||||||
**************************************/
|
|
||||||
int fid;
|
|
||||||
|
|
||||||
/* Close all files other than those explicitly requested to stay open */
|
|
||||||
|
|
||||||
for (fid = 0; fid < NOFILE; fid++)
|
|
||||||
if (!(FD_ISSET(fid, mask)))
|
|
||||||
close(fid);
|
|
||||||
|
|
||||||
#ifdef SIGTTOU
|
|
||||||
/* ignore all the teminal related signal if define */
|
|
||||||
signal(SIGTTOU, SIG_IGN);
|
|
||||||
signal(SIGTTIN, SIG_IGN);
|
|
||||||
signal(SIGTSTP, SIG_IGN);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/* Perform terminal divorce */
|
|
||||||
|
|
||||||
fid = open("/dev/tty", 2);
|
|
||||||
|
|
||||||
if (fid >= 0) {
|
|
||||||
#ifdef TIOCNOTTY
|
|
||||||
ioctl(fid, TIOCNOTTY, 0);
|
|
||||||
#endif
|
|
||||||
close(fid);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Finally, get out of the process group */
|
|
||||||
|
|
||||||
#ifdef HAVE_SETPGRP
|
|
||||||
#ifdef SETPGRP_VOID
|
|
||||||
(void)setpgrp();
|
|
||||||
#else
|
|
||||||
(void)setpgrp(0, 0);
|
|
||||||
#endif /* SETPGRP_VOID */
|
|
||||||
#else
|
|
||||||
#ifdef HAVE_SETPGID
|
|
||||||
(void)setpgid(0, 0);
|
|
||||||
#endif /* HAVE_SETPGID */
|
|
||||||
#endif /* HAVE_SETPGRP */
|
|
||||||
}
|
|
||||||
|
|
@ -32,7 +32,7 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
$Id: inet_server.cpp,v 1.33 2004-01-28 07:50:38 robocop Exp $
|
$Id: inet_server.cpp,v 1.34 2004-03-12 07:00:52 skidder Exp $
|
||||||
*/
|
*/
|
||||||
#include "firebird.h"
|
#include "firebird.h"
|
||||||
#include "../jrd/ib_stdio.h"
|
#include "../jrd/ib_stdio.h"
|
||||||
@ -118,25 +118,10 @@ $Id: inet_server.cpp,v 1.33 2004-01-28 07:50:38 robocop Exp $
|
|||||||
#define sigvector sigvec
|
#define sigvector sigvec
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef NBBY
|
|
||||||
#define NBBY 8
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef SV_INTERRUPT
|
#ifndef SV_INTERRUPT
|
||||||
#define SV_INTERRUPT 0
|
#define SV_INTERRUPT 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef NFDBITS
|
|
||||||
#define NFDBITS (sizeof(SLONG) * NBBY)
|
|
||||||
|
|
||||||
#if !(defined DARWIN)
|
|
||||||
#define FD_SET(n, p) ((p)->fds_bits[(n)/NFDBITS] |= (1 << ((n) % NFDBITS)))
|
|
||||||
#define FD_CLR(n, p) ((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS)))
|
|
||||||
#define FD_ISSET(n, p) ((p)->fds_bits[(n)/NFDBITS] & (1 << ((n) % NFDBITS)))
|
|
||||||
#define FD_ZERO(p) memset((SCHAR *)(p), 0, sizeof(*(p)))
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef SUPERSERVER
|
#ifdef SUPERSERVER
|
||||||
#ifndef WIN_NT
|
#ifndef WIN_NT
|
||||||
#define TEMP_DIR "/tmp"
|
#define TEMP_DIR "/tmp"
|
||||||
@ -189,7 +174,7 @@ int CLIB_ROUTINE main( int argc, char** argv)
|
|||||||
int child, channel;
|
int child, channel;
|
||||||
TEXT *p, c;
|
TEXT *p, c;
|
||||||
#if !(defined VMS)
|
#if !(defined VMS)
|
||||||
fd_set mask;
|
int mask;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// 01 Sept 2003, Nickolay Samofatov
|
// 01 Sept 2003, Nickolay Samofatov
|
||||||
@ -382,9 +367,9 @@ int CLIB_ROUTINE main( int argc, char** argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!debug) {
|
if (!debug) {
|
||||||
FD_ZERO(&mask);
|
mask = 0; // FD_ZERO(&mask);
|
||||||
FD_SET(2, &mask);
|
mask |= 1 << 2; // FD_SET(2, &mask);
|
||||||
divorce_terminal((int) &mask);
|
divorce_terminal(mask);
|
||||||
}
|
}
|
||||||
{ // scope block
|
{ // scope block
|
||||||
ISC_STATUS_ARRAY status_vector;
|
ISC_STATUS_ARRAY status_vector;
|
||||||
|
Loading…
Reference in New Issue
Block a user