• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ ARRLEN函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中ARRLEN函数的典型用法代码示例。如果您正苦于以下问题:C++ ARRLEN函数的具体用法?C++ ARRLEN怎么用?C++ ARRLEN使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了ARRLEN函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: verifyDatabase

bool MapDatabasePostgreSQL::saveBlock(const v3s16 &pos, const std::string &data)
{
	// Verify if we don't overflow the platform integer with the mapblock size
	if (data.size() > INT_MAX) {
		errorstream << "Database_PostgreSQL::saveBlock: Data truncation! "
			<< "data.size() over 0xFFFFFFFF (== " << data.size()
			<< ")" << std::endl;
		return false;
	}

	verifyDatabase();

	s32 x, y, z;
	x = htonl(pos.X);
	y = htonl(pos.Y);
	z = htonl(pos.Z);

	const void *args[] = { &x, &y, &z, data.c_str() };
	const int argLen[] = {
		sizeof(x), sizeof(y), sizeof(z), (int)data.size()
	};
	const int argFmt[] = { 1, 1, 1, 1 };

	if (getPGVersion() < 90500) {
		execPrepared("write_block_update", ARRLEN(args), args, argLen, argFmt);
		execPrepared("write_block_insert", ARRLEN(args), args, argLen, argFmt);
	} else {
		execPrepared("write_block", ARRLEN(args), args, argLen, argFmt);
	}
	return true;
}
开发者ID:Gael-de-Sailly,项目名称:minetest,代码行数:31,代码来源:database-postgresql.cpp


示例2: test

static void test(struct socket_server *ss) {
	pthread_t pid;
	pthread_create(&pid, NULL, _poll, ss);
	int i = 0;

	int connid = socket_server_connect(ss, 400, "127.0.0.1", 8888);
	
	getc(stdin);
	socket_server_start(ss, 401, connid);

	char* tmp[3] = { "hello", "world", "wong" };
	int cnt = ARRLEN(tmp);
	
	char* contents[ARRLEN(tmp)];
	for (i = 0; i < cnt; ++i)
	{
		contents[i] = malloc(strlen(tmp[i]) + 1); 
		memcpy(contents[i], tmp[i], strlen(tmp[i]));
	}
	
	for (i = 0; i < cnt; ++i)
	{
		socket_server_send(ss, connid, contents[i], strlen(contents[i]));
		getc(stdin);
	}
	printf("done\n");

	pthread_join(pid, NULL);
}
开发者ID:wonghoifung,项目名称:tips,代码行数:29,代码来源:client.c


示例3: updateMemory

