summaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
authorMinje Ahn <minje.ahn@samsung.com>2018-02-07 14:46:11 +0900
committerMinje Ahn <minje.ahn@samsung.com>2018-02-08 17:24:13 +0900
commit7e587dddbafbed4f8b2acbdac370280abb818c9c (patch)
tree588bf2fc37d109e17acba341453046172170e5c6 /server
parent70eb031a36555a9343b5a17d05f476ae3ebac6c3 (diff)
downloadlibmedia-thumbnail-7e587dddbafbed4f8b2acbdac370280abb818c9c.tar.gz
libmedia-thumbnail-7e587dddbafbed4f8b2acbdac370280abb818c9c.tar.bz2
libmedia-thumbnail-7e587dddbafbed4f8b2acbdac370280abb818c9c.zip
[SATIZENVUL-1315/SATIZENVUL-1316] Remove msg size from thumbMsg
Change-Id: Iaae0d5707294314a1bf856857521f95fb8582691 Signed-off-by: Minje Ahn <minje.ahn@samsung.com>
Diffstat (limited to 'server')
-rwxr-xr-xserver/thumb-server-internal.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/server/thumb-server-internal.c b/server/thumb-server-internal.c
index 1b8bac3..0ae6cca 100755
--- a/server/thumb-server-internal.c
+++ b/server/thumb-server-internal.c
@@ -139,33 +139,29 @@ gboolean _thumb_server_read_socket(GIOChannel *src, GIOCondition condition, gpoi
res_msg.msg_type = recv_msg.msg_type;
res_msg.request_id = recv_msg.request_id;
SAFE_STRLCPY(res_msg.org_path, recv_msg.org_path, sizeof(res_msg.org_path));
- res_msg.origin_path_size = recv_msg.origin_path_size;
- if (res_msg.msg_type != THUMB_RESPONSE_RAW_DATA) {
- res_msg.dest_path_size = strlen(res_msg.dst_path)+1;
+ if (res_msg.msg_type != THUMB_RESPONSE_RAW_DATA)
res_msg.thumb_size = 0;
- } else {
- res_msg.dest_path_size = 1;
+ else
res_msg.dst_path[0] = '\0';
- }
int buf_size = 0;
int sending_block = 0;
- int block_size = sizeof(res_msg) - MAX_FILEPATH_LEN*2 - sizeof(unsigned char *);
+ int block_size = sizeof(res_msg) - sizeof(unsigned char *);
unsigned char *buf = NULL;
_media_thumb_set_buffer(&res_msg, &buf, &buf_size);
while (buf_size > 0) {
- if (buf_size < THUMB_BLOCK_SIZE) {
+ if (buf_size < THUMB_BLOCK_SIZE)
block_size = buf_size;
- }
+
if (send(client_sock, buf+sending_block, block_size, 0) != block_size) {
thumb_stderror("sendto failed");
+ break;
}
sending_block += block_size;
buf_size -= block_size;
- if (block_size < THUMB_BLOCK_SIZE) {
+ if (block_size < THUMB_BLOCK_SIZE)
block_size = THUMB_BLOCK_SIZE;
- }
}
thumb_dbg_slog("Sent data(%d) from %s", res_msg.thumb_size, res_msg.org_path);
@@ -224,7 +220,7 @@ static gboolean __thumb_server_send_msg_to_agent(int msg_type)
static gboolean _thumb_server_send_deny_message(int sockfd)
{
thumbMsg msg = {0};
- int bytes_to_send = sizeof(msg) - sizeof(msg.org_path) - sizeof(msg.dst_path);
+ int bytes_to_send = sizeof(msg);
msg.msg_type = THUMB_RESPONSE;
msg.status = MS_MEDIA_ERR_PERMISSION_DENIED;