Mirror of :pserver:cvs@cvs.fefe.de:/cvs libowfat https://www.fefe.de/libowfat/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

14 lines
375 B

  1. #include <rangecheck.h>
  2. #include <inttypes.h>
  3. /* does an UTF-16 string starting at "ptr" lie in buf[0..len-1]? */
  4. int range_str2inbuf(const void* buf,size_t len,const void* stringstart) {
  5. const uint16_t* x;
  6. const uint16_t* y;
  7. if (!range_ptrinbuf(buf,len,x=stringstart)) return 0;
  8. y=(const uint16_t*)((char*)x+len);
  9. for (; x+1<=y && *x; ++x);
  10. return (x+1<=y);
  11. }