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


C++ set_offset函数代码示例

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


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

示例1: assert

void GrowableIOBuffer::SetCapacity(int capacity) {
  assert(capacity >= 0);
  // realloc will crash if it fails.
  real_data_.reset(static_cast<char*>(realloc(real_data_.release(), capacity)));
  capacity_ = capacity;
  if (offset_ > capacity)
    set_offset(capacity);
  else
    set_offset(offset_);  // The pointer may have changed.
}
开发者ID:binson001,项目名称:NIM_PC_UIKit,代码行数:10,代码来源:io_buffer.cpp

示例2: get_walker

void
TileMap::editor_update()
{
  if (get_walker()) {
    if (get_path() && get_path()->is_valid()) {
      m_movement = get_walker()->get_pos() - get_offset();
      set_offset(get_walker()->get_pos());
    } else {
      set_offset(Vector(0, 0));
    }
  }
}
开发者ID:HybridDog,项目名称:supertux,代码行数:12,代码来源:tilemap.cpp

示例3: load_imports

//--------------------------------------------------------------------------
static void load_imports(linput_t *li, dl_header &dl)
{
  if ( !dl.import_list_count ) return;
  qlseek(li, first_text_subspace_fpos+dl.import_list_loc);
  ea_t ea = data_start + dl.dlt_loc;
  int n   = dl.dlt_count;
  char buf[MAXSTR];
  for ( int i=0; i < dl.import_list_count; i++ )
  {
    import_entry ie;
    lread(li, &ie, sizeof(ie));
    ie.swap();
    if ( n == 0 ) ea = data_start + dl.plt_loc;
    n--;
    buf[0] = '.';
    get_text_name(ie.name, &buf[1], sizeof(buf)-1);
    do_name_anyway(ea, buf);
    doDwrd(ea, 4);
    set_offset(ea, 0, 0);
    if ( n > 0 )
    {
      ea += 4;
    }
    else
    {
      ea_t ea2 = get_long(ea);
      do_name_anyway(ea2, &buf[1]);
      add_func(ea2, BADADDR);
      set_func_cmt(get_func(ea2), "THUNK", false);
      doDwrd(ea+4, 4);
      ea += 8;
    }
  }
}
开发者ID:trietptm,项目名称:usefulres,代码行数:35,代码来源:hpsom.cpp

示例4: DexInstruction

void DexInstruction::verify_encoding() const {
  auto test = m_count ? new DexInstruction(opcode()) : new DexInstruction(opcode(), 0);
  if (dests_size()) {
    test->set_dest(dest());
  }
  for (unsigned i = 0; i < srcs_size(); i++) {
    test->set_src(i, src(i));
  }
  if (has_range_base()) test->set_range_base(range_base());
  if (has_range_size()) test->set_range_size(range_size());
  if (has_arg_word_count()) test->set_arg_word_count(arg_word_count());
  if (has_literal()) test->set_literal(literal());
  if (has_offset()) test->set_offset(offset());

  assert_log(m_opcode == test->m_opcode, "%x %x\n", m_opcode, test->m_opcode);
  for (unsigned i = 0; i < m_count; i++) {
    assert_log(m_arg[i] == test->m_arg[i],
               "(%x %x) (%x %x)",
               m_opcode,
               m_arg[i],
               test->m_opcode,
               test->m_arg[i]);
  }

  delete test;
}
开发者ID:Andy10101,项目名称:redex,代码行数:26,代码来源:DexInstruction.cpp

示例5: update_off_mtime

static int update_off_mtime(const char *file, int fd)
{
#ifdef PGSQL
    PGconn *conn;
    time_t now = -1;
    off_t  off = -1;
    char *ret = NULL;

    if ((conn = logpg_conn()) == NULL)
        return -1;

    time(&now);
    if ((ret = set_last_mtime(conn, file, &now)) == NULL) {
        fprintf(stderr, "set_last_mtime failed.\n");
        return -1;
    }
    free(ret);

    off = lseek(fd, 0, SEEK_CUR);
    if ((ret = set_offset(conn, file, off)) == NULL) {
        fprintf(stderr, "set_offset failed.\n");
        return -1;
    }
    free(ret);

#endif
    return 0;
}
开发者ID:tingle2008,项目名称:rplddump,代码行数:28,代码来源:main.c

示例6: name_vector

//----------------------------------------------------------------------
//
//      define location as word (2 byte), convert it to an offset, rename it
//      and comment it with the file offset
//
static void name_vector( ushort address, const char *name )
{
    do_unknown( address, true );
    do_data_ex( address, wordflag(), 2, BADNODE );
    set_offset( address, 0, 0 );
    set_name( address, name );
}
开发者ID:IDA-RE-things,项目名称:nesldr,代码行数:12,代码来源:nes.cpp

示例7: set_offset

/** Update this segment table entry with newer information from the section */
void
SgAsmElfSegmentTableEntry::update_from_section(SgAsmElfSection *section)
{
    set_offset(section->get_offset());
    set_filesz(section->get_size());
    set_vaddr(section->get_mapped_preferred_va());
    set_memsz(section->get_mapped_size());
    set_align(section->is_mapped() ? section->get_mapped_alignment() : section->get_file_alignment());

    if (section->get_mapped_rperm()) {
        set_flags((SegmentFlags)(p_flags | PF_RPERM));
    } else {
        set_flags((SegmentFlags)(p_flags & ~PF_RPERM));
    }
    if (section->get_mapped_wperm()) {
        set_flags((SegmentFlags)(p_flags | PF_WPERM));
    } else {
        set_flags((SegmentFlags)(p_flags & ~PF_WPERM));
    }
    if (section->get_mapped_xperm()) {
        set_flags((SegmentFlags)(p_flags | PF_XPERM));
    } else {
        set_flags((SegmentFlags)(p_flags & ~PF_XPERM));
    }

    if (isSgAsmElfNoteSection(section)) {
        set_type(PT_NOTE);
    }
}
开发者ID:LindaLovelace,项目名称:rose,代码行数:30,代码来源:ElfSegmentTable.C

示例8: emu

//----------------------------------------------------------------------
int idaapi emu(void)
{
  uint32 Feature = cmd.get_canon_feature();

  flow = ((Feature & CF_STOP) == 0);

  if ( Feature & CF_USE1 ) process_operand(cmd.Op1, true);
  if ( Feature & CF_USE2 ) process_operand(cmd.Op2, true);
  if ( Feature & CF_USE3 ) process_operand(cmd.Op3, true);
  if ( Feature & CF_CHG1 ) process_operand(cmd.Op1, false);
  if ( Feature & CF_CHG2 ) process_operand(cmd.Op2, false);
  if ( Feature & CF_CHG3 ) process_operand(cmd.Op3, false);

//
//      Determine if the next instruction should be executed
//
  if ( segtype(cmd.ea) == SEG_XTRN ) flow = 0;
  if ( flow ) ua_add_cref(0,cmd.ea+cmd.size,fl_F);

//
//      convert "lda imm, reg" to "lda mem, reg"
//

  if ( cmd.itype == I960_lda
    && cmd.Op1.type == o_imm
    && !isDefArg(uFlag, 0)
    && isEnabled(cmd.Op1.value) ) set_offset(cmd.ea, 0, 0);

  return 1;
}
开发者ID:Artorios,项目名称:IDAplugins-1,代码行数:31,代码来源:emu.cpp

示例9: main

/* main: parse args, loop over FILES, count and print results */
int main(int argc, char *args[])
{
	int i = 1;
	int fd;
	struct ht ht = {0, 0, 0, 0, 0};

	i += parse_opts(argc, args, &ht);
	ht.side = END;
	/* if no options specified, fallback to default */
	set_default(&ht);

	while (args[i]) {
		fd = open(args[i], O_RDONLY);
		if (fd < 0) {
			fprintf(stderr, "File %s not found.\r\n", args[i]);
			i++;
			continue;
		}
		struct wc wc = {0, 0, 0};
		word_count(fd, &wc);

		close(fd);
		fd = open(args[i], O_RDONLY);

		set_offset(&ht, &wc);

		ouroboros(fd, &ht);

		close(fd);
		i++;
	}

	exit(0);
}
开发者ID:NicoLiberato,项目名称:frosted-userland,代码行数:35,代码来源:tail.c

示例10: i2c_flash_lseek

loff_t i2c_flash_lseek(struct file *file, loff_t offset, int whence) {
	
	char *asBuf = kmalloc(2, GFP_KERNEL);
	int address;
	int res;

	set_offset(offset);

	//Addres Low
	address = (currPage & 0x00ff);
	memcpy((char *)asBuf + 1, &address, 1);

	//Address high
	address = (currPage & 0xff00) >> 8;
	memcpy((char *)asBuf, &address, 1);

	

	res = i2c_master_send(client, asBuf, 2);

	if (res < 0) {
		printk("\nWriting the address failed!\n");
		return -1;
	}

	if (asBuf) kfree(asBuf);

	return res;
}
开发者ID:TWood67,项目名称:CSE438,代码行数:29,代码来源:i2c_flash.c

示例11: reset

Samples::Samples(Samples *src)
{
	reset();
	share(src->get_shmid());
	set_allocated(src->get_allocated());
	set_offset(src->get_offset());
}
开发者ID:Cuchulain,项目名称:cinelerra,代码行数:7,代码来源:samples.C

示例12: fixup

