/** Convert to a string representation. If this RVA is unbound, then the string representation is the numeric RVA value (in * hexadecimal and decimal). Otherwise the string representation contains information about the bound section. */ std::string rose_rva_t::to_string() const { char s[1024]; sprintf(s, "0x%08"PRIx64" (%"PRIu64")", get_rva(), get_rva()); std::string ss = s; if (get_section()) { sprintf(s, " + 0x%08"PRIx64" (%"PRIu64")", get_rel(), get_rel()); ss += " <" + get_section()->get_name()->get_string(true) + s + ">"; } return ss; }
void time_to_words(Language lang, int hours, int minutes, int seconds, char* words, size_t buffer_size) { size_t remaining = buffer_size; memset(words, 0, buffer_size); // We want to operate with a resolution of 30 seconds. So multiply // minutes and seconds by 2. Then divide by (2 * 5) to carve the hour // into five minute intervals. int half_mins = (2 * minutes) + (seconds / 30); int rel_index = ((half_mins + 5) / (2 * 5)) % 12; int hour_index; if (rel_index == 0 && minutes > 30) { hour_index = (hours + 1) % 24; } else { hour_index = hours % 24; } const char* hour = get_hour(lang, hour_index); const char* next_hour = get_hour(lang, (hour_index + 1) % 24); const char* rel = get_rel(lang, rel_index); remaining -= interpolate_and_append(words, remaining, rel, hour, next_hour); // Leave one space at the end remaining -= append_string(words, remaining, " "); }