mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-24 12:03:02 +01:00
Misc and style.
This commit is contained in:
parent
97019a87ee
commit
3dd3b09005
@ -220,7 +220,8 @@ int name_length(const TEXT* const name)
|
||||
*
|
||||
**************************************/
|
||||
const TEXT* q = name - 1;
|
||||
for (const TEXT* p = name; *p; p++) {
|
||||
for (const TEXT* p = name; *p; p++)
|
||||
{
|
||||
if (*p != ' ') {
|
||||
q = p;
|
||||
}
|
||||
@ -428,7 +429,8 @@ bool isGlobalKernelPrefix()
|
||||
|
||||
DynLibHandle hmodAdvApi(LoadLibrary("advapi32.dll"));
|
||||
|
||||
if (!hmodAdvApi) {
|
||||
if (!hmodAdvApi)
|
||||
{
|
||||
gds__log("LoadLibrary failed for advapi32.dll. Error code: %lu", GetLastError());
|
||||
return false;
|
||||
}
|
||||
@ -444,7 +446,8 @@ bool isGlobalKernelPrefix()
|
||||
PFnPrivilegeCheck pfnPrivilegeCheck =
|
||||
(PFnPrivilegeCheck) GetProcAddress(hmodAdvApi, "PrivilegeCheck");
|
||||
|
||||
if (!pfnOpenProcessToken || !pfnLookupPrivilegeValue || !pfnPrivilegeCheck) {
|
||||
if (!pfnOpenProcessToken || !pfnLookupPrivilegeValue || !pfnPrivilegeCheck)
|
||||
{
|
||||
// Should never happen, really
|
||||
gds__log("Cannot access privilege management API");
|
||||
return false;
|
||||
@ -452,7 +455,8 @@ bool isGlobalKernelPrefix()
|
||||
|
||||
HANDLE hProcess = GetCurrentProcess();
|
||||
HANDLE hToken;
|
||||
if (pfnOpenProcessToken(hProcess, TOKEN_QUERY, &hToken) == 0) {
|
||||
if (pfnOpenProcessToken(hProcess, TOKEN_QUERY, &hToken) == 0)
|
||||
{
|
||||
gds__log("OpenProcessToken failed. Error code: %lu", GetLastError());
|
||||
return false;
|
||||
}
|
||||
@ -461,7 +465,8 @@ bool isGlobalKernelPrefix()
|
||||
memset(&ps, 0, sizeof(ps));
|
||||
ps.Control = PRIVILEGE_SET_ALL_NECESSARY;
|
||||
ps.PrivilegeCount = 1;
|
||||
if (pfnLookupPrivilegeValue(NULL, TEXT("SeCreateGlobalPrivilege"), &ps.Privilege[0].Luid) == 0) {
|
||||
if (pfnLookupPrivilegeValue(NULL, TEXT("SeCreateGlobalPrivilege"), &ps.Privilege[0].Luid) == 0)
|
||||
{
|
||||
// Failure here means we're running on old version of Windows 2000 or XP
|
||||
// which always allow creating global handles
|
||||
CloseHandle(hToken);
|
||||
@ -469,7 +474,8 @@ bool isGlobalKernelPrefix()
|
||||
}
|
||||
|
||||
BOOL checkResult;
|
||||
if (pfnPrivilegeCheck(hToken, &ps, &checkResult) == 0) {
|
||||
if (pfnPrivilegeCheck(hToken, &ps, &checkResult) == 0)
|
||||
{
|
||||
gds__log("PrivilegeCheck failed. Error code: %lu", GetLastError());
|
||||
CloseHandle(hToken);
|
||||
return false;
|
||||
@ -702,7 +708,8 @@ namespace {
|
||||
else {
|
||||
f = fopen(name.c_str(), "rt");
|
||||
}
|
||||
if (f && isatty(fileno(f))) {
|
||||
if (f && isatty(fileno(f)))
|
||||
{
|
||||
fprintf(stderr, "Enter password: ");
|
||||
fflush(stderr);
|
||||
#ifdef HAVE_TERMIOS_H
|
||||
|
@ -349,17 +349,20 @@ void CMD_set( qli_syntax* node)
|
||||
case set_matching_language:
|
||||
if (QLI_matching_language)
|
||||
ALLQ_release((qli_frb*) QLI_matching_language);
|
||||
if (!(string = (qli_const*) value))
|
||||
{
|
||||
string = (qli_const*) value;
|
||||
if (!string)
|
||||
QLI_matching_language = NULL;
|
||||
break;
|
||||
else
|
||||
{
|
||||
const USHORT len = string->con_desc.dsc_length;
|
||||
QLI_matching_language = (qli_const*) ALLOCPV(type_con, len);
|
||||
fb_utils::copy_terminate((char*) QLI_matching_language->con_data,
|
||||
(char*) string->con_data, len + 1);
|
||||
dsc& lang = QLI_matching_language->con_desc;
|
||||
lang.dsc_dtype = dtype_text;
|
||||
lang.dsc_address = QLI_matching_language->con_data;
|
||||
lang.dsc_length = len;
|
||||
}
|
||||
QLI_matching_language = (qli_const*) ALLOCPV(type_con, string->con_desc.dsc_length);
|
||||
fb_utils::copy_terminate((char*) QLI_matching_language->con_data, (char*) string->con_data,
|
||||
string->con_desc.dsc_length + 1);
|
||||
QLI_matching_language->con_desc.dsc_dtype = dtype_text;
|
||||
QLI_matching_language->con_desc.dsc_address = QLI_matching_language->con_data;
|
||||
QLI_matching_language->con_desc.dsc_length = string->con_desc.dsc_length;
|
||||
break;
|
||||
|
||||
case set_user:
|
||||
|
@ -1954,11 +1954,8 @@ static void show_matching()
|
||||
return;
|
||||
if (QLI_matching_language)
|
||||
{
|
||||
buf_type buffer;
|
||||
strncpy(buffer, (char*) QLI_matching_language->con_data,
|
||||
QLI_matching_language->con_desc.dsc_length);
|
||||
buffer[QLI_matching_language->con_desc.dsc_length] = 0;
|
||||
printf("\n\t%s\n", buffer);
|
||||
printf("\n\t%.*s\n",
|
||||
int(QLI_matching_language->con_desc.dsc_length), QLI_matching_language->con_data);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2185,7 +2182,6 @@ static void show_rels( qli_dbb* dbb, enum show_t sw, SSHORT width)
|
||||
switch (sw)
|
||||
{
|
||||
case show_relations:
|
||||
{
|
||||
show_dbb(dbb);
|
||||
buffer[0] = 0;
|
||||
for (const qli_rel* relation = dbb->dbb_relations; relation;
|
||||
@ -2198,9 +2194,7 @@ static void show_rels( qli_dbb* dbb, enum show_t sw, SSHORT width)
|
||||
printf("%s\n", buffer);
|
||||
printf("\n");
|
||||
break;
|
||||
}
|
||||
case show_system_relations:
|
||||
{
|
||||
show_dbb(dbb);
|
||||
buffer[0] = 0;
|
||||
for (const qli_rel* relation = dbb->dbb_relations; relation;
|
||||
@ -2213,7 +2207,6 @@ static void show_rels( qli_dbb* dbb, enum show_t sw, SSHORT width)
|
||||
printf("%s\n", buffer);
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user