void parse_cookie() { if (non_null(cookie_reject_domains)) Cookie_reject_domains = make_domain_list(cookie_reject_domains); if (non_null(cookie_accept_domains)) Cookie_accept_domains = make_domain_list(cookie_accept_domains); }
int sdl_string::strncmp(const char *s, size_t len) const { if (len <= 0) return 0; // equality if (!s) return non_null() ? 1 : 0; // "xx" > ""; ""=="" if (!non_null) return -1; // "" < "xx" return ::strncmp(space,s,len); }
boost::optional<ResultOf<F(SafeValueType<Args>...)>> apply(F&& f, Args&&... args) { if(non_null(args...)) { return std::forward<F>(f)(safe_dereference(std::forward<Args>(args))...); } else { return {}; } }
// weight type dependent weights dotproduct goes between these two void postSet(double& w, Util::Random01& rng) const { REWEIGHT_CHECK_NAN(w, before - postSet, set); if (non_null(random_add)) { double r = rng.random0n(random_add); REWEIGHT_CHECK_NAN(w, random0n, r); w += r; REWEIGHT_CHECK_NAN(w, post - random_add, random_add); } if (non_null(add)) { w += add; REWEIGHT_CHECK_NAN(w, post - add, add); } if (non_null(scale)) { w *= scale; REWEIGHT_CHECK_NAN(w, post - scale, scale); } }
void parse_proxy() { if (non_null(HTTP_proxy)) parseURL(HTTP_proxy, &HTTP_proxy_parsed, NULL); #ifdef USE_SSL if (non_null(HTTPS_proxy)) parseURL(HTTPS_proxy, &HTTPS_proxy_parsed, NULL); #endif /* USE_SSL */ #ifdef USE_GOPHER if (non_null(GOPHER_proxy)) parseURL(GOPHER_proxy, &GOPHER_proxy_parsed, NULL); #endif if (non_null(FTP_proxy)) parseURL(FTP_proxy, &FTP_proxy_parsed, NULL); if (non_null(NO_proxy)) set_no_proxy(NO_proxy); }
void initMailcap() { TextListItem *tl; int i; if (non_null(mailcap_files)) mailcap_list = make_domain_list(mailcap_files); else mailcap_list = NULL; if (mailcap_list == NULL) return; UserMailcap = New_N(struct mailcap *, mailcap_list->nitem); for (i = 0, tl = mailcap_list->first; tl; i++, tl = tl->next) UserMailcap[i] = loadMailcap(tl->ptr); }
/* run a systematic test converting characters from one encoding into UTF-8 and back, and see if everything survived */ void test_conversion (const struct ssPWD* pwd, const enum eEncodings encoding) { struct sPwdString* str; int i; /* character was converted to a replacement char U+FFFD? */ int replaced; unsigned char fffd[4] = { 0xef, 0xbf, 0xbd, 0 }; str = pwdgen_new_string(pwd, 16, encoding); if (1 == non_null (str, "string for test_conversion")) { for (i = 0; i < 256; i++) { str->content[0] = i; str->content[1] = 0x0; str->characters = 1; str->bytes = 1; str->encoding = encoding; /* printf ("# # At char %c (0x%02x), encoding %s\n", i, i, pwdgen_encoding(encoding)); */ pwdgen_convert(pwd, str, UTF_8); if (str->encoding != UTF_8) { equals (str->encoding, UTF_8, "char could be converted to UTF-8"); } if (str->characters != 1) { equals (str->characters, 1, "number of characters is 1"); } replaced = memcmp(str->content, (char*)fffd, 3); pwdgen_convert(pwd, str, encoding); if (str->encoding != encoding) { equals (str->encoding, encoding, "char could be converted back"); } if (str->characters != 1) { equals (str->characters, 1, "number of characters is still 1"); } if (str->bytes != 1) { equals (str->bytes, 1, "number of bytes is still 1"); } if (0 != replaced) { if ((unsigned char)str->content[0] != i) { if (!equals ( (unsigned char)str->content[0], i, "could be converted back")) { printf ("# # Char: %i (0x%02x, '%c') in %s\n", i, i, i, pwdgen_encoding(encoding)); hexdump_string("pwd",str); } } } else { if ( (unsigned char)str->content[0] != '?') { equals ( (unsigned char)str->content[0], '?', "could be converted back to '?'"); } } } } else { skip ( 256 * 6 + 1, "Couldn't allocate string for test_conversion"); } }
bool non_null(C const& c, Cs const&... cs) { return non_null(cs...); }
int sdl_string::strcmp(const char *s) const { if (!s) return non_null() ? 1 : 0; // "xx" > ""; ""=="" if (!non_null) return -1; // "" < "xx" return ::strcmp(space,s); }
int main (void) { non_null(NULL); return 0; }
/** if the user asked for --set X, set w to X. */ void maybeSet(double& w) const { REWEIGHT_CHECK_NAN(w, pre - maybeSet, ""); if (non_null(set)) w = set; }