size_t buf_str(const char *b,size_t len,const char **pstr,size_t* slen)
{
  size_t rl,sl;

  rl = buf_int(b,len,0,':',&sl);

  if( !rl ) return 0;

  if(len < rl + sl) return 0;
  if(pstr) *pstr = b + rl;
  if(slen) *slen = sl;

  return( rl + sl );
}
Пример #2
0
size_t decode_query(const char *b,size_t len,const char *keylist,const char **ps,size_t *pi,int method)
{
  size_t pos;
  char kl[KEYNAME_LISTSIZ];
  strcpy(kl,keylist);
  pos = decode_rev(b, len, kl);
  if( !pos ) return 0;
  switch(method){
  case QUERY_STR: return(buf_str(b + pos,len - pos, ps, pi));
  case QUERY_INT: return(buf_int(b + pos,len - pos, 'i', 'e', pi));
  case QUERY_POS:
         if(pi) *pi = decode_rev(b + pos, len - pos, (const char*) 0);
         return pos;
  default: return 0;
  }
}
Пример #3
0
static void get_buffer_seconds(unsigned int id, char *buf)
{
	buf_int(buf, (player_get_buffer_chunks() * CHUNK_SIZE + SECOND_SIZE / 2) / SECOND_SIZE);
}
Пример #4
0
size_t decode_int(const char *b,size_t len)
{
  return(buf_int(b,len,'i','e',(size_t*) 0));
}
Пример #5
0
inline size_t decode_int(const char *b, size_t len)
{
  return buf_int(b, len, 'i', 'e', (int64_t *)0);
}