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

cleanup of methods, storing data in plain char*

This commit is contained in:
alexpeshkoff 2004-11-14 18:05:13 +00:00
parent 8fd41813da
commit ea9e900ab3
6 changed files with 11 additions and 20 deletions

View File

@ -107,18 +107,6 @@ namespace Firebird {
memset(stringBuffer, c, sizeL);
}
AbstractString::size_type AbstractString::copy_to(pointer destination,
size_type bufsize) const
{
if (!destination || !bufsize)
return 0;
const size_type copy_len = length() < bufsize ? length() : bufsize - 1;
memcpy(destination, stringBuffer, copy_len);
destination[copy_len] = 0;
return copy_len;
}
void AbstractString::AdjustRange(size_type length, size_type& pos, size_type& n) {
if (pos == npos) {
pos = length > n ? length - n : 0;

View File

@ -209,15 +209,15 @@ namespace Firebird
void reserve(size_type n = 0);
void resize(size_type n, char_type c = ' ');
/* deprecated STL-compliant method - unsafe!
inline size_type copy_from(pointer s, size_type n, size_type pos = 0) const
{
AdjustRange(length(), pos, n);
memcpy(s, c_str() + pos, n);
return n;
}
*/
size_type copy_to(pointer destination, size_type bufsize) const;
/* inline void swap(AbstractString& str) {
Storage *tmp = StringData;
StringData = str.StringData;
@ -346,11 +346,15 @@ namespace Firebird
inline void alltrim(const_pointer ToTrim = " ") {
baseTrim(TrimBoth, ToTrim);
}
bool LoadFromFile(FILE *file);
void vprintf(const char* Format, va_list params);
void printf(const char* Format, ...);
inline int saveTo(char* to, size_type toSize) const
inline int copyTo(pointer to, size_type toSize) const
{
fb_assert(to);
fb_assert(toSize);
if (--toSize > length())
{
toSize = length();

View File

@ -907,7 +907,7 @@ static bool add_shadow( thread_db* tdbb, SSHORT phase, DeferredWork* work,
expanded_fname = F.RDB$FILE_NAME;
ISC_expand_filename(expanded_fname, false);
MODIFY F USING
expanded_fname.saveTo(F.RDB$FILE_NAME, sizeof(F.RDB$FILE_NAME));
expanded_fname.copyTo(F.RDB$FILE_NAME, sizeof(F.RDB$FILE_NAME));
END_MODIFY;
for (shadow = dbb->dbb_shadow; shadow; shadow = shadow->sdw_next)

View File

@ -818,7 +818,7 @@ void DYN_define_file(Global* gbl,
STORE(REQUEST_HANDLE request TRANSACTION_HANDLE gbl->gbl_transaction)
X IN RDB$FILES
temp_f.saveTo(X.RDB$FILE_NAME, sizeof(X.RDB$FILE_NAME));
temp_f.copyTo(X.RDB$FILE_NAME, sizeof(X.RDB$FILE_NAME));
X.RDB$SHADOW_NUMBER = (SSHORT)shadow_number;
X.RDB$FILE_FLAGS = 0;
X.RDB$FILE_FLAGS.NULL = FALSE;

View File

@ -1385,7 +1385,7 @@ SSHORT API_ROUTINE gds__msg_format(void* handle,
fb_utils::snprintf(formatted, size, "message system code %d", n);
s += formatted;
}
s.copy_to(formatted, size);
s.copyTo(formatted, size);
}
const USHORT l = strlen(formatted);

View File

@ -39,7 +39,6 @@ bool ISC_check_if_remote(const Firebird::PathName&, bool);
void ISC_expand_filename(Firebird::PathName&, bool);
// This form of ISC_expand_filename makes epp files happy
// It's explicit that expanded amy be equal to unexpanded
inline int ISC_expand_filename(const TEXT* unexpanded,
USHORT len_unexpanded,
TEXT* expanded,
@ -49,7 +48,7 @@ inline int ISC_expand_filename(const TEXT* unexpanded,
Firebird::PathName pn(unexpanded,
len_unexpanded ? len_unexpanded : strlen(unexpanded));
ISC_expand_filename(pn, expand_share);
return pn.saveTo(expanded, len_expanded);
return pn.copyTo(expanded, len_expanded);
}
#ifdef VMS