From bc4b0d127f31bcb7ce6b7d34291f380f9e1f9d35 Mon Sep 17 00:00:00 2001 From: robocop Date: Sat, 30 Oct 2004 07:05:41 +0000 Subject: [PATCH] Constant is the max size of the string, not the max length. --- src/burp/backup.epp | 6 +++--- src/burp/burp.h | 6 +++--- src/burp/mvol.cpp | 12 ++++++------ 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/burp/backup.epp b/src/burp/backup.epp index d3e9887ec9..c5abbf158a 100644 --- a/src/burp/backup.epp +++ b/src/burp/backup.epp @@ -37,7 +37,7 @@ */ /* -$Id: backup.epp,v 1.67 2004-10-30 05:58:47 robocop Exp $ +$Id: backup.epp,v 1.68 2004-10-30 07:05:41 robocop Exp $ */ #include "firebird.h" @@ -1262,7 +1262,7 @@ void put_array( burp_fld* field, burp_rel* relation, ISC_QUAD* blob_id) if (return_length) { - UCHAR* p; + const UCHAR* p; if (tdgbl->gbl_sw_transportable) { lstring xdr_slice; @@ -1305,7 +1305,7 @@ void put_asciz( const SCHAR attribute, const TEXT* string) const ULONG l = strlen(string); #pragma FB_COMPILER_MESSAGE("CVC: Check that file doesn't exceed 255 in length!") - // We'll have to ensure that length < MAX_FILE_NAME_LENGTH + // We'll have to ensure that length < MAX_FILE_NAME_SIZE put(tdgbl, (UCHAR) (attribute)); put(tdgbl, (UCHAR) (l)); diff --git a/src/burp/burp.h b/src/burp/burp.h index dd05543273..aa2c423179 100644 --- a/src/burp/burp.h +++ b/src/burp/burp.h @@ -640,7 +640,7 @@ enum gfld_flags_vals { // CVC: Could use MAXPATHLEN, but what about restoring in a different system? // I need to review if we tolerate different lengths for different OS's here. -const int MAX_FILE_NAME_LENGTH = 256; +const int MAX_FILE_NAME_SIZE = 256; // Note that this typedef is also defined in JRD.H and REMOTE.H // but for some reason we are avoiding including JRD.H @@ -832,8 +832,8 @@ public: UCHAR* mvol_io_volume; UCHAR* mvol_io_header; UCHAR* mvol_io_data; - TEXT mvol_db_name_buffer [MAX_FILE_NAME_LENGTH]; - SCHAR mvol_old_file [MAX_FILE_NAME_LENGTH]; + TEXT mvol_db_name_buffer [MAX_FILE_NAME_SIZE]; + SCHAR mvol_old_file [MAX_FILE_NAME_SIZE]; int mvol_volume_count; USHORT mvol_empty_file; isc_db_handle db_handle; diff --git a/src/burp/mvol.cpp b/src/burp/mvol.cpp index efb3c5fbb2..582cd7e8bb 100644 --- a/src/burp/mvol.cpp +++ b/src/burp/mvol.cpp @@ -189,8 +189,8 @@ void MVOL_init_read(const char* database_name, // unused? if (file_name != NULL) { - strncpy(tdgbl->mvol_old_file, file_name, MAX_FILE_NAME_LENGTH); - tdgbl->mvol_old_file[MAX_FILE_NAME_LENGTH - 1] = 0; + strncpy(tdgbl->mvol_old_file, file_name, MAX_FILE_NAME_SIZE); + tdgbl->mvol_old_file[MAX_FILE_NAME_SIZE - 1] = 0; } else { @@ -237,8 +237,8 @@ void MVOL_init_write(const char* database_name, // unused? if (file_name != NULL) { - strncpy(tdgbl->mvol_old_file, file_name, MAX_FILE_NAME_LENGTH); - tdgbl->mvol_old_file[MAX_FILE_NAME_LENGTH - 1] = 0; + strncpy(tdgbl->mvol_old_file, file_name, MAX_FILE_NAME_SIZE); + tdgbl->mvol_old_file[MAX_FILE_NAME_SIZE - 1] = 0; } else { @@ -866,7 +866,7 @@ static DESC next_volume( DESC handle, ULONG mode, bool full_buffer) // Loop until we have opened a file successfully - SCHAR new_file[MAX_FILE_NAME_LENGTH]; + SCHAR new_file[MAX_FILE_NAME_SIZE]; DESC new_desc = INVALID_HANDLE_VALUE; for (;;) { @@ -1097,7 +1097,7 @@ static bool read_header(DESC handle, USHORT* format, bool init_flag) { - TEXT buffer[MAX_FILE_NAME_LENGTH], msg[BURP_MSG_GET_SIZE]; + TEXT buffer[MAX_FILE_NAME_SIZE], msg[BURP_MSG_GET_SIZE]; BurpGlobals* tdgbl = BurpGlobals::getSpecific();