コード例 #1
0
ファイル: rc.c プロジェクト: galexcode/w3m
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);
}
コード例 #2
0
ファイル: sdl_string.C プロジェクト: glycerine/shore-mt
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);
}
コード例 #3
0
ファイル: main.cpp プロジェクト: CCJY/coliru
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 {};
    }
}
コード例 #4
0
ファイル: Reweight.hpp プロジェクト: sdl-research/hyp
 // 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);
   }
 }
コード例 #5
0
ファイル: rc.c プロジェクト: galexcode/w3m
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);
}
コード例 #6
0
ファイル: mailcap.c プロジェクト: dafyddcrosby/sw3m
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);

}
コード例 #7
0
ファイル: test_sbe.c プロジェクト: gitpan/Dicop-Workerframe
/* 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"); }
 
  }
コード例 #8
0
ファイル: main.cpp プロジェクト: CCJY/coliru
bool non_null(C const& c, Cs const&... cs)
{ return non_null(cs...); }
コード例 #9
0
ファイル: sdl_string.C プロジェクト: glycerine/shore-mt
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);
}
コード例 #10
0
ファイル: non-null.c プロジェクト: nemequ/hedley
int main (void) {
  non_null(NULL);

  return 0;
}
コード例 #11
0
ファイル: Reweight.hpp プロジェクト: sdl-research/hyp
 /**
    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;
 }