Skip to content

Commit

Permalink
Fix MSVC QgsCopyFileTask compilation issue (#44518)
Browse files Browse the repository at this point in the history
* Fix MSVC QgsCopyFileTask compilation issue

* use std::vector instead
  • Loading branch information
troopa81 committed Aug 2, 2021
1 parent c4cd13e commit b6f2521
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/core/qgscopyfiletask.cpp
Expand Up @@ -60,10 +60,10 @@ bool QgsCopyFileTask::run()
const int chunkSize = std::clamp( size / 100, 1024, 1024 * 1024 );

int bytesRead = 0;
char data[chunkSize];
std::vector<char> data( chunkSize );
while ( true )
{
const int len = fileSource.read( data, chunkSize );
const int len = fileSource.read( data.data(), chunkSize );
if ( len == -1 )
{
mErrorString = tr( "Fail reading from '%1'" ).arg( mSource );
Expand All @@ -74,7 +74,7 @@ bool QgsCopyFileTask::run()
if ( !len )
break;

if ( fileDestination.write( data, len ) != len )
if ( fileDestination.write( data.data(), len ) != len )
{
mErrorString = tr( "Fail writing to '%1'" ).arg( mDestination );
return false;
Expand Down

0 comments on commit b6f2521

Please sign in to comment.