[parted-devel] [Patch] Remove non-indentation tabulators from
libparted/*.c
Håkon Løvdal
hlovdal at gmail.com
Mon Mar 19 01:24:04 CET 2007
Replace tabulator with space in those cases where tabulator
is inappropriately used for alignment.
---
This is not a complete fix-every-issue-with-regards-to-code-layout
patch, it only removes tabulator where its usage is not for indentation.
A very few minor changes in addition to replacing tabulators:
* Replaced space indentation with tabulator where this was
obviously correct, like for instance the return statement
in ped_timer_touch which had an indentation of 1 tab
followed by 8 spaces and indentation elsewhere in the
function was done with tabulator.
* Removed tabulator in comments where it had no function.
* In ped_exception_throw the while(1) body had double
indentation for no apparent reason, so I changed that to
normal, single level indentation.
There are still some issues left with regards to code layout.
* All space indented functions are left unchanged.
* Some functions with the arguments listed on several
lines have the second line not properly alligned like
for instance
static void default_handler ( const int level, const char* file, int line,
const char* function, const char* msg );
which I am sure some time previously have been
static void
default_handler(const int level, const char* file, int line,
const char* function, const char* msg );
This has not been addressed since the focus of this
patch was to remove inappropriate tabulator usage.
libparted/debug.c | 4 +-
libparted/device.c | 32 +++---
libparted/disk.c | 256 ++++++++++++++++++++++++------------------------
libparted/exception.c | 40 ++++----
libparted/filesys.c | 130 +++++++++++++-------------
libparted/libparted.c | 40 ++++----
libparted/timer.c | 28 +++---
libparted/unit.c | 84 ++++++++--------
8 files changed, 307 insertions(+), 307 deletions(-)
diff --git a/libparted/debug.c b/libparted/debug.c
index 82d05c4..3b1e5bb 100644
--- a/libparted/debug.c
+++ b/libparted/debug.c
@@ -84,9 +84,9 @@ void ped_debug_set_handler ( PedDebugHandler* handler )
* Do not call this directly -- use PED_ASSERT() instead.
*/
int ped_assert ( int cond, const char* cond_text,
- const char* file, int line, const char* function )
+ const char* file, int line, const char* function )
{
- PedExceptionOption opt;
+ PedExceptionOption opt;
if ( cond )
return 1;
diff --git a/libparted/device.c b/libparted/device.c
index e079fca..db52aa7 100644
--- a/libparted/device.c
+++ b/libparted/device.c
@@ -45,17 +45,17 @@
#include <unistd.h>
#include <errno.h>
-static PedDevice* devices; /* legal advice says: initialized to NULL,
- under section 6.7.8 part 10
- of ISO/EIC 9899:1999 */
+static PedDevice* devices; /* legal advice says: initialized to NULL,
+ under section 6.7.8 part 10
+ of ISO/EIC 9899:1999 */
#ifndef HAVE_CANONICALIZE_FILE_NAME
char *
canonicalize_file_name (const char *name)
{
- char * buf;
- int size;
- char * result;
+ char * buf;
+ int size;
+ char * result;
#ifdef PATH_MAX
size = PATH_MAX;
@@ -83,7 +83,7 @@ canonicalize_file_name (const char *name)
static void
_device_register (PedDevice* dev)
{
- PedDevice* walk;
+ PedDevice* walk;
for (walk = devices; walk && walk->next; walk = walk->next);
if (walk)
walk->next = dev;
@@ -95,8 +95,8 @@ _device_register (PedDevice* dev)
static void
_device_unregister (PedDevice* dev)
{
- PedDevice* walk;
- PedDevice* last = NULL;
+ PedDevice* walk;
+ PedDevice* last = NULL;
for (walk = devices; walk != NULL; last = walk, walk = walk->next) {
if (walk == dev) break;
@@ -127,7 +127,7 @@ ped_device_get_next (const PedDevice* dev)
void
_ped_device_probe (const char* path)
{
- PedDevice* dev;
+ PedDevice* dev;
PED_ASSERT (path != NULL, return);
@@ -167,8 +167,8 @@ ped_device_free_all ()
PedDevice*
ped_device_get (const char* path)
{
- PedDevice* walk;
- char* normal_path;
+ PedDevice* walk;
+ char* normal_path;
PED_ASSERT (path != NULL, return NULL);
normal_path = canonicalize_file_name (path);
@@ -239,7 +239,7 @@ ped_device_is_busy (PedDevice* dev)
int
ped_device_open (PedDevice* dev)
{
- int status;
+ int status;
PED_ASSERT (dev != NULL, return 0);
PED_ASSERT (!dev->external_mode, return 0);
@@ -338,7 +338,7 @@ ped_device_end_external_access (PedDevice* dev)
*/
int
ped_device_read (const PedDevice* dev, void* buffer, PedSector start,
- PedSector count)
+ PedSector count)
{
PED_ASSERT (dev != NULL, return 0);
PED_ASSERT (buffer != NULL, return 0);
@@ -359,7 +359,7 @@ ped_device_read (const PedDevice* dev, void* buffer, PedSector start,
*/
int
ped_device_write (PedDevice* dev, const void* buffer, PedSector start,
- PedSector count)
+ PedSector count)
{
PED_ASSERT (dev != NULL, return 0);
PED_ASSERT (buffer != NULL, return 0);
@@ -371,7 +371,7 @@ ped_device_write (PedDevice* dev, const void* buffer, PedSector start,
PedSector
ped_device_check (PedDevice* dev, void* buffer, PedSector start,
- PedSector count)
+ PedSector count)
{
PED_ASSERT (dev != NULL, return 0);
PED_ASSERT (!dev->external_mode, return 0);
diff --git a/libparted/disk.c b/libparted/disk.c
index c678d65..0f4740d 100644
--- a/libparted/disk.c
+++ b/libparted/disk.c
@@ -54,13 +54,13 @@ static int _disk_check_sanity (PedDisk* disk);
static void _disk_push_update_mode (PedDisk* disk);
static void _disk_pop_update_mode (PedDisk* disk);
static int _disk_raw_insert_before (PedDisk* disk, PedPartition* loc,
- PedPartition* part);
+ PedPartition* part);
static int _disk_raw_insert_after (PedDisk* disk, PedPartition* loc,
- PedPartition* part);
+ PedPartition* part);
static int _disk_raw_remove (PedDisk* disk, PedPartition* part);
static int _disk_raw_add (PedDisk* disk, PedPartition* part);
-static PedDiskType* disk_types = NULL;
+static PedDiskType* disk_types = NULL;
void
ped_disk_type_register (PedDiskType* disk_type)
@@ -77,8 +77,8 @@ ped_disk_type_register (PedDiskType* disk_type)
void
ped_disk_type_unregister (PedDiskType* disk_type)
{
- PedDiskType* walk;
- PedDiskType* last = NULL;
+ PedDiskType* walk;
+ PedDiskType* last = NULL;
PED_ASSERT (disk_types != NULL, return);
PED_ASSERT (disk_type != NULL, return);
@@ -134,7 +134,7 @@ ped_disk_type_get_next (PedDiskType* type)
PedDiskType*
ped_disk_type_get (const char* name)
{
- PedDiskType* walk = NULL;
+ PedDiskType* walk = NULL;
PED_ASSERT (name != NULL, return NULL);
@@ -154,7 +154,7 @@ ped_disk_type_get (const char* name)
PedDiskType*
ped_disk_probe (PedDevice* dev)
{
- PedDiskType* walk = NULL;
+ PedDiskType* walk = NULL;
PED_ASSERT (dev != NULL, return NULL);
@@ -188,8 +188,8 @@ ped_disk_probe (PedDevice* dev)
PedDisk*
ped_disk_new (PedDevice* dev)
{
- PedDiskType* type;
- PedDisk* disk;
+ PedDiskType* type;
+ PedDisk* disk;
PED_ASSERT (dev != NULL, return NULL);
@@ -223,8 +223,8 @@ error:
static int
_add_duplicate_part (PedDisk* disk, PedPartition* old_part)
{
- PedPartition* new_part;
- PedConstraint* constraint_exact;
+ PedPartition* new_part;
+ PedConstraint* constraint_exact;
new_part = disk->type->ops->partition_duplicate (old_part);
if (!new_part)
@@ -255,8 +255,8 @@ error:
PedDisk*
ped_disk_duplicate (const PedDisk* old_disk)
{
- PedDisk* new_disk;
- PedPartition* old_part;
+ PedDisk* new_disk;
+ PedPartition* old_part;
PED_ASSERT (old_disk != NULL, return NULL);
PED_ASSERT (!old_disk->update_mode, return NULL);
@@ -296,7 +296,7 @@ error:
int
ped_disk_clobber_exclude (PedDevice* dev, const PedDiskType* exclude)
{
- PedDiskType* walk;
+ PedDiskType* walk;
PED_ASSERT (dev != NULL, goto error);
@@ -305,7 +305,7 @@ ped_disk_clobber_exclude (PedDevice* dev, const PedDiskType* exclude)
for (walk = ped_disk_type_get_next (NULL); walk;
walk = ped_disk_type_get_next (walk)) {
- int probed;
+ int probed;
if (walk == exclude)
continue;
@@ -355,7 +355,7 @@ ped_disk_clobber (PedDevice* dev)
PedDisk*
ped_disk_new_fresh (PedDevice* dev, const PedDiskType* type)
{
- PedDisk* disk;
+ PedDisk* disk;
PED_ASSERT (dev != NULL, return NULL);
PED_ASSERT (type != NULL, return NULL);
@@ -363,7 +363,7 @@ ped_disk_new_fresh (PedDevice* dev, const PedDiskType* type)
disk = type->ops->alloc (dev);
if (!disk)
- goto error;
+ goto error;
_disk_pop_update_mode (disk);
PED_ASSERT (disk->update_mode == 0, goto error_destroy_disk);
@@ -379,7 +379,7 @@ error:
PedDisk*
_ped_disk_alloc (const PedDevice* dev, const PedDiskType* disk_type)
{
- PedDisk* disk;
+ PedDisk* disk;
disk = (PedDisk*) ped_malloc (sizeof (PedDisk));
if (!disk)
@@ -565,16 +565,16 @@ ped_partition_get_path (const PedPartition* part)
int
ped_disk_check (const PedDisk* disk)
{
- PedPartition* walk;
+ PedPartition* walk;
PED_ASSERT (disk != NULL, return 0);
for (walk = disk->part_list; walk;
walk = ped_disk_next_partition (disk, walk)) {
- const PedFileSystemType* fs_type = walk->fs_type;
- PedGeometry* geom;
- PedSector length_error;
- PedSector max_length_error;
+ const PedFileSystemType* fs_type = walk->fs_type;
+ PedGeometry* geom;
+ PedSector length_error;
+ PedSector max_length_error;
if (!ped_partition_is_active (walk) || !fs_type)
continue;
@@ -617,7 +617,7 @@ ped_disk_check (const PedDisk* disk)
*/
int
ped_disk_type_check_feature (const PedDiskType* disk_type,
- PedDiskTypeFeature feature)
+ PedDiskTypeFeature feature)
{
return (disk_type->features & feature) != 0;
}
@@ -628,8 +628,8 @@ ped_disk_type_check_feature (const PedDiskType* disk_type,
int
ped_disk_get_primary_partition_count (const PedDisk* disk)
{
- PedPartition* walk;
- int count = 0;
+ PedPartition* walk;
+ int count = 0;
PED_ASSERT (disk != NULL, return 0);
@@ -649,8 +649,8 @@ ped_disk_get_primary_partition_count (const PedDisk* disk)
int
ped_disk_get_last_partition_num (const PedDisk* disk)
{
- PedPartition* walk;
- int highest = -1;
+ PedPartition* walk;
+ int highest = -1;
PED_ASSERT (disk != NULL, return 0);
@@ -674,7 +674,7 @@ ped_disk_get_max_primary_partition_count (const PedDisk* disk)
{
PED_ASSERT (disk->type != NULL, return 0);
PED_ASSERT (disk->type->ops->get_max_primary_partition_count != NULL,
- return 0);
+ return 0);
return disk->type->ops->get_max_primary_partition_count (disk);
}
@@ -703,7 +703,7 @@ ped_disk_get_max_primary_partition_count (const PedDisk* disk)
static int
_partition_align (PedPartition* part, const PedConstraint* constraint)
{
- const PedDiskType* disk_type;
+ const PedDiskType* disk_type;
PED_ASSERT (part != NULL, return 0);
PED_ASSERT (part->num != -1, return 0);
@@ -719,7 +719,7 @@ _partition_align (PedPartition* part, const PedConstraint* constraint)
static int
_partition_enumerate (PedPartition* part)
{
- const PedDiskType* disk_type;
+ const PedDiskType* disk_type;
PED_ASSERT (part != NULL, return 0);
PED_ASSERT (part->disk != NULL, return 0);
@@ -737,9 +737,9 @@ _partition_enumerate (PedPartition* part)
static int
ped_disk_enumerate_partitions (PedDisk* disk)
{
- PedPartition* walk;
- int i;
- int end;
+ PedPartition* walk;
+ int i;
+ int end;
PED_ASSERT (disk != NULL, return 0);
@@ -771,8 +771,8 @@ ped_disk_enumerate_partitions (PedDisk* disk)
static int
_disk_remove_metadata (PedDisk* disk)
{
- PedPartition* walk = NULL;
- PedPartition* next;
+ PedPartition* walk = NULL;
+ PedPartition* next;
PED_ASSERT (disk != NULL, return 0);
@@ -805,8 +805,8 @@ _disk_alloc_metadata (PedDisk* disk)
static int
_disk_remove_freespace (PedDisk* disk)
{
- PedPartition* walk;
- PedPartition* next;
+ PedPartition* walk;
+ PedPartition* next;
walk = ped_disk_next_partition (disk, NULL);
for (; walk; walk = next) {
@@ -824,11 +824,11 @@ _disk_remove_freespace (PedDisk* disk)
static int
_alloc_extended_freespace (PedDisk* disk)
{
- PedSector last_end;
- PedPartition* walk;
- PedPartition* last;
- PedPartition* free_space;
- PedPartition* extended_part;
+ PedSector last_end;
+ PedPartition* walk;
+ PedPartition* last;
+ PedPartition* free_space;
+ PedPartition* extended_part;
extended_part = ped_disk_extended_partition (disk);
if (!extended_part)
@@ -871,10 +871,10 @@ _alloc_extended_freespace (PedDisk* disk)
static int
_disk_alloc_freespace (PedDisk* disk)
{
- PedSector last_end;
- PedPartition* walk;
- PedPartition* last;
- PedPartition* free_space;
+ PedSector last_end;
+ PedPartition* walk;
+ PedPartition* last;
+ PedPartition* free_space;
if (!_disk_remove_freespace (disk))
return 0;
@@ -972,10 +972,10 @@ _disk_pop_update_mode (PedDisk* disk)
PedPartition*
_ped_partition_alloc (const PedDisk* disk, PedPartitionType type,
- const PedFileSystemType* fs_type,
- PedSector start, PedSector end)
+ const PedFileSystemType* fs_type,
+ PedSector start, PedSector end)
{
- PedPartition* part;
+ PedPartition* part;
PED_ASSERT (disk != NULL, return 0);
@@ -1011,11 +1011,11 @@ _ped_partition_free (PedPartition* part)
int
_ped_partition_attempt_align (PedPartition* part,
- const PedConstraint* external,
- PedConstraint* internal)
+ const PedConstraint* external,
+ PedConstraint* internal)
{
- PedConstraint* intersection;
- PedGeometry* solution;
+ PedConstraint* intersection;
+ PedGeometry* solution;
intersection = ped_constraint_intersect (external, internal);
ped_constraint_destroy (internal);
@@ -1053,17 +1053,17 @@ fail:
*/
PedPartition*
ped_partition_new (const PedDisk* disk, PedPartitionType type,
- const PedFileSystemType* fs_type, PedSector start,
- PedSector end)
+ const PedFileSystemType* fs_type, PedSector start,
+ PedSector end)
{
- int supports_extended;
- PedPartition* part;
+ int supports_extended;
+ PedPartition* part;
PED_ASSERT (disk != NULL, return NULL);
PED_ASSERT (disk->type->ops->partition_new != NULL, return NULL);
supports_extended = ped_disk_type_check_feature (disk->type,
- PED_DISK_TYPE_EXTENDED);
+ PED_DISK_TYPE_EXTENDED);
if (!supports_extended
&& (type == PED_PARTITION_EXTENDED
@@ -1146,7 +1146,7 @@ ped_partition_is_active (const PedPartition* part)
int
ped_partition_set_flag (PedPartition* part, PedPartitionFlag flag, int state)
{
- PedDiskOps* ops;
+ PedDiskOps* ops;
PED_ASSERT (part != NULL, return 0);
PED_ASSERT (part->disk != NULL, return 0);
@@ -1182,7 +1182,7 @@ ped_partition_get_flag (const PedPartition* part, PedPartitionFlag flag)
PED_ASSERT (part != NULL, return 0);
PED_ASSERT (part->disk != NULL, return 0);
PED_ASSERT (part->disk->type->ops->partition_get_flag != NULL,
- return 0);
+ return 0);
PED_ASSERT (ped_partition_is_active (part), return 0);
return part->disk->type->ops->partition_get_flag (part, flag);
@@ -1195,12 +1195,12 @@ ped_partition_get_flag (const PedPartition* part, PedPartitionFlag flag)
*/
int
ped_partition_is_flag_available (const PedPartition* part,
- PedPartitionFlag flag)
+ PedPartitionFlag flag)
{
PED_ASSERT (part != NULL, return 0);
PED_ASSERT (part->disk != NULL, return 0);
PED_ASSERT (part->disk->type->ops->partition_is_flag_available != NULL,
- return 0);
+ return 0);
PED_ASSERT (ped_partition_is_active (part), return 0);
return part->disk->type->ops->partition_is_flag_available (part, flag);
@@ -1217,7 +1217,7 @@ ped_partition_is_flag_available (const PedPartition* part,
int
ped_partition_set_system (PedPartition* part, const PedFileSystemType* fs_type)
{
- const PedDiskType* disk_type;
+ const PedDiskType* disk_type;
PED_ASSERT (part != NULL, return 0);
PED_ASSERT (ped_partition_is_active (part), return 0);
@@ -1272,7 +1272,7 @@ ped_partition_set_name (PedPartition* part, const char* name)
return 0;
PED_ASSERT (part->disk->type->ops->partition_set_name != NULL,
- return 0);
+ return 0);
part->disk->type->ops->partition_set_name (part, name);
return 1;
}
@@ -1282,7 +1282,7 @@ ped_partition_set_name (PedPartition* part, const char* name)
* label supports it.
*
* \note The returned string should not be modified. It should
- * not be referenced after the partition is destroyed.
+ * not be referenced after the partition is destroyed.
*/
const char*
ped_partition_get_name (const PedPartition* part)
@@ -1295,7 +1295,7 @@ ped_partition_get_name (const PedPartition* part)
return NULL;
PED_ASSERT (part->disk->type->ops->partition_get_name != NULL,
- return NULL);
+ return NULL);
return part->disk->type->ops->partition_get_name (part);
}
@@ -1310,7 +1310,7 @@ ped_partition_get_name (const PedPartition* part)
PedPartition*
ped_disk_extended_partition (const PedDisk* disk)
{
- PedPartition* walk;
+ PedPartition* walk;
PED_ASSERT (disk != NULL, return 0);
@@ -1352,7 +1352,7 @@ ped_disk_next_partition (const PedDisk* disk, const PedPartition* part)
static int
_disk_check_sanity (PedDisk* disk)
{
- PedPartition* walk;
+ PedPartition* walk;
PED_ASSERT (disk != NULL, return 0);
@@ -1382,7 +1382,7 @@ _disk_check_sanity (PedDisk* disk)
PedPartition*
ped_disk_get_partition (const PedDisk* disk, int num)
{
- PedPartition* walk;
+ PedPartition* walk;
PED_ASSERT (disk != NULL, return 0);
@@ -1403,7 +1403,7 @@ ped_disk_get_partition (const PedDisk* disk, int num)
PedPartition*
ped_disk_get_partition_by_sector (const PedDisk* disk, PedSector sect)
{
- PedPartition* walk;
+ PedPartition* walk;
PED_ASSERT (disk != NULL, return 0);
@@ -1490,9 +1490,9 @@ _disk_raw_remove (PedDisk* disk, PedPartition* part)
static int
_disk_raw_add (PedDisk* disk, PedPartition* part)
{
- PedPartition* walk;
- PedPartition* last;
- PedPartition* ext_part;
+ PedPartition* walk;
+ PedPartition* last;
+ PedPartition* ext_part;
PED_ASSERT (disk->update_mode, return 0);
@@ -1526,10 +1526,10 @@ _disk_raw_add (PedDisk* disk, PedPartition* part)
static PedConstraint*
_partition_get_overlap_constraint (PedPartition* part, PedGeometry* geom)
{
- PedSector min_start;
- PedSector max_end;
- PedPartition* walk;
- PedGeometry free_space;
+ PedSector min_start;
+ PedSector max_end;
+ PedPartition* walk;
+ PedGeometry free_space;
PED_ASSERT (part->disk->update_mode, return NULL);
PED_ASSERT (part->geom.dev == geom->dev, return NULL);
@@ -1567,7 +1567,7 @@ _partition_get_overlap_constraint (PedPartition* part, PedGeometry* geom)
return NULL;
ped_geometry_init (&free_space, part->disk->dev,
- min_start, max_end - min_start + 1);
+ min_start, max_end - min_start + 1);
return ped_constraint_new_from_max (&free_space);
}
@@ -1585,7 +1585,7 @@ _partition_get_overlap_constraint (PedPartition* part, PedGeometry* geom)
static int
_disk_check_part_overlaps (PedDisk* disk, PedPartition* part)
{
- PedPartition* walk;
+ PedPartition* walk;
PED_ASSERT (disk != NULL, return 0);
PED_ASSERT (part != NULL, return 0);
@@ -1604,7 +1604,7 @@ _disk_check_part_overlaps (PedDisk* disk, PedPartition* part)
if (walk->type & PED_PARTITION_EXTENDED
&& part->type & PED_PARTITION_LOGICAL
&& ped_geometry_test_inside (&walk->geom,
- &part->geom))
+ &part->geom))
continue;
return 0;
}
@@ -1616,7 +1616,7 @@ _disk_check_part_overlaps (PedDisk* disk, PedPartition* part)
static int
_partition_check_basic_sanity (PedDisk* disk, PedPartition* part)
{
- PedPartition* ext_part = ped_disk_extended_partition (disk);
+ PedPartition* ext_part = ped_disk_extended_partition (disk);
PED_ASSERT (part->disk == disk, return 0);
@@ -1664,8 +1664,8 @@ _partition_check_basic_sanity (PedDisk* disk, PedPartition* part)
static int
_check_extended_partition (PedDisk* disk, PedPartition* part)
{
- PedPartition* walk;
- PedPartition* ext_part;
+ PedPartition* walk;
+ PedPartition* ext_part;
PED_ASSERT (disk != NULL, return 0);
ext_part = ped_disk_extended_partition (disk);
@@ -1697,7 +1697,7 @@ _check_extended_partition (PedDisk* disk, PedPartition* part)
static int
_check_partition (PedDisk* disk, PedPartition* part)
{
- PedPartition* ext_part = ped_disk_extended_partition (disk);
+ PedPartition* ext_part = ped_disk_extended_partition (disk);
PED_ASSERT (part->geom.start <= part->geom.end, return 0);
@@ -1752,10 +1752,10 @@ _check_partition (PedDisk* disk, PedPartition* part)
*/
int
ped_disk_add_partition (PedDisk* disk, PedPartition* part,
- const PedConstraint* constraint)
+ const PedConstraint* constraint)
{
- PedConstraint* overlap_constraint = NULL;
- PedConstraint* constraints = NULL;
+ PedConstraint* overlap_constraint = NULL;
+ PedConstraint* constraints = NULL;
PED_ASSERT (disk != NULL, return 0);
PED_ASSERT (part != NULL, return 0);
@@ -1769,7 +1769,7 @@ ped_disk_add_partition (PedDisk* disk, PedPartition* part,
overlap_constraint
= _partition_get_overlap_constraint (part, &part->geom);
constraints = ped_constraint_intersect (overlap_constraint,
- constraint);
+ constraint);
if (!constraints && constraint) {
ped_exception_throw (
@@ -1859,9 +1859,9 @@ ped_disk_delete_partition (PedDisk* disk, PedPartition* part)
static int
ped_disk_delete_all_logical (PedDisk* disk)
{
- PedPartition* walk;
- PedPartition* next;
- PedPartition* ext_part;
+ PedPartition* walk;
+ PedPartition* next;
+ PedPartition* ext_part;
PED_ASSERT (disk != NULL, return 0);
ext_part = ped_disk_extended_partition (disk);
@@ -1884,8 +1884,8 @@ ped_disk_delete_all_logical (PedDisk* disk)
int
ped_disk_delete_all (PedDisk* disk)
{
- PedPartition* walk;
- PedPartition* next;
+ PedPartition* walk;
+ PedPartition* next;
PED_ASSERT (disk != NULL, return 0);
@@ -1917,13 +1917,13 @@ ped_disk_delete_all (PedDisk* disk)
*/
int
ped_disk_set_partition_geom (PedDisk* disk, PedPartition* part,
- const PedConstraint* constraint,
- PedSector start, PedSector end)
+ const PedConstraint* constraint,
+ PedSector start, PedSector end)
{
- PedConstraint* overlap_constraint = NULL;
- PedConstraint* constraints = NULL;
- PedGeometry old_geom;
- PedGeometry new_geom;
+ PedConstraint* overlap_constraint = NULL;
+ PedConstraint* constraints = NULL;
+ PedGeometry old_geom;
+ PedGeometry new_geom;
PED_ASSERT (disk != NULL, return 0);
PED_ASSERT (part != NULL, return 0);
@@ -1977,15 +1977,15 @@ error_pop_update_mode:
*/
int
ped_disk_maximize_partition (PedDisk* disk, PedPartition* part,
- const PedConstraint* constraint)
+ const PedConstraint* constraint)
{
- PedGeometry old_geom;
- PedSector global_min_start;
- PedSector global_max_end;
- PedSector new_start;
- PedSector new_end;
- PedPartition* ext_part = ped_disk_extended_partition (disk);
- PedConstraint* constraint_any;
+ PedGeometry old_geom;
+ PedSector global_min_start;
+ PedSector global_max_end;
+ PedSector new_start;
+ PedSector new_end;
+ PedPartition* ext_part = ped_disk_extended_partition (disk);
+ PedConstraint* constraint_any;
PED_ASSERT (disk != NULL, return 0);
PED_ASSERT (part != NULL, return 0);
@@ -2014,7 +2014,7 @@ ped_disk_maximize_partition (PedDisk* disk, PedPartition* part,
new_end = global_max_end;
if (!ped_disk_set_partition_geom (disk, part, constraint, new_start,
- new_end))
+ new_end))
goto error;
_disk_pop_update_mode (disk);
@@ -2023,7 +2023,7 @@ ped_disk_maximize_partition (PedDisk* disk, PedPartition* part,
error:
constraint_any = ped_constraint_any (disk->dev);
ped_disk_set_partition_geom (disk, part, constraint_any,
- old_geom.start, old_geom.end);
+ old_geom.start, old_geom.end);
ped_constraint_destroy (constraint_any);
_disk_pop_update_mode (disk);
return 0;
@@ -2037,11 +2037,11 @@ error:
*/
PedGeometry*
ped_disk_get_max_partition_geometry (PedDisk* disk, PedPartition* part,
- const PedConstraint* constraint)
+ const PedConstraint* constraint)
{
- PedGeometry old_geom;
- PedGeometry* max_geom;
- PedConstraint* constraint_exact;
+ PedGeometry old_geom;
+ PedGeometry* max_geom;
+ PedConstraint* constraint_exact;
PED_ASSERT(disk != NULL, return NULL);
PED_ASSERT(part != NULL, return NULL);
@@ -2054,14 +2054,14 @@ ped_disk_get_max_partition_geometry (PedDisk* disk, PedPartition* part,
constraint_exact = ped_constraint_exact (&old_geom);
ped_disk_set_partition_geom (disk, part, constraint_exact,
- old_geom.start, old_geom.end);
+ old_geom.start, old_geom.end);
ped_constraint_destroy (constraint_exact);
/* this assertion should never fail, because the old
* geometry was valid
*/
PED_ASSERT (ped_geometry_test_equal (&part->geom, &old_geom),
- return NULL);
+ return NULL);
return max_geom;
}
@@ -2076,12 +2076,12 @@ ped_disk_get_max_partition_geometry (PedDisk* disk, PedPartition* part,
int
ped_disk_minimize_extended_partition (PedDisk* disk)
{
- PedPartition* first_logical;
- PedPartition* last_logical;
- PedPartition* walk;
- PedPartition* ext_part;
- PedConstraint* constraint;
- int status;
+ PedPartition* first_logical;
+ PedPartition* last_logical;
+ PedPartition* walk;
+ PedPartition* ext_part;
+ PedConstraint* constraint;
+ int status;
PED_ASSERT (disk != NULL, return 0);
@@ -2102,8 +2102,8 @@ ped_disk_minimize_extended_partition (PedDisk* disk)
constraint = ped_constraint_any (disk->dev);
status = ped_disk_set_partition_geom (disk, ext_part, constraint,
- first_logical->geom.start,
- last_logical->geom.end);
+ first_logical->geom.start,
+ last_logical->geom.end);
ped_constraint_destroy (constraint);
_disk_pop_update_mode (disk);
@@ -2214,11 +2214,11 @@ ped_partition_flag_next (PedPartitionFlag flag)
PedPartitionFlag
ped_partition_flag_get_by_name (const char* name)
{
- PedPartitionFlag flag;
- const char* flag_name;
+ PedPartitionFlag flag;
+ const char* flag_name;
for (flag = ped_partition_flag_next (0); flag;
- flag = ped_partition_flag_next (flag)) {
+ flag = ped_partition_flag_next (flag)) {
flag_name = ped_partition_flag_get_name (flag);
if (strcasecmp (name, flag_name) == 0
|| strcasecmp (name, _(flag_name)) == 0)
@@ -2253,7 +2253,7 @@ ped_partition_print (const PedPartition* part)
void
ped_disk_print (const PedDisk* disk)
{
- PedPartition* part;
+ PedPartition* part;
PED_ASSERT (disk != NULL, return);
diff --git a/libparted/exception.c b/libparted/exception.c
index d109209..d513590 100644
--- a/libparted/exception.c
+++ b/libparted/exception.c
@@ -66,15 +66,15 @@
#include <stdarg.h>
#include <stdlib.h>
-int ped_exception = 0;
+int ped_exception = 0;
static PedExceptionOption default_handler (PedException* ex);
-static PedExceptionHandler* ex_handler = default_handler;
-static PedException* ex = NULL;
-static int ex_fetch_count = 0;
+static PedExceptionHandler* ex_handler = default_handler;
+static PedException* ex = NULL;
+static int ex_fetch_count = 0;
-static char* type_strings [] = {
+static char* type_strings [] = {
N_("Information"),
N_("Warning"),
N_("Error"),
@@ -83,7 +83,7 @@ static char* type_strings [] = {
N_("No Implementation")
};
-static char* option_strings [] = {
+static char* option_strings [] = {
N_("Fix"),
N_("Yes"),
N_("No"),
@@ -109,7 +109,7 @@ ped_log2 (int n)
{
int x;
- PED_ASSERT (n > 0, return -1);
+ PED_ASSERT (n > 0, return -1);
for (x=0; 1 << x <= n; x++);
@@ -141,7 +141,7 @@ default_handler (PedException* e)
VERSION);
else
fprintf (stderr, "%s: ",
- ped_exception_get_type_string (e->type));
+ ped_exception_get_type_string (e->type));
fprintf (stderr, "%s\n", e->message);
switch (e->options) {
@@ -199,7 +199,7 @@ ped_exception_catch ()
static PedExceptionOption
do_throw ()
{
- PedExceptionOption ex_opt;
+ PedExceptionOption ex_opt;
ped_exception = 1;
@@ -228,9 +228,9 @@ do_throw ()
*/
PedExceptionOption
ped_exception_throw (PedExceptionType ex_type,
- PedExceptionOption ex_opts, const char* message, ...)
+ PedExceptionOption ex_opts, const char* message, ...)
{
- va_list arg_list;
+ va_list arg_list;
int result;
static int size = 1000;
@@ -245,18 +245,18 @@ ped_exception_throw (PedExceptionType ex_type,
ex->options = ex_opts;
while (1) {
- ex->message = (char*) malloc (size);
- if (!ex->message)
- goto no_memory;
+ ex->message = (char*) malloc (size);
+ if (!ex->message)
+ goto no_memory;
- va_start (arg_list, message);
- result = vsnprintf (ex->message, size, message, arg_list);
- va_end (arg_list);
+ va_start (arg_list, message);
+ result = vsnprintf (ex->message, size, message, arg_list);
+ va_end (arg_list);
- if (result > -1 && result < size)
- break;
+ if (result > -1 && result < size)
+ break;
- size += 10;
+ size += 10;
}
return do_throw ();
diff --git a/libparted/filesys.c b/libparted/filesys.c
index cef277c..87166ff 100644
--- a/libparted/filesys.c
+++ b/libparted/filesys.c
@@ -39,9 +39,9 @@
# define _(String) (String)
#endif /* ENABLE_NLS */
-#define BUFFER_SIZE 4096 /* in sectors */
+#define BUFFER_SIZE 4096 /* in sectors */
-static PedFileSystemType* fs_types = NULL;
+static PedFileSystemType* fs_types = NULL;
void
ped_file_system_type_register (PedFileSystemType* fs_type)
@@ -49,7 +49,7 @@ ped_file_system_type_register (PedFileSystemType* fs_type)
PED_ASSERT (fs_type != NULL, return);
PED_ASSERT (fs_type->ops != NULL, return);
PED_ASSERT (fs_type->name != NULL, return);
-
+
/* pretend that "next" isn't part of the struct :-) */
((struct _PedFileSystemType*) fs_type)->next = fs_types;
fs_types = (struct _PedFileSystemType*) fs_type;
@@ -58,20 +58,20 @@ ped_file_system_type_register (PedFileSystemType* fs_type)
void
ped_file_system_type_unregister (PedFileSystemType* fs_type)
{
- PedFileSystemType* walk;
- PedFileSystemType* last = NULL;
+ PedFileSystemType* walk;
+ PedFileSystemType* last = NULL;
PED_ASSERT (fs_types != NULL, return);
PED_ASSERT (fs_type != NULL, return);
for (walk = fs_types; walk && walk != fs_type;
- last = walk, walk = walk->next);
+ last = walk, walk = walk->next);
PED_ASSERT (walk != NULL, return);
if (last)
((struct _PedFileSystemType*) last)->next = fs_type->next;
else
- fs_types = fs_type->next;
+ fs_types = fs_type->next;
}
/**
@@ -82,7 +82,7 @@ ped_file_system_type_unregister (PedFileSystemType* fs_type)
PedFileSystemType*
ped_file_system_type_get (const char* name)
{
- PedFileSystemType* walk;
+ PedFileSystemType* walk;
PED_ASSERT (name != NULL, return NULL);
@@ -119,7 +119,7 @@ PedGeometry*
ped_file_system_probe_specific (
const PedFileSystemType* fs_type, PedGeometry* geom)
{
- PedGeometry* result;
+ PedGeometry* result;
PED_ASSERT (fs_type != NULL, return NULL);
PED_ASSERT (fs_type->ops->probe != NULL, return NULL);
@@ -135,7 +135,7 @@ ped_file_system_probe_specific (
static int
_test_open (PedFileSystemType* fs_type, PedGeometry* geom)
{
- PedFileSystem* fs;
+ PedFileSystem* fs;
ped_exception_fetch_all ();
fs = fs_type->ops->open (geom);
@@ -149,10 +149,10 @@ _test_open (PedFileSystemType* fs_type, PedGeometry* geom)
static PedFileSystemType*
_probe_with_open (PedGeometry* geom, int detected_count,
- PedFileSystemType* detected[])
+ PedFileSystemType* detected[])
{
- int i;
- PedFileSystemType* open_detected = NULL;
+ int i;
+ PedFileSystemType* open_detected = NULL;
ped_device_open (geom->dev);
@@ -186,7 +186,7 @@ _probe_with_open (PedGeometry* geom, int detected_count,
} else {
open_detected = detected [i];
}
- }
+ }
ped_device_close (geom->dev);
return open_detected;
@@ -195,19 +195,19 @@ _probe_with_open (PedGeometry* geom, int detected_count,
static int
_geometry_error (const PedGeometry* a, const PedGeometry* b)
{
- PedSector start_delta = a->start - b->start;
- PedSector end_delta = a->end - b->end;
+ PedSector start_delta = a->start - b->start;
+ PedSector end_delta = a->end - b->end;
return abs (start_delta) + abs (end_delta);
}
static PedFileSystemType*
_best_match (const PedGeometry* geom, PedFileSystemType* detected [],
- const int detected_error [], int detected_count)
+ const int detected_error [], int detected_count)
{
- int best_match = 0;
- int i;
- PedSector min_error;
+ int best_match = 0;
+ int i;
+ PedSector min_error;
min_error = PED_MAX (4096, geom->length / 100);
@@ -243,10 +243,10 @@ _best_match (const PedGeometry* geom, PedFileSystemType* detected [],
PedFileSystemType*
ped_file_system_probe (PedGeometry* geom)
{
- PedFileSystemType* detected[32];
- int detected_error[32];
- int detected_count = 0;
- PedFileSystemType* walk = NULL;
+ PedFileSystemType* detected[32];
+ int detected_error[32];
+ int detected_count = 0;
+ PedFileSystemType* walk = NULL;
PED_ASSERT (geom != NULL, return NULL);
@@ -255,7 +255,7 @@ ped_file_system_probe (PedGeometry* geom)
ped_exception_fetch_all ();
while ( (walk = ped_file_system_type_get_next (walk)) ) {
- PedGeometry* probed;
+ PedGeometry* probed;
probed = ped_file_system_probe_specific (walk, geom);
if (probed) {
@@ -292,7 +292,7 @@ ped_file_system_probe (PedGeometry* geom)
int
ped_file_system_clobber (PedGeometry* geom)
{
- PedFileSystemType* fs_type = NULL;
+ PedFileSystemType* fs_type = NULL;
PED_ASSERT (geom != NULL, return 0);
@@ -301,7 +301,7 @@ ped_file_system_clobber (PedGeometry* geom)
ped_exception_fetch_all ();
while ((fs_type = ped_file_system_type_get_next (fs_type))) {
- PedGeometry* probed;
+ PedGeometry* probed;
if (!fs_type->ops->clobber)
continue;
@@ -334,7 +334,7 @@ error:
*/
static int
ped_file_system_clobber_exclude (PedGeometry* geom,
- const PedGeometry* exclude)
+ const PedGeometry* exclude)
{
PedGeometry* clobber_geom;
int status;
@@ -369,9 +369,9 @@ ped_file_system_clobber_exclude (PedGeometry* geom,
PedFileSystem*
ped_file_system_open (PedGeometry* geom)
{
- PedFileSystemType* type;
- PedFileSystem* fs;
- PedGeometry* probed_geom;
+ PedFileSystemType* type;
+ PedFileSystem* fs;
+ PedGeometry* probed_geom;
PED_ASSERT (geom != NULL, return NULL);
@@ -381,7 +381,7 @@ ped_file_system_open (PedGeometry* geom)
type = ped_file_system_probe (geom);
if (!type) {
ped_exception_throw (PED_EXCEPTION_ERROR, PED_EXCEPTION_CANCEL,
- _("Could not detect file system."));
+ _("Could not detect file system."));
goto error_close_dev;
}
@@ -399,10 +399,10 @@ ped_file_system_open (PedGeometry* geom)
if (!type->ops->open) {
ped_exception_throw (PED_EXCEPTION_NO_FEATURE,
- PED_EXCEPTION_CANCEL,
- _("Support for opening %s file systems "
- "is not implemented yet."),
- type->name);
+ PED_EXCEPTION_CANCEL,
+ _("Support for opening %s file systems "
+ "is not implemented yet."),
+ type->name);
goto error_destroy_probed_geom;
}
@@ -426,25 +426,25 @@ error:
* signatures. If \p timer is non-NULL, it is used as the progress meter.
*
* \throws PED_EXCEPTION_NO_FEATURE if creating file system type \p type
- * is not implemented yet
+ * is not implemented yet
*
* \return a PedFileSystem on success, \c NULL on failure
*/
PedFileSystem*
ped_file_system_create (PedGeometry* geom, const PedFileSystemType* type,
- PedTimer* timer)
+ PedTimer* timer)
{
- PedFileSystem* fs;
+ PedFileSystem* fs;
PED_ASSERT (geom != NULL, return NULL);
PED_ASSERT (type != NULL, return NULL);
if (!type->ops->create) {
ped_exception_throw (PED_EXCEPTION_NO_FEATURE,
- PED_EXCEPTION_CANCEL,
- _("Support for creating %s file systems "
- "is not implemented yet."),
- type->name);
+ PED_EXCEPTION_CANCEL,
+ _("Support for creating %s file systems "
+ "is not implemented yet."),
+ type->name);
goto error;
}
@@ -472,7 +472,7 @@ error:
int
ped_file_system_close (PedFileSystem* fs)
{
- PedDevice* dev = fs->geom->dev;
+ PedDevice* dev = fs->geom->dev;
PED_ASSERT (fs != NULL, goto error_close_dev);
@@ -490,7 +490,7 @@ error_close_dev:
* Check \p fs file system for errors.
*
* \throws PED_EXCEPTION_NO_FEATURE if checking file system \p fs is
- * not implemented yet
+ * not implemented yet
*
* \return \c 0 on failure (i.e. unfixed errors)
*/
@@ -501,10 +501,10 @@ ped_file_system_check (PedFileSystem* fs, PedTimer* timer)
if (!fs->type->ops->check) {
ped_exception_throw (PED_EXCEPTION_NO_FEATURE,
- PED_EXCEPTION_CANCEL,
- _("Support for checking %s file systems "
- "is not implemented yet."),
- fs->type->name);
+ PED_EXCEPTION_CANCEL,
+ _("Support for checking %s file systems "
+ "is not implemented yet."),
+ fs->type->name);
return 0;
}
return fs->type->ops->check (fs, timer);
@@ -513,14 +513,14 @@ ped_file_system_check (PedFileSystem* fs, PedTimer* timer)
static int
_raw_copy (const PedGeometry* src, PedGeometry* dest, PedTimer* timer)
{
- char* buf;
- PedSector pos;
+ char* buf;
+ PedSector pos;
PED_ASSERT (src != NULL, goto error);
PED_ASSERT (dest != NULL, goto error);
PED_ASSERT (src->length <= dest->length, goto error);
- buf = ped_malloc (BUFFER_SIZE * 512); /* FIXME */
+ buf = ped_malloc (BUFFER_SIZE * 512); /* FIXME */
if (!buf)
goto error;
@@ -562,10 +562,10 @@ error:
static PedFileSystem*
_raw_copy_and_resize (const PedFileSystem* fs, PedGeometry* geom,
- PedTimer* timer)
+ PedTimer* timer)
{
- PedFileSystem* new_fs;
- PedTimer* sub_timer = NULL;
+ PedFileSystem* new_fs;
+ PedTimer* sub_timer = NULL;
ped_timer_reset (timer);
ped_timer_set_state_name (timer, _("raw block copying"));
@@ -601,7 +601,7 @@ error:
*
* \throws PED_EXCEPTION_ERROR when trying to copy onto an overlapping partition
* \throws PED_EXCEPTION_NO_FEATURE if copying of file system \p fs
- * is not implemented yet
+ * is not implemented yet
*
* \return a new PedFileSystem on success, \c NULL on failure
*/
@@ -637,7 +637,7 @@ ped_file_system_copy (PedFileSystem* fs, PedGeometry* geom, PedTimer* timer)
return _raw_copy_and_resize (
fs, (PedGeometry*) geom,
timer);
-
+
ped_exception_throw (
PED_EXCEPTION_NO_FEATURE,
PED_EXCEPTION_CANCEL,
@@ -680,7 +680,7 @@ error:
* to fail ;) If \p timer is non-NULL, it is used as the progress meter.
*
* \throws PED_EXCEPTION_NO_FEATURE if resizing of file system \p fs
- * is not implemented yet
+ * is not implemented yet
*
* \return \c 0 on failure
*/
@@ -692,10 +692,10 @@ ped_file_system_resize (PedFileSystem* fs, PedGeometry* geom, PedTimer* timer)
if (!fs->type->ops->resize) {
ped_exception_throw (PED_EXCEPTION_NO_FEATURE,
- PED_EXCEPTION_CANCEL,
- _("Support for resizing %s file systems "
- "is not implemented yet."),
- fs->type->name);
+ PED_EXCEPTION_CANCEL,
+ _("Support for resizing %s file systems "
+ "is not implemented yet."),
+ fs->type->name);
return 0;
}
if (!fs->checked && fs->type->ops->check) {
@@ -718,7 +718,7 @@ ped_file_system_resize (PedFileSystem* fs, PedGeometry* geom, PedTimer* timer)
*/
PedConstraint*
ped_file_system_get_create_constraint (const PedFileSystemType* fs_type,
- const PedDevice* dev)
+ const PedDevice* dev)
{
PED_ASSERT (fs_type != NULL, return NULL);
PED_ASSERT (dev != NULL, return NULL);
@@ -758,9 +758,9 @@ ped_file_system_get_resize_constraint (const PedFileSystem* fs)
*/
PedConstraint*
ped_file_system_get_copy_constraint (const PedFileSystem* fs,
- const PedDevice* dev)
+ const PedDevice* dev)
{
- PedGeometry full_dev;
+ PedGeometry full_dev;
PED_ASSERT (fs != NULL, return NULL);
PED_ASSERT (dev != NULL, return NULL);
diff --git a/libparted/libparted.c b/libparted/libparted.c
index b1a6201..a7bda6e 100644
--- a/libparted/libparted.c
+++ b/libparted/libparted.c
@@ -48,25 +48,25 @@ const PedArchitecture* ped_architecture;
*/
typedef struct
{
- void* pointer;
- size_t size;
+ void* pointer;
+ size_t size;
} pointer_size_type;
#ifdef DEBUG
static pointer_size_type dodgy_malloc_list[] = {
- {0, 0},
- {0, 0},
- {0, 0},
- {0, 0},
- {0, 0},
- {0, 0},
- {0, 0},
- {0, 0},
- {0, 0},
- {0, 0}
+ {0, 0},
+ {0, 0},
+ {0, 0},
+ {0, 0},
+ {0, 0},
+ {0, 0},
+ {0, 0},
+ {0, 0},
+ {0, 0},
+ {0, 0}
};
-static int dodgy_memory_active[100];
+static int dodgy_memory_active[100];
#endif /* DEBUG */
int
@@ -93,7 +93,7 @@ extern void ped_disk_dasd_init ();
static void
init_disk_types ()
{
- ped_disk_loop_init (); /* must be last in the probe list */
+ ped_disk_loop_init (); /* must be last in the probe list */
#if defined(__s390__) || defined(__s390x__)
ped_disk_dasd_init();
@@ -253,11 +253,11 @@ ped_get_version ()
static void
_check_dodgy_pointer (const void* ptr, size_t size, int is_malloc)
{
- int i;
+ int i;
for (i=0; dodgy_malloc_list[i].pointer; i++) {
if (dodgy_malloc_list[i].pointer != ptr)
- continue;
+ continue;
if (is_malloc && dodgy_malloc_list[i].size != size)
continue;
if (!is_malloc && !dodgy_memory_active[i])
@@ -288,12 +288,12 @@ _check_dodgy_pointer (const void* ptr, size_t size, int is_malloc)
void*
ped_malloc (size_t size)
{
- void* mem;
+ void* mem;
mem = (void*) malloc (size);
if (!mem) {
ped_exception_throw (PED_EXCEPTION_FATAL, PED_EXCEPTION_CANCEL,
- _("Out of memory."));
+ _("Out of memory."));
return NULL;
}
@@ -308,12 +308,12 @@ ped_malloc (size_t size)
int
ped_realloc (void** old, size_t size)
{
- void* mem;
+ void* mem;
mem = (void*) realloc (*old, size);
if (!mem) {
ped_exception_throw (PED_EXCEPTION_FATAL, PED_EXCEPTION_CANCEL,
- _("Out of memory."));
+ _("Out of memory."));
return 0;
}
*old = mem;
diff --git a/libparted/timer.c b/libparted/timer.c
index e315273..bb479e2 100644
--- a/libparted/timer.c
+++ b/libparted/timer.c
@@ -47,12 +47,12 @@
#include <parted/parted.h>
#include <parted/debug.h>
-#define PED_TIMER_START_DELAY 2
+#define PED_TIMER_START_DELAY 2
typedef struct {
- PedTimer* parent;
- float nest_frac;
- float start_frac;
+ PedTimer* parent;
+ float nest_frac;
+ float start_frac;
} NestedContext;
@@ -67,7 +67,7 @@ typedef struct {
PedTimer*
ped_timer_new (PedTimerHandler* handler, void* context)
{
- PedTimer* timer;
+ PedTimer* timer;
PED_ASSERT (handler != NULL, return NULL);
@@ -100,7 +100,7 @@ ped_timer_destroy (PedTimer* timer)
static void
_nest_handler (PedTimer* timer, void* context)
{
- NestedContext* ncontext = (NestedContext*) context;
+ NestedContext* ncontext = (NestedContext*) context;
ped_timer_update (
ncontext->parent,
@@ -125,7 +125,7 @@ _nest_handler (PedTimer* timer, void* context)
PedTimer*
ped_timer_new_nested (PedTimer* parent, float nest_frac)
{
- NestedContext* context;
+ NestedContext* context;
if (!parent)
return NULL;
@@ -160,7 +160,7 @@ ped_timer_destroy_nested (PedTimer* timer)
* \internal
*
* \brief This function calls the update handler, making sure that it has
- * the latest time.
+ * the latest time.
*
* First it updates \p timer->now and recomputes \p timer->predicted_end,
* and then calls the handler.
@@ -169,7 +169,7 @@ void
ped_timer_touch (PedTimer* timer)
{
if (!timer)
- return;
+ return;
timer->now = time (NULL);
if (timer->now > timer->predicted_end)
@@ -190,7 +190,7 @@ void
ped_timer_reset (PedTimer* timer)
{
if (!timer)
- return;
+ return;
timer->start = timer->now = timer->predicted_end = time (NULL);
timer->state_name = NULL;
@@ -211,7 +211,7 @@ void
ped_timer_update (PedTimer* timer, float frac)
{
if (!timer)
- return;
+ return;
timer->now = time (NULL);
timer->frac = frac;
@@ -228,8 +228,8 @@ ped_timer_update (PedTimer* timer, float frac)
* \internal
*
* \brief This function changes the description of the current task that the
- * \p timer describes.
- *
+ * \p timer describes.
+ *
* Sets a new name - \p state_name - for the current "phase" of the operation,
* and calls ped_timer_touch().
*/
@@ -237,7 +237,7 @@ void
ped_timer_set_state_name (PedTimer* timer, const char* state_name)
{
if (!timer)
- return;
+ return;
timer->state_name = state_name;
ped_timer_touch (timer);
diff --git a/libparted/unit.c b/libparted/unit.c
index 4810246..ca3b7b3 100644
--- a/libparted/unit.c
+++ b/libparted/unit.c
@@ -40,7 +40,7 @@
*
* sectors, bytes, kilobytes, megabytes, gigabytes, terabytes, compact,
* cylinder and percent.
- *
+ *
* PedUnit has a global variable that contains the default unit for all
* conversions.
*
@@ -117,18 +117,18 @@ ped_unit_get_size (const PedDevice* dev, PedUnit unit)
PedSector cyl_size = dev->bios_geom.heads * dev->bios_geom.sectors;
switch (unit) {
- case PED_UNIT_SECTOR: return dev->sector_size;
- case PED_UNIT_BYTE: return 1;
- case PED_UNIT_KILOBYTE: return PED_KILOBYTE_SIZE;
- case PED_UNIT_MEGABYTE: return PED_MEGABYTE_SIZE;
- case PED_UNIT_GIGABYTE: return PED_GIGABYTE_SIZE;
- case PED_UNIT_TERABYTE: return PED_TERABYTE_SIZE;
- case PED_UNIT_KIBIBYTE: return PED_KIBIBYTE_SIZE;
- case PED_UNIT_MEBIBYTE: return PED_MEBIBYTE_SIZE;
- case PED_UNIT_GIBIBYTE: return PED_GIBIBYTE_SIZE;
- case PED_UNIT_TEBIBYTE: return PED_TEBIBYTE_SIZE;
- case PED_UNIT_CYLINDER: return cyl_size * dev->sector_size;
- case PED_UNIT_CHS: return dev->sector_size;
+ case PED_UNIT_SECTOR: return dev->sector_size;
+ case PED_UNIT_BYTE: return 1;
+ case PED_UNIT_KILOBYTE: return PED_KILOBYTE_SIZE;
+ case PED_UNIT_MEGABYTE: return PED_MEGABYTE_SIZE;
+ case PED_UNIT_GIGABYTE: return PED_GIGABYTE_SIZE;
+ case PED_UNIT_TERABYTE: return PED_TERABYTE_SIZE;
+ case PED_UNIT_KIBIBYTE: return PED_KIBIBYTE_SIZE;
+ case PED_UNIT_MEBIBYTE: return PED_MEBIBYTE_SIZE;
+ case PED_UNIT_GIBIBYTE: return PED_GIBIBYTE_SIZE;
+ case PED_UNIT_TEBIBYTE: return PED_TEBIBYTE_SIZE;
+ case PED_UNIT_CYLINDER: return cyl_size * dev->sector_size;
+ case PED_UNIT_CHS: return dev->sector_size;
case PED_UNIT_PERCENT:
return dev->length * dev->sector_size / 100;
@@ -200,14 +200,14 @@ ped_unit_format_custom_byte (const PedDevice* dev, PedSector byte, PedUnit unit)
int p;
PED_ASSERT (dev != NULL, return NULL);
-
+
/* CHS has a special comma-separated format. */
if (unit == PED_UNIT_CHS) {
const PedCHSGeometry *chs = &dev->bios_geom;
snprintf (buf, 100, "%lld,%lld,%lld",
- sector / chs->sectors / chs->heads,
- (sector / chs->sectors) % chs->heads,
- sector % chs->sectors);
+ sector / chs->sectors / chs->heads,
+ (sector / chs->sectors) % chs->heads,
+ sector % chs->sectors);
return ped_strdup (buf);
}
@@ -216,22 +216,22 @@ ped_unit_format_custom_byte (const PedDevice* dev, PedSector byte, PedUnit unit)
|| unit == PED_UNIT_SECTOR
|| unit == PED_UNIT_BYTE) {
snprintf (buf, 100, "%lld%s",
- byte / ped_unit_get_size (dev, unit),
- ped_unit_get_name (unit));
+ byte / ped_unit_get_size (dev, unit),
+ ped_unit_get_name (unit));
return ped_strdup (buf);
}
-
- if (unit == PED_UNIT_COMPACT) {
- if (byte >= 10LL * PED_TERABYTE_SIZE)
- unit = PED_UNIT_TERABYTE;
- else if (byte >= 10LL * PED_GIGABYTE_SIZE)
- unit = PED_UNIT_GIGABYTE;
- else if (byte >= 10LL * PED_MEGABYTE_SIZE)
- unit = PED_UNIT_MEGABYTE;
- else if (byte >= 10LL * PED_KILOBYTE_SIZE)
- unit = PED_UNIT_KILOBYTE;
- else
- unit = PED_UNIT_BYTE;
+
+ if (unit == PED_UNIT_COMPACT) {
+ if (byte >= 10LL * PED_TERABYTE_SIZE)
+ unit = PED_UNIT_TERABYTE;
+ else if (byte >= 10LL * PED_GIGABYTE_SIZE)
+ unit = PED_UNIT_GIGABYTE;
+ else if (byte >= 10LL * PED_MEGABYTE_SIZE)
+ unit = PED_UNIT_MEGABYTE;
+ else if (byte >= 10LL * PED_KILOBYTE_SIZE)
+ unit = PED_UNIT_KILOBYTE;
+ else
+ unit = PED_UNIT_BYTE;
}
/* IEEE754 says that 100.5 has to be rounded to 100 (by printf) */
@@ -241,11 +241,11 @@ ped_unit_format_custom_byte (const PedDevice* dev, PedSector byte, PedUnit unit)
d = ((double)byte / (double)ped_unit_get_size (dev, unit))
* (1. + DBL_EPSILON);
w = d + ( (d < 10. ) ? 0.005 :
- (d < 100.) ? 0.05 :
- 0.5 );
+ (d < 100.) ? 0.05 :
+ 0.5 );
p = (w < 10. ) ? 2 :
(w < 100.) ? 1 :
- 0 ;
+ 0 ;
#ifdef __BEOS__
snprintf (buf, 100, "%.*f%s", p, d, ped_unit_get_name(unit));
@@ -296,7 +296,7 @@ ped_unit_format (const PedDevice* dev, PedSector sector)
{
PED_ASSERT (dev != NULL, return NULL);
return ped_unit_format_custom_byte (dev, sector * dev->sector_size,
- default_unit);
+ default_unit);
}
/**
@@ -305,14 +305,14 @@ ped_unit_format (const PedDevice* dev, PedSector sector)
* is created in \p *range describing a 2 units large area centered on
* \p *sector. If the \p range as described here would be partially outside
* the device \p dev, the geometry returned is the intersection between the
- * former and the whole device geometry. If no units are specified, then the
+ * former and the whole device geometry. If no units are specified, then the
* default unit is assumed.
*
* \return \c 1 if \p str is a valid location description, \c 0 otherwise
*/
int
ped_unit_parse (const char* str, const PedDevice* dev, PedSector *sector,
- PedGeometry** range)
+ PedGeometry** range)
{
return ped_unit_parse_custom (str, dev, default_unit, sector, range);
}
@@ -367,7 +367,7 @@ is_chs (const char* str)
static int
parse_chs (const char* str, const PedDevice* dev, PedSector* sector,
- PedGeometry** range)
+ PedGeometry** range)
{
PedSector cyl_size = dev->bios_geom.heads * dev->bios_geom.sectors;
char* copy = ped_strdup (str);
@@ -380,7 +380,7 @@ parse_chs (const char* str, const PedDevice* dev, PedSector* sector,
remove_punct (copy);
if (sscanf (copy, "%d %d %d",
- &chs.cylinders, &chs.heads, &chs.sectors) != 3) {
+ &chs.cylinders, &chs.heads, &chs.sectors) != 3) {
ped_exception_throw (
PED_EXCEPTION_ERROR, PED_EXCEPTION_CANCEL,
_("\"%s\" has invalid syntax for locations."),
@@ -404,8 +404,8 @@ parse_chs (const char* str, const PedDevice* dev, PedSector* sector,
}
*sector = 1LL * chs.cylinders * cyl_size
- + chs.heads * dev->bios_geom.sectors
- + chs.sectors;
+ + chs.heads * dev->bios_geom.sectors
+ + chs.sectors;
if (*sector >= dev->length) {
ped_exception_throw (
@@ -500,7 +500,7 @@ parse_unit_suffix (const char* suffix, PedUnit suggested_unit)
*/
int
ped_unit_parse_custom (const char* str, const PedDevice* dev, PedUnit unit,
- PedSector* sector, PedGeometry** range)
+ PedSector* sector, PedGeometry** range)
{
char* copy;
char* suffix;
--
1.5.0.3
BR Håkon Løvdal
More information about the parted-devel
mailing list