Skip to content

Commit b694ebf

Browse files
committed
WL13133: Fix MSVC2017 warnings
1 parent 8d0f311 commit b694ebf

File tree

11 files changed

+53
-24
lines changed

11 files changed

+53
-24
lines changed

cppconn/sqlstring.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2008, 2019, Oracle and/or its affiliates. All rights reserved.
33
*
44
* This program is free software; you can redistribute it and/or modify
55
* it under the terms of the GNU General Public License, version 2.0, as
@@ -42,7 +42,14 @@ namespace sql
4242
{
4343
class CPPCONN_PUBLIC_FUNC SQLString
4444
{
45+
#ifdef _WIN32
46+
#pragma warning(push)
47+
#pragma warning(disable: 4251)
48+
#endif
4549
std::string realStr;
50+
#ifdef _WIN32
51+
#pragma warning(pop)
52+
#endif
4653

4754
public:
4855
#ifdef _WIN32

driver/mysql_connection.h

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2008, 2019, Oracle and/or its affiliates. All rights reserved.
33
*
44
* This program is free software; you can redistribute it and/or modify
55
* it under the terms of the GNU General Public License, version 2.0, as
@@ -178,13 +178,28 @@ class CPPCONN_PUBLIC_FUNC MySQL_Connection : public sql::Connection
178178
void init(std::map< sql::SQLString, sql::ConnectPropertyVal > & properties);
179179

180180
Driver * driver;
181+
182+
#ifdef _WIN32
183+
#pragma warning(push)
184+
#pragma warning(disable: 4251)
185+
#endif
181186
boost::shared_ptr< NativeAPI::NativeConnectionWrapper > proxy;
187+
#ifdef _WIN32
188+
#pragma warning(pop)
189+
#endif
182190

183191
/* statement handle to execute queries initiated by driver. Perhaps it is
184192
a good idea to move it to a separate helper class */
193+
#ifdef _WIN32
194+
#pragma warning(push)
195+
#pragma warning(disable: 4251)
196+
#endif
185197
boost::scoped_ptr< ::sql::mysql::MySQL_Statement > service;
186198

187199
boost::scoped_ptr< ::sql::mysql::MySQL_ConnectionData > intern; /* pimpl */
200+
#ifdef _WIN32
201+
#pragma warning(pop)
202+
#endif
188203

189204
/* Prevent use of these */
190205
MySQL_Connection(const MySQL_Connection &);

driver/mysql_driver.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2008, 2019, Oracle and/or its affiliates. All rights reserved.
33
*
44
* This program is free software; you can redistribute it and/or modify
55
* it under the terms of the GNU General Public License, version 2.0, as
@@ -57,7 +57,14 @@ namespace NativeAPI
5757

5858
class CPPCONN_PUBLIC_FUNC MySQL_Driver : public sql::Driver
5959
{
60+
#ifdef _WIN32
61+
#pragma warning(push)
62+
#pragma warning(disable: 4251)
63+
#endif
6064
boost::scoped_ptr< ::sql::mysql::NativeAPI::NativeDriverWrapper > proxy;
65+
#ifdef _WIN32
66+
#pragma warning(pop)
67+
#endif
6168

6269
public:
6370
MySQL_Driver();

driver/mysql_prepared_statement.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2008, 2019, Oracle and/or its affiliates. All rights reserved.
33
*
44
* This program is free software; you can redistribute it and/or modify
55
* it under the terms of the GNU General Public License, version 2.0, as
@@ -141,7 +141,7 @@ class LongDataSender : public boost::static_visitor<bool>
141141
while (sent < str->length())
142142
{
143143
chunkSize= (sent + MAX_SEND_LONGDATA_CHUNK > str->length()
144-
? str->length() - sent
144+
? static_cast<unsigned int>(str->length() - sent)
145145
: MAX_SEND_LONGDATA_CHUNK);
146146

147147
if (proxy->send_long_data(position, str->c_str() + sent, chunkSize)) {

driver/nativeapi/mysql_native_connection_wrapper.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2009, 2018, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2009, 2019, Oracle and/or its affiliates. All rights reserved.
33
*
44
* This program is free software; you can redistribute it and/or modify
55
* it under the terms of the GNU General Public License, version 2.0, as
@@ -383,7 +383,7 @@ MySQL_NativeConnectionWrapper::get_option(::sql::mysql::MySQL_Connection_Options
383383
int
384384
MySQL_NativeConnectionWrapper::query(const SQLString & stmt_str)
385385
{
386-
return api->real_query(mysql, stmt_str.c_str(), stmt_str.length());
386+
return api->real_query(mysql, stmt_str.c_str(), static_cast<unsigned long>(stmt_str.length()));
387387
}
388388
/* }}} */
389389

driver/nativeapi/mysql_native_statement_wrapper.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2009, 2018, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2009, 2019, Oracle and/or its affiliates. All rights reserved.
33
*
44
* This program is free software; you can redistribute it and/or modify
55
* it under the terms of the GNU General Public License, version 2.0, as
@@ -197,7 +197,7 @@ MySQL_NativeStatementWrapper::param_count()
197197
int
198198
MySQL_NativeStatementWrapper::prepare(const ::sql::SQLString & stmt_str)
199199
{
200-
return api->stmt_prepare(stmt, stmt_str.c_str(), stmt_str.length());
200+
return api->stmt_prepare(stmt, stmt_str.c_str(), static_cast<unsigned long>(stmt_str.length()));
201201
}
202202
/* }}} */
203203

@@ -206,7 +206,7 @@ MySQL_NativeStatementWrapper::prepare(const ::sql::SQLString & stmt_str)
206206
NativeResultsetWrapper *
207207
MySQL_NativeStatementWrapper::result_metadata()
208208
{
209-
::MYSQL_RES * raw = api->stmt_result_metadata(stmt);
209+
::MYSQL_RES * raw = api->stmt_result_metadata(stmt);
210210

211211
if (raw == NULL) {
212212
return NULL;

examples/dynamic_load.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2008, 2019, Oracle and/or its affiliates. All rights reserved.
33
*
44
* This program is free software; you can redistribute it and/or modify
55
* it under the terms of the GNU General Public License, version 2.0, as
@@ -313,7 +313,7 @@ static void validateResultSet(boost::scoped_ptr< sql::ResultSet > & res, struct
313313
validateRow(res, max);
314314
/* Another way to move after the last entry */
315315
cout << "#\t Trying absolute(NUMROWS + 10) to move cursor after last row and fetch last entry..." << endl;
316-
if (false != res->absolute(res->rowsCount() + 10)) {
316+
if (false != res->absolute(static_cast<int>(res->rowsCount() + 10))) {
317317
throw runtime_error("Call did fail although parameter is valid");
318318
}
319319
if (true != res->isAfterLast()) {

examples/resultset.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2008, 2019, Oracle and/or its affiliates. All rights reserved.
33
*
44
* This program is free software; you can redistribute it and/or modify
55
* it under the terms of the GNU General Public License, version 2.0, as
@@ -277,7 +277,7 @@ static void validateResultSet(boost::scoped_ptr< sql::ResultSet > & res, struct
277277
validateRow(res, max);
278278
/* Another way to move after the last entry */
279279
cout << "#\t Trying absolute(NUMROWS + 10) to move cursor after last row and fetch last entry..." << endl;
280-
if (false != res->absolute(res->rowsCount() + 10)) {
280+
if (false != res->absolute(static_cast<int>(res->rowsCount() + 10))) {
281281
throw runtime_error("Call did fail although parameter is valid");
282282
}
283283
if (true != res->isAfterLast()) {

test/framework/test_case.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2008, 2019, Oracle and/or its affiliates. All rights reserved.
33
*
44
* This program is free software; you can redistribute it and/or modify
55
* it under the terms of the GNU General Public License, version 2.0, as
@@ -47,7 +47,7 @@
4747

4848
namespace testsuite
4949
{
50-
_ABSTRACT class Test: virtual private Private::TestContainer
50+
_ABSTRACT class Test: virtual public Private::TestContainer
5151
{
5252
friend class Private::TestContainer::StorableTest;
5353

test/unit/bugs/bugs.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2009, 2018, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2009, 2019, Oracle and/or its affiliates. All rights reserved.
33
*
44
* This program is free software; you can redistribute it and/or modify
55
* it under the terms of the GNU General Public License, version 2.0, as
@@ -309,7 +309,7 @@ void bugs::expired_pwd()
309309
SKIP("The expired password does not work with anonymous-user accounts.");
310310
}
311311
}
312-
catch (sql::SQLException &e)
312+
catch (sql::SQLException&)
313313
{
314314
/* If no anonymous user present then continue */
315315
}
@@ -884,7 +884,7 @@ void bugs::bug21053335()
884884
ASSERT(res->wasNull());
885885
FAIL("Exception was not thrown by wasNull()");
886886
}
887-
catch (sql::SQLException & e)
887+
catch (sql::SQLException&)
888888
{
889889
// Everything is ok
890890
}
@@ -899,7 +899,7 @@ void bugs::bug21053335()
899899

900900
}
901901

902-
catch (sql::SQLException &e)
902+
catch (sql::SQLException&)
903903
{
904904
FAIL("Exception thrown by wasNull()");
905905
throw;
@@ -935,7 +935,7 @@ void bugs::bug17218692()
935935
ASSERT_EQUALS(log.str(), log2.str());
936936

937937
}
938-
catch (sql::SQLException & e)
938+
catch (sql::SQLException&)
939939
{
940940
FAIL("Exception thrown");
941941
throw;
@@ -966,7 +966,7 @@ void bugs::bug21067193()
966966
ASSERT_EQUALS(false, res->absolute(std::numeric_limits<int>::min())); //Invalid position, Returns FALSE
967967

968968
}
969-
catch (sql::SQLException & e)
969+
catch (sql::SQLException&)
970970
{
971971
// Error....
972972
throw;

test/unit/classes/connection.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2008, 2019, Oracle and/or its affiliates. All rights reserved.
33
*
44
* This program is free software; you can redistribute it and/or modify
55
* it under the terms of the GNU General Public License, version 2.0, as
@@ -3104,7 +3104,7 @@ void connection::tls_version()
31043104
con.reset(driver->connect(connection_properties));
31053105
FAIL("Wrong TLS version used and still can connect!");
31063106
}
3107-
catch (sql::SQLException &e)
3107+
catch (sql::SQLException &)
31083108
{
31093109
//Should FAIL to connect
31103110
}

0 commit comments

Comments
 (0)