From: Vlad S. <vl...@cr...> - 2005-06-10 13:44:45
|
* Tcl_GetByteArrayFromObj -- * * Attempt to get the array of bytes from the Tcl object. If the * object is not already a ByteArray object, an attempt will be * made to convert it to one. So, if i call ns_return from Tcl and pass data parameter, it will be always type of String. ByteArrays are created from Tcl by binary command only, other commands work with String types, so i need to tell ns_return to treat data as bytearray. Tcl string can contain binary data but it is still String and that check will never work for binary data. Stephen Deasey wrote: > I think it's fine to also alow ns_return to handle binary data, I'm > just wondering if it should be with the extra command ns_returnbinary? > > It looks like you can simple check the type of the Tcl object passed > to ns_return for "bytearray". That's the only case it makes sense to > write the bytes directly. > > The advantage over ns_returnbinary is that in many cases the uses > doesn't have to know what's going on. e.g. a command which creates a > png graph would be returned as a byte array, and if passed to > ns_return everything should just work. > > > > On 6/9/05, Vlad Seryakov <vl...@cr...> wrote: > >>ns_respond now supports binary so ns_returnbinary is redundant, but i >>think Tcl_GetByteArray works with string and byte array, just >>Tcl_GetByteArray does not do eny encoding/converting to/From utf. >> >>Stephen Deasey wrote: >> >>>Before you cvs commit, you must make test. Two tests are broken... >>>We're strugeling for tests, but tclresp.c is one file that does have a >>>reasonably complete set. Can you add some for the new commands? >>>Also, the cut 'n paste comment for Ns_ObjvByteArray is no longer >>>correct. >>> >>>I was wondering, is ns_returnbinary necessary? What if ns_return was >>>modified to check the type of it's data arg, and if it's byterray, >>>send using Ns_ConnReturnData. Would this work? > > > > ------------------------------------------------------- > This SF.Net email is sponsored by: NEC IT Guy Games. How far can you shotput > a projector? How fast can you ride your desk chair down the office luge track? > If you want to score the big prize, get to know the little guy. > Play to win an NEC 61" plasma display: http://www.necitguy.com/?r > _______________________________________________ > naviserver-devel mailing list > nav...@li... > https://lists.sourceforge.net/lists/listinfo/naviserver-devel -- Vlad Seryakov 571 262-8608 office vl...@cr... http://www.crystalballinc.com/vlad/ |