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

Treat string literals and string constants with more respect.

This commit is contained in:
robocop 2004-11-08 03:14:17 +00:00
parent 9f72719409
commit a7498d91e6
6 changed files with 24 additions and 22 deletions

View File

@ -803,9 +803,9 @@ public:
bool gbl_sw_convert_ext_tables; bool gbl_sw_convert_ext_tables;
bool gbl_sw_mode; bool gbl_sw_mode;
bool gbl_sw_mode_val; bool gbl_sw_mode_val;
SCHAR* gbl_sw_sql_role; const SCHAR* gbl_sw_sql_role;
SCHAR* gbl_sw_user; const SCHAR* gbl_sw_user;
SCHAR* gbl_sw_password; const SCHAR* gbl_sw_password;
SLONG gbl_sw_skip_count; SLONG gbl_sw_skip_count;
SLONG gbl_sw_page_buffers; SLONG gbl_sw_page_buffers;
burp_fil* gbl_sw_files; burp_fil* gbl_sw_files;

View File

@ -24,7 +24,7 @@
* 2003.08.17 Claudio Valderrama: Fix SF Bug #750659. * 2003.08.17 Claudio Valderrama: Fix SF Bug #750659.
*/ */
/* /*
$Id: restore.epp,v 1.84 2004-11-02 02:41:25 asfernandes Exp $ $Id: restore.epp,v 1.85 2004-11-08 03:12:14 robocop Exp $
*/ */
#include "firebird.h" #include "firebird.h"
@ -560,7 +560,7 @@ int RESTORE_restore (const TEXT* file_name,
{ {
*d++ = (UCHAR) isc_dpb_user_name; *d++ = (UCHAR) isc_dpb_user_name;
*d++ = (UCHAR) strlen (tdgbl->gbl_sw_user); *d++ = (UCHAR) strlen (tdgbl->gbl_sw_user);
for (UCHAR* q = (UCHAR*) tdgbl->gbl_sw_user; *q;) for (const UCHAR* q = (UCHAR*) tdgbl->gbl_sw_user; *q;)
*d++ = *q++; *d++ = *q++;
} }
@ -571,7 +571,7 @@ int RESTORE_restore (const TEXT* file_name,
else else
*d++ = (UCHAR) isc_dpb_password_enc; *d++ = (UCHAR) isc_dpb_password_enc;
*d++ = (UCHAR) strlen (tdgbl->gbl_sw_password); *d++ = (UCHAR) strlen (tdgbl->gbl_sw_password);
for (UCHAR* q = (UCHAR*) tdgbl->gbl_sw_password; *q;) for (const UCHAR* q = (UCHAR*) tdgbl->gbl_sw_password; *q;)
*d++ = *q++; *d++ = *q++;
} }
@ -612,7 +612,7 @@ int RESTORE_restore (const TEXT* file_name,
{ {
*d++ = (UCHAR) isc_dpb_user_name; *d++ = (UCHAR) isc_dpb_user_name;
*d++ = (UCHAR) strlen (tdgbl->gbl_sw_user); *d++ = (UCHAR) strlen (tdgbl->gbl_sw_user);
for (UCHAR* q = (UCHAR*) tdgbl->gbl_sw_user; *q;) for (const UCHAR* q = (UCHAR*) tdgbl->gbl_sw_user; *q;)
*d++ = *q++; *d++ = *q++;
} }
@ -623,7 +623,7 @@ int RESTORE_restore (const TEXT* file_name,
else else
*d++ = (UCHAR) isc_dpb_password_enc; *d++ = (UCHAR) isc_dpb_password_enc;
*d++ = (UCHAR) strlen (tdgbl->gbl_sw_password); *d++ = (UCHAR) strlen (tdgbl->gbl_sw_password);
for (UCHAR* q = (UCHAR*) tdgbl->gbl_sw_password; *q;) for (const UCHAR* q = (UCHAR*) tdgbl->gbl_sw_password; *q;)
*d++ = *q++; *d++ = *q++;
} }

View File

@ -193,7 +193,7 @@ int main( int argc, char *argv[])
*/ */
bool file_nm_sw = false; bool file_nm_sw = false;
SCHAR* string = NULL; const SCHAR* string = NULL;
const SCHAR* const* const end = argv + argc; const SCHAR* const* const end = argv + argc;
++argv; ++argv;

View File

