Branch: Tag:

2014-02-28

2014-02-28 11:57:36 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Efuns: Fixed trailer fixup code in random_string().

Due to missing compensation for the three byte offset from the main
loop in the fixup loop, the fixup loop never did anything.

Also a minor optimization of the previous code.

830:    /* Note: Assumes pike_string->str is aligned on a 4 byte boundary    * (it is, currently)    */ -  for(e=3;e<len;e+=sizeof(INT32)) -  ((unsigned INT32 *)(ret->str+e-3))[0] = DO_NOT_WARN(my_rand()); +  len -= sizeof(INT32)-1; +  for(e=0;e<len;e+=sizeof(INT32)) +  ((unsigned INT32 *)(ret->str+e))[0] = DO_NOT_WARN(my_rand()); +  len += sizeof(INT32)-1;    for(;e<len;e++)    ret->str[e] = DO_NOT_WARN((char)my_rand());