Example #1
0
static void format_string(struct writer_struct *writer, const char *format, va_list vl) {
	char **arg = (char **) &format;
	int c;
	unsigned long val;
	int i;
	char buf[180];
	char *p;

	arg++;
	i = 0;
	while ((c = *format++) != 0) {
		int number_len=0;
		if (c != '%'){
			if (str_writer(writer,c) ==0) return;
		}
		else {
			c = *format++;
			if (c>'0' && c<='9'){
				number_len=(c-'0')*2;
				c = *format++;
			}
			switch (c) {
			case 'd':
			case 'u':
			case 'x':
			case 'i':
				if (c == 'u') {
					val = va_arg(vl,unsigned int) & 0xffff;
					c = 'x';
				}else if (c == 'i') {
					val = va_arg(vl,unsigned int);
					c = 'd';
				} else
Example #2
0
section *Sections::add( const std::string &name ) {
	section *new_section = parent->create_section();
	new_section->set_name( name );
	Elf_Half str_index = parent->get_section_name_str_index();
	section *string_table( parent->sections_[str_index] );
	string_section_accessor str_writer( string_table );
	Elf_Word pos = str_writer.add_string( name );
	new_section->set_name_string_offset( pos );
	return new_section;
}