@ -211,7 +211,7 @@ bool PREPARSE_execute(
!strcmp(token, pp_symbols[i].symbol)) !strcmp(token, pp_symbols[i].symbol))
{ {
bool get_out = false; bool get_out = false;
SCHAR* ch; const SCHAR* ch;
SSHORT l; SSHORT l;
// CVC: What's strange, this routine doesn't check token_length // CVC: What's strange, this routine doesn't check token_length
// but it proceeds blindly, trying to exhaust the token itself. // but it proceeds blindly, trying to exhaust the token itself.

View File

@ -30,7 +30,7 @@
*/ */
/* /*
$Id: utld.cpp,v 1.30 2004-09-24 06:48:24 robocop Exp $ $Id: utld.cpp,v 1.31 2004-11-08 03:14:17 robocop Exp $
*/ */
#include "firebird.h" #include "firebird.h"
@ -46,8 +46,8 @@ $Id: utld.cpp,v 1.30 2004-09-24 06:48:24 robocop Exp $
static void cleanup(void *); static void cleanup(void *);
static ISC_STATUS error_dsql_804(ISC_STATUS *, ISC_STATUS); static ISC_STATUS error_dsql_804(ISC_STATUS *, ISC_STATUS);
static SLONG get_numeric_info(SCHAR **); static SLONG get_numeric_info(const SCHAR**);
static SLONG get_string_info(SCHAR **, SCHAR *, int); static SLONG get_string_info(const SCHAR**, SCHAR*, int);
#ifdef NOT_USED_OR_REPLACED #ifdef NOT_USED_OR_REPLACED
#ifdef DEV_BUILD #ifdef DEV_BUILD
static void print_xsqlda(XSQLDA *); static void print_xsqlda(XSQLDA *);
@ -98,7 +98,7 @@ const int DSQL_FAILURE_SPACE = 2048;
ISC_STATUS UTLD_parse_sql_info( ISC_STATUS UTLD_parse_sql_info(
ISC_STATUS* status, ISC_STATUS* status,
USHORT dialect, USHORT dialect,
SCHAR* info, const SCHAR* info,
XSQLDA* xsqlda, XSQLDA* xsqlda,
USHORT* return_index) USHORT* return_index)
{ {
@ -119,7 +119,7 @@ ISC_STATUS UTLD_parse_sql_info(
info += 2; info += 2;
SSHORT n = static_cast<SSHORT> (get_numeric_info(&info)); const SSHORT n = static_cast<SSHORT>(get_numeric_info(&info));
if (dialect >= DIALECT_xsqlda) if (dialect >= DIALECT_xsqlda)
{ {
if (xsqlda->version != SQLDA_VERSION1) if (xsqlda->version != SQLDA_VERSION1)
@ -789,11 +789,12 @@ static ISC_STATUS error_dsql_804( ISC_STATUS * status, ISC_STATUS err)
@param ptr @param ptr
**/ **/
static SLONG get_numeric_info( SCHAR ** ptr) static SLONG get_numeric_info( const SCHAR** ptr)
{ {
SSHORT l = static_cast<SSHORT>(gds__vax_integer(reinterpret_cast<UCHAR*>(*ptr), 2)); const SSHORT l =
static_cast<SSHORT>(gds__vax_integer(reinterpret_cast<const UCHAR*>(*ptr), 2));
*ptr += 2; *ptr += 2;
int item = gds__vax_integer(reinterpret_cast<UCHAR*>(*ptr), l); int item = gds__vax_integer(reinterpret_cast<const UCHAR*>(*ptr), l);
*ptr += l; *ptr += l;
return item; return item;
@ -814,10 +815,11 @@ static SLONG get_numeric_info( SCHAR ** ptr)
@param buffer_len @param buffer_len
**/ **/
static SLONG get_string_info( SCHAR ** ptr, SCHAR * buffer, int buffer_len) static SLONG get_string_info( const SCHAR** ptr, SCHAR * buffer, int buffer_len)
{ {
SCHAR *p = *ptr; const SCHAR* p = *ptr;
SSHORT l = static_cast<SSHORT>(gds__vax_integer(reinterpret_cast<UCHAR*>(p), 2)); SSHORT l =
static_cast<SSHORT>(gds__vax_integer(reinterpret_cast<const UCHAR*>(p), 2));
*ptr += l + 2; *ptr += l + 2;
p += 2; p += 2;

View File

@ -27,7 +27,7 @@
#ifndef DSQL_UTLD_PROTO_H #ifndef DSQL_UTLD_PROTO_H
#define DSQL_UTLD_PROTO_H #define DSQL_UTLD_PROTO_H
ISC_STATUS UTLD_parse_sql_info(ISC_STATUS*, USHORT, SCHAR*, XSQLDA*, USHORT*); ISC_STATUS UTLD_parse_sql_info(ISC_STATUS*, USHORT, const SCHAR*, XSQLDA*, USHORT*);
ISC_STATUS UTLD_parse_sqlda(ISC_STATUS*, sqlda_sup* const, USHORT*, USHORT*, ISC_STATUS UTLD_parse_sqlda(ISC_STATUS*, sqlda_sup* const, USHORT*, USHORT*,
USHORT*, USHORT, XSQLDA*, const USHORT); USHORT*, USHORT, XSQLDA*, const USHORT);
void UTLD_save_status_strings(ISC_STATUS*); void UTLD_save_status_strings(ISC_STATUS*);