[jira] [Updated] (PROTON-661) pn_message_save_* do not return correct message size when PN_OVERFLOW

2014-09-23 Thread Miguel da Rocha Correia Lima (JIRA)

 [ 
https://issues.apache.org/jira/browse/PROTON-661?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Miguel da Rocha Correia Lima updated PROTON-661:

Description: 
Expected behavior:
When you use pn_message_save* functions API, you pass char *data  and size_t 
*size. If the size IS NOT enough to save mesage body text, this functions 
return in size_t *size variable, the necessary buffer size and return 
PN_OVERFLOW status. 

Behavior observed:
The pn_message_save*  functions API return PN_OVERFLOW status and DO NOT return 
a correct value of necessary buffer.

Patch to fix expected behavior  is attached:


  was:
Expected behavior:
When you use pn_message_save* functions API, you pass char *data  and char 
*size. If the size IS NOT enough to save mesage body text, this functions 
return in char *size variable, the necessary buffer size and return PN_OVERFLOW 
status. 

Behavior observed:
The pn_message_save*  functions API return PN_OVERFLOW status and DO NOT return 
a correct value of necessary buffer.

Patch to fix expected behavior :
--
diff -Naur qpid-proton-0.7-ORIG/proton-c/src/message/message.c 
qpid-proton-0.7-LDX/p
--- qpid-proton-0.7-ORIG/proton-c/src/message/message.c 2014-03-10 
13:33:11.
+++ qpid-proton-0.7-LDX/proton-c/src/message/message.c  2014-09-04 
23:31:44.9280
@@ -972,6 +972,7 @@
   pn_data_error(msg->body));
   if (scanned) {
 if (bytes.size > *size) {
+  *size = bytes.size;
   return PN_OVERFLOW;
 } else {
   memcpy(data, bytes.start, bytes.size);
@@ -994,6 +995,7 @@
   {
 pn_bytes_t str = pn_data_get_bytes(msg->body);
 if (str.size >= *size) {
+  *size = str.size;
   return PN_OVERFLOW;
 } else {
   memcpy(data, str.start, str.size);
--



> pn_message_save_* do not return correct message size when PN_OVERFLOW
> -
>
> Key: PROTON-661
> URL: https://issues.apache.org/jira/browse/PROTON-661
> Project: Qpid Proton
>  Issue Type: Bug
>  Components: proton-c
>Affects Versions: 0.4, 0.5, 0.7
> Environment: All plataforms
>Reporter: Miguel da Rocha Correia Lima
>Priority: Critical
> Attachments: landix-ret-size-message-save.patch
>
>
> Expected behavior:
> When you use pn_message_save* functions API, you pass char *data  and size_t 
> *size. If the size IS NOT enough to save mesage body text, this functions 
> return in size_t *size variable, the necessary buffer size and return 
> PN_OVERFLOW status. 
> Behavior observed:
> The pn_message_save*  functions API return PN_OVERFLOW status and DO NOT 
> return a correct value of necessary buffer.
> Patch to fix expected behavior  is attached:



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Updated] (PROTON-661) pn_message_save_* do not return correct message size when PN_OVERFLOW

2014-09-23 Thread Miguel da Rocha Correia Lima (JIRA)

 [ 
https://issues.apache.org/jira/browse/PROTON-661?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Miguel da Rocha Correia Lima updated PROTON-661:

Attachment: landix-ret-size-message-save.patch

Patch to return necessary buffer message size in pm_message_save* .

> pn_message_save_* do not return correct message size when PN_OVERFLOW
> -
>
> Key: PROTON-661
> URL: https://issues.apache.org/jira/browse/PROTON-661
> Project: Qpid Proton
>  Issue Type: Bug
>  Components: proton-c
>Affects Versions: 0.4, 0.5, 0.7
> Environment: All plataforms
>Reporter: Miguel da Rocha Correia Lima
>Priority: Critical
> Attachments: landix-ret-size-message-save.patch
>
>
> Expected behavior:
> When you use pn_message_save* functions API, you pass char *data  and char 
> *size. If the size IS NOT enough to save mesage body text, this functions 
> return in char *size variable, the necessary buffer size and return 
> PN_OVERFLOW status. 
> Behavior observed:
> The pn_message_save*  functions API return PN_OVERFLOW status and DO NOT 
> return a correct value of necessary buffer.
> Patch to fix expected behavior :
> --
> diff -Naur qpid-proton-0.7-ORIG/proton-c/src/message/message.c 
> qpid-proton-0.7-LDX/p
> --- qpid-proton-0.7-ORIG/proton-c/src/message/message.c 2014-03-10 
> 13:33:11.
> +++ qpid-proton-0.7-LDX/proton-c/src/message/message.c  2014-09-04 
> 23:31:44.9280
> @@ -972,6 +972,7 @@
>pn_data_error(msg->body));
>if (scanned) {
>  if (bytes.size > *size) {
> +  *size = bytes.size;
>return PN_OVERFLOW;
>  } else {
>memcpy(data, bytes.start, bytes.size);
> @@ -994,6 +995,7 @@
>{
>  pn_bytes_t str = pn_data_get_bytes(msg->body);
>  if (str.size >= *size) {
> +  *size = str.size;
>return PN_OVERFLOW;
>  } else {
>memcpy(data, str.start, str.size);
> --



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)