Esempio n. 1
0
static void print_flags(ms_MediaCode flags, const ms_Flag *user_flags)
{
  /* Non-standard flags first */
  if (user_flags != NULL) {
    while (user_flags->code != ms_none) {
      if (user_flags->code & flags) {
        errprintf_nomem("%s", user_flags->name);
        flags &= ~user_flags->code;
      }
      user_flags++;
    }
  }

  /* Standard substrings */
  if (flags & MS_SMALL_FLAG) eprintf(MS_SMALL_STRING);
  if (flags & MS_BIG_FLAG  ) eprintf(MS_BIG_STRING);
  if (flags & MS_EXTRA_FLAG) eprintf(MS_EXTRA_STRING);
  flags &= ~(MS_SMALL_FLAG | MS_BIG_FLAG | MS_EXTRA_FLAG);

  /* Completeness check */
  if (flags & ~MS_TRANSVERSE_FLAG)
    eprintf1("0x%04X", (unsigned int)(flags & ~MS_TRANSVERSE_FLAG));

  /* Standard qualifier */
  if (flags & MS_TRANSVERSE_FLAG) eprintf("." MS_TRANSVERSE_STRING);

  return;
}
Esempio n. 2
0
int gs_throw_imp(const char *func, const char *file, int line, int op, int code, const char *fmt, ...)
{
    char msg[1024];
    va_list ap;

    va_start(ap, fmt);
    vsnprintf(msg, sizeof(msg), fmt, ap);
    msg[sizeof(msg) - 1] = 0;
    va_end(ap);

    if (!gs_debug_c('#')) {
        ; /* NB: gs_log_errors
           * we could disable these printfs, and probably will when,
           * the code becomes more stable:
           * return code;
           */
    }

    /* throw */
    if (op == 0)
        errprintf_nomem("+ %s:%d: %s(): %s\n", file, line, func, msg);

    /* rethrow */
    if (op == 1)
        errprintf_nomem("| %s:%d: %s(): %s\n", file, line, func, msg);

    /* catch */
    if (op == 2)
        errprintf_nomem("- %s:%d: %s(): %s\n", file, line, func, msg);

    /* warn */
    if (op == 3)
        errprintf_nomem("  %s:%d: %s(): %s\n", file, line, func, msg);

    return code;
}