您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ GUINT32_FROM_LE函数代码示例

51自学网 2021-06-01 20:59:56
  C++
这篇教程C++ GUINT32_FROM_LE函数代码示例写得很实用,希望能帮到您。

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

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

示例1: dfu_image_from_dfuse

/** * dfu_image_from_dfuse: (skip) * @data: data buffer * @length: length of @data we can access * @consumed: (out): the number of bytes we consued * @error: a #GError, or %NULL * * Unpacks an image from DfuSe data. * * Returns: a #DfuImage, or %NULL for error **/static DfuImage *dfu_image_from_dfuse (const guint8 *data,		      guint32 length,		      guint32 *consumed,		      GError **error){	DfuSeImagePrefix *im;	guint32 elements;	guint32 offset = sizeof(DfuSeImagePrefix);	g_autoptr(DfuImage) image = NULL;	g_assert_cmpint(sizeof(DfuSeImagePrefix), ==, 274);	/* check input buffer size */	if (length < sizeof(DfuSeImagePrefix)) {		g_set_error (error,			     FWUPD_ERROR,			     FWUPD_ERROR_INTERNAL,			     "invalid image data size %u",			     (guint32) length);		return NULL;	}	/* verify image signature */	im = (DfuSeImagePrefix *) data;	if (memcmp (im->sig, "Target", 6) != 0) {		g_set_error_literal (error,				     FWUPD_ERROR,				     FWUPD_ERROR_INVALID_FILE,				     "invalid DfuSe target signature");		return NULL;	}	/* create new image */	image = dfu_image_new ();	dfu_image_set_alt_setting (image, im->alt_setting);	if (GUINT32_FROM_LE (im->target_named) == 0x01)		dfu_image_set_name (image, im->target_name);	/* parse elements */	length -= offset;	elements = GUINT32_FROM_LE (im->elements);	for (guint j = 0; j < elements; j++) {		guint32 consumed_local;		g_autoptr(DfuElement) element = NULL;		element = dfu_element_from_dfuse (data + offset, length,						  &consumed_local, error);		if (element == NULL)			return NULL;		dfu_image_add_element (image, element);		offset += consumed_local;		length -= consumed_local;	}	/* return size */	if (consumed != NULL)		*consumed = offset;	return g_object_ref (image);}
开发者ID:superm1,项目名称:fwupd,代码行数:71,


示例2: ico_write_int32

