summaryrefslogtreecommitdiffstats
path: root/apps/twofactor_backupcodes/l10n/es_CR.js
Commit message (Expand)AuthorAgeFilesLines
* [tx-robot] updated from transifexNextcloud bot2020-03-221-7/+7
* [tx-robot] updated from transifexNextcloud bot2020-02-071-3/+2
* [tx-robot] updated from transifexNextcloud bot2018-10-021-1/+1
* [tx-robot] updated from transifexNextcloud bot2018-09-281-3/+3
* [tx-robot] updated from transifexNextcloud bot2018-05-231-0/+1
* [tx-robot] updated from transifexNextcloud bot2017-11-031-0/+18
span>va_end(args); return r; } glong rspamd_log_fprintf(FILE *f, const char *fmt, ...) { va_list args; glong r; va_start(args, fmt); r = rspamd_vprintf_common(rspamd_printf_append_file, f, fmt, args); va_end(args); fflush(f); return r; } glong rspamd_snprintf(char *buf, glong max, const char *fmt, ...) { char *r; va_list args; va_start(args, fmt); r = rspamd_vsnprintf(buf, max, fmt, args); va_end(args); return (r - buf); } char * rspamd_vsnprintf(char *buf, glong max, const char *fmt, va_list args) { struct rspamd_printf_char_buf dst; dst.begin = buf; dst.pos = dst.begin; dst.remain = max - 1; (void) rspamd_vprintf_common(rspamd_printf_append_char, &dst, fmt, args); *dst.pos = '\0'; return dst.pos; } glong rspamd_printf_gstring(GString *s, const char *fmt, ...) { va_list args; glong r; va_start(args, fmt); r = rspamd_vprintf_gstring(s, fmt, args); va_end(args); return r; } glong rspamd_vprintf_gstring(GString *s, const char *fmt, va_list args) { return rspamd_vprintf_common(rspamd_printf_append_gstring, s, fmt, args); } glong rspamd_printf_fstring(rspamd_fstring_t **s, const char *fmt, ...) { va_list args; glong r; va_start(args, fmt); r = rspamd_vprintf_fstring(s, fmt, args); va_end(args); return r; } glong rspamd_vprintf_fstring(rspamd_fstring_t **s, const char *fmt, va_list args) { return rspamd_vprintf_common(rspamd_printf_append_fstring, s, fmt, args); } #define RSPAMD_PRINTF_APPEND(buf, len) \ do { \ RSPAMD_PRINTF_APPEND_BUF(buf, len); \ fmt++; \ buf_start = fmt; \ } while (0) #define RSPAMD_PRINTF_APPEND_BUF(buf, len) \ do { \ wr = func((buf), (len), apd); \ if (wr < (__typeof(wr)) (len)) { \ goto oob; \ } \ written += wr; \ } while (0) glong rspamd_vprintf_common(rspamd_printf_append_func func, gpointer apd, const char *fmt, va_list args) { char zero, numbuf[G_ASCII_DTOSTR_BUF_SIZE], dtoabuf[32], *p, *last; unsigned char c; const char *buf_start = fmt; int d; double f; glong written = 0, wr, slen; int64_t i64; uint64_t ui64; unsigned int width, sign, hex, humanize, bytes, frac_width, b32, b64; rspamd_fstring_t *v; rspamd_ftok_t *tok; GString *gs; GError *err; while (*fmt) { /* * "buf < last" means that we could copy at least one character: * the plain character, "%%", "%c", and minus without the checking */ if (*fmt == '%') { /* Append what we have in buf */ if (fmt > buf_start) { wr = func(buf_start, fmt - buf_start, apd); if (wr <= 0) { goto oob; } written += wr; } i64 = 0; ui64 = 0; zero = (char) ((*++fmt == '0') ? '0' : ' '); width = 0; sign = 1; hex = 0; b32 = 0; b64 = 0; bytes = 0; humanize = 0; frac_width = 0; slen = -1; while (*fmt >= '0' && *fmt <= '9') { width = width * 10 + *fmt++ - '0'; } for (;;) { switch (*fmt) { case 'u': sign = 0; fmt++; continue; case 'm': fmt++; continue; case 'X': hex = 2; sign = 0; fmt++; continue; case 'x': hex = 1; sign = 0; fmt++; continue; case 'b': b32 = 1; sign = 0; fmt++; continue; case 'B': b64 = 1; sign = 0; fmt++; continue; case 'H': humanize = 1; bytes = 1; sign = 0; fmt++; continue; case 'h': humanize = 1; sign = 0; fmt++; continue; case '.': fmt++; if (*fmt == '*') { d = (int) va_arg(args, int); if (G_UNLIKELY(d < 0)) { return 0; } frac_width = (unsigned int) d; fmt++; } else { while (*fmt >= '0' && *fmt <= '9') { frac_width = frac_width * 10 + *fmt++ - '0'; } } break; case '*': d = (int) va_arg(args, int); if (G_UNLIKELY(d < 0)) { return 0; } slen = (glong) d; fmt++; continue; default: break; } break; } switch (*fmt) { case 'V': v = va_arg(args, rspamd_fstring_t *); if (v) { slen = v->len; if (G_UNLIKELY(width != 0)) { slen = MIN(v->len, width); } RSPAMD_PRINTF_APPEND(v->str, slen); } else { RSPAMD_PRINTF_APPEND("(NULL)", 6); } continue; case 'T': tok = va_arg(args, rspamd_ftok_t *); if (tok) { slen = tok->len; if (G_UNLIKELY(width != 0)) { slen = MIN(tok->len, width); } RSPAMD_PRINTF_APPEND(tok->begin, slen); } else { RSPAMD_PRINTF_APPEND("(NULL)", 6); } continue; case 'v': gs = va_arg(args, GString *); if (gs) { slen = gs->len; if (G_UNLIKELY(width != 0)) { slen = MIN(gs->len, width); } RSPAMD_PRINTF_APPEND(gs->str, slen); } else { RSPAMD_PRINTF_APPEND("(NULL)", 6); } continue; case 'e': err = va_arg(args, GError *); if (err) { p = err->message; if (p == NULL) { p = "(NULL)"; } } else { p = "unknown error"; } slen = strlen(p); RSPAMD_PRINTF_APPEND(p, slen); continue; case 's': p = va_arg(args, char *); if (p == NULL) { p = "(NULL)"; slen = sizeof("(NULL)") - 1; } if (G_UNLIKELY(b32)) { char *b32buf; if (G_UNLIKELY(slen == -1)) { if (G_LIKELY(width != 0)) { slen = width; } else { /* NULL terminated string */ slen = strlen(p); } } b32buf = rspamd_encode_base32(p, slen, RSPAMD_BASE32_DEFAULT); if (b32buf) { RSPAMD_PRINTF_APPEND(b32buf, strlen(b32buf)); g_free(b32buf); } else { RSPAMD_PRINTF_APPEND("(NULL)", sizeof("(NULL)") - 1); } } else if (G_UNLIKELY(hex)) { char hexbuf[2]; if (G_UNLIKELY(slen == -1)) { if (G_LIKELY(width != 0)) { slen = width; } else { /* NULL terminated string */ slen = strlen(p); } } while (slen) { hexbuf[0] = hex == 2 ? _HEX[(*p >> 4u) & 0xfu] : _hex[(*p >> 4u) & 0xfu]; hexbuf[1] = hex == 2 ? _HEX[*p & 0xfu] : _hex[*p & 0xfu]; RSPAMD_PRINTF_APPEND_BUF(hexbuf, 2); p++; slen--; } fmt++; buf_start = fmt; } else if (G_UNLIKELY(b64)) { char *b64buf; gsize olen = 0; if (G_UNLIKELY(slen == -1)) { if (G_LIKELY(width != 0)) { slen = width; } else { /* NULL terminated string */ slen = strlen(p); } } b64buf = rspamd_encode_base64(p, slen, 0, &olen); if (b64buf) { RSPAMD_PRINTF_APPEND(b64buf, olen); g_free(b64buf); } else { RSPAMD_PRINTF_APPEND("(NULL)", sizeof("(NULL)") - 1); } } else { if (slen == -1) { /* NULL terminated string */ slen = strlen(p); } if (G_UNLIKELY(width != 0)) { slen = MIN(slen, width); } RSPAMD_PRINTF_APPEND(p, slen); } continue; case 'O': i64 = (int64_t) va_arg(args, off_t); sign = 1; break; case 'P': i64 = (int64_t) va_arg(args, pid_t); sign = 1; break; case 't': i64 = (int64_t) va_arg(args, time_t); sign = 1; break; case 'z': if (sign) { i64 = (int64_t) va_arg(args, ssize_t); } else { ui64 = (uint64_t) va_arg(args, size_t); } break; case 'd': if (sign) { i64 = (int64_t) va_arg(args, int); } else { ui64 = (uint64_t) va_arg(args, unsigned int); } break; case 'l': if (sign) { i64 = (int64_t) va_arg(args, glong); } else { ui64 = (uint64_t) va_arg(args, gulong); } break; case 'D': if (sign) { i64 = (int64_t) va_arg(args, int32_t); } else { ui64 = (uint64_t) va_arg(args, uint32_t); } break; case 'L': if (sign) { i64 = va_arg(args, int64_t); } else { ui64 = va_arg(args, uint64_t); } break; case 'f': f = (double) va_arg(args, double); slen = fpconv_dtoa(f, dtoabuf, frac_width, false); RSPAMD_PRINTF_APPEND(dtoabuf, slen); continue; case 'g': f = (double) va_arg(args, double); slen = fpconv_dtoa(f, dtoabuf, 0, true); RSPAMD_PRINTF_APPEND(dtoabuf, slen); continue; case 'F': f = (double) va_arg(args, long double); slen = fpconv_dtoa(f, dtoabuf, frac_width, false); RSPAMD_PRINTF_APPEND(dtoabuf, slen); continue; case 'G': f = (double) va_arg(args, long double); slen = fpconv_dtoa(f, dtoabuf, 0, true); RSPAMD_PRINTF_APPEND(dtoabuf, slen); continue; case 'p': ui64 = (uintptr_t) va_arg(args, void *); hex = 2; sign = 0; zero = '0'; width = sizeof(void *) * 2; break; case 'c': c = va_arg(args, int); c &= 0xffu; if (G_UNLIKELY(hex)) { char hexbuf[2]; hexbuf[0] = hex == 2 ? _HEX[(c >> 4u) & 0xfu] : _hex[(c >> 4u) & 0xfu]; hexbuf[1] = hex == 2 ? _HEX[c & 0xfu] : _hex[c & 0xfu]; RSPAMD_PRINTF_APPEND(hexbuf, 2); } else { RSPAMD_PRINTF_APPEND(&c, 1); } continue; case 'Z': c = '\0'; RSPAMD_PRINTF_APPEND(&c, 1); continue; case 'N': c = '\n'; RSPAMD_PRINTF_APPEND(&c, 1); continue; case '%': c = '%'; RSPAMD_PRINTF_APPEND(&c, 1); continue; default: c = *fmt; RSPAMD_PRINTF_APPEND(&c, 1); continue; } /* Print number */ p = numbuf; last = p + sizeof(numbuf); if (sign) { if (i64 < 0) { *p++ = '-'; ui64 = (uint64_t) -i64; } else { ui64 = (uint64_t) i64; } } if (!humanize) { p = rspamd_sprintf_num(p, last, ui64, zero, hex, b64 + b32, width); } else { p = rspamd_humanize_number(p, last, ui64, bytes); } slen = p - numbuf; RSPAMD_PRINTF_APPEND(numbuf, slen); } else { fmt++; } } /* Finish buffer */ if (fmt > buf_start) { wr = func(buf_start, fmt - buf_start, apd); if (wr <= 0) { goto oob; } written += wr; } oob: return written; }