当前位置: 首页>>代码示例>>C++>>正文


C++ GSIZE_TO_POINTER函数代码示例

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


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

示例1: tail_align

static void
tail_align (gpointer ptr,
            gsize size,
            const AlignmentCriteria * criteria,
            TailAlignResult * result)
{
  gsize unaligned_start_address, unaligned_end_address;
  gsize next_tail_boundary;
  gsize aligned_start_address, aligned_end_address;

  unaligned_start_address = GPOINTER_TO_SIZE (ptr);
  unaligned_end_address = unaligned_start_address + size - 1;
  next_tail_boundary = ((unaligned_end_address / criteria->tail) + 1) * criteria->tail;

  aligned_start_address = ((next_tail_boundary - size) / criteria->front) * criteria->front;
  if (aligned_start_address < unaligned_start_address)
  {
    aligned_start_address += criteria->tail;
    next_tail_boundary += criteria->tail;
  }
  aligned_end_address = aligned_start_address + size - 1;

  result->aligned_ptr = GSIZE_TO_POINTER (aligned_start_address);
  result->next_tail_ptr = GSIZE_TO_POINTER (next_tail_boundary);
  result->gap_size = next_tail_boundary - (aligned_end_address + 1);
}
开发者ID:Fitblip,项目名称:frida-gum,代码行数:26,代码来源:gumpagepool.c

示例2: torflowrelay_addMeasurement

void torflowrelay_addMeasurement(TorFlowRelay* relay,
        gsize contentLength, gsize roundTripTime, gsize payloadTime, gsize totalTime) {
    g_assert(relay);

    relay->transferTimes = g_slist_prepend(relay->transferTimes, GSIZE_TO_POINTER(totalTime));
    relay->transferSizes = g_slist_prepend(relay->transferSizes, GSIZE_TO_POINTER(contentLength));
}
开发者ID:shadow,项目名称:shadow-plugin-tor,代码行数:7,代码来源:torflow-relay.c

示例3: build_address_lookup

int build_address_lookup(char* first_snapshot, char* second_snapshot) {
    ssize_t rc;
    char* line;
    size_t len = 0;
    uint32_t addr;
    u_long taint_val;

    address_lookup = g_hash_table_new(g_direct_hash, g_direct_equal); 
    second_address_lookup = g_hash_table_new(g_direct_hash, g_direct_equal); 
   
/*  First Snapshot ############################################# */
    FILE* fp = fopen(first_snapshot, "r");
    assert(fp);
    while ((rc = getline(&line, &len, fp)) != -1) {
        sscanf(line, "%x: %lu\n", &addr, &taint_val);
        g_hash_table_insert(address_lookup, GUINT_TO_POINTER(addr), GSIZE_TO_POINTER(taint_val));
    }
    
/*  Second Snapshot ############################################# */
    fp = fopen(second_snapshot, "r");
    assert(fp);
    while ((rc = getline(&line, &len, fp)) != -1) {
        sscanf(line, "%x: %lu\n", &addr, &taint_val);
        g_hash_table_insert(second_address_lookup, GUINT_TO_POINTER(addr), GSIZE_TO_POINTER(taint_val));
    }
    return 1;
}
开发者ID:andrewjylee,项目名称:taint_trackers,代码行数:27,代码来源:stitch_working.cpp

示例4: glx_ctx_push_thread_local

void
glx_ctx_push_thread_local(VdpDeviceData *deviceData)
{
    glx_ctx_lock();
    Display *dpy = deviceData->display;
    const Window wnd = deviceData->root;
    thread_id_t thread_id = get_current_thread_id();

    ctx_stack.dpy = glXGetCurrentDisplay();
    if (!ctx_stack.dpy)
        ctx_stack.dpy = dpy;
    ctx_stack.wnd =     glXGetCurrentDrawable();
    ctx_stack.glc =     glXGetCurrentContext();
    ctx_stack.element_count ++;

    struct val_s *val = g_hash_table_lookup(glc_hash_table, GSIZE_TO_POINTER(thread_id));
    if (!val) {
        GLXContext glc = glXCreateContext(dpy, root_vi, root_glc, GL_TRUE);
        assert(glc);
        val = make_val(dpy, glc);
        g_hash_table_insert(glc_hash_table, GSIZE_TO_POINTER(thread_id), val);

        // try cleanup expired entries
        g_hash_table_foreach_remove(glc_hash_table, is_thread_expired, NULL);
    }
    assert(val->dpy == dpy);

    glXMakeCurrent(dpy, wnd, val->glc);
}
开发者ID:Dangku,项目名称:libvdpau-va-gl,代码行数:29,代码来源:ctx-stack.c

