Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
Please login to access the resource
openSUSE:12.2:ARM
purple-plugin-pack
purple-plugin_pack-autoprofile-crash.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File purple-plugin_pack-autoprofile-crash.patch of Package purple-plugin-pack
--- purple-plugin_pack-2.6.3.orig/autoprofile/comp_uptime.c 2009-04-19 06:30:03.000000000 +0200 +++ purple-plugin_pack-2.6.3/autoprofile/comp_uptime.c 2011-09-01 23:50:47.268111582 +0200 @@ -32,7 +32,7 @@ char *uptime_generate (struct widget *w) { gboolean exec; char *out, *line, *working; - char *p_character, *colon_character, *comma_character, *m_character; + char *comma_character, *behind_timestamp_and_spaces_character; GError *return_error; line = N_("uptime"); @@ -43,37 +43,19 @@ if (exec) { /* Buffer length for safety */ working = (char *)malloc (strlen (out)+7+8+8+1); - strcpy (working, "Uptime:"); - /* Break into minutes, hours, and everything else */ - p_character = strchr (out, 'p'); - m_character = strchr (p_character, 'm'); + strcpy (working, "Uptime: "); - /* Uptime format including "pm" */ - if (m_character != NULL && m_character == p_character + 1) { - p_character = strchr (m_character, 'p'); - m_character = strchr (p_character, 'm'); - } + /* There are 1 or 2 spaces in front of the timestamp and even X:YY has a length of 4. If time format includes pm, it should follow without a space hH:MMpm or hH:MM:SSpm. But even if there is a space in between, with the second strchr we are in the free space after the timestamp. And if the two spaces behind the timestamp from the english version are kept in all translation, we are safe.. */ + behind_timestamp_and_spaces_character = strchr (out+4, ' '); + behind_timestamp_and_spaces_character = strchr (behind_timestamp_and_spaces_character, ' '); + /* Right behind the timestamp. Now skipping spaces until the uptime message begins */ + while (*(++behind_timestamp_and_spaces_character) == ' ') {} - /* Uptime if < 1 hour */ - if (m_character != NULL && *(m_character+1) == 'i') { - *m_character = '\0'; - p_character++; - strcat (working, p_character); - strcat (working, "minutes"); + comma_character = strchr (behind_timestamp_and_spaces_character, ','); + /* The relevant part ends with a , */ + *comma_character = '\0'; - /* General uptime */ - } else { - colon_character = strchr (p_character, ':'); - comma_character = strchr (colon_character, ','); - p_character++; - *colon_character++ = '\0'; - *comma_character = '\0'; - /* Yank it all together */ - strcat (working, p_character); - strcat (working, " hours, "); - strcat (working, colon_character); - strcat (working, " minutes"); - } + strcat (working, behind_timestamp_and_spaces_character); free (out); return working;
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor