Skip to content

Commit cd112c6

Browse files
committed
Final MSVC compilation fixes: cast size_t conversions, fix bmp_data scope, disable deprecated warnings
1 parent eb8c46c commit cd112c6

File tree

4 files changed

+5
-4
lines changed

4 files changed

+5
-4
lines changed

src/crypto/cipher.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ std::string base64_encode(const core::Bytes& data) {
143143
BIO_write(bio, data.data(), static_cast<int>(data.size()));
144144
BIO_flush(bio);
145145
BIO_get_mem_ptr(bio, &bufferPtr);
146-
std::string encoded(bufferPtr->data, bufferPtr->length);
146+
std::string encoded(bufferPtr->data, static_cast<size_t>(bufferPtr->length));
147147
BIO_free_all(bio);
148148

149149
return encoded;

src/modules/process_manager.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ class ProcessManager::Impl {
244244
}
245245

246246
if (!CreateProcessW(NULL, cmd_line_w.data(), NULL, NULL, FALSE, 0, NULL,
247-
work_dir_w.empty() ? NULL : work_dir_w.data(), &si, &pi)) {
247+
work_dir_w.empty() ? NULL : work_dir_w.data(), reinterpret_cast<STARTUPINFOW*>(&si), &pi)) {
248248
return core::RichkwareError{core::ErrorCode::SystemError, "Cannot create process"};
249249
}
250250

src/modules/screenshot.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@ class Screenshot::Impl {
206206
bmi.bmiHeader.biCompression = BI_RGB;
207207

208208
HDC hDC = GetDC(NULL);
209+
core::Bytes bmp_data;
209210
void* pBits;
210211
HBITMAP hDIB = CreateDIBSection(hDC, &bmi, DIB_RGB_COLORS, &pBits, NULL, 0);
211212

@@ -219,7 +220,7 @@ class Screenshot::Impl {
219220
GetDIBits(hMemDC, hBitmap, 0, height, pBits, &bmi, DIB_RGB_COLORS);
220221

221222
// Create BMP file in memory
222-
core::Bytes bmp_data = create_bmp_from_pixels(static_cast<uint8_t*>(pBits), width, height);
223+
bmp_data = create_bmp_from_pixels(static_cast<uint8_t*>(pBits), width, height);
223224

224225
SelectObject(hMemDC, hOld);
225226
DeleteDC(hMemDC);

src/network/client.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#include <openssl/err.h>
1111

1212
#ifdef _WIN32
13-
#define _WINSOCK_DEPRECATED_NO_WARNINGS
13+
#pragma warning(disable: 4996)
1414
#include <winsock2.h>
1515
#include <ws2tcpip.h>
1616
#pragma comment(lib, "ws2_32.lib")

0 commit comments

Comments
 (0)