summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrediano Ziglio <fziglio@redhat.com>2020-03-30 15:09:01 +0100
committerFrediano Ziglio <fziglio@redhat.com>2020-03-30 15:11:22 +0100
commit5988f86a75ced12fe5ae10656ff453403d69d3ad (patch)
treed7d491c8a117ea6b3beb5298ee9f8e54c1d7e32e
parent57266085b9d68474f4006e09dece5945e5f8cc82 (diff)
Revert 3 last patches
Revert "try to remove other bugs", commit 57266085b9d68474f4006e09dece5945e5f8cc82. Revert "try to fix previous", commit 8e4037706841a89915ccb0db84e4b336433027eb. Revert "attempt to fix more warnings!", commit 66b6933a388b222cb9ffa510401bf2485d4e6f2e. I put by mistake on the MR due to some automatic scripts. Their state are pretty experimental. Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
-rw-r--r--vdagent/image.cpp6
-rw-r--r--vdagent/image.h4
-rw-r--r--vdagent/imagepng.cpp6
-rw-r--r--vdagent/imagetest.cpp2
-rw-r--r--vdagent/vdagent.cpp5
5 files changed, 11 insertions, 12 deletions
diff --git a/vdagent/image.cpp b/vdagent/image.cpp
index 56612d3..c0bcdb5 100644
--- a/vdagent/image.cpp
+++ b/vdagent/image.cpp
@@ -64,7 +64,7 @@ HANDLE get_image_handle(const VDAgentClipboard& clipboard, uint32_t size, UINT&
}
uint8_t* get_raw_clipboard_image(const VDAgentClipboardRequest& clipboard_request,
- HANDLE clip_data, intptr_t& new_size)
+ HANDLE clip_data, long& new_size)
{
new_size = 0;
@@ -133,7 +133,7 @@ public:
BitmapCoder() {};
size_t get_dib_size(const uint8_t *data, size_t size);
void get_dib_data(uint8_t *dib, const uint8_t *data, size_t size);
- uint8_t *from_bitmap(const BITMAPINFO& info, const void *bits, intptr_t&size);
+ uint8_t *from_bitmap(const BITMAPINFO& info, const void *bits, long &size);
};
size_t BitmapCoder::get_dib_size(const uint8_t *data, size_t size)
@@ -150,7 +150,7 @@ void BitmapCoder::get_dib_data(uint8_t *dib, const uint8_t *data, size_t size)
memcpy(dib, data + (size - new_size), new_size);
}
-uint8_t *BitmapCoder::from_bitmap(const BITMAPINFO& info, const void *bits, intptr_t&size)
+uint8_t *BitmapCoder::from_bitmap(const BITMAPINFO& info, const void *bits, long &size)
{
BITMAPFILEHEADER file_hdr;
diff --git a/vdagent/image.h b/vdagent/image.h
index 21d8922..326d7f9 100644
--- a/vdagent/image.h
+++ b/vdagent/image.h
@@ -25,7 +25,7 @@ public:
virtual ~ImageCoder() {}
virtual size_t get_dib_size(const uint8_t *data, size_t size)=0;
virtual void get_dib_data(uint8_t *dib, const uint8_t *data, size_t size)=0;
- virtual uint8_t *from_bitmap(const BITMAPINFO& info, const void *bits, intptr_t&size)=0;
+ virtual uint8_t *from_bitmap(const BITMAPINFO& info, const void *bits, long &size)=0;
private:
ImageCoder(const ImageCoder& rhs);
void operator=(const ImageCoder &rhs);
@@ -61,7 +61,7 @@ HANDLE get_image_handle(const VDAgentClipboard& clipboard, uint32_t size, UINT&
* @param[out] new_size size of returned data
*/
uint8_t* get_raw_clipboard_image(const VDAgentClipboardRequest& clipboard_request,
- HANDLE clip_data, intptr_t& new_size);
+ HANDLE clip_data, long& new_size);
/**
* Free data returned by get_raw_clipboard_image
diff --git a/vdagent/imagepng.cpp b/vdagent/imagepng.cpp
index 1cc8ec6..78b4188 100644
--- a/vdagent/imagepng.cpp
+++ b/vdagent/imagepng.cpp
@@ -29,14 +29,14 @@ public:
PngCoder() {};
size_t get_dib_size(const uint8_t *data, size_t size);
void get_dib_data(uint8_t *dib, const uint8_t *data, size_t size);
- uint8_t *from_bitmap(const BITMAPINFO& info, const void *bits, intptr_t&size);
+ uint8_t *from_bitmap(const BITMAPINFO& info, const void *bits, long &size);
private:
size_t convert_to_dib(uint8_t *out_buf, const uint8_t *data, size_t size);
};
struct ReadBufferIo {
const uint8_t *buf;
- size_t pos, size;
+ uint32_t pos, size;
ReadBufferIo(const uint8_t *_buf, uint32_t _size):
buf(_buf), pos(0), size(_size)
{}
@@ -271,7 +271,7 @@ void PngCoder::get_dib_data(uint8_t *dib, const uint8_t *data, size_t size)
convert_to_dib(dib, data, size);
}
-uint8_t *PngCoder::from_bitmap(const BITMAPINFO& bmp_info, const void *bits, intptr_t&size)
+uint8_t *PngCoder::from_bitmap(const BITMAPINFO& bmp_info, const void *bits, long &size)
{
// this vector is here to avoid leaking resources if libpng use setjmp/longjmp
std::vector<png_color> palette;
diff --git a/vdagent/imagetest.cpp b/vdagent/imagetest.cpp
index e9ccb47..36b8f6c 100644
--- a/vdagent/imagetest.cpp
+++ b/vdagent/imagetest.cpp
@@ -30,7 +30,7 @@ save_dib_to_file(ImageCoder& coder, const uint8_t *raw_dib, const char *filename
const BITMAPINFO& info(*(BITMAPINFO*) raw_dib);
const uint8_t *raw_bits = &raw_dib[sizeof(BITMAPINFOHEADER) + 4 * info.bmiHeader.biClrUsed];
- intptr_t size = 0;
+ long size = 0;
uint8_t *raw_file = coder.from_bitmap(info, raw_bits, size);
assert(raw_file && size > 0);
diff --git a/vdagent/vdagent.cpp b/vdagent/vdagent.cpp
index 5d2fdcb..df794b8 100644
--- a/vdagent/vdagent.cpp
+++ b/vdagent/vdagent.cpp
@@ -28,7 +28,6 @@
#include <queue>
#include <set>
#include <vector>
-#include <cinttypes>
#define VD_AGENT_LOG_PATH TEXT("%svdagent.log")
#define VD_AGENT_WINCLASS_NAME TEXT("VDAGENT")
@@ -1102,7 +1101,7 @@ bool VDAgent::handle_clipboard_request(const VDAgentClipboardRequest* clipboard_
UINT format;
HANDLE clip_data;
uint8_t* new_data = NULL;
- intptr_t new_size = 0;
+ long new_size = 0;
size_t len = 0;
VDAgentClipboard* clipboard = NULL;
@@ -1144,7 +1143,7 @@ bool VDAgent::handle_clipboard_request(const VDAgentClipboardRequest* clipboard_
goto handle_clipboard_request_fail;
}
if ((_max_clipboard != -1) && (new_size > _max_clipboard)) {
- vd_printf("clipboard is too large (%" PRIdPTR " > %d), discarding",
+ vd_printf("clipboard is too large (%ld > %d), discarding",
new_size, _max_clipboard);
goto handle_clipboard_request_fail;
}