示例5: _insert_grl_mex_link

static void
_insert_grl_mex_link (GrlKeyID grl_key, MexContentMetadata mex_key)
{
  /* g_hash_table_insert (grl_to_mex, */
  /*                      GSIZE_TO_POINTER (grl_key), */
  /*                      GSIZE_TO_POINTER (mex_key)); */
  g_hash_table_insert (mex_to_grl,
                       GSIZE_TO_POINTER (mex_key),
                       GSIZE_TO_POINTER (grl_key));
}
开发者ID:jpwhiting,项目名称:media-explorer,代码行数:10,代码来源:mex-grilo.c

示例6: register_conversion_function

static void
register_conversion_function (GType          type,
                              ParseFunc      parse,
                              ToStringFunc   to_string)
{
  if (parse)
    g_hash_table_insert (parse_funcs, GSIZE_TO_POINTER (type), parse);
  if (to_string)
    g_hash_table_insert (to_string_funcs, GSIZE_TO_POINTER (type), to_string);
}
开发者ID:nacho,项目名称:gtk-,代码行数:10,代码来源:gtkcssstringfuncs.c

示例7: ipcam_event_input_msg_handler_read_param

static gboolean
ipcam_event_input_msg_handler_read_param(IpcamEventInputMsgHandler *handler, JsonBuilder *builder, const gchar *name)
{
    IpcamIConfig *iconfig;
    g_object_get(G_OBJECT(handler), "app", &iconfig, NULL);
    gboolean ret = FALSE;
    GVariant *value = NULL;

    value = ipcam_iconfig_read(iconfig, IPCAM_EVENT_INPUT_TYPE, name, "enable");
    if (value)
    {
        json_builder_set_member_name(builder, "enable");
        json_builder_add_boolean_value(builder, g_variant_get_boolean(value));
        g_variant_unref(value);
    }
    
    value = ipcam_iconfig_read(iconfig, IPCAM_EVENT_INPUT_TYPE, name, "schedules");
    if (value)
    {
        Schedules *sche;
        if (IS_64BIT_MACHINE)
        {
            sche = GSIZE_TO_POINTER(g_variant_get_uint64(value));
        }
        else
        {
            sche = GSIZE_TO_POINTER(g_variant_get_uint32(value));
        }
        gint i = 0;
        json_builder_set_member_name(builder, "schedules");
        json_builder_begin_object(builder);
        if (sche)
        {            
            for (i = ENUM_MON; i < ENUM_WEEKDAY_LAST; i++)
            {
                if (sche->schedule[i])
                {
                    json_builder_set_member_name(builder, weekday_name[i]);
                    json_builder_add_string_value(builder, sche->schedule[i]);
                    g_free(sche->schedule[i]);
                }
            }
            g_free(sche);
        }
        json_builder_end_object(builder);

        g_variant_unref(value);
    }
    
    return ret;
}
开发者ID:TangCheng,项目名称:iconfig,代码行数:51,代码来源:ipcam-event-input-handler.c

示例8: main_loop

static void
main_loop ()
{
  log_write ("openvassd %s started\n", OPENVASSD_VERSION);
  proctitle_set ("openvassd: Waiting for incoming connections");
  for (;;)
    {
      int soc;
      int family;
      unsigned int lg_address;
      struct sockaddr_in6 address6;
      struct sockaddr_in6 *p_addr;
      struct arglist *globals;
      struct addrinfo *ai;

      check_and_reload ();
      wait_for_children1 ();
      ai = arg_get_value (g_options, "addr");
      lg_address = sizeof (struct sockaddr_in6);
      soc = accept (global_iana_socket, (struct sockaddr *) (&address6),
                    &lg_address);
      if (soc == -1)
        continue;

      /*
       * MA: you cannot share an open SSL connection through fork/multithread
       * The SSL connection shall be open _after_ the fork */
      globals = emalloc (sizeof (struct arglist));
      arg_add_value (globals, "global_socket", ARG_INT, -1,
                     GSIZE_TO_POINTER (soc));

      arg_add_value (globals, "plugins", ARG_ARGLIST, -1, global_plugins);
      arg_add_value (globals, "preferences", ARG_ARGLIST, -1, global_preferences);

      p_addr = emalloc (sizeof (struct sockaddr_in6));
      family = ai->ai_family;
      memcpy (p_addr, &address6, sizeof (address6));
      arg_add_value (globals, "client_address", ARG_PTR, -1, p_addr);
      arg_add_value (globals, "family", ARG_INT, -1, GSIZE_TO_POINTER (family));

      /* we do not want to create an io thread, yet so the last argument is -1 */
      if (create_process ((process_func_t) scanner_thread, globals) < 0)
        {
          log_write ("Could not fork - client won't be served");
          sleep (2);
        }
      close (soc);
      arg_free (globals);
    }
}
开发者ID:manfredgithub,项目名称:Openvas-Source,代码行数:50,代码来源:openvassd.c

示例9: gum_store_runtime_bounds

static gboolean
gum_store_runtime_bounds (const GumModuleDetails * details,
                          GumRuntimeBounds * bounds)
{
  const GumMemoryRange * range = details->range;

  if (strcmp (details->name, "libandroid_runtime.so") != 0)
    return TRUE;

  bounds->start = GSIZE_TO_POINTER (range->base_address);
  bounds->end = GSIZE_TO_POINTER (range->base_address + range->size);

  return FALSE;
}
开发者ID:aonorin,项目名称:frida-gum,代码行数:14,代码来源:interceptor-android.c

示例10: af_animator_register_type_transformation

void
af_animator_register_type_transformation (GType                    type,
                                          AfTypeTransformationFunc trans_func)
{
  if (!transformable_types)
    transformable_types = g_hash_table_new (g_direct_hash, g_direct_equal);

  if (!trans_func)
    g_hash_table_remove (transformable_types, GSIZE_TO_POINTER (type));
  else
    g_hash_table_insert (transformable_types,
                         GSIZE_TO_POINTER (type),
                         trans_func);
}
开发者ID:troja84,项目名称:af,代码行数:14,代码来源:af-animator.c

示例11: gum_script_backend_obtain_v8

GumScriptBackend *
gum_script_backend_obtain_v8 (void)
{
  static volatile gsize gonce_value;

  if (g_once_init_enter (&gonce_value))
  {
    GumScriptBackend * backend = NULL;

    if (gum_query_is_rwx_supported ())
    {
#ifdef HAVE_V8
      backend = GUM_SCRIPT_BACKEND (
          g_object_new (GUM_V8_TYPE_SCRIPT_BACKEND, NULL));
#endif

      if (backend != NULL)
        _gum_register_early_destructor (gum_script_backend_deinit_v8);
    }

    g_once_init_leave (&gonce_value, GPOINTER_TO_SIZE (backend) + 1);
  }

  return GUM_SCRIPT_BACKEND (GSIZE_TO_POINTER (gonce_value - 1));
}
开发者ID:aonorin,项目名称:frida-gum,代码行数:25,代码来源:gumscriptbackend.c

示例12: gum_emit_malloc_range