int updateMemory(void)
{

#define ARRLEN(X) (sizeof(X) / sizeof(X[0]))
    long pagesize; /* using a long promotes the arithmetic */
    size_t len;

    {
        static int mib[] = {CTL_HW, HW_PHYSMEM};

        len = sizeof(Total);
        sysctl(mib, ARRLEN(mib), &Total, &len, NULL, 0);
        Total >>= 10;
    }

    {
        struct uvmexp x;
        static int mib[] = {CTL_VM, VM_UVMEXP};

        len = sizeof(x);
        STotal = SUsed = SFree = -1;
        pagesize = 1;
        if(-1 < sysctl(mib, ARRLEN(mib), &x, &len, NULL, 0))
        {
            pagesize = x.pagesize;
            STotal = (pagesize * x.swpages) >> 10;
            SUsed = (pagesize * x.swpginuse) >> 10;
            SFree = STotal - SUsed;
        }
    }
开发者ID:serghei,项目名称:kde3-kdebase,代码行数:30,代码来源:Memory.c


示例4: test_nghttp2_hd_deflate_bound

void test_nghttp2_hd_deflate_bound(void) {
  nghttp2_hd_deflater deflater;
  nghttp2_nv nva[] = {MAKE_NV(":method", "GET"), MAKE_NV("alpha", "bravo")};
  nghttp2_bufs bufs;
  size_t bound, bound2;
  nghttp2_mem *mem;

  mem = nghttp2_mem_default();
  frame_pack_bufs_init(&bufs);

  nghttp2_hd_deflate_init(&deflater, mem);

  bound = nghttp2_hd_deflate_bound(&deflater, nva, ARRLEN(nva));

  CU_ASSERT(12 + 6 * 2 * 2 + nva[0].namelen + nva[0].valuelen + nva[1].namelen +
                nva[1].valuelen ==
            bound);

  nghttp2_hd_deflate_hd_bufs(&deflater, &bufs, nva, ARRLEN(nva));

  CU_ASSERT(bound > (size_t)nghttp2_bufs_len(&bufs));

  bound2 = nghttp2_hd_deflate_bound(&deflater, nva, ARRLEN(nva));

  CU_ASSERT(bound == bound2);

  nghttp2_bufs_free(&bufs);
  nghttp2_hd_deflate_free(&deflater);
}
开发者ID:0xfffffff7,项目名称:nghttp2,代码行数:29,代码来源:nghttp2_hd_test.c


示例5: main

int main(void)
{
	int A[] = {6, 2, 4, 3, 5, 1}; 
	int i = 0;

	
	clock_t begin, end;
	
	printf("Tal før sortering:\n  ");
	
	for(i = 0; i < ARRLEN(A); i++)
		printf("%d  ", A[i]);
		
	printf("\n");
	
	begin = clock();
	MergeSort(A, 0, ARRLEN(A) - 1);
	end = clock();
	
	printf("Tal efter sortering:\n  ");
	
	for(i = 0; i < ARRLEN(A); i++)	
		printf("%d  ", A[i]);
		
	printf("\n");	
	
	printf("Kørselstid = %f\n", (double)(end - begin) / CLOCKS_PER_SEC);
}
开发者ID:BachelorDatalogi2012-2015,项目名称:C,代码行数:28,代码来源:MergeSort.c


示例6: generateOFFSIVAL

static int generateOFFSIVAL(OFFSIVALARR *oivr, 
			    int d_min, int d_max, 
			    const ResultSet *rsp)
     /**< Collect position intervals for the top scoring results of
      * the largest fragment.
      * Array of results must have been sorted by rsr[i].swatscor.
      */
{
  int errcode;
  struct SETUPOFFSIVALARG_ arg;
  
  resultSetGetNumberOfResultsInSegment(0, rsp);
  ARRLEN(*oivr) = (size_t) 0;

  if (resultSetGetNumberOfResultsInSegment(0, rsp) < 1) 
    return ERRCODE_SUCCESS;

  arg.dmin = (SEQLEN_t) (d_min < 0)? 0: d_min;
  arg.dmax = (SEQLEN_t) (d_max < 0)? 0: d_max;
  if (arg.dmin > arg.dmax) 
    return ERRCODE_ASSERT;
  
  arg.oivr = *oivr;
  arg.max_rank = 0;
  if ((errcode = resultSetDo(&arg, setupOFFSIVALcbf, rsp)))
    return errcode;
  *oivr = arg.oivr;

  /* sort intervals by sequence and lower limit */
  qsort(*oivr, ARRLEN(*oivr), sizeof(OFFSIVAL), cmpOFFSIVAL);
  
  return ERRCODE_SUCCESS; 
}
开发者ID:rcallahan,项目名称:smalt,代码行数:33,代码来源:resultpairs.c


示例7: resetPairs

static void resetPairs(ResultPairs *p)
{
  ARRLEN(p->mpr) = 0;
  ARRLEN(p->ivr) = 0;
  p->status = 0;
  p->n_proper = 0;
  p->n_within = 0;
}
开发者ID:rcallahan,项目名称:smalt,代码行数:8,代码来源:resultpairs.c


示例8: size_readable

void size_readable(float *size, const char **unit)
{
	const char *units[] = { "", "K", "M", "G" };
	int i;

	for (i = 0; i < ARRLEN(units) && *size > 1024.0; i++)
		*size /= 1024.0;
	*unit = units[MIN(i, ARRLEN(units) - 1)];
}
开发者ID:bchallenor,项目名称:sxiv,代码行数:9,代码来源:util.c


示例9: resultSetBlankPairs

void resultSetBlankPairs(ResultPairs *p)
{
  if ((p)) {
    ARRLEN(p->ivr) = 0;
    ARRLEN(p->mpr) = 0;
    p->status = 0;
    p->n_proper = 0;
    p->n_within = 0;
    p->dmin = 0;
    p->dmax = 0;
  }
}
开发者ID:rcallahan,项目名称:smalt,代码行数:12,代码来源:resultpairs.c


示例10: run_nghttp2_hd

static void run_nghttp2_hd(void) {
  nghttp2_hd_deflater deflater;
  nghttp2_hd_inflater inflater;
  nghttp2_bufs bufs;
  int rv;
  nghttp2_nv nva1[] = {
      MAKE_NV(":scheme", "https"), MAKE_NV(":authority", "example.org"),
      MAKE_NV(":path", "/slashdot"),
      MAKE_NV("accept-encoding", "gzip, deflate"), MAKE_NV("foo", "bar")};
  nghttp2_nv nva2[] = {
      MAKE_NV(":scheme", "https"), MAKE_NV(":authority", "example.org"),
      MAKE_NV(":path", "/style.css"), MAKE_NV("cookie", "nghttp2=FTW"),
      MAKE_NV("foo", "bar2")};

  rv = frame_pack_bufs_init(&bufs);

  if (rv != 0) {
    return;
  }

  rv = nghttp2_hd_deflate_init(&deflater, nghttp2_mem_fm());

  if (rv != 0) {
    goto deflate_init_fail;
  }

  rv = nghttp2_hd_inflate_init(&inflater, nghttp2_mem_fm());

  if (rv != 0) {
    goto inflate_init_fail;
  }

  rv = deflate_inflate(&deflater, &inflater, &bufs, nva1, ARRLEN(nva1),
                       nghttp2_mem_fm());

  if (rv != 0) {
    goto deflate_hd_fail;
  }

  rv = deflate_inflate(&deflater, &inflater, &bufs, nva2, ARRLEN(nva2),
                       nghttp2_mem_fm());

  if (rv != 0) {
    goto deflate_hd_fail;
  }

deflate_hd_fail:
  nghttp2_hd_inflate_free(&inflater);
inflate_init_fail:
  nghttp2_hd_deflate_free(&deflater);
deflate_init_fail:
  nghttp2_bufs_free(&bufs);
}
开发者ID:dajobe,项目名称:nghttp2,代码行数:53,代码来源:failmalloc_test.c


示例11: flagOutPairsWithDoubleFragments

static int flagOutPairsWithDoubleFragments(const ResultPairs *pairp,
					   const ResultSet *rsrp, 
					   const ResultSet *rsmp)
{
  int errcode;
  MATEPAIRARR mpr = pairp->mpr;
  size_t npairs = ARRLEN(pairp->mpr);
  MAPFLG_t const mask = MAPFLG_PROPER | MAPFLG_WITHIN | MAPFLG_INVALID;
  MAPFLG_t const properflg = MAPFLG_PROPER | MAPFLG_WITHIN;
  int nn, i, j;
  short qsegnoA, qsegnoB;

  if (npairs > INT_MAX)
    return ERRCODE_OVERFLOW;

  nn = (int) npairs;
  if ((errcode = resultSetGetNumberOfSegments(NULL, &qsegnoA, rsrp)))
    return errcode;

  if ((errcode = resultSetGetNumberOfSegments(NULL, &qsegnoB, rsmp)))
    return errcode;

  if (nn < 2 || (qsegnoA < 1 && qsegnoB < 1))
    return ERRCODE_SUCCESS;
  
  for (i=0; i<nn; i++) {
    if ((mpr[i].mapflg&mask) == properflg) {
      /* is first proper pair, flag out all other pairs with complementary fragments */
      int sxA = resultGetFragmentNo(mpr[i].ap);
      int sxB = resultGetFragmentNo(mpr[i].bp);
 
      for (j=0; j<nn; j++) {
	if (!(mpr[j].mapflg&MAPFLG_INVALID) &&
	    j != i &&
	    (mpr[j].mapflg&properflg) != properflg &&
	    (resultGetFragmentNo(mpr[j].ap) == sxA ||
	     resultGetFragmentNo(mpr[j].bp) == sxB)
	    )
	  mpr[j].mapflg |= MAPFLG_INVALID;
      }
    }
  }
  /* skip the flagged out pairs */
  for (j=0; j<nn && !(mpr[j].mapflg&MAPFLG_INVALID); j++);
  for (i=j+1; i<nn; i++) {
    if (!(mpr[i].mapflg&MAPFLG_INVALID)) 
      mpr[j++] = mpr[i];
  }
  ARRLEN(mpr) = (size_t) j;

  return ERRCODE_SUCCESS;
}
开发者ID:rcallahan,项目名称:smalt,代码行数:52,代码来源:resultpairs.c


示例12: test_nghttp2_hd_deflate_same_indexed_repr

void test_nghttp2_hd_deflate_same_indexed_repr(void) {
  nghttp2_hd_deflater deflater;
  nghttp2_hd_inflater inflater;
  nghttp2_nv nva1[] = {MAKE_NV("cookie", "alpha"), MAKE_NV("cookie", "alpha")};
  nghttp2_nv nva2[] = {MAKE_NV("cookie", "alpha"), MAKE_NV("cookie", "alpha"),
                       MAKE_NV("cookie", "alpha")};
  nghttp2_bufs bufs;
  ssize_t blocklen;
  nva_out out;
  int rv;
  nghttp2_mem *mem;

  mem = nghttp2_mem_default();
  frame_pack_bufs_init(&bufs);

  nva_out_init(&out);
  CU_ASSERT(0 == nghttp2_hd_deflate_init(&deflater, mem));
  CU_ASSERT(0 == nghttp2_hd_inflate_init(&inflater, mem));

  /* Encode 2 same headers.  Emit 1 literal reprs and 1 index repr. */
  rv = nghttp2_hd_deflate_hd_bufs(&deflater, &bufs, nva1, ARRLEN(nva1));
  blocklen = nghttp2_bufs_len(&bufs);

  CU_ASSERT(0 == rv);
  CU_ASSERT(blocklen > 0);
  CU_ASSERT(blocklen == inflate_hd(&inflater, &out, &bufs, 0, mem));

  CU_ASSERT(2 == out.nvlen);
  assert_nv_equal(nva1, out.nva, 2, mem);

  nva_out_reset(&out, mem);
  nghttp2_bufs_reset(&bufs);

  /* Encode 3 same headers.  This time, emits 3 index reprs. */
  rv = nghttp2_hd_deflate_hd_bufs(&deflater, &bufs, nva2, ARRLEN(nva2));
  blocklen = nghttp2_bufs_len(&bufs);

  CU_ASSERT(0 == rv);
  CU_ASSERT(blocklen == 3);
  CU_ASSERT(blocklen == inflate_hd(&inflater, &out, &bufs, 0, mem));

  CU_ASSERT(3 == out.nvlen);
  assert_nv_equal(nva2, out.nva, 3, mem);

  nva_out_reset(&out, mem);
  nghttp2_bufs_reset(&bufs);

  /* Cleanup */
  nghttp2_bufs_free(&bufs);
  nghttp2_hd_inflate_free(&inflater);
  nghttp2_hd_deflate_free(&deflater);
}
开发者ID:0xfffffff7,项目名称:nghttp2,代码行数:52,代码来源:nghttp2_hd_test.c


示例13:

MapgenSpecificParams *EmergeManager::createMapgenParams(const std::string &mgname)
{
	u32 i;
	for (i = 0; i < ARRLEN(reg_mapgens) && mgname != reg_mapgens[i].name; i++);
	if (i == ARRLEN(reg_mapgens)) {
		errorstream << "EmergeManager: Mapgen " << mgname <<
			" not registered" << std::endl;
		return NULL;
	}

	MapgenFactory *mgfactory = reg_mapgens[i].factory;
	return mgfactory->createMapgenParams();
}
开发者ID:nikkuang,项目名称:minetest,代码行数:13,代码来源:emerge.cpp


示例14: test_nghttp2_hd_no_index

void test_nghttp2_hd_no_index(void) {
  nghttp2_hd_deflater deflater;
  nghttp2_hd_inflater inflater;
  nghttp2_bufs bufs;
  ssize_t blocklen;
  nghttp2_nv nva[] = {
      MAKE_NV(":method", "GET"), MAKE_NV(":method", "POST"),
      MAKE_NV(":path", "/foo"),  MAKE_NV("version", "HTTP/1.1"),
      MAKE_NV(":method", "GET"),
  };
  size_t i;
  nva_out out;
  int rv;
  nghttp2_mem *mem;

  mem = nghttp2_mem_default();

  /* 1st :method: GET can be indexable, last one is not */
  for (i = 1; i < ARRLEN(nva); ++i) {
    nva[i].flags = NGHTTP2_NV_FLAG_NO_INDEX;
  }

  frame_pack_bufs_init(&bufs);

  nva_out_init(&out);

  nghttp2_hd_deflate_init(&deflater, mem);
  nghttp2_hd_inflate_init(&inflater, mem);

  rv = nghttp2_hd_deflate_hd_bufs(&deflater, &bufs, nva, ARRLEN(nva));
  blocklen = nghttp2_bufs_len(&bufs);

  CU_ASSERT(0 == rv);
  CU_ASSERT(blocklen > 0);
  CU_ASSERT(blocklen == inflate_hd(&inflater, &out, &bufs, 0, mem));

  CU_ASSERT(ARRLEN(nva) == out.nvlen);
  assert_nv_equal(nva, out.nva, ARRLEN(nva), mem);

  CU_ASSERT(out.nva[0].flags == NGHTTP2_NV_FLAG_NONE);
  for (i = 1; i < ARRLEN(nva); ++i) {
    CU_ASSERT(out.nva[i].flags == NGHTTP2_NV_FLAG_NO_INDEX);
  }

  nva_out_reset(&out, mem);

  nghttp2_bufs_free(&bufs);
  nghttp2_hd_inflate_free(&inflater);
  nghttp2_hd_deflate_free(&deflater);
}
开发者ID:0xfffffff7,项目名称:nghttp2,代码行数:50,代码来源:nghttp2_hd_test.c


示例15: test_nghttp2_nv_array_copy

void test_nghttp2_nv_array_copy(void)
{
  nghttp2_nv *nva;
  ssize_t rv;
  nghttp2_nv emptynv[] = {MAKE_NV("", ""),
                          MAKE_NV("", "")};
  nghttp2_nv nv[] = {MAKE_NV("alpha", "bravo"),
                     MAKE_NV("charlie", "delta")};
  nghttp2_nv bignv;

  bignv.name = (uint8_t*)"echo";
  bignv.namelen = strlen("echo");
  bignv.valuelen = (1 << 14) - 1;
  bignv.value = malloc(bignv.valuelen);
  memset(bignv.value, '0', bignv.valuelen);

  rv = nghttp2_nv_array_copy(&nva, NULL, 0);
  CU_ASSERT(0 == rv);
  CU_ASSERT(NULL == nva);

  rv = nghttp2_nv_array_copy(&nva, emptynv, ARRLEN(emptynv));
  CU_ASSERT(0 == rv);
  CU_ASSERT(nva[0].namelen == 0);
  CU_ASSERT(nva[0].valuelen == 0);
  CU_ASSERT(nva[1].namelen == 0);
  CU_ASSERT(nva[1].valuelen == 0);

  nghttp2_nv_array_del(nva);

  rv = nghttp2_nv_array_copy(&nva, nv, ARRLEN(nv));
  CU_ASSERT(0 == rv);
  CU_ASSERT(nva[0].namelen == 5);
  CU_ASSERT(0 == memcmp("alpha", nva[0].name, 5));
  CU_ASSERT(nva[0].valuelen = 5);
  CU_ASSERT(0 == memcmp("bravo", nva[0].value, 5));
  CU_ASSERT(nva[1].namelen == 7);
  CU_ASSERT(0 == memcmp("charlie", nva[1].name, 7));
  CU_ASSERT(nva[1].valuelen == 5);
  CU_ASSERT(0 == memcmp("delta", nva[1].value, 5));

  nghttp2_nv_array_del(nva);

  /* Large header field is acceptable */
  rv = nghttp2_nv_array_copy(&nva, &bignv, 1);
  CU_ASSERT(0 == rv);

  nghttp2_nv_array_del(nva);

  free(bignv.value);
}
开发者ID:DrDoing,项目名称:nghttp2,代码行数:50,代码来源:nghttp2_frame_test.c


示例16: read_memswap

gint read_memswap(gulong *mem, gulong *swap, gulong *MT, gulong *MU, gulong *ST, gulong *SU)
{
    int pagesize;
    size_t len;

#define ARRLEN(X) (sizeof(X)/sizeof(X[0]))
    {
        static int mib[2];
        /* 64-bit datatype */
        if(sizeof(size_t) == 8) {
            mib[0] = CTL_HW;
            mib[1] = HW_PHYSMEM64;
        }
        /* assume 32-bit datatype */
        else {
            mib[0] = CTL_HW;
            mib[1] = HW_PHYSMEM;
        }
        len = sizeof(MTotal);
        sysctl(mib, ARRLEN(mib), &MTotal, &len, NULL, 0);
        MTotal >>= 10;
    }

    {
      static int mib[] = {CTL_HW, HW_PAGESIZE};
      len = sizeof(pagesize);
      sysctl(mib, ARRLEN(mib), &pagesize, &len, NULL, 0);
    }

#if __NetBSD_Version__ > 106210000
    {
      struct swapent* swap;
      int nswap, n;
      STotal = SUsed = SFree = 0;
      if ((nswap = swapctl(SWAP_NSWAP, NULL, 0)) > 0) {
        swap = (struct swapent*)malloc(nswap * sizeof(*swap));
        if (swapctl(SWAP_STATS, (void*)swap, nswap) == nswap) {
          for (n = 0; n < nswap; n++) {
            STotal += swap[n].se_nblks;
            SUsed  += swap[n].se_inuse;
          }

          STotal = dbtob(STotal >> 10);
          SUsed  = dbtob(SUsed >> 10);
          SFree  = STotal - SUsed;
        }
        free(swap);
      }
    }
开发者ID:cianmcgovern,项目名称:xfce4-systemload-plugin,代码行数:49,代码来源:memswap.c


示例17: img_init

void img_init(img_t *img, win_t *win) {
	zoom_min = zoom_levels[0] / 100.0;
	zoom_max = zoom_levels[ARRLEN(zoom_levels) - 1] / 100.0;

	if (img == NULL || win == NULL)
		return;

	imlib_context_set_display(win->env.dpy);
	imlib_context_set_visual(win->env.vis);
	imlib_context_set_colormap(win->env.cmap);

	img->im = NULL;
	img->win = win;
	img->zoom = options->zoom;
	img->zoom = MAX(img->zoom, zoom_min);
	img->zoom = MIN(img->zoom, zoom_max);
	img->checkpan = false;
	img->dirty = false;
	img->aa = options->aa;
	img->alpha = true;
	img->slideshow = false;
	img->ss_delay = SLIDESHOW_DELAY * 1000;
	img->multi.cap = img->multi.cnt = 0;
	img->multi.animate = false;
}
开发者ID:paradigm,项目名称:sxiv,代码行数:25,代码来源:image.c


示例18: img_init

void img_init(img_t *img, win_t *win)
{
	zoom_min = zoom_levels[0] / 100.0;
	zoom_max = zoom_levels[ARRLEN(zoom_levels) - 1] / 100.0;

	if (img == NULL || win == NULL)
		return;

	imlib_context_set_display(win->env.dpy);
	imlib_context_set_visual(win->env.vis);
	imlib_context_set_colormap(win->env.cmap);

	img->im = NULL;
	img->win = win;
	img->scalemode = options->scalemode;
	img->zoom = options->zoom;
	img->zoom = MAX(img->zoom, zoom_min);
	img->zoom = MIN(img->zoom, zoom_max);
	img->checkpan = false;
	img->dirty = false;
	img->aa = ANTI_ALIAS;
	img->alpha = ALPHA_LAYER;
	img->multi.cap = img->multi.cnt = 0;
	img->multi.animate = false;
	img->multi.length = img->multi.repeat = 0;

	img->cmod = imlib_create_color_modifier();
	img->gamma = MIN(MAX(options->gamma, -GAMMA_RANGE), GAMMA_RANGE);
	
	img->ss.on = options->slideshow > 0;
	img->ss.delay = options->slideshow > 0 ? options->slideshow : SLIDESHOW_DELAY;
}
开发者ID:kkb7401,项目名称:sxiv,代码行数:32,代码来源:image.c


示例19: img_init

void img_init(img_t *img, win_t *win)
{
	zoom_min = zoom_levels[0] / 100.0;
	zoom_max = zoom_levels[ARRLEN(zoom_levels) - 1] / 100.0;

	if (img == NULL || win == NULL)
		return;

	imlib_context_set_display(win->env.dpy);
	imlib_context_set_visual(win->env.vis);
	imlib_context_set_colormap(win->env.cmap);

	img->im = NULL;
	img->win = win;
	img->zoom = options->zoom;
	img->zoom = MAX(img->zoom, zoom_min);
	img->zoom = MIN(img->zoom, zoom_max);
	img->checkpan = false;
	img->dirty = false;
	img->aa = RENDER_ANTI_ALIAS;
	img->alpha = !RENDER_WHITE_ALPHA;
	img->multi.cap = img->multi.cnt = 0;
	img->multi.animate = false;

	img->cmod = imlib_create_color_modifier();
	img->gamma = MIN(MAX(options->gamma, -GAMMA_RANGE), GAMMA_RANGE);
}
开发者ID:Xender,项目名称:sxiv,代码行数:27,代码来源:image.c


示例20: error_reply

static int error_reply(nghttp2_session *session,
                       http2_stream_data *stream_data)
{
  int rv;
  int pipefd[2];
  nghttp2_nv hdrs[] = {
    MAKE_NV(":status", "404")
  };

  rv = pipe(pipefd);
  if(rv != 0) {
    warn("Could not create pipe");
    rv = nghttp2_submit_rst_stream(session, NGHTTP2_FLAG_NONE,
                                   stream_data->stream_id,
                                   NGHTTP2_INTERNAL_ERROR);
    if(rv != 0) {
      warnx("Fatal error: %s", nghttp2_strerror(rv));
      return -1;
    }
    return 0;
  }
  write(pipefd[1], ERROR_HTML, sizeof(ERROR_HTML) - 1);
  close(pipefd[1]);
  stream_data->fd = pipefd[0];
  if(send_response(session, stream_data->stream_id, hdrs, ARRLEN(hdrs),
                   pipefd[0]) != 0) {
    close(pipefd[0]);
    return -1;
  }
  return 0;
}
开发者ID:bizzbyster,项目名称:nghttp2,代码行数:31,代码来源:libevent-server.c



注:本文中的ARRLEN函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ ARRPTR函数代码示例发布时间:2022-05-30
下一篇:
C++ ARRAY_TYPE函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap