Esempio n. 1
0
static size_t run(int i)
{
  upb_status status = UPB_STATUS_INIT;
  i %= NUM_MESSAGES;
  upb_msg_clear(msg[i], def);
  upb_decoder_reset(&d, upb_stringsrc_bytesrc(&strsrc),
                    0, UPB_NONDELIMITED, msg[i]);
  upb_decoder_decode(&d, &status);
  if(!upb_ok(&status)) goto err;
  return len;

err:
  fprintf(stderr, "Decode error: %s", upb_status_getstr(&status));
  return 0;
}
Esempio n. 2
0
static size_t run(int i)
{
  (void)i;
  upb_status status = UPB_STATUS_INIT;
  upb_msg_clear(msg, def);
  upb_stringsrc_reset(&strsrc, input_str);
  upb_decoder_reset(&d, upb_stringsrc_bytesrc(&strsrc), msg);
  upb_decoder_decode(&d, &status);
  if(!upb_ok(&status)) goto err;
  return upb_string_len(input_str);

err:
  fprintf(stderr, "Decode error: ");
  upb_printerr(&status);
  return 0;
}