static gboolean
gum_emit_malloc_range (const GumMallocRangeDetails * details,
                       gpointer user_data)
{
  GumJscMatchContext * mc = user_data;
  GumJscCore * core = mc->self->core;
  GumJscScope scope = GUM_JSC_SCOPE_INIT (core);
  JSContextRef ctx = mc->ctx;
  JSObjectRef range;
  JSValueRef result;
  gboolean proceed;
  gchar * str;

  range = JSObjectMake (ctx, NULL, NULL);
  _gumjs_object_set_pointer (ctx, range, "base",
      GSIZE_TO_POINTER (details->range->base_address), core);
  _gumjs_object_set_uint (ctx, range, "size", details->range->size);

  result = JSObjectCallAsFunction (ctx, mc->on_match, NULL, 1,
      (JSValueRef *) &range, &scope.exception);
  _gum_jsc_scope_flush (&scope);

  proceed = TRUE;
  if (result != NULL && _gumjs_string_try_get (ctx, result, &str, NULL))
  {
    proceed = strcmp (str, "stop") != 0;
    g_free (str);
  }

  return proceed;
}
开发者ID:terry2012,项目名称:frida-gum,代码行数:31,代码来源:gumjscprocess.c

示例13: find_image_text_section_ids

static GSList *
find_image_text_section_ids (gconstpointer address)
{
  GSList * ids = NULL;
  gsize section_count = 0;
  const gum_mach_header_t * header = address;
  guint8 * p;
  guint cmd_index, section_index;

  p = (guint8 *) (header + 1);
  for (cmd_index = 0; cmd_index != header->ncmds; cmd_index++)
  {
    struct load_command * lc = (struct load_command *) p;

    if (lc->cmd == GUM_LC_SEGMENT)
    {
      gum_segment_command_t * segcmd = (gum_segment_command_t *) lc;

      if ((segcmd->initprot & VM_PROT_EXECUTE) != 0)
      {
        for (section_index = 0; section_index != segcmd->nsects; section_index++)
        {
          ids = g_slist_prepend (ids,
              GSIZE_TO_POINTER (section_count + section_index + 1));
        }
      }

      section_count += segcmd->nsects;
    }

    p += lc->cmdsize;
  }

  return g_slist_reverse (ids);
}
开发者ID:idkwim,项目名称:frida-gum,代码行数:35,代码来源:gumprocess-darwin.c

示例14: gum_metal_array_get_extents

void
gum_metal_array_get_extents (GumMetalArray * self,
                             gpointer * start,
                             gpointer * end)
{
  GumMemoryRange range;
  guint size;

  size = (guint) ((guint8 *) gum_metal_array_element_at (self, self->capacity) -
      (guint8 *) self->data);
  gum_query_page_allocation_range (self->data, gum_round_up_to_page_size (size),
      &range);

  *start = GSIZE_TO_POINTER (range.base_address);
  *end = GSIZE_TO_POINTER (range.base_address + range.size);
}
开发者ID:frida,项目名称:frida-gum,代码行数:16,代码来源:gummetalarray.c

示例15: tny_gnome_keyring_password_getter_register_type

static gpointer
tny_gnome_keyring_password_getter_register_type (gpointer notused)
{
	GType type = 0;
	static const GTypeInfo info = 
		{
			sizeof (TnyGnomeKeyringPasswordGetterClass),
			NULL,   /* base_init */
			NULL,   /* base_finalize */
			(GClassInitFunc) tny_gnome_keyring_password_getter_class_init,   /* class_init */
			NULL,   /* class_finalize */
			NULL,   /* class_data */
			sizeof (TnyGnomeKeyringPasswordGetter),
			0,      /* n_preallocs */
			tny_gnome_keyring_password_getter_instance_init,    /* instance_init */
			NULL
		};


	static const GInterfaceInfo tny_password_getter_info = 
		{
			(GInterfaceInitFunc) tny_password_getter_init, /* interface_init */
			NULL,         /* interface_finalize */
			NULL          /* interface_data */
		};

	type = g_type_register_static (G_TYPE_OBJECT,
				       "TnyGnomeKeyringPasswordGetter",
				       &info, 0);

	g_type_add_interface_static (type, TNY_TYPE_PASSWORD_GETTER,
				     &tny_password_getter_info);

	return GSIZE_TO_POINTER (type);
}
开发者ID:Codeminded,项目名称:tinymail,代码行数:35,代码来源:tny-gnome-keyring-password-getter.c


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