Hi, 2010/6/18 Dan Roberts <ademan...@gmail.com>: > Hey Everybody, > It seems no one's in #pypy at the moment, so I figured I'd post to the > mailing list for non-realtime questioning. I wrote my implementation of > PyUnicode_DecodeUTF16() which is correct as best I can tell (and it > passes its test, but I wrote the test too :-) ). > The code is here: http://paste.pocoo.org/show/226753/ and its test is > here: http://paste.pocoo.org/show/226752/ . I have a few questions, like > I said, the test passes, but I'm unsure of some of the code I've > written. There are XXX and FIXME and other comments throughout the > code, those represent places where I'm unsure. > In the test code, line 6 I'm not sure if that malloc() is correct, > and even if it is, would it have been better (and also valid) to > lltype.malloc(lltype.Signed, ...) ? Then from line 7 to 12 I assign > "native" integers to the malloc-ed memory, is this done correctly? ex. > pendian[0] = -1 or should it be pendian[0] = rffi.cast(lltype.Signed, > -1) ? > In the implementation, I'm fairly certain I've marked everything with > FIXME or XXX, so there's not much more to say about that... I'd really > appreciate anyone who's willing to take a look.
All this looks quite good, except for the second cast - it should be pbyteorder[0] = rffi.cast(rffi.INT, byteorder) And I suggest to add another test: automatic detection of byte order when a Byte Order Mark is present. -- Amaury Forgeot d'Arc _______________________________________________ pypy-dev@codespeak.net http://codespeak.net/mailman/listinfo/pypy-dev