From c986de33a2c51f89e3b9e9c17b85a5761a6119b5 Mon Sep 17 00:00:00 2001 From: asfernandes Date: Wed, 22 Apr 2009 01:58:40 +0000 Subject: [PATCH] Misc --- src/alice/alice_meta.epp | 3 -- src/burp/burp.cpp | 67 ++++++++++++++++---------------- src/burp/spit.cpp | 6 +-- src/common/cvt.cpp | 8 +++- src/dsql/gen.cpp | 1 - src/dsql/keywords.cpp | 3 +- src/dsql/metd.epp | 4 +- src/jrd/isc_sync.cpp | 10 ++--- src/remote/os/win32/ibconfig.cpp | 2 + src/remote/os/win32/property.cpp | 2 +- src/remote/os/win32/srvr_w32.cpp | 2 +- src/remote/os/win32/wnet.cpp | 6 +-- src/remote/xdr.cpp | 2 +- 13 files changed, 58 insertions(+), 58 deletions(-) diff --git a/src/alice/alice_meta.epp b/src/alice/alice_meta.epp index 9b82ff45d7..8919f915b6 100644 --- a/src/alice/alice_meta.epp +++ b/src/alice/alice_meta.epp @@ -1,6 +1,4 @@ /* - * tab=4 - * *____________________________________________________________ * * PROGRAM: Alice (All Else) Utility @@ -63,7 +61,6 @@ static USHORT snarf_blob(ISC_QUAD*, USHORT, TEXT*); // table used to determine capabilities, checking for specific // fields in system relations - struct rfr_tab_t { const TEXT* relation; diff --git a/src/burp/burp.cpp b/src/burp/burp.cpp index 9cd74cc304..7712c3ccd3 100644 --- a/src/burp/burp.cpp +++ b/src/burp/burp.cpp @@ -188,7 +188,7 @@ static int api_gbak(Firebird::UtilSvc* uSvc, in_sw_tab_t* const in_sw_tab) case IN_SW_BURP_SE: // service name if (itr >= argc - 1) { - // user name parameter missing + // user name parameter missing BURP_error(inSw->in_sw == IN_SW_BURP_USER ? 188 : // password parameter missing inSw->in_sw == IN_SW_BURP_PASS ? 189 : @@ -1660,6 +1660,7 @@ static gbak_action open_files(const TEXT* file1, flag = QUIT; break; } + // We ignore SIGPIPE so that we can report an IO error when we // try to write to the broken pipe. @@ -1729,40 +1730,39 @@ static gbak_action open_files(const TEXT* file1, } - // If we got to here, then we're really not backing up a database, + // If we got to here, then we're really not backing up a database, // so open a backup file. - /* There are four possible cases such as: - * - * 1. restore single backup file to single db file - * 2. restore single backup file to multiple db files - * 3. restore multiple backup files (join operation) to single db file - * 4. restore multiple backup files (join operation) to multiple db files - * - * Just looking at the command line, we can't say for sure whether it is a - * specification of the last file to be join or it is a specification of the - * primary db file (case 4), for example: - * - * gbak -c gbk1 gbk2 gbk3 db1 200 db2 500 db3 -v - * ^^^ - * db1 could be either the last file to be join or primary db file - * - * Since 'gbk' and 'gsplit' formats are different (gsplit file has its own - * header record) hence we can use it as follows: - * - * - open first file - * - read & check a header record - * - * If a header is identified as a 'gsplit' one then we know exactly how - * many files need to be join and in which order. We keep opening a file by - * file till we reach the last one to be join. During this step we check - * that the files are accessible and are in proper order. It gives us - * possibility to let silly customer know about an error as soon as possible. - * Besides we have to find out which file is going to be a db file. - * - * If header is not identified as a 'gsplit' record then we assume that - * we got a single backup file. - */ + // There are four possible cases such as: + // + // 1. restore single backup file to single db file + // 2. restore single backup file to multiple db files + // 3. restore multiple backup files (join operation) to single db file + // 4. restore multiple backup files (join operation) to multiple db files + // + // Just looking at the command line, we can't say for sure whether it is a + // specification of the last file to be join or it is a specification of the + // primary db file (case 4), for example: + // + // gbak -c gbk1 gbk2 gbk3 db1 200 db2 500 db3 -v + // ^^^ + // db1 could be either the last file to be join or primary db file + // + // Since 'gbk' and 'gsplit' formats are different (gsplit file has its own + // header record) hence we can use it as follows: + // + // - open first file + // - read & check a header record + // + // If a header is identified as a 'gsplit' one then we know exactly how + // many files need to be join and in which order. We keep opening a file by + // file till we reach the last one to be join. During this step we check + // that the files are accessible and are in proper order. It gives us + // possibility to let silly customer know about an error as soon as possible. + // Besides we have to find out which file is going to be a db file. + // + // If header is not identified as a 'gsplit' record then we assume that + // we got a single backup file. fil = tdgbl->gbl_sw_files; tdgbl->gbl_sw_backup_files = tdgbl->gbl_sw_files; @@ -1929,6 +1929,7 @@ static gbak_action open_files(const TEXT* file1, // if we got an error from attach database and we have replace switch set // then look for error from attach returned due to not owner, if we are // not owner then return the error status back up + BURP_error(274, true); // msg # 274 : Cannot restore over current database, must be sysdba // or owner of the existing database. diff --git a/src/burp/spit.cpp b/src/burp/spit.cpp index c9d34b0a5b..d5a4fb4a47 100644 --- a/src/burp/spit.cpp +++ b/src/burp/spit.cpp @@ -1165,12 +1165,10 @@ static int flush_io_buff(const UCHAR* remaining_io, SLONG write_cnt; - if (file_size > remaining_io_len) { + if (file_size > remaining_io_len) write_cnt = write(output_fl_desc, remaining_io, remaining_io_len); - } - else { // file_size <= remaining_io_len + else // file_size <= remaining_io_len write_cnt = write(output_fl_desc, remaining_io, (unsigned int) file_size); - } switch (write_cnt) { diff --git a/src/common/cvt.cpp b/src/common/cvt.cpp index e81a41957e..950a95a469 100644 --- a/src/common/cvt.cpp +++ b/src/common/cvt.cpp @@ -106,7 +106,7 @@ using namespace Firebird; #define LONG_LIMIT ((1L << 30) / 5) // NOTE: The syntax for the below line may need modification to ensure -// the result of 1 << 62 is a quad +// the result of 1 << 62 is a quad #define QUAD_LIMIT ((((SINT64) 1) << 62) / 5) #define INT64_LIMIT ((((SINT64) 1) << 62) / 5) @@ -869,7 +869,8 @@ SLONG CVT_get_long(const dsc* desc, SSHORT scale, ErrorFunction err) val64 = *((SINT64 *) p); // adjust for scale first, *before* range-checking the value. - if (scale > 0) { + if (scale > 0) + { SLONG fraction = 0; do { if (scale == 1) @@ -886,11 +887,13 @@ SLONG CVT_get_long(const dsc* desc, SSHORT scale, ErrorFunction err) val64--; } else if (scale < 0) + { do { if ((val64 > INT64_LIMIT) || (val64 < -INT64_LIMIT)) err(Arg::Gds(isc_arith_except) << Arg::Gds(isc_numeric_out_of_range)); val64 *= 10; } while (++scale); + } if ((val64 > LONG_MAX_int64) || (val64 < LONG_MIN_int64)) err(Arg::Gds(isc_arith_except) << Arg::Gds(isc_numeric_out_of_range)); @@ -976,6 +979,7 @@ SLONG CVT_get_long(const dsc* desc, SSHORT scale, ErrorFunction err) fraction = value % 10; value /= 10; } while (--scale); + if (fraction > 4) value++; // The following 2 lines are correct for platforms where diff --git a/src/dsql/gen.cpp b/src/dsql/gen.cpp index ff1de89d0a..d9195da3e7 100644 --- a/src/dsql/gen.cpp +++ b/src/dsql/gen.cpp @@ -1590,7 +1590,6 @@ static void gen_constant( CompiledStatement* statement, const dsc* desc, bool ne // If the value will fit into a 32-bit signed integer, generate // it that way, else as an INT64. - if ((i64value >= (SINT64) MIN_SLONG) && (i64value <= (SINT64) MAX_SLONG)) { stuff(statement, blr_long); diff --git a/src/dsql/keywords.cpp b/src/dsql/keywords.cpp index b80eb3cd34..086e2d5581 100644 --- a/src/dsql/keywords.cpp +++ b/src/dsql/keywords.cpp @@ -410,8 +410,7 @@ static const TOK tokens[] = // This method is currently used in isql/isql.epp to check if a // user field is a reserved word, and hence needs to be quoted. // Obviously a hash table would make this a little quicker. -// -// MOD 29-June-2002 +// MOD 29-June-2002 extern "C" { diff --git a/src/dsql/metd.epp b/src/dsql/metd.epp index 78d0e06833..fcba9938b7 100644 --- a/src/dsql/metd.epp +++ b/src/dsql/metd.epp @@ -59,8 +59,8 @@ using namespace Jrd; using namespace Firebird; // NOTE: The static definition of DB and gds_trans by gpre will not -// be used by the meta data routines. Each of those routines has -// its own local definition of these variables. +// be used by the meta data routines. Each of those routines has +// its own local definition of these variables. DATABASE DB = STATIC "yachts.lnk"; diff --git a/src/jrd/isc_sync.cpp b/src/jrd/isc_sync.cpp index 04b41e135b..6d4cfe3476 100644 --- a/src/jrd/isc_sync.cpp +++ b/src/jrd/isc_sync.cpp @@ -2074,6 +2074,7 @@ static bool setSharedMemoryAccessRights(ISC_STATUS* status_vector, SLONG shmid) char secDb[MAXPATHLEN]; SecurityDatabase::getPath(secDb); struct stat st; + if (stat(secDb, &st) == 0) { shmid_ds ds; @@ -2199,7 +2200,7 @@ UCHAR* ISC_map_file(ISC_STATUS* status_vector, */ if ((shmid = shmget(key, 0, 0)) == -1) { string msg; - msg.printf("shmget(0x%x, 0, PRIV)", key); + msg.printf("shmget(0x%x, 0, 0)", key); error(status_vector, msg.c_str(), errno); fclose(fp); return NULL; @@ -2217,8 +2218,7 @@ UCHAR* ISC_map_file(ISC_STATUS* status_vector, we use IPC_EXCL flag to get an error if by some miracle the sagment with the same key is already exists */ - if ((shmid = shmget(key, length, IPC_CREAT | IPC_EXCL | PRIV)) == - -1) + if ((shmid = shmget(key, length, IPC_CREAT | IPC_EXCL | PRIV)) == -1) { string msg; msg.printf("shmget(0x%x, %d, IPC_CREAT | IPC_EXCL | PRIV)", key, length); @@ -2291,7 +2291,7 @@ UCHAR* ISC_map_file(ISC_STATUS* status_vector, length = buf.shm_segsz; if ((shmid = shmget(key, length, 0)) == -1) { string msg; - msg.printf("shmget(0x%x, %d, PRIV)", key, length); + msg.printf("shmget(0x%x, %d, 0)", key, length); error(status_vector, msg.c_str(), errno); fclose(fp); return NULL; @@ -2314,7 +2314,7 @@ UCHAR* ISC_map_file(ISC_STATUS* status_vector, if ((shmid = shmget(key, length, 0)) == -1) { string msg; - msg.printf("shmget(0x%x, %d, PRIV)", key, length); + msg.printf("shmget(0x%x, %d, 0)", key, length); error(status_vector, msg.c_str(), errno); fclose(fp); return NULL; diff --git a/src/remote/os/win32/ibconfig.cpp b/src/remote/os/win32/ibconfig.cpp index 20334ec56b..8318ab5f58 100644 --- a/src/remote/os/win32/ibconfig.cpp +++ b/src/remote/os/win32/ibconfig.cpp @@ -503,8 +503,10 @@ BOOL WriteFBSettings(HWND hDlg) isc_vax_integer((SCHAR *) & lCachePages, sizeof(long)); pchPtr += sizeof(long); */ + *psLen = pchPtr - pchSendBuf - sizeof(short) - sizeof(char); *psLen = (short) isc_vax_integer((SCHAR *) psLen, sizeof(short)); + // Query service with set_config char szResBuf[16]; // Response buffer diff --git a/src/remote/os/win32/property.cpp b/src/remote/os/win32/property.cpp index d124654a84..b0a89a961c 100644 --- a/src/remote/os/win32/property.cpp +++ b/src/remote/os/win32/property.cpp @@ -57,7 +57,7 @@ #include "../remote/os/win32/ibsvrhlp.h" #include "../remote/os/win32/chop_proto.h" -#include "../common/thd.h" // get jrd_proto.h to declare the function +#include "../common/thd.h" // get jrd_proto.h to declare the function #include "../jrd/jrd_proto.h" // JRD_num_attachments() #include // sprintf() diff --git a/src/remote/os/win32/srvr_w32.cpp b/src/remote/os/win32/srvr_w32.cpp index 1ac1732fbb..824a073e47 100644 --- a/src/remote/os/win32/srvr_w32.cpp +++ b/src/remote/os/win32/srvr_w32.cpp @@ -312,7 +312,7 @@ int WINAPI WinMain(HINSTANCE hThisInst, HINSTANCE hPrevInst, LPSTR lpszArgs, int #ifdef DEBUG_GDS_ALLOC // In Debug mode - this will report all server-side memory leaks - // due to remote access + // due to remote access //gds_alloc_report(0, __FILE__, __LINE__); char name[MAXPATHLEN]; diff --git a/src/remote/os/win32/wnet.cpp b/src/remote/os/win32/wnet.cpp index 25f7192a4c..b7c1c2ca87 100644 --- a/src/remote/os/win32/wnet.cpp +++ b/src/remote/os/win32/wnet.cpp @@ -74,7 +74,7 @@ static void exit_handler(void*); #endif static void force_close(rem_port*); static rem_str* make_pipe_name(const TEXT*, const TEXT*, const TEXT*); -static rem_port* receive(rem_port*, PACKET*); +static rem_port* receive(rem_port*, PACKET*); static int send_full(rem_port*, PACKET*); static int send_partial(rem_port*, PACKET*); static int xdrwnet_create(XDR*, rem_port*, UCHAR*, USHORT, xdr_op); @@ -167,7 +167,7 @@ rem_port* WNET_analyze(const Firebird::PathName& file_name, cnct->p_cnct_file.cstr_address = reinterpret_cast(file_name.c_str()); // Note: prior to V3.1E a receivers could not in truth handle more - // then 5 protocol descriptions; however, this restriction does not + // than 5 protocol descriptions; however, this restriction does not // apply to Windows since it was created in 4.0 // If we want user verification, we can't speak anything less than version 7 @@ -798,7 +798,7 @@ static void disconnect(rem_port* port) port->port_async = NULL; } - // If this is a sub-port, unlink it from it's parent + // If this is a sub-port, unlink it from its parent rem_port* const parent = port->port_parent; if (parent) diff --git a/src/remote/xdr.cpp b/src/remote/xdr.cpp index f317d0a33a..683061c52d 100644 --- a/src/remote/xdr.cpp +++ b/src/remote/xdr.cpp @@ -34,7 +34,7 @@ #include "../jrd/gds_proto.h" #ifdef BURP -#include "../burp/misc_proto.h" // Was "../burp/misc_pro.h" -Jeevan +#include "../burp/misc_proto.h" inline UCHAR* XDR_ALLOC(ULONG size) { return MISC_alloc_burp(size);