//----------------------------------------------------------------------
static void fixup(uint32 ea, uint32 delta, int extdef)
{
  fixup_data_t fd;
  fd.type = FIXUP_OFF32;
  if ( extdef ) fd.type |= FIXUP_EXTDEF;
  segment_t *s = getseg(delta);
  fd.displacement = get_long(ea);
  if ( s == NULL ) {
    fd.sel = 0;
    fd.off = delta;
  } else {
    fd.sel = (ushort)s->sel;
    fd.off = delta - get_segm_base(s);
  }
  set_fixup(ea, &fd);
  uint32 target = get_long(ea) + delta;
  put_long(ea, target);
  set_offset(ea, 0, 0);
  cmd.ea = ea; ua_add_dref(0, target, dr_O); cmd.ea = BADADDR;
  if ( target != toc_ea
    && !has_name(get_flags_novalue(ea))
    && has_name(get_flags_novalue(target)) )
  {
    char buf[MAXSTR];
    if ( get_true_name(BADADDR, target, &buf[3], sizeof(buf)-3) != NULL )
    {
      buf[0] = 'T';
      buf[1] = 'C';
      buf[2] = '_';
      do_name_anyway(ea, buf);
      make_name_auto(ea);
    }
  }
//  toc.charset(ea,XMC_TC+1,1);
}
开发者ID:awesome-security,项目名称:vera,代码行数:36,代码来源:pef.cpp

示例13: Vector2

void GraphNode::_input_event(const InputEvent& p_ev) {

	if (p_ev.type==InputEvent::MOUSE_BUTTON && p_ev.mouse_button.pressed && p_ev.mouse_button.button_index==BUTTON_LEFT) {

		Vector2 mpos = Vector2(p_ev.mouse_button.x,p_ev.mouse_button.y);
		if (close_rect.size!=Size2() && close_rect.has_point(mpos)) {
			emit_signal("close_request");
			return;
		}

		drag_from=get_offset();
		drag_accum=Vector2();
		dragging=true;
		emit_signal("raise_request");

	}

	if (p_ev.type==InputEvent::MOUSE_BUTTON && !p_ev.mouse_button.pressed && p_ev.mouse_button.button_index==BUTTON_LEFT) {

		dragging=false;
		emit_signal("dragged",drag_from,get_offset()); //useful for undo/redo
	}

	if (p_ev.type==InputEvent::MOUSE_MOTION && dragging) {

		drag_accum+=Vector2(p_ev.mouse_motion.relative_x,p_ev.mouse_motion.relative_y);
		set_offset(drag_from+drag_accum);
	}

}
开发者ID:AMG194,项目名称:godot,代码行数:30,代码来源:graph_node.cpp

示例14: float2

void gui_surface::resize(const float2& buffer_size_) {
	uint2 buffer_size_abs_ = ((flags & SURFACE_FLAGS::ABSOLUTE_SIZE) == SURFACE_FLAGS::ABSOLUTE_SIZE ?
							  buffer_size_.rounded() :
							  buffer_size_ * float2(oclraster::get_width(), oclraster::get_height()));
	if(buffer.get_attachment_count() != 0 &&
	   buffer_size_abs.x == buffer_size_abs_.x && buffer_size_abs.y == buffer_size_abs_.y) {
		// same size, nothing to do here
		return;
	}
	buffer_size = buffer_size_;
	buffer_size_abs = buffer_size_abs_;
	
	delete_buffer();
	
	const bool has_depth = ((flags & SURFACE_FLAGS::NO_DEPTH) != SURFACE_FLAGS::NO_DEPTH);
	buffer = framebuffer::create_with_images(buffer_size_abs.x, buffer_size_abs.y,
											 { { IMAGE_TYPE::UINT_8, IMAGE_CHANNEL::RGBA } },
											 {
												 has_depth ? IMAGE_TYPE::FLOAT_32 : IMAGE_TYPE::NONE,
												 has_depth ? IMAGE_CHANNEL::R : IMAGE_CHANNEL::NONE
											 });
	
	// set blit vbo rectangle data
	set_offset(offset);
	
	//
	redraw();
}
开发者ID:AMD-FirePro,项目名称:oclraster,代码行数:28,代码来源:gui_surface.cpp

示例15: pkg_dispack

int pkg_dispack(void *net_struct,char *buf,T_PkgType *pkg_type,char delimit)
{
	char *cp;
	register char *cp1;
	char dml[2];
	T_PkgType *typ;

	*dml=delimit;
	dml[1]=0;
	cp=buf;
	if(!cp||!*cp) return 0;
	if(pkg_type->offset<0) set_offset(pkg_type);
	for(typ=pkg_type;typ->type>-1;typ++){
		if(typ->bindtype&NOSELECT) continue;
		if(typ->type==CH_STRUCT) {
			cp+=pkg_dispack((char *)net_struct+typ->offset,cp,(T_PkgType *)typ->format,delimit);
			continue;
		}
		cp1=cp;
		cp=stptok(cp,0,0,dml);
		if(*cp==delimit) *cp++=0;
		put_str_one(net_struct,cp1,typ,delimit);
		if(!*cp) break;
	}
	return (cp-buf);
}
开发者ID:weihualiu,项目名称:sdbc,代码行数:26,代码来源:pack.c


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