static gintico_write_int32 (FILE     *fp,                 guint32  *data,                 gint      count){  gint total;  total = count;  if (count > 0)    {#if (G_BYTE_ORDER == G_BIG_ENDIAN)      gint i;      for (i = 0; i < count; i++)        data[i] = GUINT32_FROM_LE (data[i]);#endif      ico_write_int8 (fp, (guint8 *) data, count * 4);#if (G_BYTE_ORDER == G_BIG_ENDIAN)      /* Put it back like we found it */      for (i = 0; i < count; i++)        data[i] = GUINT32_FROM_LE (data[i]);#endif    }  return total * 4;}
开发者ID:Distrotech,项目名称:gimp,代码行数:28,


示例3: dfu_firmware_from_dfuse

/** * dfu_firmware_from_dfuse: (skip) * @firmware: a #DfuFirmware * @bytes: data to parse * @flags: some #DfuFirmwareParseFlags * @error: a #GError, or %NULL * * Unpacks into a firmware object from DfuSe data. * * Returns: %TRUE for success **/gbooleandfu_firmware_from_dfuse (DfuFirmware *firmware,			 GBytes *bytes,			 DfuFirmwareParseFlags flags,			 GError **error){	DfuSePrefix *prefix;	gsize len;	guint32 offset = sizeof(DfuSePrefix);	guint8 *data;	/* check the prefix (BE) */	data = (guint8 *) g_bytes_get_data (bytes, &len);	prefix = (DfuSePrefix *) data;	if (memcmp (prefix->sig, "DfuSe", 5) != 0) {		g_set_error_literal (error,				     FWUPD_ERROR,				     FWUPD_ERROR_INTERNAL,				     "invalid DfuSe prefix");		return FALSE;	}	/* check the version */	if (prefix->ver != 0x01) {		g_set_error (error,			     FWUPD_ERROR,			     FWUPD_ERROR_INTERNAL,			     "invalid DfuSe version, got %02x",			     prefix->ver);		return FALSE;	}	/* check image size */	if (GUINT32_FROM_LE (prefix->image_size) != len) {		g_set_error (error,			     FWUPD_ERROR,			     FWUPD_ERROR_INTERNAL,			     "invalid DfuSe image size, "			     "got %" G_GUINT32_FORMAT ", "			     "expected %" G_GSIZE_FORMAT,			     GUINT32_FROM_LE (prefix->image_size),			     len);		return FALSE;	}	/* parse the image targets */	len -= sizeof(DfuSePrefix);	for (guint i = 0; i < prefix->targets; i++) {		guint consumed;		g_autoptr(DfuImage) image = NULL;		image = dfu_image_from_dfuse (data + offset, (guint32) len,					      &consumed, error);		if (image == NULL)			return FALSE;		dfu_firmware_add_image (firmware, image);		offset += consumed;		len -= consumed;	}	return TRUE;}
开发者ID:superm1,项目名称:fwupd,代码行数:71,


示例4: hcidump_process_packet

static gboolean hcidump_process_packet(FILE_T fh, struct wtap_pkthdr *phdr,    Buffer *buf, int *err, gchar **err_info){	struct dump_hdr dh;	int packet_size;	if (!wtap_read_bytes_or_eof(fh, &dh, DUMP_HDR_SIZE, err, err_info))		return FALSE;	packet_size = GUINT16_FROM_LE(dh.len);	if (packet_size > WTAP_MAX_PACKET_SIZE) {		/*		 * Probably a corrupt capture file; don't blow up trying		 * to allocate space for an immensely-large packet.		 */		*err = WTAP_ERR_BAD_FILE;		*err_info = g_strdup_printf("hcidump: File has %u-byte packet, bigger than maximum of %u",			packet_size, WTAP_MAX_PACKET_SIZE);		return FALSE;	}	phdr->rec_type = REC_TYPE_PACKET;	phdr->presence_flags = WTAP_HAS_TS;	phdr->ts.secs = GUINT32_FROM_LE(dh.ts_sec);	phdr->ts.nsecs = GUINT32_FROM_LE(dh.ts_usec) * 1000;	phdr->caplen = packet_size;	phdr->len = packet_size;	phdr->pseudo_header.p2p.sent = (dh.in ? FALSE : TRUE);	return wtap_read_packet_bytes(fh, buf, packet_size, err, err_info);}
开发者ID:ARK1988,项目名称:wireshark,代码行数:32,


示例5: riff_seek_id3

size_triff_seek_id3(FILE *file){	int ret;	struct stat st;	struct riff_header header;	struct riff_chunk_header chunk;	size_t size;	/* determine the file size */	ret = fstat(fileno(file), &st);	if (ret < 0) {		g_warning("Failed to stat file descriptor: %s",			  strerror(errno));		return 0;	}	/* seek to the beginning and read the RIFF header */	ret = fseek(file, 0, SEEK_SET);	if (ret != 0) {		g_warning("Failed to seek: %s", g_strerror(errno));		return 0;	}	size = fread(&header, sizeof(header), 1, file);	if (size != 1 ||	    memcmp(header.id, "RIFF", 4) != 0 ||	    GUINT32_FROM_LE(header.size) > (uint32_t)st.st_size)		/* not a RIFF file */		return 0;	while (true) {		/* read the chunk header */		size = fread(&chunk, sizeof(chunk), 1, file);		if (size != 1)			return 0;		size = GUINT32_FROM_LE(chunk.size);		if (size > G_MAXINT32)			/* too dangerous, bail out: possible integer			   underflow when casting to off_t */			return 0;		if (size % 2 != 0)			/* pad byte */			++size;		if (memcmp(chunk.id, "id3 ", 4) == 0)			/* found it! */			return size;		ret = fseek(file, size, SEEK_CUR);		if (ret != 0)			return 0;	}}
开发者ID:GunioRobot,项目名称:mpd,代码行数:59,


示例6: print_obj

static void print_obj(struct db_obj_ent *obj){	uint32_t n_str = GUINT32_FROM_LE(obj->n_str);	int i;	void *p;	uint16_t *slenp;	char *dbstr;	if (GUINT32_FROM_LE(obj->flags) & DB_OBJ_INLINE) {		printf("%s/t%s/t%s/t[%u]/t%u/n",			obj->bucket,			obj->owner,			obj->md5,			(unsigned) GUINT64_FROM_LE(obj->size),			n_str);	} else {		printf("%s/t%s/t%s/t%llX",			obj->bucket,			obj->owner,			obj->md5,			(long long) GUINT64_FROM_LE(obj->d.a.oid));		for (i = 0; i < MAXWAY; i++) {			if (i == 0) {				printf("/t");			} else {				printf(",");			}			printf("%d", GUINT32_FROM_LE(obj->d.a.nidv[i]));		}		printf(" %u/n", n_str);	}	p = obj;	p += sizeof(*obj);	slenp = p;	p += n_str * sizeof(uint16_t);	for (i = 0; i < n_str; i++) {		char pfx[16];		dbstr = p;		p += GUINT16_FROM_LE(*slenp);		slenp++;		if (i == 0)			strcpy(pfx, "key: ");		else			sprintf(pfx, "str%d: ", i);		printf("%s%s/n", pfx, dbstr);	}	printf("====/n");}
开发者ID:jgarzik,项目名称:tabled,代码行数:55,


示例7: g_assert

static BlueSkyCleanerItem *bluesky_cleaner_deserialize(BlueSkyRCStr *raw){    const char *data = raw->data;    size_t len = raw->len;    const char *data1, *data2, *data3;    size_t len1, len2, len3;    g_assert(len > 4);    if (len < sizeof(struct cloudlog_header)        || memcmp(data, CLOUDLOG_MAGIC, 4) != 0)    {        g_warning("Deserializing garbage cloud log item from cleaner!");        return NULL;    };    struct cloudlog_header *header = (struct cloudlog_header *)data;    len1 = GUINT32_FROM_LE(header->size1);    len2 = GUINT32_FROM_LE(header->size2);    len3 = GUINT32_FROM_LE(header->size3);    data1 = data + sizeof(struct cloudlog_header);    data2 = data1 + len1;    data3 = data2 + len2;    g_assert(data3 + len3 - data <= len);    BlueSkyCleanerItem *item = g_new0(BlueSkyCleanerItem, 1);    item->type = header->type - '0';    item->inum = GUINT64_FROM_LE(header->inum);    memcpy(&item->id, &header->id, sizeof(BlueSkyCloudID));    int link_count = len2 / sizeof(BlueSkyCloudID);    g_print("Outgoing links: %d/n", link_count);    item->links = g_array_new(FALSE, TRUE, sizeof(BlueSkyCleanerLink));    for (int i = 0; i < link_count; i++) {        BlueSkyCleanerLink link;        g_assert(len2 >= sizeof(link.id));        memcpy(&link.id, data2, sizeof(link.id));        data2 += sizeof(link.id); len2 -= sizeof(link.id);        g_assert(len3 >= sizeof(link.location));        memcpy(&link.location, data3, sizeof(link.location));        data3 += sizeof(link.location); len3 -= sizeof(link.location);        g_array_append_val(item->links, link);    }    return item;}
开发者ID:richwolski,项目名称:bluesky,代码行数:48,


示例8: fu_smbios_parse_ep64

static gbooleanfu_smbios_parse_ep64 (FuSmbios *self, const gchar *buf, gsize sz, GError **error){	FuSmbiosStructureEntryPoint64 *ep;	guint8 csum = 0;	/* verify size */	if (sz != sizeof(FuSmbiosStructureEntryPoint64)) {		g_set_error (error,			     FWUPD_ERROR,			     FWUPD_ERROR_INVALID_FILE,			     "invalid smbios3 entry point got %" G_GSIZE_FORMAT			     " bytes, expected %" G_GSIZE_FORMAT,			     sz, sizeof(FuSmbiosStructureEntryPoint32));		return FALSE;	}	/* verify checksum */	for (guint i = 0; i < sz; i++)		csum += buf[i];	if (csum != 0x00) {		g_set_error_literal (error,				     FWUPD_ERROR,				     FWUPD_ERROR_INVALID_FILE,				     "entry point checksum invalid");		return FALSE;	}	ep = (FuSmbiosStructureEntryPoint64 *) buf;	self->structure_table_len = GUINT32_FROM_LE (ep->structure_table_len);	self->smbios_ver = g_strdup_printf ("%u.%u",					    ep->smbios_major_ver,					    ep->smbios_minor_ver);	return TRUE;}
开发者ID:vathpela,项目名称:fwupd,代码行数:34,


示例9: mdb_get_single

float mdb_get_single(unsigned char *buf, int offset){	union {guint32 g; float f;} f;	memcpy(&f, &buf[offset], 4);	f.g = GUINT32_FROM_LE(f.g);	return f.f;}
开发者ID:Jalakas,项目名称:libgarmin,代码行数:7,


示例10: mongo_bson_new_from_data

/** * mongo_bson_new_from_data: * @buffer: (in): The buffer to create a #MongoBson. * @length: (in): The length of @buffer. * * Creates a new #MongoBson instance using the buffer and the length. * * Returns: A new #MongoBson that should be freed with mongo_bson_unref(). */MongoBson *mongo_bson_new_from_data (const guint8 *buffer,                          gsize         length){   MongoBson *bson;   guint32 bson_len;   g_return_val_if_fail(buffer != NULL, NULL);   /*    * The first 4 bytes of a BSON are the length, including the 4 bytes    * containing said length.    */   memcpy(&bson_len, buffer, sizeof bson_len);   bson_len = GUINT32_FROM_LE(bson_len);   if (bson_len != length) {      return NULL;   }   bson = g_slice_new0(MongoBson);   bson->ref_count = 1;   bson->buf = g_byte_array_sized_new(length);   g_byte_array_append(bson->buf, buffer, length);   return bson;}
开发者ID:codebutler,项目名称:mongo-glib,代码行数:35,


示例11: commview_read_header

static gbooleancommview_read_header(commview_header_t *cv_hdr, FILE_T fh, int *err,    gchar **err_info){	wtap_file_read_expected_bytes(&cv_hdr->data_len, 2, fh, err, err_info);	wtap_file_read_expected_bytes(&cv_hdr->source_data_len, 2, fh, err, err_info);	wtap_file_read_expected_bytes(&cv_hdr->version, 1, fh, err, err_info);	wtap_file_read_expected_bytes(&cv_hdr->year, 2, fh, err, err_info);	wtap_file_read_expected_bytes(&cv_hdr->month, 1, fh, err, err_info);	wtap_file_read_expected_bytes(&cv_hdr->day, 1, fh, err, err_info);	wtap_file_read_expected_bytes(&cv_hdr->hours, 1, fh, err, err_info);	wtap_file_read_expected_bytes(&cv_hdr->minutes, 1, fh, err, err_info);	wtap_file_read_expected_bytes(&cv_hdr->seconds, 1, fh, err, err_info);	wtap_file_read_expected_bytes(&cv_hdr->usecs, 4, fh, err, err_info);	wtap_file_read_expected_bytes(&cv_hdr->flags, 1, fh, err, err_info);	wtap_file_read_expected_bytes(&cv_hdr->signal_level_percent, 1, fh, err, err_info);	wtap_file_read_expected_bytes(&cv_hdr->rate, 1, fh, err, err_info);	wtap_file_read_expected_bytes(&cv_hdr->band, 1, fh, err, err_info);	wtap_file_read_expected_bytes(&cv_hdr->channel, 1, fh, err, err_info);	wtap_file_read_expected_bytes(&cv_hdr->direction, 1, fh, err, err_info);	wtap_file_read_expected_bytes(&cv_hdr->signal_level_dbm, 1, fh, err, err_info);	wtap_file_read_expected_bytes(&cv_hdr->noise_level, 1, fh, err, err_info);	/* Convert multi-byte values from little endian to host endian format */	cv_hdr->data_len = GUINT16_FROM_LE(cv_hdr->data_len);	cv_hdr->source_data_len = GUINT16_FROM_LE(cv_hdr->source_data_len);	cv_hdr->year = GUINT16_FROM_LE(cv_hdr->year);	cv_hdr->usecs = GUINT32_FROM_LE(cv_hdr->usecs);	return TRUE;}
开发者ID:dot-Sean,项目名称:wireshark-http2,代码行数:31,


示例12: mdb_get_single

float mdb_get_single(void *buf, int offset){	union {guint32 g; float f;} f;	memcpy(&f, buf + offset, 4);	f.g = GUINT32_FROM_LE(f.g);	return f.f;}
开发者ID:ASAPPinc,项目名称:mdbtools,代码行数:7,


示例13: fwupd_guid_to_string

/** * fwupd_guid_to_string: * @guid: a #fwupd_guid_t to read * @flags: some %FwupdGuidFlags, e.g. %FWUPD_GUID_FLAG_MIXED_ENDIAN * * Returns a text GUID of mixed or BE endian for a packed buffer. * * Returns: A new GUID * * Since: 1.2.5 **/gchar *fwupd_guid_to_string (const fwupd_guid_t *guid, FwupdGuidFlags flags){	fwupd_guid_native_t gnat;	g_return_val_if_fail (guid != NULL, NULL);	/* copy to avoid issues with aligning */	memcpy (&gnat, guid, sizeof(gnat));	/* mixed is bizaar, but specified as the DCE encoding */	if (flags & FWUPD_GUID_FLAG_MIXED_ENDIAN) {		return g_strdup_printf ("%08x-%04x-%04x-%04x-%02x%02x%02x%02x%02x%02x",					GUINT32_FROM_LE(gnat.a),					GUINT16_FROM_LE(gnat.b),					GUINT16_FROM_LE(gnat.c),					GUINT16_FROM_BE(gnat.d),					gnat.e[0], gnat.e[1],					gnat.e[2], gnat.e[3],					gnat.e[4], gnat.e[5]);	}	return g_strdup_printf ("%08x-%04x-%04x-%04x-%02x%02x%02x%02x%02x%02x",				GUINT32_FROM_BE(gnat.a),				GUINT16_FROM_BE(gnat.b),				GUINT16_FROM_BE(gnat.c),				GUINT16_FROM_BE(gnat.d),				gnat.e[0], gnat.e[1],				gnat.e[2], gnat.e[3],				gnat.e[4], gnat.e[5]);}
开发者ID:vathpela,项目名称:fwupd,代码行数:41,


示例14: msn_read32le

guint32msn_read32le(const char *buf){    guint32 val;    memcpy(&val, buf, sizeof(val));    return GUINT32_FROM_LE(val);}
开发者ID:N8Fear,项目名称:purple-facebook,代码行数:7,


示例15: mongo_bson_new_from_static_data

/** * mongo_bson_new_from_static_data: * @buffer: (in) (transfer full): The static buffer to use. * @length: (in): The number of bytes in @buffer. * @notify: (in): A #GDestroyNotify to free @buffer. * * Creates a new #MongoBson structure using @buffer. This does not copy * the content of the buffer and uses it directly. Therefore, you MUST make * sure that the structure outlives the buffer beneath it. * * If the structure is referenced with mongo_bson_ref(), the contents of * the buffer will be copied. * * When the structure is released, @notify will be called to release * @buffer. * * You MAY NOT modify the contents of @buffer using any of the * mongo_bson_append methods. * * Returns: A newly created #MongoBson structure. */MongoBson *mongo_bson_new_from_static_data (guint8         *buffer,                                 gsize           length,                                 GDestroyNotify  notify){   MongoBson *bson;   guint32 bson_len;   g_return_val_if_fail(buffer != NULL, NULL);   /*    * The first 4 bytes of a BSON are the length, including the 4 bytes    * containing said length.    */   memcpy(&bson_len, buffer, sizeof bson_len);   bson_len = GUINT32_FROM_LE(bson_len);   if (bson_len != length) {      return NULL;   }   bson = g_slice_new0(MongoBson);   bson->ref_count = 1;   bson->static_data = buffer;   bson->static_len = length;   bson->static_notify = notify;   return bson;}
开发者ID:codebutler,项目名称:mongo-glib,代码行数:49,


示例16: dfu_element_from_dfuse

/** * dfu_element_from_dfuse: (skip) * @data: data buffer * @length: length of @data we can access * @consumed: (out): the number of bytes we consued * @error: a #GError, or %NULL * * Unpacks an element from DfuSe data. * * Returns: a #DfuElement, or %NULL for error **/static DfuElement *dfu_element_from_dfuse (const guint8 *data,			guint32 length,			guint32 *consumed,			GError **error){	DfuElement *element = NULL;	DfuSeElementPrefix *el = (DfuSeElementPrefix *) data;	guint32 size;	g_autoptr(GBytes) contents = NULL;	g_assert_cmpint(sizeof(DfuSeElementPrefix), ==, 8);	/* check input buffer size */	if (length < sizeof(DfuSeElementPrefix)) {		g_set_error (error,			     FWUPD_ERROR,			     FWUPD_ERROR_INTERNAL,			     "invalid element data size %u",			     (guint32) length);		return NULL;	}	/* check size */	size = GUINT32_FROM_LE (el->size);	if (size + sizeof(DfuSeElementPrefix) > length) {		g_set_error (error,			     FWUPD_ERROR,			     FWUPD_ERROR_INTERNAL,			     "invalid element size %u, only %u bytes left",			     size,			     (guint32) (length - sizeof(DfuSeElementPrefix)));		return NULL;	}	/* create new element */	element = dfu_element_new ();	dfu_element_set_address (element, GUINT32_FROM_LE (el->address));	contents = g_bytes_new (data + sizeof(DfuSeElementPrefix), size);	dfu_element_set_contents (element, contents);	/* return size */	if (consumed != NULL)		*consumed = (guint32) sizeof(DfuSeElementPrefix) + size;	return element;}
开发者ID:superm1,项目名称:fwupd,代码行数:58,


示例17: incoming_node_data

// Processes messages having this format:// https://en.bitcoin.it/wiki/Protocol_specification#Message_structurevoid incoming_node_data(const int fd, struct bitcoin_storage *const st){	static struct msg_wire *buf = NULL; // For storing the message payload	static int buf_allocated = 0;	static int buf_pos = 0;	static int buf_left = sizeof(struct msg_wire);	static enum msg_type buf_type = UNDEFINED;	// Reallocate buffer only if it is too small.	if (buf_allocated < buf_pos+buf_left) {		buf_allocated = buf_pos+buf_left;		buf = g_realloc(buf,buf_allocated);	}	const int got = read(fd,(void*)buf+buf_pos,buf_left);	if (got == 0) {		errx(3,"Unexpected end of bitcoind stream");	} else if (got == -1) {		err(3,"Error reading bitcoind stream");	}	buf_pos += got;	buf_left -= got;	// Header received. To continue reading in next pass, update	// the message length and possibly compact the header.	if (buf_type == UNDEFINED && buf_pos == sizeof(struct msg_wire)) {		// Check message header		if (GUINT32_FROM_LE(buf->magic) != 0xD9B4BEF9) {			errx(3,"Magic error. Probably we got out of sync.");		}		// Gather message type and length		buf_type = bitcoin_find_type(buf);		const guint32 payload_len = GUINT32_FROM_LE(buf->length_le);				// Do header compaction if type is not INV. Doing		// dangerous in-place rewrite.		if (buf_type != INV) {			COMPACT->type = buf_type;			COMPACT->length = payload_len;			COMPACT->sent = false;			// Rewind to compacted payload starting pos			buf_pos = offsetof(struct msg,payload);		}				buf_left = payload_len;	}
开发者ID:9cat,项目名称:kryptoradio,代码行数:49,


示例18: vfs_fget_le32

/** * Reads an unsigned 32-bit Little Endian value from the stream into native endian format. * * @param value Pointer to the variable to read the value into. * @param stream A #VFSFile object representing the stream. * @return TRUE if read was succesful, FALSE if there was an error. */EXPORT bool_t vfs_fget_le32(uint32_t *value, VFSFile *stream){    uint32_t tmp;    if (vfs_fread(&tmp, sizeof(tmp), 1, stream) != 1)        return FALSE;    *value = GUINT32_FROM_LE(tmp);    return TRUE;}
开发者ID:umurkontaci,项目名称:audacious,代码行数:15,


示例19: __attribute__

/** * unzip_file: * @zip_file:   pointer to start of compressed data * @unzip_size: the size of the compressed data block * * Returns a pointer to uncompressed data (maybe NULL) */void *unzip_file(gchar *zip_file, gulong *unzip_size){	void *unzip_data = NULL;#ifndef HAVE_LIBZ	goto end;#else	gchar *zip_data;	struct _lfh {		guint32 sig;		guint16 extract_version;		guint16 flags;		guint16 comp_method;		guint16 time;		guint16 date;		guint32 crc_32;		guint32 compressed_size;		guint32 uncompressed_size;		guint16 filename_len;		guint16 extra_field_len;	}  __attribute__ ((__packed__)) *local_file_header = NULL;	local_file_header = (struct _lfh *) zip_file;	if (GUINT32_FROM_LE(local_file_header->sig) != 0x04034b50) {		g_warning("%s(): wrong format", __PRETTY_FUNCTION__);		g_free(unzip_data);		goto end;	}	zip_data = zip_file + sizeof(struct _lfh)		+ GUINT16_FROM_LE(local_file_header->filename_len)		+ GUINT16_FROM_LE(local_file_header->extra_field_len);	gulong uncompressed_size = GUINT32_FROM_LE(local_file_header->uncompressed_size);	unzip_data = g_malloc(uncompressed_size);	if (!(*unzip_size = uncompress_data(unzip_data, uncompressed_size, zip_data, GUINT32_FROM_LE(local_file_header->compressed_size)))) {		g_free(unzip_data);		unzip_data = NULL;		goto end;	}#endifend:	return(unzip_data);}
开发者ID:gdt,项目名称:viking,代码行数:52,


示例20: sizeof

static struct fp_print_data *fpi_print_data_from_fp2_data(unsigned char *buf,	size_t buflen){	size_t total_data_len, item_len;	struct fp_print_data *data;	struct fp_print_data_item *item;	struct fpi_print_data_fp2 *raw = (struct fpi_print_data_fp2 *) buf;	unsigned char *raw_buf;	struct fpi_print_data_item_fp2 *raw_item;	total_data_len = buflen - sizeof(*raw);	data = print_data_new(GUINT16_FROM_LE(raw->driver_id),		GUINT32_FROM_LE(raw->devtype), raw->data_type);	raw_buf = raw->data;	while (total_data_len) {		if (total_data_len < sizeof(*raw_item))			break;		total_data_len -= sizeof(*raw_item);		raw_item = (struct fpi_print_data_item_fp2 *)raw_buf;		item_len = GUINT32_FROM_LE(raw_item->length);		fp_dbg("item len %d, total_data_len %d", item_len, total_data_len);		if (total_data_len < item_len) {			fp_err("corrupted fingerprint data");			break;		}		total_data_len -= item_len;		item = fpi_print_data_item_new(item_len);		/* FIXME: fp_print_data->data content is not endianess agnostic */		memcpy(item->data, raw_item->data, item_len);		data->prints = g_slist_prepend(data->prints, item);		raw_buf += sizeof(*raw_item);		raw_buf += item_len;	}	if (g_slist_length(data->prints) == 0) {		fp_print_data_free(data);		data = NULL;	}	return data;}
开发者ID:anarsoul,项目名称:libfprint,代码行数:45,


示例21: koneplus_rmp_macro_key_info_new

KoneplusRmpMacroKeyInfo *koneplus_rmp_macro_key_info_v1_to_koneplus_rmp_macro_key_info(KoneplusRmpMacroKeyInfoV1 const *v1) {	KoneplusRmpMacroKeyInfo *result;	result = koneplus_rmp_macro_key_info_new();	result->button_number = v1->button_number;	result->type = v1->type;	koneplus_rmp_macro_key_info_set_talk_device(result, GUINT16_FROM_LE(v1->talk_device));	koneplus_rmp_macro_key_info_set_macroset_name(result, (gchar const *)v1->macroset_name);	koneplus_rmp_macro_key_info_set_macro_name(result, (gchar const *)v1->macro_name);	koneplus_rmp_macro_key_info_set_loop(result, GUINT32_FROM_LE(v1->loop));	koneplus_rmp_macro_key_info_set_count(result, GUINT16_FROM_LE(v1->count));	memcpy(&result->keystrokes[0], &v1->keystrokes[0], sizeof(result->keystrokes));	koneplus_rmp_macro_key_info_set_timer_length(result, GUINT32_FROM_LE(v1->timer_length));	koneplus_rmp_macro_key_info_set_timer_name(result, (gchar const *)v1->timer_name);	koneplus_rmp_macro_key_info_set_filename(result, (gchar const *)v1->filename);	return result;}
开发者ID:ngg,项目名称:roccat-tools,代码行数:18,


示例22: gst_riff_parse_strf_iavs

gbooleangst_riff_parse_strf_iavs (GstElement * element,    GstBuffer * buf, gst_riff_strf_iavs ** _strf, GstBuffer ** data){  gst_riff_strf_iavs *strf;  g_return_val_if_fail (buf != NULL, FALSE);  g_return_val_if_fail (_strf != NULL, FALSE);  g_return_val_if_fail (data != NULL, FALSE);  if (GST_BUFFER_SIZE (buf) < sizeof (gst_riff_strf_iavs))    goto too_small;  strf = g_memdup (GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf));  gst_buffer_unref (buf);#if (G_BYTE_ORDER == G_BIG_ENDIAN)  strf->DVAAuxSrc = GUINT32_FROM_LE (strf->DVAAuxSrc);  strf->DVAAuxCtl = GUINT32_FROM_LE (strf->DVAAuxCtl);  strf->DVAAuxSrc1 = GUINT32_FROM_LE (strf->DVAAuxSrc1);  strf->DVAAuxCtl1 = GUINT32_FROM_LE (strf->DVAAuxCtl1);  strf->DVVAuxSrc = GUINT32_FROM_LE (strf->DVVAuxSrc);  strf->DVVAuxCtl = GUINT32_FROM_LE (strf->DVVAuxCtl);  strf->DVReserved1 = GUINT32_FROM_LE (strf->DVReserved1);  strf->DVReserved2 = GUINT32_FROM_LE (strf->DVReserved2);#endif  /* debug */  GST_INFO_OBJECT (element, "strf tag found in context iavs:");  GST_INFO_OBJECT (element, " DVAAuxSrc   %08x", strf->DVAAuxSrc);  GST_INFO_OBJECT (element, " DVAAuxCtl   %08x", strf->DVAAuxCtl);  GST_INFO_OBJECT (element, " DVAAuxSrc1  %08x", strf->DVAAuxSrc1);  GST_INFO_OBJECT (element, " DVAAuxCtl1  %08x", strf->DVAAuxCtl1);  GST_INFO_OBJECT (element, " DVVAuxSrc   %08x", strf->DVVAuxSrc);  GST_INFO_OBJECT (element, " DVVAuxCtl   %08x", strf->DVVAuxCtl);  GST_INFO_OBJECT (element, " DVReserved1 %08x", strf->DVReserved1);  GST_INFO_OBJECT (element, " DVReserved2 %08x", strf->DVReserved2);  *_strf = strf;  *data = NULL;  return TRUE;  /* ERRORS */too_small:  {    GST_ERROR_OBJECT (element,        "Too small strf_iavs (%d available, %" G_GSSIZE_FORMAT " needed)",        GST_BUFFER_SIZE (buf), sizeof (gst_riff_strf_iavs));    gst_buffer_unref (buf);    return FALSE;  }}
开发者ID:adenexter,项目名称:gst-plugins-base,代码行数:53,


示例23: purple_pn_xfer_got_invite

voidpurple_pn_xfer_got_invite(struct pn_peer_call *call,                          const char *branch,                          const char *context){    PurpleAccount *account;    PurpleXfer *xfer;    char *bin;    gsize bin_len;    guint32 file_size;    char *file_name;    gunichar2 *uni_name;    account = msn_session_get_user_data (pn_peer_link_get_session (call->link));    call->cb = xfer_completed_cb;    call->end_cb = xfer_end_cb;    call->progress_cb = xfer_progress_cb;    call->branch = g_strdup(branch);    call->pending = TRUE;    xfer = purple_xfer_new(account, PURPLE_XFER_RECEIVE,                           pn_peer_link_get_passport (call->link));    if (xfer)    {        bin = (char *)purple_base64_decode(context, &bin_len);        file_size = GUINT32_FROM_LE(*(gsize *)(bin + 8));        uni_name = (gunichar2 *)(bin + 20);        while(*uni_name != 0 && ((char *)uni_name - (bin + 20)) < MAX_FILE_NAME_LEN) {            *uni_name = GUINT16_FROM_LE(*uni_name);            uni_name++;        }        file_name = g_utf16_to_utf8((const gunichar2 *)(bin + 20), -1,                                    NULL, NULL, NULL);        g_free(bin);        purple_xfer_set_filename(xfer, file_name);        purple_xfer_set_size(xfer, file_size);        purple_xfer_set_init_fnc(xfer, xfer_init);        purple_xfer_set_request_denied_fnc(xfer, xfer_cancel);        purple_xfer_set_cancel_recv_fnc(xfer, xfer_cancel);        call->xfer = xfer;        purple_xfer_ref(call->xfer);        xfer->data = call;        purple_xfer_request(xfer);    }}
开发者ID:allanfreitas,项目名称:msn-pecan,代码行数:54,


示例24: bu256_hex

void bu256_hex(char *hexstr, const bu256_t *v){	*hexstr = 0;	int i;	for (i = 7; i >= 0; i--) {		/* endian: high to low */		char tmp[8 + 1];		sprintf(tmp, "%08x", GUINT32_FROM_LE(v->dword[i]));		strcat(hexstr, tmp);	}}
开发者ID:colindean,项目名称:picocoin,代码行数:12,


示例25: g_bytes_vector_read_uint32

/** * g_bytes_vector_read_uint32: * @vector: (in): A #GBytesVector. * @value: (out): A location for a #guint32. * * Reads a #guint64 from the vector of buffers in @vector. If successful * then @value is set and %TRUE is returned. * * Returns: %TRUE if successful; otherwise %FALSE. */gbooleang_bytes_vector_read_uint32 (GBytesVector *vector,                            guint32      *value){   gboolean ret;   if ((ret = g_bytes_vector_read(vector, (guint8 *)value, sizeof *value))) {      *value = GUINT32_FROM_LE(*value);   }   return ret;}
开发者ID:chergert,项目名称:gbytesvector,代码行数:22,


示例26: fu_wac_calculate_checksum32le

guint32fu_wac_calculate_checksum32le (const guint8 *data, gsize len){	guint32 csum = 0x0;	g_return_val_if_fail (len % 4 == 0, 0xff);	for (guint i = 0; i < len; i += 4) {		guint32 tmp;		memcpy (&tmp, &data[i], sizeof(guint32));		csum += GUINT32_FROM_LE (tmp);	}	return GUINT32_TO_LE (csum);}
开发者ID:vathpela,项目名称:fwupd,代码行数:12,


示例27: mongo_bson_stream_next

/** * mongo_bson_stream_next: * @stream: (in): A #MongoBsonStream. * * Gets the next #MongoBson document found in the stream. * * Returns: (transfer full): A #MongoBson if successful; otherwise %NULL. */MongoBson *mongo_bson_stream_next (MongoBsonStream *stream){   MongoBson *bson;   guint32 doc_len_le;   guint32 doc_len;   guint8 *buffer;   g_return_val_if_fail(MONGO_IS_BSON_STREAM(stream), NULL);   g_return_val_if_fail(stream->priv->stream ||                        stream->priv->channel,                        NULL);   if (!mongo_bson_stream_read(stream,                               (guint8 *)&doc_len_le,                               sizeof doc_len_le,                               sizeof doc_len_le)) {      return NULL;   }   doc_len = GUINT32_FROM_LE(doc_len_le);   /*    * Sanity check to make sure it is less than 8mB and    * greater than 5 bytes (minimum required).    */   if (doc_len > (1024 * 1024 * 8) || doc_len <= 5) {      return NULL;   }   buffer = g_malloc(doc_len);   memcpy(buffer, &doc_len_le, sizeof doc_len_le);   /*    * Read the rest of the BSON document into our buffer.    */   if (!mongo_bson_stream_read(stream,                               buffer + sizeof doc_len_le,                               doc_len,                               doc_len - sizeof doc_len_le)) {      return NULL;   }   if (!(bson = mongo_bson_new_from_data(buffer, doc_len))) {      g_free(buffer);      return NULL;   }   return bson;}
开发者ID:codebutler,项目名称:mongo-glib,代码行数:58,



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


C++ GUINT32_TO_LE函数代码示例
C++ GUINT16_FROM_LE函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。