mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-26 12:12:10 +01:00
Fix some compiler warnings
svn path=/trunk/; revision=7755
This commit is contained in:
parent
caa5ed0d22
commit
0f6b25ca96
13
ChangeLog
13
ChangeLog
@ -1,3 +1,16 @@
|
||||
2008-12-30 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* glib/gspawn.c:
|
||||
* glib/gthread.c:
|
||||
* glib/goption.c:
|
||||
* glib/gmain.c:
|
||||
* glib/gkeyfile.c:
|
||||
* glib/gfileutils.c:
|
||||
* glib/gdate.c:
|
||||
* glib/garray.c:
|
||||
* glib/gbookmarkfile.c:
|
||||
* glib/gbacktrace.c: Fix some compiler warnings.
|
||||
|
||||
2008-12-19 Tor Lillqvist <tml@novell.com>
|
||||
|
||||
* glib/glib.symbols: Add g_thread_get_initialized here,
|
||||
|
116
glib/garray.c
116
glib/garray.c
@ -102,8 +102,8 @@ GArray* g_array_sized_new (gboolean zero_terminated,
|
||||
}
|
||||
|
||||
gchar*
|
||||
g_array_free (GArray *array,
|
||||
gboolean free_segment)
|
||||
g_array_free (GArray *array,
|
||||
gboolean free_segment)
|
||||
{
|
||||
gchar* segment;
|
||||
|
||||
@ -164,7 +164,7 @@ g_array_prepend_vals (GArray *farray,
|
||||
|
||||
GArray*
|
||||
g_array_insert_vals (GArray *farray,
|
||||
guint index,
|
||||
guint index_,
|
||||
gconstpointer data,
|
||||
guint len)
|
||||
{
|
||||
@ -172,11 +172,11 @@ g_array_insert_vals (GArray *farray,
|
||||
|
||||
g_array_maybe_expand (array, len);
|
||||
|
||||
g_memmove (g_array_elt_pos (array, len + index),
|
||||
g_array_elt_pos (array, index),
|
||||
g_array_elt_len (array, array->len - index));
|
||||
g_memmove (g_array_elt_pos (array, len + index_),
|
||||
g_array_elt_pos (array, index_),
|
||||
g_array_elt_len (array, array->len - index_));
|
||||
|
||||
memcpy (g_array_elt_pos (array, index), data, g_array_elt_len (array, len));
|
||||
memcpy (g_array_elt_pos (array, index_), data, g_array_elt_len (array, len));
|
||||
|
||||
array->len += len;
|
||||
|
||||
@ -208,19 +208,19 @@ g_array_set_size (GArray *farray,
|
||||
}
|
||||
|
||||
GArray*
|
||||
g_array_remove_index (GArray* farray,
|
||||
guint index)
|
||||
g_array_remove_index (GArray *farray,
|
||||
guint index_)
|
||||
{
|
||||
GRealArray* array = (GRealArray*) farray;
|
||||
|
||||
g_return_val_if_fail (array, NULL);
|
||||
|
||||
g_return_val_if_fail (index < array->len, NULL);
|
||||
g_return_val_if_fail (index_ < array->len, NULL);
|
||||
|
||||
if (index != array->len - 1)
|
||||
g_memmove (g_array_elt_pos (array, index),
|
||||
g_array_elt_pos (array, index + 1),
|
||||
g_array_elt_len (array, array->len - index - 1));
|
||||
if (index_ != array->len - 1)
|
||||
g_memmove (g_array_elt_pos (array, index_),
|
||||
g_array_elt_pos (array, index_ + 1),
|
||||
g_array_elt_len (array, array->len - index_ - 1));
|
||||
|
||||
array->len -= 1;
|
||||
|
||||
@ -233,17 +233,17 @@ g_array_remove_index (GArray* farray,
|
||||
}
|
||||
|
||||
GArray*
|
||||
g_array_remove_index_fast (GArray* farray,
|
||||
guint index)
|
||||
g_array_remove_index_fast (GArray *farray,
|
||||
guint index_)
|
||||
{
|
||||
GRealArray* array = (GRealArray*) farray;
|
||||
|
||||
g_return_val_if_fail (array, NULL);
|
||||
|
||||
g_return_val_if_fail (index < array->len, NULL);
|
||||
g_return_val_if_fail (index_ < array->len, NULL);
|
||||
|
||||
if (index != array->len - 1)
|
||||
memcpy (g_array_elt_pos (array, index),
|
||||
if (index_ != array->len - 1)
|
||||
memcpy (g_array_elt_pos (array, index_),
|
||||
g_array_elt_pos (array, array->len - 1),
|
||||
g_array_elt_len (array, 1));
|
||||
|
||||
@ -258,9 +258,9 @@ g_array_remove_index_fast (GArray* farray,
|
||||
}
|
||||
|
||||
GArray*
|
||||
g_array_remove_range (GArray *farray,
|
||||
guint index_,
|
||||
guint length)
|
||||
g_array_remove_range (GArray *farray,
|
||||
guint index_,
|
||||
guint length)
|
||||
{
|
||||
GRealArray *array = (GRealArray*) farray;
|
||||
|
||||
@ -382,8 +382,8 @@ g_ptr_array_sized_new (guint reserved_size)
|
||||
}
|
||||
|
||||
gpointer*
|
||||
g_ptr_array_free (GPtrArray *array,
|
||||
gboolean free_segment)
|
||||
g_ptr_array_free (GPtrArray *array,
|
||||
gboolean free_segment)
|
||||
{
|
||||
gpointer* segment;
|
||||
|
||||
@ -404,7 +404,7 @@ g_ptr_array_free (GPtrArray *array,
|
||||
|
||||
static void
|
||||
g_ptr_array_maybe_expand (GRealPtrArray *array,
|
||||
gint len)
|
||||
gint len)
|
||||
{
|
||||
if ((array->len + len) > array->alloc)
|
||||
{
|
||||
@ -419,8 +419,8 @@ g_ptr_array_maybe_expand (GRealPtrArray *array,
|
||||
}
|
||||
|
||||
void
|
||||
g_ptr_array_set_size (GPtrArray *farray,
|
||||
gint length)
|
||||
g_ptr_array_set_size (GPtrArray *farray,
|
||||
gint length)
|
||||
{
|
||||
GRealPtrArray* array = (GRealPtrArray*) farray;
|
||||
|
||||
@ -450,21 +450,21 @@ g_ptr_array_set_size (GPtrArray *farray,
|
||||
}
|
||||
|
||||
gpointer
|
||||
g_ptr_array_remove_index (GPtrArray* farray,
|
||||
guint index)
|
||||
g_ptr_array_remove_index (GPtrArray *farray,
|
||||
guint index_)
|
||||
{
|
||||
GRealPtrArray* array = (GRealPtrArray*) farray;
|
||||
gpointer result;
|
||||
|
||||
g_return_val_if_fail (array, NULL);
|
||||
|
||||
g_return_val_if_fail (index < array->len, NULL);
|
||||
g_return_val_if_fail (index_ < array->len, NULL);
|
||||
|
||||
result = array->pdata[index];
|
||||
result = array->pdata[index_];
|
||||
|
||||
if (index != array->len - 1)
|
||||
g_memmove (array->pdata + index, array->pdata + index + 1,
|
||||
sizeof (gpointer) * (array->len - index - 1));
|
||||
if (index_ != array->len - 1)
|
||||
g_memmove (array->pdata + index_, array->pdata + index_ + 1,
|
||||
sizeof (gpointer) * (array->len - index_ - 1));
|
||||
|
||||
array->len -= 1;
|
||||
|
||||
@ -475,20 +475,20 @@ g_ptr_array_remove_index (GPtrArray* farray,
|
||||
}
|
||||
|
||||
gpointer
|
||||
g_ptr_array_remove_index_fast (GPtrArray* farray,
|
||||
guint index)
|
||||
g_ptr_array_remove_index_fast (GPtrArray *farray,
|
||||
guint index_)
|
||||
{
|
||||
GRealPtrArray* array = (GRealPtrArray*) farray;
|
||||
gpointer result;
|
||||
|
||||
g_return_val_if_fail (array, NULL);
|
||||
|
||||
g_return_val_if_fail (index < array->len, NULL);
|
||||
g_return_val_if_fail (index_ < array->len, NULL);
|
||||
|
||||
result = array->pdata[index];
|
||||
result = array->pdata[index_];
|
||||
|
||||
if (index != array->len - 1)
|
||||
array->pdata[index] = array->pdata[array->len - 1];
|
||||
if (index_ != array->len - 1)
|
||||
array->pdata[index_] = array->pdata[array->len - 1];
|
||||
|
||||
array->len -= 1;
|
||||
|
||||
@ -499,7 +499,7 @@ g_ptr_array_remove_index_fast (GPtrArray* farray,
|
||||
}
|
||||
|
||||
void
|
||||
g_ptr_array_remove_range (GPtrArray* farray,
|
||||
g_ptr_array_remove_range (GPtrArray *farray,
|
||||
guint index_,
|
||||
guint length)
|
||||
{
|
||||
@ -524,8 +524,8 @@ g_ptr_array_remove_range (GPtrArray* farray,
|
||||
}
|
||||
|
||||
gboolean
|
||||
g_ptr_array_remove (GPtrArray* farray,
|
||||
gpointer data)
|
||||
g_ptr_array_remove (GPtrArray *farray,
|
||||
gpointer data)
|
||||
{
|
||||
GRealPtrArray* array = (GRealPtrArray*) farray;
|
||||
guint i;
|
||||
@ -545,8 +545,8 @@ g_ptr_array_remove (GPtrArray* farray,
|
||||
}
|
||||
|
||||
gboolean
|
||||
g_ptr_array_remove_fast (GPtrArray* farray,
|
||||
gpointer data)
|
||||
g_ptr_array_remove_fast (GPtrArray *farray,
|
||||
gpointer data)
|
||||
{
|
||||
GRealPtrArray* array = (GRealPtrArray*) farray;
|
||||
guint i;
|
||||
@ -566,8 +566,8 @@ g_ptr_array_remove_fast (GPtrArray* farray,
|
||||
}
|
||||
|
||||
void
|
||||
g_ptr_array_add (GPtrArray* farray,
|
||||
gpointer data)
|
||||
g_ptr_array_add (GPtrArray *farray,
|
||||
gpointer data)
|
||||
{
|
||||
GRealPtrArray* array = (GRealPtrArray*) farray;
|
||||
|
||||
@ -630,7 +630,7 @@ g_ptr_array_foreach (GPtrArray *array,
|
||||
/* Byte arrays
|
||||
*/
|
||||
|
||||
GByteArray* g_byte_array_new (void)
|
||||
GByteArray* g_byte_array_new (void)
|
||||
{
|
||||
return (GByteArray*) g_array_sized_new (FALSE, FALSE, 1, 0);
|
||||
}
|
||||
@ -646,18 +646,18 @@ guint8* g_byte_array_free (GByteArray *array,
|
||||
return (guint8*) g_array_free ((GArray*) array, free_segment);
|
||||
}
|
||||
|
||||
GByteArray* g_byte_array_append (GByteArray *array,
|
||||
GByteArray* g_byte_array_append (GByteArray *array,
|
||||
const guint8 *data,
|
||||
guint len)
|
||||
guint len)
|
||||
{
|
||||
g_array_append_vals ((GArray*) array, (guint8*)data, len);
|
||||
|
||||
return array;
|
||||
}
|
||||
|
||||
GByteArray* g_byte_array_prepend (GByteArray *array,
|
||||
GByteArray* g_byte_array_prepend (GByteArray *array,
|
||||
const guint8 *data,
|
||||
guint len)
|
||||
guint len)
|
||||
{
|
||||
g_array_prepend_vals ((GArray*) array, (guint8*)data, len);
|
||||
|
||||
@ -673,25 +673,25 @@ GByteArray* g_byte_array_set_size (GByteArray *array,
|
||||
}
|
||||
|
||||
GByteArray* g_byte_array_remove_index (GByteArray *array,
|
||||
guint index)
|
||||
guint index_)
|
||||
{
|
||||
g_array_remove_index((GArray*) array, index);
|
||||
g_array_remove_index ((GArray*) array, index_);
|
||||
|
||||
return array;
|
||||
}
|
||||
|
||||
GByteArray* g_byte_array_remove_index_fast (GByteArray *array,
|
||||
guint index)
|
||||
guint index_)
|
||||
{
|
||||
g_array_remove_index_fast((GArray*) array, index);
|
||||
g_array_remove_index_fast ((GArray*) array, index_);
|
||||
|
||||
return array;
|
||||
}
|
||||
|
||||
GByteArray*
|
||||
g_byte_array_remove_range (GByteArray *array,
|
||||
guint index_,
|
||||
guint length)
|
||||
guint index_,
|
||||
guint length)
|
||||
{
|
||||
g_return_val_if_fail (array, NULL);
|
||||
g_return_val_if_fail (index_ < array->len, NULL);
|
||||
|
@ -212,7 +212,7 @@ stack_trace (char **args)
|
||||
SELECT_MASK fdset;
|
||||
SELECT_MASK readset;
|
||||
struct timeval tv;
|
||||
int sel, index, state;
|
||||
int sel, idx, state;
|
||||
char buffer[256];
|
||||
char c;
|
||||
|
||||
@ -249,7 +249,7 @@ stack_trace (char **args)
|
||||
write (in_fd[1], "p x = 0\n", 8);
|
||||
write (in_fd[1], "quit\n", 5);
|
||||
|
||||
index = 0;
|
||||
idx = 0;
|
||||
state = 0;
|
||||
|
||||
while (1)
|
||||
@ -272,18 +272,18 @@ stack_trace (char **args)
|
||||
if (c == '#')
|
||||
{
|
||||
state = 1;
|
||||
index = 0;
|
||||
buffer[index++] = c;
|
||||
idx = 0;
|
||||
buffer[idx++] = c;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
buffer[index++] = c;
|
||||
buffer[idx++] = c;
|
||||
if ((c == '\n') || (c == '\r'))
|
||||
{
|
||||
buffer[index] = 0;
|
||||
buffer[idx] = 0;
|
||||
_g_fprintf (stdout, "%s", buffer);
|
||||
state = 0;
|
||||
index = 0;
|
||||
idx = 0;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
@ -1409,7 +1409,7 @@ g_bookmark_file_parse (GBookmarkFile *bookmark,
|
||||
if (!buffer)
|
||||
return FALSE;
|
||||
|
||||
if (length == -1)
|
||||
if (length == (gsize) -1)
|
||||
length = strlen (buffer);
|
||||
|
||||
parse_data = parse_data_new ();
|
||||
|
56
glib/gdate.c
56
glib/gdate.c
@ -176,7 +176,7 @@ g_date_update_julian (const GDate *const_d)
|
||||
{
|
||||
GDate *d = (GDate *) const_d;
|
||||
GDateYear year;
|
||||
gint index;
|
||||
gint idx;
|
||||
|
||||
g_return_if_fail (d != NULL);
|
||||
g_return_if_fail (d->dmy);
|
||||
@ -184,10 +184,10 @@ g_date_update_julian (const GDate *const_d)
|
||||
g_return_if_fail (g_date_valid_dmy (d->day, d->month, d->year));
|
||||
|
||||
/* What we actually do is: multiply years * 365 days in the year,
|
||||
* add the number of years divided by 4, subtract the number of
|
||||
* years divided by 100 and add the number of years divided by 400,
|
||||
* which accounts for leap year stuff. Code from Steffen Beyer's
|
||||
* DateCalc.
|
||||
* add the number of years divided by 4, subtract the number of
|
||||
* years divided by 100 and add the number of years divided by 400,
|
||||
* which accounts for leap year stuff. Code from Steffen Beyer's
|
||||
* DateCalc.
|
||||
*/
|
||||
|
||||
year = d->year - 1; /* we know d->year > 0 since it's valid */
|
||||
@ -197,9 +197,9 @@ g_date_update_julian (const GDate *const_d)
|
||||
d->julian_days -= (year /= 25); /* divides original # years by 100 */
|
||||
d->julian_days += year >> 2; /* divides by 4, which divides original by 400 */
|
||||
|
||||
index = g_date_is_leap_year (d->year) ? 1 : 0;
|
||||
idx = g_date_is_leap_year (d->year) ? 1 : 0;
|
||||
|
||||
d->julian_days += days_in_year[index][d->month] + d->day;
|
||||
d->julian_days += days_in_year[idx][d->month] + d->day;
|
||||
|
||||
g_return_if_fail (g_date_valid_julian (d->julian_days));
|
||||
|
||||
@ -321,7 +321,7 @@ g_date_get_julian (const GDate *d)
|
||||
guint
|
||||
g_date_get_day_of_year (const GDate *d)
|
||||
{
|
||||
gint index;
|
||||
gint idx;
|
||||
|
||||
g_return_val_if_fail (g_date_valid (d), 0);
|
||||
|
||||
@ -330,9 +330,9 @@ g_date_get_day_of_year (const GDate *d)
|
||||
|
||||
g_return_val_if_fail (d->dmy, 0);
|
||||
|
||||
index = g_date_is_leap_year (d->year) ? 1 : 0;
|
||||
idx = g_date_is_leap_year (d->year) ? 1 : 0;
|
||||
|
||||
return (days_in_year[index][d->month] + d->day);
|
||||
return (days_in_year[idx][d->month] + d->day);
|
||||
}
|
||||
|
||||
guint
|
||||
@ -672,7 +672,9 @@ g_date_prepare_to_parse (const gchar *str,
|
||||
++i;
|
||||
}
|
||||
if (using_twodigit_years)
|
||||
DEBUG_MSG (("**Using twodigit years with cutoff year: %u", twodigit_start_year));
|
||||
{
|
||||
DEBUG_MSG (("**Using twodigit years with cutoff year: %u", twodigit_start_year));
|
||||
}
|
||||
{
|
||||
gchar *strings[3];
|
||||
i = 0;
|
||||
@ -851,7 +853,9 @@ g_date_set_parse (GDate *d,
|
||||
}
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
else
|
||||
DEBUG_MSG (("Rejected DMY %u %u %u", day, m, y));
|
||||
{
|
||||
DEBUG_MSG (("Rejected DMY %u %u %u", day, m, y));
|
||||
}
|
||||
#endif
|
||||
G_UNLOCK (g_date_global);
|
||||
}
|
||||
@ -1053,7 +1057,7 @@ g_date_is_first_of_month (const GDate *d)
|
||||
gboolean
|
||||
g_date_is_last_of_month (const GDate *d)
|
||||
{
|
||||
gint index;
|
||||
gint idx;
|
||||
|
||||
g_return_val_if_fail (g_date_valid (d), FALSE);
|
||||
|
||||
@ -1062,9 +1066,9 @@ g_date_is_last_of_month (const GDate *d)
|
||||
|
||||
g_return_val_if_fail (d->dmy, FALSE);
|
||||
|
||||
index = g_date_is_leap_year (d->year) ? 1 : 0;
|
||||
idx = g_date_is_leap_year (d->year) ? 1 : 0;
|
||||
|
||||
if (d->day == days_in_months[index][d->month]) return TRUE;
|
||||
if (d->day == days_in_months[idx][d->month]) return TRUE;
|
||||
else return FALSE;
|
||||
}
|
||||
|
||||
@ -1104,7 +1108,7 @@ g_date_add_months (GDate *d,
|
||||
guint nmonths)
|
||||
{
|
||||
guint years, months;
|
||||
gint index;
|
||||
gint idx;
|
||||
|
||||
g_return_if_fail (g_date_valid (d));
|
||||
|
||||
@ -1121,10 +1125,10 @@ g_date_add_months (GDate *d,
|
||||
d->month = months + 1;
|
||||
d->year += years;
|
||||
|
||||
index = g_date_is_leap_year (d->year) ? 1 : 0;
|
||||
idx = g_date_is_leap_year (d->year) ? 1 : 0;
|
||||
|
||||
if (d->day > days_in_months[index][d->month])
|
||||
d->day = days_in_months[index][d->month];
|
||||
if (d->day > days_in_months[idx][d->month])
|
||||
d->day = days_in_months[idx][d->month];
|
||||
|
||||
d->julian = FALSE;
|
||||
|
||||
@ -1136,7 +1140,7 @@ g_date_subtract_months (GDate *d,
|
||||
guint nmonths)
|
||||
{
|
||||
guint years, months;
|
||||
gint index;
|
||||
gint idx;
|
||||
|
||||
g_return_if_fail (g_date_valid (d));
|
||||
|
||||
@ -1160,10 +1164,10 @@ g_date_subtract_months (GDate *d,
|
||||
d->year -= 1;
|
||||
}
|
||||
|
||||
index = g_date_is_leap_year (d->year) ? 1 : 0;
|
||||
idx = g_date_is_leap_year (d->year) ? 1 : 0;
|
||||
|
||||
if (d->day > days_in_months[index][d->month])
|
||||
d->day = days_in_months[index][d->month];
|
||||
if (d->day > days_in_months[idx][d->month])
|
||||
d->day = days_in_months[idx][d->month];
|
||||
|
||||
d->julian = FALSE;
|
||||
|
||||
@ -1228,14 +1232,14 @@ guint8
|
||||
g_date_get_days_in_month (GDateMonth month,
|
||||
GDateYear year)
|
||||
{
|
||||
gint index;
|
||||
gint idx;
|
||||
|
||||
g_return_val_if_fail (g_date_valid_year (year), 0);
|
||||
g_return_val_if_fail (g_date_valid_month (month), 0);
|
||||
|
||||
index = g_date_is_leap_year (year) ? 1 : 0;
|
||||
idx = g_date_is_leap_year (year) ? 1 : 0;
|
||||
|
||||
return days_in_months[index][month];
|
||||
return days_in_months[idx][month];
|
||||
}
|
||||
|
||||
guint8
|
||||
|
@ -518,11 +518,11 @@ g_file_error_from_errno (gint err_no)
|
||||
}
|
||||
|
||||
static gboolean
|
||||
get_contents_stdio (const gchar *display_filename,
|
||||
FILE *f,
|
||||
gchar **contents,
|
||||
gsize *length,
|
||||
GError **error)
|
||||
get_contents_stdio (const gchar *display_filename,
|
||||
FILE *f,
|
||||
gchar **contents,
|
||||
gsize *length,
|
||||
GError **error)
|
||||
{
|
||||
gchar buf[4096];
|
||||
gsize bytes;
|
||||
@ -620,12 +620,12 @@ get_contents_stdio (const gchar *display_filename,
|
||||
#ifndef G_OS_WIN32
|
||||
|
||||
static gboolean
|
||||
get_contents_regfile (const gchar *display_filename,
|
||||
struct stat *stat_buf,
|
||||
gint fd,
|
||||
gchar **contents,
|
||||
gsize *length,
|
||||
GError **error)
|
||||
get_contents_regfile (const gchar *display_filename,
|
||||
struct stat *stat_buf,
|
||||
gint fd,
|
||||
gchar **contents,
|
||||
gsize *length,
|
||||
GError **error)
|
||||
{
|
||||
gchar *buf;
|
||||
gsize bytes_read;
|
||||
@ -698,10 +698,10 @@ get_contents_regfile (const gchar *display_filename,
|
||||
}
|
||||
|
||||
static gboolean
|
||||
get_contents_posix (const gchar *filename,
|
||||
gchar **contents,
|
||||
gsize *length,
|
||||
GError **error)
|
||||
get_contents_posix (const gchar *filename,
|
||||
gchar **contents,
|
||||
gsize *length,
|
||||
GError **error)
|
||||
{
|
||||
struct stat stat_buf;
|
||||
gint fd;
|
||||
@ -786,10 +786,10 @@ get_contents_posix (const gchar *filename,
|
||||
#else /* G_OS_WIN32 */
|
||||
|
||||
static gboolean
|
||||
get_contents_win32 (const gchar *filename,
|
||||
gchar **contents,
|
||||
gsize *length,
|
||||
GError **error)
|
||||
get_contents_win32 (const gchar *filename,
|
||||
gchar **contents,
|
||||
gsize *length,
|
||||
GError **error)
|
||||
{
|
||||
FILE *f;
|
||||
gboolean retval;
|
||||
@ -841,10 +841,10 @@ get_contents_win32 (const gchar *filename,
|
||||
* Return value: %TRUE on success, %FALSE if an error occurred
|
||||
**/
|
||||
gboolean
|
||||
g_file_get_contents (const gchar *filename,
|
||||
gchar **contents,
|
||||
gsize *length,
|
||||
GError **error)
|
||||
g_file_get_contents (const gchar *filename,
|
||||
gchar **contents,
|
||||
gsize *length,
|
||||
GError **error)
|
||||
{
|
||||
g_return_val_if_fail (filename != NULL, FALSE);
|
||||
g_return_val_if_fail (contents != NULL, FALSE);
|
||||
@ -867,10 +867,10 @@ g_file_get_contents (const gchar *filename,
|
||||
/* Binary compatibility version. Not for newly compiled code. */
|
||||
|
||||
gboolean
|
||||
g_file_get_contents (const gchar *filename,
|
||||
gchar **contents,
|
||||
gsize *length,
|
||||
GError **error)
|
||||
g_file_get_contents (const gchar *filename,
|
||||
gchar **contents,
|
||||
gsize *length,
|
||||
GError **error)
|
||||
{
|
||||
gchar *utf8_filename = g_locale_to_utf8 (filename, -1, NULL, NULL, error);
|
||||
gboolean retval;
|
||||
@ -888,9 +888,9 @@ g_file_get_contents (const gchar *filename,
|
||||
#endif
|
||||
|
||||
static gboolean
|
||||
rename_file (const char *old_name,
|
||||
const char *new_name,
|
||||
GError **err)
|
||||
rename_file (const char *old_name,
|
||||
const char *new_name,
|
||||
GError **err)
|
||||
{
|
||||
errno = 0;
|
||||
if (g_rename (old_name, new_name) == -1)
|
||||
@ -917,10 +917,10 @@ rename_file (const char *old_name,
|
||||
}
|
||||
|
||||
static gchar *
|
||||
write_to_temp_file (const gchar *contents,
|
||||
gssize length,
|
||||
const gchar *template,
|
||||
GError **err)
|
||||
write_to_temp_file (const gchar *contents,
|
||||
gssize length,
|
||||
const gchar *template,
|
||||
GError **err)
|
||||
{
|
||||
gchar *tmp_name;
|
||||
gchar *display_name;
|
||||
@ -1061,10 +1061,10 @@ write_to_temp_file (const gchar *contents,
|
||||
* Since: 2.8
|
||||
**/
|
||||
gboolean
|
||||
g_file_set_contents (const gchar *filename,
|
||||
const gchar *contents,
|
||||
gssize length,
|
||||
GError **error)
|
||||
g_file_set_contents (const gchar *filename,
|
||||
const gchar *contents,
|
||||
gssize length,
|
||||
GError **error)
|
||||
{
|
||||
gchar *tmp_filename;
|
||||
gboolean retval;
|
||||
@ -1337,13 +1337,13 @@ g_mkstemp (gchar *tmpl)
|
||||
* and @error will be set.
|
||||
**/
|
||||
gint
|
||||
g_file_open_tmp (const gchar *tmpl,
|
||||
gchar **name_used,
|
||||
GError **error)
|
||||
g_file_open_tmp (const gchar *tmpl,
|
||||
gchar **name_used,
|
||||
GError **error)
|
||||
{
|
||||
int retval;
|
||||
const char *tmpdir;
|
||||
char *sep;
|
||||
const char *sep;
|
||||
char *fulltemplate;
|
||||
const char *slash;
|
||||
|
||||
@ -1424,9 +1424,9 @@ g_file_open_tmp (const gchar *tmpl,
|
||||
/* Binary compatibility version. Not for newly compiled code. */
|
||||
|
||||
gint
|
||||
g_file_open_tmp (const gchar *tmpl,
|
||||
gchar **name_used,
|
||||
GError **error)
|
||||
g_file_open_tmp (const gchar *tmpl,
|
||||
gchar **name_used,
|
||||
GError **error)
|
||||
{
|
||||
gchar *utf8_tmpl = g_locale_to_utf8 (tmpl, -1, NULL, NULL, error);
|
||||
gchar *utf8_name_used;
|
||||
@ -1880,8 +1880,8 @@ g_format_size_for_display (goffset size)
|
||||
* Since: 2.4
|
||||
*/
|
||||
gchar *
|
||||
g_file_read_link (const gchar *filename,
|
||||
GError **error)
|
||||
g_file_read_link (const gchar *filename,
|
||||
GError **error)
|
||||
{
|
||||
#ifdef HAVE_READLINK
|
||||
gchar *buffer;
|
||||
|
@ -182,7 +182,6 @@ g_io_error_get_from_g_error (GIOStatus status,
|
||||
}
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
return G_IO_ERROR_UNKNOWN; /* Keep the compiler happy */
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2526,8 +2526,6 @@ g_key_file_set_key_comment (GKeyFile *key_file,
|
||||
tmp = key_node->next;
|
||||
while (tmp != NULL)
|
||||
{
|
||||
GKeyFileKeyValuePair *pair;
|
||||
|
||||
pair = (GKeyFileKeyValuePair *) tmp->data;
|
||||
|
||||
if (pair->key != NULL)
|
||||
@ -2748,8 +2746,6 @@ g_key_file_get_key_comment (GKeyFile *key_file,
|
||||
|
||||
while (tmp != key_node)
|
||||
{
|
||||
GKeyFileKeyValuePair *pair;
|
||||
|
||||
pair = (GKeyFileKeyValuePair *) tmp->data;
|
||||
|
||||
if (string == NULL)
|
||||
|
@ -3668,8 +3668,8 @@ g_child_watch_source_init_single (void)
|
||||
sigaction (SIGCHLD, &action, NULL);
|
||||
}
|
||||
|
||||
static gpointer
|
||||
child_watch_helper_thread (gpointer data)
|
||||
G_GNUC_NORETURN static gpointer
|
||||
child_watch_helper_thread (gpointer data)
|
||||
{
|
||||
while (1)
|
||||
{
|
||||
@ -3694,8 +3694,6 @@ child_watch_helper_thread (gpointer data)
|
||||
}
|
||||
G_UNLOCK (main_context_list);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
|
105
glib/goption.c
105
glib/goption.c
@ -656,13 +656,13 @@ g_option_context_get_help (GOptionContext *context,
|
||||
list = context->groups;
|
||||
while (list != NULL)
|
||||
{
|
||||
GOptionGroup *group = list->data;
|
||||
for (i = 0; i < group->n_entries; i++)
|
||||
GOptionGroup *g = list->data;
|
||||
for (i = 0; i < g->n_entries; i++)
|
||||
{
|
||||
entry = &group->entries[i];
|
||||
entry = &g->entries[i];
|
||||
if (g_hash_table_lookup (shadow_map, entry->long_name) &&
|
||||
!(entry->flags & G_OPTION_FLAG_NOALIAS))
|
||||
entry->long_name = g_strdup_printf ("%s-%s", group->name, entry->long_name);
|
||||
entry->long_name = g_strdup_printf ("%s-%s", g->name, entry->long_name);
|
||||
else
|
||||
g_hash_table_insert (shadow_map, (gpointer)entry->long_name, entry);
|
||||
|
||||
@ -695,14 +695,14 @@ g_option_context_get_help (GOptionContext *context,
|
||||
|
||||
while (list != NULL)
|
||||
{
|
||||
GOptionGroup *group = list->data;
|
||||
GOptionGroup *g = list->data;
|
||||
|
||||
/* First, we check the --help-<groupname> options */
|
||||
len = _g_utf8_strwidth ("--help-", -1) + _g_utf8_strwidth (group->name, -1);
|
||||
len = _g_utf8_strwidth ("--help-", -1) + _g_utf8_strwidth (g->name, -1);
|
||||
max_length = MAX (max_length, len);
|
||||
|
||||
/* Then we go through the entries */
|
||||
len = calculate_max_length (group);
|
||||
len = calculate_max_length (g);
|
||||
max_length = MAX (max_length, len);
|
||||
|
||||
list = list->next;
|
||||
@ -727,12 +727,12 @@ g_option_context_get_help (GOptionContext *context,
|
||||
|
||||
while (list)
|
||||
{
|
||||
GOptionGroup *group = list->data;
|
||||
GOptionGroup *g = list->data;
|
||||
|
||||
if (group_has_visible_entries (context, group, FALSE))
|
||||
if (group_has_visible_entries (context, g, FALSE))
|
||||
g_string_append_printf (string, " --help-%-*s %s\n",
|
||||
max_length - 5, group->name,
|
||||
TRANSLATE (group, group->help_description));
|
||||
max_length - 5, g->name,
|
||||
TRANSLATE (g, g->help_description));
|
||||
|
||||
list = list->next;
|
||||
}
|
||||
@ -761,15 +761,15 @@ g_option_context_get_help (GOptionContext *context,
|
||||
|
||||
while (list)
|
||||
{
|
||||
GOptionGroup *group = list->data;
|
||||
GOptionGroup *g = list->data;
|
||||
|
||||
if (group_has_visible_entries (context, group, FALSE))
|
||||
if (group_has_visible_entries (context, g, FALSE))
|
||||
{
|
||||
g_string_append (string, group->description);
|
||||
g_string_append (string, g->description);
|
||||
g_string_append (string, "\n");
|
||||
for (i = 0; i < group->n_entries; i++)
|
||||
if (!(group->entries[i].flags & G_OPTION_FLAG_IN_MAIN))
|
||||
print_entry (group, max_length, &group->entries[i], string);
|
||||
for (i = 0; i < g->n_entries; i++)
|
||||
if (!(g->entries[i].flags & G_OPTION_FLAG_IN_MAIN))
|
||||
print_entry (g, max_length, &g->entries[i], string);
|
||||
|
||||
g_string_append (string, "\n");
|
||||
}
|
||||
@ -794,12 +794,12 @@ g_option_context_get_help (GOptionContext *context,
|
||||
|
||||
while (list != NULL)
|
||||
{
|
||||
GOptionGroup *group = list->data;
|
||||
GOptionGroup *g = list->data;
|
||||
|
||||
/* Print main entries from other groups */
|
||||
for (i = 0; i < group->n_entries; i++)
|
||||
if (group->entries[i].flags & G_OPTION_FLAG_IN_MAIN)
|
||||
print_entry (group, max_length, &group->entries[i], string);
|
||||
for (i = 0; i < g->n_entries; i++)
|
||||
if (g->entries[i].flags & G_OPTION_FLAG_IN_MAIN)
|
||||
print_entry (g, max_length, &g->entries[i], string);
|
||||
|
||||
list = list->next;
|
||||
}
|
||||
@ -816,6 +816,7 @@ g_option_context_get_help (GOptionContext *context,
|
||||
return g_string_free (string, FALSE);
|
||||
}
|
||||
|
||||
G_GNUC_NORETURN
|
||||
static void
|
||||
print_help (GOptionContext *context,
|
||||
gboolean main_help,
|
||||
@ -1199,8 +1200,8 @@ parse_arg (GOptionContext *context,
|
||||
static gboolean
|
||||
parse_short_option (GOptionContext *context,
|
||||
GOptionGroup *group,
|
||||
gint index,
|
||||
gint *new_index,
|
||||
gint idx,
|
||||
gint *new_idx,
|
||||
gchar arg,
|
||||
gint *argc,
|
||||
gchar ***argv,
|
||||
@ -1222,7 +1223,7 @@ parse_short_option (GOptionContext *context,
|
||||
value = NULL;
|
||||
else
|
||||
{
|
||||
if (*new_index > index)
|
||||
if (*new_idx > idx)
|
||||
{
|
||||
g_set_error (error,
|
||||
G_OPTION_ERROR, G_OPTION_ERROR_FAILED,
|
||||
@ -1231,27 +1232,27 @@ parse_short_option (GOptionContext *context,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (index < *argc - 1)
|
||||
if (idx < *argc - 1)
|
||||
{
|
||||
if (!OPTIONAL_ARG (&group->entries[j]))
|
||||
{
|
||||
value = (*argv)[index + 1];
|
||||
add_pending_null (context, &((*argv)[index + 1]), NULL);
|
||||
*new_index = index+1;
|
||||
value = (*argv)[idx + 1];
|
||||
add_pending_null (context, &((*argv)[idx + 1]), NULL);
|
||||
*new_idx = idx + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((*argv)[index + 1][0] == '-')
|
||||
if ((*argv)[idx + 1][0] == '-')
|
||||
value = NULL;
|
||||
else
|
||||
{
|
||||
value = (*argv)[index + 1];
|
||||
add_pending_null (context, &((*argv)[index + 1]), NULL);
|
||||
*new_index = index + 1;
|
||||
value = (*argv)[idx + 1];
|
||||
add_pending_null (context, &((*argv)[idx + 1]), NULL);
|
||||
*new_idx = idx + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (index >= *argc - 1 && OPTIONAL_ARG (&group->entries[j]))
|
||||
else if (idx >= *argc - 1 && OPTIONAL_ARG (&group->entries[j]))
|
||||
value = NULL;
|
||||
else
|
||||
{
|
||||
@ -1281,7 +1282,7 @@ parse_short_option (GOptionContext *context,
|
||||
static gboolean
|
||||
parse_long_option (GOptionContext *context,
|
||||
GOptionGroup *group,
|
||||
gint *index,
|
||||
gint *idx,
|
||||
gchar *arg,
|
||||
gboolean aliased,
|
||||
gint *argc,
|
||||
@ -1293,7 +1294,7 @@ parse_long_option (GOptionContext *context,
|
||||
|
||||
for (j = 0; j < group->n_entries; j++)
|
||||
{
|
||||
if (*index >= *argc)
|
||||
if (*idx >= *argc)
|
||||
return TRUE;
|
||||
|
||||
if (aliased && (group->entries[j].flags & G_OPTION_FLAG_NOALIAS))
|
||||
@ -1310,7 +1311,7 @@ parse_long_option (GOptionContext *context,
|
||||
NULL, option_name, error);
|
||||
g_free(option_name);
|
||||
|
||||
add_pending_null (context, &((*argv)[*index]), NULL);
|
||||
add_pending_null (context, &((*argv)[*idx]), NULL);
|
||||
*parsed = TRUE;
|
||||
|
||||
return retval;
|
||||
@ -1325,22 +1326,22 @@ parse_long_option (GOptionContext *context,
|
||||
gchar *value = NULL;
|
||||
gchar *option_name;
|
||||
|
||||
add_pending_null (context, &((*argv)[*index]), NULL);
|
||||
add_pending_null (context, &((*argv)[*idx]), NULL);
|
||||
option_name = g_strconcat ("--", group->entries[j].long_name, NULL);
|
||||
|
||||
if (arg[len] == '=')
|
||||
value = arg + len + 1;
|
||||
else if (*index < *argc - 1)
|
||||
else if (*idx < *argc - 1)
|
||||
{
|
||||
if (!(group->entries[j].flags & G_OPTION_FLAG_OPTIONAL_ARG))
|
||||
{
|
||||
value = (*argv)[*index + 1];
|
||||
add_pending_null (context, &((*argv)[*index + 1]), NULL);
|
||||
(*index)++;
|
||||
value = (*argv)[*idx + 1];
|
||||
add_pending_null (context, &((*argv)[*idx + 1]), NULL);
|
||||
(*idx)++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((*argv)[*index + 1][0] == '-')
|
||||
if ((*argv)[*idx + 1][0] == '-')
|
||||
{
|
||||
gboolean retval;
|
||||
retval = parse_arg (context, group, &group->entries[j],
|
||||
@ -1351,13 +1352,13 @@ parse_long_option (GOptionContext *context,
|
||||
}
|
||||
else
|
||||
{
|
||||
value = (*argv)[*index + 1];
|
||||
add_pending_null (context, &((*argv)[*index + 1]), NULL);
|
||||
(*index)++;
|
||||
value = (*argv)[*idx + 1];
|
||||
add_pending_null (context, &((*argv)[*idx + 1]), NULL);
|
||||
(*idx)++;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (*index >= *argc - 1 &&
|
||||
else if (*idx >= *argc - 1 &&
|
||||
group->entries[j].flags & G_OPTION_FLAG_OPTIONAL_ARG)
|
||||
{
|
||||
gboolean retval;
|
||||
@ -1395,7 +1396,7 @@ parse_long_option (GOptionContext *context,
|
||||
static gboolean
|
||||
parse_remaining_arg (GOptionContext *context,
|
||||
GOptionGroup *group,
|
||||
gint *index,
|
||||
gint *idx,
|
||||
gint *argc,
|
||||
gchar ***argv,
|
||||
GError **error,
|
||||
@ -1405,7 +1406,7 @@ parse_remaining_arg (GOptionContext *context,
|
||||
|
||||
for (j = 0; j < group->n_entries; j++)
|
||||
{
|
||||
if (*index >= *argc)
|
||||
if (*idx >= *argc)
|
||||
return TRUE;
|
||||
|
||||
if (group->entries[j].long_name[0])
|
||||
@ -1415,9 +1416,9 @@ parse_remaining_arg (GOptionContext *context,
|
||||
group->entries[j].arg == G_OPTION_ARG_STRING_ARRAY ||
|
||||
group->entries[j].arg == G_OPTION_ARG_FILENAME_ARRAY, FALSE);
|
||||
|
||||
add_pending_null (context, &((*argv)[*index]), NULL);
|
||||
add_pending_null (context, &((*argv)[*idx]), NULL);
|
||||
|
||||
if (!parse_arg (context, group, &group->entries[j], (*argv)[*index], "", error))
|
||||
if (!parse_arg (context, group, &group->entries[j], (*argv)[*idx], "", error))
|
||||
return FALSE;
|
||||
|
||||
*parsed = TRUE;
|
||||
@ -1623,8 +1624,6 @@ g_option_context_parse (GOptionContext *context,
|
||||
print_help (context, FALSE, NULL);
|
||||
else if (strncmp (arg, "help-", 5) == 0)
|
||||
{
|
||||
GList *list;
|
||||
|
||||
list = context->groups;
|
||||
|
||||
while (list)
|
||||
@ -1695,7 +1694,7 @@ g_option_context_parse (GOptionContext *context,
|
||||
}
|
||||
else
|
||||
{ /* short option */
|
||||
gint j, new_i = i, arg_length;
|
||||
gint new_i = i, arg_length;
|
||||
gboolean *nulled_out = NULL;
|
||||
arg = (*argv)[i] + 1;
|
||||
arg_length = strlen (arg);
|
||||
|
@ -880,6 +880,7 @@ write_all (gint fd, gconstpointer vbuf, gsize to_write)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
G_GNUC_NORETURN
|
||||
static void
|
||||
write_err_and_exit (gint fd, gint msg)
|
||||
{
|
||||
|
@ -2391,8 +2391,6 @@ g_strsplit_set (const gchar *string,
|
||||
{
|
||||
if (delim_table[*(guchar *)s] && n_tokens + 1 < max_tokens)
|
||||
{
|
||||
gchar *token;
|
||||
|
||||
token = g_strndup (current, s - current);
|
||||
tokens = g_slist_prepend (tokens, token);
|
||||
++n_tokens;
|
||||
|
@ -497,10 +497,10 @@ g_static_private_set (GStaticPrivate *private_key,
|
||||
void
|
||||
g_static_private_free (GStaticPrivate *private_key)
|
||||
{
|
||||
guint index = private_key->index;
|
||||
guint idx = private_key->index;
|
||||
GRealThread *thread;
|
||||
|
||||
if (!index)
|
||||
if (!idx)
|
||||
return;
|
||||
|
||||
private_key->index = 0;
|
||||
@ -513,27 +513,27 @@ g_static_private_free (GStaticPrivate *private_key)
|
||||
GArray *array = thread->private_data;
|
||||
thread = thread->next;
|
||||
|
||||
if (array && index <= array->len)
|
||||
if (array && idx <= array->len)
|
||||
{
|
||||
GStaticPrivateNode *node = &g_array_index (array,
|
||||
GStaticPrivateNode,
|
||||
index - 1);
|
||||
idx - 1);
|
||||
gpointer ddata = node->data;
|
||||
GDestroyNotify ddestroy = node->destroy;
|
||||
|
||||
node->data = NULL;
|
||||
node->destroy = NULL;
|
||||
|
||||
if (ddestroy)
|
||||
{
|
||||
G_UNLOCK (g_thread);
|
||||
ddestroy (ddata);
|
||||
G_LOCK (g_thread);
|
||||
}
|
||||
if (ddestroy)
|
||||
{
|
||||
G_UNLOCK (g_thread);
|
||||
ddestroy (ddata);
|
||||
G_LOCK (g_thread);
|
||||
}
|
||||
}
|
||||
}
|
||||
g_thread_free_indeces = g_slist_prepend (g_thread_free_indeces,
|
||||
GUINT_TO_POINTER (index));
|
||||
GUINT_TO_POINTER (idx));
|
||||
G_UNLOCK (g_thread);
|
||||
}
|
||||
|
||||
@ -638,13 +638,13 @@ g_thread_create_proxy (gpointer data)
|
||||
}
|
||||
|
||||
GThread*
|
||||
g_thread_create_full (GThreadFunc func,
|
||||
gpointer data,
|
||||
gulong stack_size,
|
||||
gboolean joinable,
|
||||
gboolean bound,
|
||||
GThreadPriority priority,
|
||||
GError **error)
|
||||
g_thread_create_full (GThreadFunc func,
|
||||
gpointer data,
|
||||
gulong stack_size,
|
||||
gboolean joinable,
|
||||
gboolean bound,
|
||||
GThreadPriority priority,
|
||||
GError **error)
|
||||
{
|
||||
GRealThread* result;
|
||||
GError *local_error = NULL;
|
||||
|
@ -60,7 +60,7 @@ libpcre_la_LIBADD = $(DEP_LIBS)
|
||||
|
||||
libpcre_la_LDFLAGS = -no-undefined
|
||||
|
||||
EXTRA_DIST = \
|
||||
EXTRA_DIST += \
|
||||
COPYING \
|
||||
makefile.msc
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user