Skip to content

Fix warnings in examples #8636

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion builds/win32/msvc15/empbuild.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,10 @@
<Project>{4fe03933-98cd-4879-a135-fd9430087a6b}</Project>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="..\..\..\examples\empbuild\empbuild.epp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
</Project>
10 changes: 9 additions & 1 deletion builds/win32/msvc15/empbuild.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,18 @@
<UniqueIdentifier>{307f31db-efbf-4c9c-9aa6-dbda2d6d8484}</UniqueIdentifier>
<Extensions>ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe</Extensions>
</Filter>
<Filter Include="GPRE files">
<UniqueIdentifier>{dbcdcdf8-efc8-4106-b609-1e490745e955}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\..\gen\examples\empbuild.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>
<ItemGroup>
<None Include="..\..\..\examples\empbuild\empbuild.epp">
<Filter>GPRE files</Filter>
</None>
</ItemGroup>
</Project>
4 changes: 2 additions & 2 deletions examples/dbcrypt/CryptKeyHolder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ int CryptKeyHolder::keyCallback(CheckStatusWrapper* status, ICryptKeyCallback* c
confEntry = getEntry(status, "Key");
if (confEntry)
{
key = confEntry->getIntValue();
key = static_cast<ISC_UCHAR>(confEntry->getIntValue());
confEntry->release();
}
else
Expand Down Expand Up @@ -311,7 +311,7 @@ ICryptKeyCallback* CryptKeyHolder::keyHandle(CheckStatusWrapper* status, const c
IConfigEntry* confEntry = getEntry(status, kn);
if (confEntry)
{
int k = confEntry->getIntValue();
int k = static_cast<int>(confEntry->getIntValue());
confEntry->release();
if (k > 0 && k < 256)
{
Expand Down
4 changes: 2 additions & 2 deletions examples/dbcrypt/DbCrypt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ class DbCrypt : public IDbCryptPluginImpl<DbCrypt, CheckStatusWrapper>

private:
IPluginConfig* config;
char savedKeyName[32];
char savedKeyName[32]{};
ISC_UCHAR key;

std::atomic_int refCounter;
Expand Down Expand Up @@ -218,7 +218,7 @@ void DbCrypt::setKey(CheckStatusWrapper* status, unsigned int length, IKeyHolder
def->release();
if (confEntry)
{
v = confEntry->getIntValue();
v = static_cast<char>(confEntry->getIntValue());
confEntry->release();
if (v)
{
Expand Down
1 change: 1 addition & 0 deletions examples/dbcrypt/msvc/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.user
4 changes: 2 additions & 2 deletions examples/empbuild/empbuild.epp
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ while (fgets (line, 100, Fp) != NULL)
if (*line == '\n')
break;

len = strlen (line);
len = static_cast<int>(strlen(line));
EXEC SQL INSERT CURSOR be VALUES (:line INDICATOR :len);
}

Expand Down Expand Up @@ -365,7 +365,7 @@ while (fgets (line, 100, Fp) != NULL)
if (*line == '\n')
break;

len = strlen (line);
len = static_cast<int>(strlen(line));
EXEC SQL INSERT CURSOR bd VALUES (:line INDICATOR :len);
}

Expand Down
14 changes: 7 additions & 7 deletions examples/extauth/ExtAuth.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@

#define HANDSHAKE_DEBUG(A)

const unsigned LOGINSIZE = 128u;
const unsigned RANDSIZE = 32u;
const unsigned SALTLEN = 8u;
constexpr unsigned LOGINSIZE = 128u;
constexpr unsigned RANDSIZE = 32u;
constexpr unsigned SALTLEN = 8u;

typedef unsigned int ULong;

Expand Down Expand Up @@ -138,7 +138,7 @@ class PluginData

PseudoRandom pseudoRand;
HashSha256 hash;
rsa_key privateKey;
rsa_key privateKey{};
int iniLvl;
};

Expand Down Expand Up @@ -253,7 +253,7 @@ int ExtAuthClient::authenticate(ThrowStatusWrapper* status, IClientBlock* cBlock
error(status, "Malformed data from server - missing random block");

// next append login to random block
unsigned len = strlen(login);
unsigned long len = static_cast<unsigned long>(strlen(login));
if (len > LOGINSIZE)
len = LOGINSIZE;
memcpy(&bytes[RANDSIZE], login, len);
Expand Down Expand Up @@ -340,7 +340,7 @@ class ExtAuthServer : public IServerImpl<ExtAuthServer, ThrowStatusWrapper>, pub
}

private:
unsigned char msg[RANDSIZE + LOGINSIZE];
unsigned char msg[RANDSIZE + LOGINSIZE]{};
bool sentData;
};

Expand Down Expand Up @@ -377,7 +377,7 @@ int ExtAuthServer::authenticate(ThrowStatusWrapper* status, IServerBlock* sBlock

// decompose message
const char* login = reinterpret_cast<const char*>(data);
unsigned len = strnlen(login, dl);
unsigned len = static_cast<unsigned>(strnlen(login, dl));
if (len == dl)
error(status, "Wrong data from client - no signature in a message");
if (len == 0)
Expand Down
2 changes: 1 addition & 1 deletion examples/extauth/TcWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ unsigned readHexKey(ThrowStatusWrapper* status, const char* hex, unsigned char*
error(status, "Key format error");
*k++ = static_cast<unsigned char>(c);
}
return k - key;
return static_cast<unsigned>(k - key);
}

void PseudoRandom::init(ThrowStatusWrapper* status)
Expand Down
1 change: 1 addition & 0 deletions examples/extauth/msvc/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.user
8 changes: 4 additions & 4 deletions examples/udr/Triggers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ FB_UDR_BEGIN_TRIGGER(replicate)
SQL_DIALECT_CURRENT, inSqlDa), status, statusVector);
inSqlDa->sqlvar[0].sqldata = new char[sizeof(short) + inSqlDa->sqlvar[0].sqllen];
strncpy(inSqlDa->sqlvar[0].sqldata + sizeof(short), info, inSqlDa->sqlvar[0].sqllen);
*reinterpret_cast<short*>(inSqlDa->sqlvar[0].sqldata) = strlen(info);
*reinterpret_cast<short*>(inSqlDa->sqlvar[0].sqldata) = static_cast<short>(strlen(info));

XSQLDA* outSqlDa = reinterpret_cast<XSQLDA*>(new char[(XSQLDA_LENGTH(1))]);
outSqlDa->version = SQLDA_VERSION1;
Expand Down Expand Up @@ -136,7 +136,7 @@ FB_UDR_BEGIN_TRIGGER(replicate)

strcat(buffer, " p");
const size_t buflen = strlen(buffer);
snprintf(buffer + buflen, sizeof(buffer) - buflen, "%d type of column \"%s\".\"%s\" = ?", i, table, name);
snprintf(buffer + buflen, sizeof(buffer) - buflen, "%u type of column \"%s\".\"%s\" = ?", i, table, name);
}

