diff --git a/src/common/classes/SafeArg.h b/src/common/classes/SafeArg.h index 392f5e68d8..44eec7666b 100644 --- a/src/common/classes/SafeArg.h +++ b/src/common/classes/SafeArg.h @@ -107,13 +107,12 @@ class BaseStream; // This is the main class that does the magic of receiving a chain of type-safe // parameters. All parameters should be appended to it using the << operator. -// Only basic data types are supported, with the exception of length counted strings. +// Only basic data types are supported. // The allowed types are char, UCHAR, all lengths of signed/unsigned integral values, -// the SINT128 fake type (a struct, really), double, strings, UCHAR strings, -// counted string and the (non-const) void pointer. Care should be taken to not -// pass something by address (except char* and UCHAR* types) because the compiler -// may route it to the overload for the void pointer and it will be printed as an -// address in hex. +// the SINT128 fake type (a struct, really), double, strings, UCHAR strings and the +// (non-const) void pointer. Care should be taken to not pass something by address +// (except char* and UCHAR* types) because the compiler may route it to the overload +// for the void pointer and it will be printed as an address in hex. // An object of this class can be created, filled and passed later to the printing // routines, cleaned with clear(), refilled and passed again to the printing routines // or simply constructed as an anonymous object and being filled at the same time diff --git a/src/common/fb_exception.cpp b/src/common/fb_exception.cpp index 973508560c..913a1ce4aa 100644 --- a/src/common/fb_exception.cpp +++ b/src/common/fb_exception.cpp @@ -41,7 +41,7 @@ char* dupStringTemp2(const char* s) ISC_STATUS dupStringTemp(const char* s) { - return (ISC_STATUS)(IPTR)(dupStringTemp2(s)); + return (ISC_STATUS)(IPTR) dupStringTemp2(s); } void fill_status(ISC_STATUS* ptr, const ISC_STATUS* orig_status) diff --git a/src/dsql/errd.cpp b/src/dsql/errd.cpp index f544cf623e..0062e6ba3a 100644 --- a/src/dsql/errd.cpp +++ b/src/dsql/errd.cpp @@ -281,15 +281,13 @@ static void internal_post(const ISC_STATUS* tmp_status) i = err_status_len + tmp_status_len; if (i < ISC_STATUS_LENGTH) { - memcpy(&status_vector[err_status_len], tmp_status, - sizeof(ISC_STATUS) * tmp_status_len); + memcpy(&status_vector[err_status_len], tmp_status, sizeof(ISC_STATUS) * tmp_status_len); ERR_make_permanent(&status_vector[err_status_len]); // copy current warning(s) to the status_vector if (warning_count && i + warning_count - 1 < ISC_STATUS_LENGTH) { memcpy(&status_vector[i - 1], warning_status, sizeof(ISC_STATUS) * warning_count); - } } ERRD_punt(); diff --git a/src/dsql/parse.y b/src/dsql/parse.y index 6de13ab7ed..12a9f77feb 100644 --- a/src/dsql/parse.y +++ b/src/dsql/parse.y @@ -2764,7 +2764,7 @@ non_charset_simple_type : national_character_type ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-104) << Arg::Gds(isc_sql_db_dialect_dtype_unsupport) << Arg::Num(db_dialect) << Arg::Str("TIME")); - lex.g_field->fld_dtype = dtype_sql_time; + lex.g_field->fld_dtype = dtype_sql_time; lex.g_field->fld_length = sizeof (SLONG); } | TIMESTAMP diff --git a/src/include/fb_exception.h b/src/include/fb_exception.h index de79862862..26487d6d74 100644 --- a/src/include/fb_exception.h +++ b/src/include/fb_exception.h @@ -56,7 +56,8 @@ public: CircularStringsBuffer() throw() { init(); } explicit CircularStringsBuffer(MemoryPool&) throw() { init(); } - virtual char* alloc(const char* string, size_t& length) { + virtual char* alloc(const char* string, size_t& length) + { // if string too long, truncate it if (length > BUFFER_SIZE / 4) length = BUFFER_SIZE / 4; diff --git a/src/jrd/extds/ExtDS.cpp b/src/jrd/extds/ExtDS.cpp index 364358a832..e9c7d033f3 100644 --- a/src/jrd/extds/ExtDS.cpp +++ b/src/jrd/extds/ExtDS.cpp @@ -943,8 +943,8 @@ void Statement::preprocess(const string& sql, string& ret) passAsIs = false; } else { - passAsIs = !(ident == "INSERT" || ident == "UPDATE" || ident == "DELETE" - || ident == "MERGE" || ident == "SELECT" || ident == "WITH"); + passAsIs = !(ident == "INSERT" || ident == "UPDATE" || ident == "DELETE" || + ident == "MERGE" || ident == "SELECT" || ident == "WITH"); } if (passAsIs) diff --git a/src/jrd/os/posix/unix.cpp b/src/jrd/os/posix/unix.cpp index dbf62cf6b1..052c326f4f 100644 --- a/src/jrd/os/posix/unix.cpp +++ b/src/jrd/os/posix/unix.cpp @@ -118,7 +118,7 @@ using namespace Firebird; static jrd_file* seek_file(jrd_file*, BufferDesc*, FB_UINT64*, ISC_STATUS*); static jrd_file* setup_file(Database*, const PathName&, int, bool); -static bool unix_error(const TEXT*, const jrd_file*, ISC_STATUS, ISC_STATUS* = 0); +static bool unix_error(const TEXT*, const jrd_file*, ISC_STATUS, ISC_STATUS* = NULL); #if !(defined HAVE_PREAD && defined HAVE_PWRITE) static SLONG pread(int, SCHAR *, SLONG, SLONG); static SLONG pwrite(int, SCHAR *, SLONG, SLONG); @@ -1099,23 +1099,31 @@ static bool raw_devices_validate_database(int desc, const PathName& file_name) /* Read in database header. Code lifted from PIO_header. */ if (desc == -1) + { ERR_post(Arg::Gds(isc_io_error) << Arg::Str("raw_devices_validate_database") << Arg::Str(file_name) << Arg::Gds(isc_io_read_err) << Arg::Unix(errno)); + } for (int i = 0; i < IO_RETRY; i++) { if (lseek (desc, LSEEK_OFFSET_CAST 0, 0) == (off_t) -1) + { ERR_post(Arg::Gds(isc_io_error) << Arg::Str("lseek") << Arg::Str(file_name) << Arg::Gds(isc_io_read_err) << Arg::Unix(errno)); + } + const ssize_t bytes = read (desc, header, sizeof(header)); if (bytes == sizeof(header)) goto read_finished; + if (bytes == -1 && !SYSCALL_INTERRUPTED(errno)) + { ERR_post(Arg::Gds(isc_io_error) << Arg::Str("read") << Arg::Str(file_name) << Arg::Gds(isc_io_read_err) << Arg::Unix(errno)); + } } ERR_post(Arg::Gds(isc_io_error) << Arg::Str("read_retry") << @@ -1124,10 +1132,12 @@ static bool raw_devices_validate_database(int desc, const PathName& file_name) read_finished: /* Rewind file pointer */ - if (lseek (desc, LSEEK_OFFSET_CAST 0, 0) == (off_t)-1) + if (lseek (desc, LSEEK_OFFSET_CAST 0, 0) == (off_t) -1) + { ERR_post(Arg::Gds(isc_io_error) << Arg::Str("lseek") << Arg::Str(file_name) << Arg::Gds(isc_io_read_err) << Arg::Unix(errno)); + } /* Validate database header. Code lifted from PAG_header. */ if (hp->hdr_header.pag_type != pag_header /*|| hp->hdr_sequence*/) @@ -1164,10 +1174,13 @@ static int raw_devices_unlink_database(const PathName& file_name) { if ((desc = open (file_name.c_str(), O_RDWR | O_BINARY)) != -1) break; + if (!SYSCALL_INTERRUPTED(errno)) + { ERR_post(Arg::Gds(isc_io_error) << Arg::Str("open") << Arg::Str(file_name) << Arg::Gds(isc_io_open_err) << Arg::Unix(errno)); + } } memset(header, 0xa5, sizeof(header)); diff --git a/src/jrd/os/win32/winnt.cpp b/src/jrd/os/win32/winnt.cpp index bdf2bbee6a..aaa95d8852 100644 --- a/src/jrd/os/win32/winnt.cpp +++ b/src/jrd/os/win32/winnt.cpp @@ -571,12 +571,14 @@ jrd_file* PIO_open(Database* dbb, FILE_ATTRIBUTE_NORMAL | g_dwExtraFlags, 0); - if (desc == INVALID_HANDLE_VALUE) { + if (desc == INVALID_HANDLE_VALUE) + { ERR_post(Arg::Gds(isc_io_error) << Arg::Str("CreateFile (open)") << Arg::Str(file_name) << Arg::Gds(isc_io_open_err) << Arg::Windows(GetLastError())); } - else { + else + { /* If this is the primary file, set Database flag to indicate that it is * being opened ReadOnly. This flag will be used later to compare with * the Header Page flag setting to make sure that the database is set @@ -1123,7 +1125,8 @@ static bool nt_error(TEXT* string, * **************************************/ - if (status_vector) { + if (status_vector) + { ERR_build_status(status_vector, Arg::Gds(isc_io_error) << Arg::Str(string) << Arg::Str(file->fil_string) << Arg::Gds(operation) << Arg::Windows(GetLastError()));