Skip to content

Commit 51a6504

Browse files
committed
Fix warnings in examples
1 parent 98a1628 commit 51a6504

File tree

10 files changed

+33
-20
lines changed

10 files changed

+33
-20
lines changed

builds/win32/msvc15/empbuild.vcxproj

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,10 @@
282282
<Project>{4fe03933-98cd-4879-a135-fd9430087a6b}</Project>
283283
</ProjectReference>
284284
</ItemGroup>
285+
<ItemGroup>
286+
<None Include="..\..\..\examples\empbuild\empbuild.epp" />
287+
</ItemGroup>
285288
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
286289
<ImportGroup Label="ExtensionTargets">
287290
</ImportGroup>
288-
</Project>
291+
</Project>

builds/win32/msvc15/empbuild.vcxproj.filters

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,18 @@
1313
<UniqueIdentifier>{307f31db-efbf-4c9c-9aa6-dbda2d6d8484}</UniqueIdentifier>
1414
<Extensions>ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe</Extensions>
1515
</Filter>
16+
<Filter Include="GPRE files">
17+
<UniqueIdentifier>{dbcdcdf8-efc8-4106-b609-1e490745e955}</UniqueIdentifier>
18+
</Filter>
1619
</ItemGroup>
1720
<ItemGroup>
1821
<ClCompile Include="..\..\..\gen\examples\empbuild.cpp">
1922
<Filter>Source Files</Filter>
2023
</ClCompile>
2124
</ItemGroup>
22-
</Project>
25+
<ItemGroup>
26+
<None Include="..\..\..\examples\empbuild\empbuild.epp">
27+
<Filter>GPRE files</Filter>
28+
</None>
29+
</ItemGroup>
30+
</Project>

examples/dbcrypt/CryptKeyHolder.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ int CryptKeyHolder::keyCallback(CheckStatusWrapper* status, ICryptKeyCallback* c
273273
confEntry = getEntry(status, "Key");
274274
if (confEntry)
275275
{
276-
key = confEntry->getIntValue();
276+
key = static_cast<ISC_UCHAR>(confEntry->getIntValue());
277277
confEntry->release();
278278
}
279279
else
@@ -311,7 +311,7 @@ ICryptKeyCallback* CryptKeyHolder::keyHandle(CheckStatusWrapper* status, const c
311311
IConfigEntry* confEntry = getEntry(status, kn);
312312
if (confEntry)
313313
{
314-
int k = confEntry->getIntValue();
314+
int k = static_cast<int>(confEntry->getIntValue());
315315
confEntry->release();
316316
if (k > 0 && k < 256)
317317
{

examples/dbcrypt/DbCrypt.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ class DbCrypt : public IDbCryptPluginImpl<DbCrypt, CheckStatusWrapper>
119119

120120
private:
121121
IPluginConfig* config;
122-
char savedKeyName[32];
122+
char savedKeyName[32]{};
123123
ISC_UCHAR key;
124124

125125
std::atomic_int refCounter;
@@ -218,7 +218,7 @@ void DbCrypt::setKey(CheckStatusWrapper* status, unsigned int length, IKeyHolder
218218
def->release();
219219
if (confEntry)
220220
{
221-
v = confEntry->getIntValue();
221+
v = static_cast<char>(confEntry->getIntValue());
222222
confEntry->release();
223223
if (v)
224224
{

examples/dbcrypt/msvc/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.user

examples/empbuild/empbuild.epp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ while (fgets (line, 100, Fp) != NULL)
287287
if (*line == '\n')
288288
break;
289289

290-
len = strlen (line);
290+
len = static_cast<int>(strlen(line));
291291
EXEC SQL INSERT CURSOR be VALUES (:line INDICATOR :len);
292292
}
293293

@@ -365,7 +365,7 @@ while (fgets (line, 100, Fp) != NULL)
365365
if (*line == '\n')
366366
break;
367367

368-
len = strlen (line);
368+
len = static_cast<int>(strlen(line));
369369
EXEC SQL INSERT CURSOR bd VALUES (:line INDICATOR :len);
370370
}
371371

examples/extauth/ExtAuth.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@
3232

3333
#define HANDSHAKE_DEBUG(A)
3434

35-
const unsigned LOGINSIZE = 128u;
36-
const unsigned RANDSIZE = 32u;
37-
const unsigned SALTLEN = 8u;
35+
constexpr unsigned LOGINSIZE = 128u;
36+
constexpr unsigned RANDSIZE = 32u;
37+
constexpr unsigned SALTLEN = 8u;
3838

3939
typedef unsigned int ULong;
4040

@@ -138,7 +138,7 @@ class PluginData
138138

139139
PseudoRandom pseudoRand;
140140
HashSha256 hash;
141-
rsa_key privateKey;
141+
rsa_key privateKey{};
142142
int iniLvl;
143143
};
144144

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

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

342342
private:
343-
unsigned char msg[RANDSIZE + LOGINSIZE];
343+
unsigned char msg[RANDSIZE + LOGINSIZE]{};
344344
bool sentData;
345345
};
346346

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

378378
// decompose message
379379
const char* login = reinterpret_cast<const char*>(data);
380-
unsigned len = strnlen(login, dl);
380+
unsigned len = static_cast<unsigned>(strnlen(login, dl));
381381
if (len == dl)
382382
error(status, "Wrong data from client - no signature in a message");
383383
if (len == 0)

examples/extauth/TcWrapper.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ unsigned readHexKey(ThrowStatusWrapper* status, const char* hex, unsigned char*
8181
error(status, "Key format error");
8282
*k++ = static_cast<unsigned char>(c);
8383
}
84-
return k - key;
84+
return static_cast<unsigned>(k - key);
8585
}
8686

8787
void PseudoRandom::init(ThrowStatusWrapper* status)

examples/extauth/msvc/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.user

examples/udr/Triggers.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ FB_UDR_BEGIN_TRIGGER(replicate)
104104
SQL_DIALECT_CURRENT, inSqlDa), status, statusVector);
105105
inSqlDa->sqlvar[0].sqldata = new char[sizeof(short) + inSqlDa->sqlvar[0].sqllen];
106106
strncpy(inSqlDa->sqlvar[0].sqldata + sizeof(short), info, inSqlDa->sqlvar[0].sqllen);
107-
*reinterpret_cast<short*>(inSqlDa->sqlvar[0].sqldata) = strlen(info);
107+
*reinterpret_cast<short*>(inSqlDa->sqlvar[0].sqldata) = static_cast<short>(strlen(info));
108108

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

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

142142
strcat(buffer,
@@ -177,7 +177,7 @@ FB_UDR_BEGIN_TRIGGER(replicate)
177177
strcat(buffer, ", ");
178178
strcat(buffer, ":p");
179179
const size_t buflen = strlen(buffer);
180-
snprintf(buffer + buflen, sizeof(buffer) - buflen, "%d", i);
180+
snprintf(buffer + buflen, sizeof(buffer) - buflen, "%u", i);
181181
}
182182

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

260260
XSQLDA* outSqlDa = reinterpret_cast<XSQLDA*>(new char[(XSQLDA_LENGTH(1))]);
261261
outSqlDa->version = SQLDA_VERSION1;

0 commit comments

Comments
 (0)