strcat(buffer,
Expand Down Expand Up @@ -177,7 +177,7 @@ FB_UDR_BEGIN_TRIGGER(replicate)
strcat(buffer, ", ");
strcat(buffer, ":p");
const size_t buflen = strlen(buffer);
snprintf(buffer + buflen, sizeof(buffer) - buflen, "%d", i);
snprintf(buffer + buflen, sizeof(buffer) - buflen, "%u", i);
}

strcat(buffer, ")\n on external data source '");
Expand Down Expand Up @@ -255,7 +255,7 @@ FB_UDR_BEGIN_TRIGGER(replicate_persons)
statusVector, &stmtHandle, SQL_DIALECT_CURRENT, inSqlDa), status, statusVector);
inSqlDa->sqlvar[0].sqldata = new char[sizeof(short) + inSqlDa->sqlvar[0].sqllen];
strncpy(inSqlDa->sqlvar[0].sqldata + sizeof(short), info, inSqlDa->sqlvar[0].sqllen);
*reinterpret_cast<short*>(inSqlDa->sqlvar[0].sqldata) = strlen(info);
*reinterpret_cast<short*>(inSqlDa->sqlvar[0].sqldata) = static_cast<short>(strlen(info));

XSQLDA* outSqlDa = reinterpret_cast<XSQLDA*>(new char[(XSQLDA_LENGTH(1))]);
outSqlDa->version = SQLDA_VERSION1;
Expand Down
Loading