FACT++  1.0
void did_prepare_command ( char *  str,
char *  service,
char *  format 
)

Definition at line 2260 of file webDid.c.

References dic_cmnd_service(), did_read_string(), Memory::free(), get_type_size(), Memory::malloc(), size, str, and type.

Referenced by find_services().

2261 {
2262 char type;
2263 int num;
2264 int size, full_size = 0;
2265 char *ptr;
2266 static int last_size = 0;
2267 static void *last_buffer = 0;
2268 void *buffer_ptr;
2269 char *str_ptr;
2270 void did_read_string(char, int, void **, char **);
2271 
2272  str_ptr = str;
2273  ptr = format;
2274  while(*ptr)
2275  {
2276  type = *ptr++;
2277  if(*ptr == ':')
2278  {
2279  ptr++;
2280  size = get_type_size(type);
2281  sscanf(ptr, "%d", &num);
2282  full_size += size * num;
2283  if( (ptr = strchr(ptr,';')) )
2284  ptr++;
2285  else
2286  break;
2287  }
2288  }
2289 
2290  full_size += 256;
2291  if(full_size > last_size)
2292  {
2293  if(last_size)
2294  free(last_buffer);
2295  last_buffer = malloc((size_t)full_size);
2296  last_size = full_size;
2297  }
2298  memset(last_buffer, 0, (size_t)last_size);
2299  buffer_ptr = last_buffer;
2300  ptr = format;
2301  while(*ptr)
2302  {
2303  type = *ptr++;
2304  if(*ptr == ':')
2305  {
2306  ptr++;
2307  sscanf(ptr, "%d", &num);
2308  did_read_string(type, num, &buffer_ptr, &str_ptr);
2309  if(!str_ptr)
2310  break;
2311  if( (ptr = strchr(ptr,';')) )
2312  ptr++;
2313  else
2314  break;
2315  }
2316  else
2317  {
2318  did_read_string(type, 0, &buffer_ptr, &str_ptr);
2319  break;
2320  }
2321  }
2322  full_size = (int) ((char *)buffer_ptr - (char *)last_buffer);
2323  dic_cmnd_service(service,last_buffer,full_size);
2324 }
char str[80]
Definition: test_client.c:7
void did_read_string(char type, int num, void **buffer_ptr, char **str_ptr)
Definition: webDid.c:2365
void * malloc()
Definition: EventBuilder.cc:99
int get_type_size(char type)
Definition: webDid.c:2226
int dic_cmnd_service(char *serv_name, void *serv_address, int serv_size)
Definition: dic.c:694
int type
int size
Definition: db_dim_server.c:17
void free(void *mem)

+ Here is the call graph for this function:

+ Here is the caller graph for this function: