On 30/10/2011, at 9:40 AM, john skaller wrote: > Hi, I'm having some problems with JudySL .. not sure what's going on.
Well ... isn't this impossible? // program open Judy; x := JSLArray(); var je: JError_t; var pv : &word; var buffer: &char = C_hack::cast[&char] (C_hack::malloc(1000)); for var i in 0 upto 1000 do var j = Cstdlib::rand(); println$ "Rand = " + str j; var s = j.str; println$ "Rand = " + s; var cp = s.cstr; println$ "C string="+ str cp; strncpy(buffer,cp,800); print$ str i + " --> " + str j + " = " + buffer; JudySLIns(x,buffer,&je,&pv); assert not (isNULL pv); print$ " Done " + str i; if C_hack::cast[long] (*pv) != 0l do println "DUPLICATE"; done *pv = C_hack::cast[word] i; println$ " Assigned " + str i; done // tail of output 812 --> 1608776735 = 1608776735 Done 812 Assigned 812 Rand = 1891469415 Rand = 1891469415 C string=1891469415 813 --> 1891469415 = 1891469415 Done 813 Assigned 813 Rand = 726031364 Rand = 726031364 C string=726031364 814 --> 726031364 = 726031364 Done 814 Assigned 814 Rand = 407052494 Rand = 407052494 C string=407052494 815 --> 407052494 = 407052494 Done 815 Assigned 815 Rand = 1595850963 Rand = 1595850963 C string=1595850963 816 --> 1595850963 = 1595850963 Done 816 Assigned 816 Rand = 1543867758 Rand = 1543867758 C string=1543867758 817 --> 1543867758 = 1543867758 Done 817 Assigned 817 Rand = 1887985652 Rand = 1887985652 C string=1887985652 Segmentation fault /// So .. strncpy has valid data but it is segfaulting. The only way this could possibly happen is if the pointer variable buffer got corrupted. -- john skaller skal...@users.sourceforge.net ------------------------------------------------------------------------------ Get your Android app more play: Bring it to the BlackBerry PlayBook in minutes. BlackBerry App World™ now supports Android™ Apps for the BlackBerry® PlayBook™. Discover just how easy and simple it is! http://p.sf.net/sfu/android-dev2dev _______________________________________________ Felix-language mailing list Felix-language@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/felix-language