I think found the bug in owcapi.c. After allocating the buffer, OWQ_size()
wasn't set to the max buffer-size.

 

        if ((OWQ_buffer(owq) = malloc(s + 1)) == NULL)

                return -ENOMEM;

+        OWQ_size(owq) = s ;

 

I checked in the changes into the CVS.

 

/Christian

 

 

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Steve
Malenfant
Sent: den 4 juni 2007 21:51
To: [email protected]
Subject: Re: [Owfs-developers] (C) API question

 

There is definitively something wrong in owfs-tcl in 2.6

 

The path returned always contains "," instead of white space " ".  Also the
result always comes back with nothing when it's at the end of the tree.

 

Steve M.

 

On 6/4/07, Christian Magnusson <[EMAIL PROTECTED]> wrote: 

The problem is in Fowq_output_offset_and_size(). When I looked at the
variables, OWQ_size and OWQ_length didn't contain correct values.

 

  DEBUG: OWQ_size=0 OWQ_length=-1028883844 length=12 copy_length=12

 

After this, copy_length is set to 0 since OWQ_size == 0.

if ( copy_length > OWQ_size(owq) ) copy_length = OWQ_size(owq) ;

 

This results into a 0 copied bytes to the output-buffer.

I tried to just comment away this if-statement, and then it worked good. I'm
not sure if this is correct though. OWQ_size should be set to some bigger
value in some other place I guess. 

 

/Christian

 

 

 

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]> ] On Behalf Of Paul
Alfille
Sent: den 2 juni 2007 14:46
To: [email protected]
<mailto:[email protected]> 
Subject: Re: [Owfs-developers] (C) API question

 

Sounds like a bug in owcapi -- I'll check.

Paul Alfille

On 6/2/07, Sven Geggus <[EMAIL PROTECTED]> wrote: 

Hi there,

my last posting I assumed this to be a bug of owtcl, but its not!

Presumably I have just got some misunderstanding of the API.

Anyway, this did work with some older Version of owfs!

So, whats wrong with this piece of code:

--cut--
int main() {
  char *s;
  size_t n;

  if(OW_init("localhost:55555") !=0) exit(1);;

  OW_get("/10.B963D4000800/type",&s,&n); 
  printf("%d\n",n);
  if (n >0) printf("%s\n",s);

  OW_finish();
  exit(EXIT_SUCCESS);
}
--cut--

BTW, it works just fine, when I replace "/10.B963D4000800/type" by 
"/10.B963D4000800" only.

Sven

--
/* Fuck me gently with a chainsaw... */ 
(David S. Miller in /usr/src/linux/arch/sparc/kernel/ptrace.c)

/me is [EMAIL PROTECTED], http://sven.gegg.us/ on the Web

------------------------------------------------------------------------- 
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take 
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/ 
_______________________________________________
Owfs-developers mailing list
[email protected] 
https://lists.sourceforge.net/lists/listinfo/owfs-developers

 


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take 
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/ 
_______________________________________________
Owfs-developers mailing list
[email protected] 
https://lists.sourceforge.net/lists/listinfo/owfs-developers

 

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Owfs-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/owfs-developers

Reply via email to