Skip to content

Commit

Permalink
more eol whitespace
Browse files Browse the repository at this point in the history
  • Loading branch information
miekg committed Apr 4, 2010
1 parent b4fc98f commit 2778968
Show file tree
Hide file tree
Showing 24 changed files with 233 additions and 233 deletions.
6 changes: 3 additions & 3 deletions abspath.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

/*
* Remove /./ and /../ and // from a pathname
* An absolute pathname argument is required.
* An absolute pathname argument is required.
* Returns NULL on error, otherwise NULL terminated
* sanitized pathname.
*
Expand All @@ -21,8 +21,8 @@ char * abspath(char *path)
if (!g_path_is_absolute(path))
return NULL;

/* abspath can be NULL or abspath[0] == '\0'. The NULL
* is initial. the [0] == '\0' is when we got back to
/* abspath can be NULL or abspath[0] == '\0'. The NULL
* is initial. the [0] == '\0' is when we got back to
* the root
*/
abspath = NULL;
Expand Down
68 changes: 34 additions & 34 deletions base64.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ static char encode(unsigned char u);
static unsigned char decode(char c);

/**
* Implementation of base64 encoding/decoding.
* Implementation of base64 encoding/decoding.
* @author Jan-Henrik Haukeland, <[email protected]>
* @version \$Id: base64.c,v 1.19 2007/07/25 12:54:31 hauk Exp $
*
*
*/

/**
Expand All @@ -40,8 +40,8 @@ static unsigned char decode(char c);
* @param src The data to be base64 encode
* @return encoded string otherwise NULL
*/
char
*encode_base64(int size, unsigned char *src)
char
*encode_base64(int size, unsigned char *src)
{
int i;
char *out, *p;
Expand All @@ -51,36 +51,36 @@ char

if(!size)
size= strlen((char *)src);

out = g_malloc0(size*4/3+4);
p = out;

for(i=0; i<size; i+=3) {

unsigned char b1=0, b2=0, b3=0, b4=0, b5=0, b6=0, b7=0;

b1 = src[i];

if(i+1<size)
b2 = src[i+1];

if(i+2<size)
b3 = src[i+2];

b4= b1>>2;
b5= ((b1&0x3)<<4)|(b2>>4);
b6= ((b2&0xf)<<2)|(b3>>6);
b7= b3&0x3f;

*p++= encode(b4);
*p++= encode(b5);

if(i+1<size) {
*p++= encode(b6);
} else {
*p++= '=';
}

if(i+2<size) {
*p++= encode(b7);
} else {
Expand All @@ -100,54 +100,54 @@ char
* @return (the length of the decoded string) if decode
* succeeded otherwise FALSE.
*/
int
decode_base64(unsigned char *dest, const char *src)
int
decode_base64(unsigned char *dest, const char *src)
{
if(src && *src) {

unsigned char *p= dest;
int k, l= strlen(src)+1;
unsigned char *buf= g_malloc0(l);

/* Ignore non base64 chars as per the POSIX standard */
for(k=0, l=0; src[k]; k++) {
if(is_base64(src[k])) {
buf[l++]= src[k];
}
}
}

for(k=0; k<l; k+=4) {
char c1='A', c2='A', c3='A', c4='A';
unsigned char b1=0, b2=0, b3=0, b4=0;

c1= buf[k];
if(k+1<l) {
c2= buf[k+1];
}

if(k+2<l) {
c3= buf[k+2];
}

if(k+3<l) {
c4= buf[k+3];
}

b1= decode(c1);
b2= decode(c2);
b3= decode(c3);
b4= decode(c4);

*p++=((b1<<2)|(b2>>4) );

if(c3 != '=') {
*p++=(((b2&0xf)<<4)|(b3>>2) );
}
if(c4 != '=') {
*p++=(((b3&0x3)<<6)|b4 );
}
}

g_free(buf);
return(p-dest);
}
Expand All @@ -157,23 +157,23 @@ decode_base64(unsigned char *dest, const char *src)
/**
* Base64 encode one byte
*/
static char
encode(unsigned char u)
static char
encode(unsigned char u)
{
if(u < 26) return 'A'+u;
if(u < 52) return 'a'+(u-26);
if(u < 62) return '0'+(u-52);
if(u == 62) return '-'; /* was + */

/* return '/'; */
return '_';
}

/**
* Decode a base64 character
*/
static unsigned char
decode(char c)
static unsigned char
decode(char c)
{
if(c >= 'A' && c <= 'Z') return(c - 'A');
if(c >= 'a' && c <= 'z') return(c - 'a' + 26);
Expand All @@ -185,8 +185,8 @@ decode(char c)
/**
* Return TRUE if 'c' is a valid base64 character, otherwise FALSE
*/
static int
is_base64(char c)
static int
is_base64(char c)
{
if((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') ||
(c >= '0' && c <= '9') || (c == '-') ||
Expand Down
18 changes: 9 additions & 9 deletions child.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*
/*
* Copyright (c) 2009,2010 Miek Gieben
* child.c handle child stuff
*/
Expand All @@ -18,7 +18,7 @@ close_pipes(GSList *pipes, int n1, int n2)
int *q;
int j;

for (j = 0, p = g_slist_nth(pipes, 0); p; p = p->next, j++) {
for (j = 0, p = g_slist_nth(pipes, 0); p; p = p->next, j++) {
q = p->data;
/* msg("Pipe set %d fds %d %d", j, q[0], q[1]); */
if (j == n1 || j == n2)
Expand All @@ -32,10 +32,10 @@ close_pipes(GSList *pipes, int n1, int n2)
int
wait_pids(GSList *pids, int flags)
{
GSList *p;
GSList *p;
int status;

for (p = g_slist_nth(pids, 0); p; p = p->next) {
for (p = g_slist_nth(pids, 0); p; p = p->next) {
if (sig != 0)
signal_abort(sig);

Expand All @@ -47,7 +47,7 @@ wait_pids(GSList *pids, int flags)
waitpid(*(pid_t* )(p->data), &status, flags); /* errno ECHILD is ok */
#if 0
if (WIFEXITED(status)) {
/* msg("Child exit %d", WEXITSTATUS(status));
/* msg("Child exit %d", WEXITSTATUS(status));
if (WEXITSTATUS(status) != 0)
ret = -1;
*/
Expand All @@ -63,7 +63,7 @@ wait_pids(GSList *pids, int flags)

/* create pipes and childs, return pids */
GSList *
create_childeren(GSList *child, GSList **pipes, int file)
create_childeren(GSList *child, GSList **pipes, int file)
{
GSList *p;
GSList *pids = NULL;
Expand All @@ -77,13 +77,13 @@ create_childeren(GSList *child, GSList **pipes, int file)
if (!child)
return NULL;

/* create all pipes before forking
/* create all pipes before forking
* As a parent we read from the last pipe created
* We attach file to the input of the first child
* This eliminates to use of a tmp file
*/
childs = g_slist_length(child);
for (j = 0; j < childs; j++) {
for (j = 0; j < childs; j++) {
pips = g_malloc(2 * sizeof(int));
if (pipe(pips) == -1) {
msg(_("Failure creating pipes"));
Expand All @@ -92,7 +92,7 @@ create_childeren(GSList *child, GSList **pipes, int file)
cpipe = g_slist_append(cpipe, pips);
}

for (j = 0, p = g_slist_nth(child, 0); p; p = p->next, j++) {
for (j = 0, p = g_slist_nth(child, 0); p; p = p->next, j++) {
if (sig != 0)
signal_abort(sig);

Expand Down
16 changes: 8 additions & 8 deletions crawler.c
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ dir_crawl(GTree *t, GHashTable *linkhash, GHashTable *userhash,
#else
if (fstat(rdup_dirfd(dir), &s) != 0) {
#endif
msg(_("Cannot determine holding device of the directory `%s\': %s"), path,
msg(_("Cannot determine holding device of the directory `%s\': %s"), path,
strerror(errno));
closedir(dir);
g_free(dirstack);
Expand All @@ -132,7 +132,7 @@ dir_crawl(GTree *t, GHashTable *linkhash, GHashTable *userhash,
current_dev = s.st_dev;

while((dent = readdir(dir))) {
if (!strcmp(dent->d_name, ".") ||
if (!strcmp(dent->d_name, ".") ||
!strcmp(dent->d_name, ".."))
continue;

Expand All @@ -156,7 +156,7 @@ dir_crawl(GTree *t, GHashTable *linkhash, GHashTable *userhash,
continue;
}

if (S_ISREG(s.st_mode) || S_ISLNK(s.st_mode) ||
if (S_ISREG(s.st_mode) || S_ISLNK(s.st_mode) ||
S_ISBLK(s.st_mode) || S_ISCHR(s.st_mode) ||
S_ISFIFO(s.st_mode) || S_ISSOCK(s.st_mode) ) {

Expand Down Expand Up @@ -206,7 +206,7 @@ dir_crawl(GTree *t, GHashTable *linkhash, GHashTable *userhash,
pop.f_lnk = 1;
}
}
if (S_ISLNK(s.st_mode))
if (S_ISLNK(s.st_mode))
pop.f_target = slink(&pop);


Expand All @@ -233,7 +233,7 @@ dir_crawl(GTree *t, GHashTable *linkhash, GHashTable *userhash,
continue;
}
dirstack[d] = g_malloc(sizeof(struct rdup));
dirstack[d]->f_name = g_strdup(curpath);
dirstack[d]->f_name = g_strdup(curpath);
dirstack[d]->f_target = NULL;
dirstack[d]->f_name_size = curpath_len;
dirstack[d]->f_uid = s.st_uid;
Expand All @@ -251,8 +251,8 @@ dir_crawl(GTree *t, GHashTable *linkhash, GHashTable *userhash,
dirstack[d]->f_lnk = 0;

if (d++ % D_STACKSIZE == 0) {
dirstack = g_realloc(dirstack,
++dstack_cnt * D_STACKSIZE *
dirstack = g_realloc(dirstack,
++dstack_cnt * D_STACKSIZE *
sizeof(struct rdup *));
}
g_free(curpath);
Expand All @@ -277,7 +277,7 @@ dir_crawl(GTree *t, GHashTable *linkhash, GHashTable *userhash,
}

while (d > 0) {
directory = dirstack[--d];
directory = dirstack[--d];
g_tree_insert(t, (gpointer) entry_dup(directory), VALUE);
/* recurse */
/* potentially expensive operation. Better would be to when we hit
Expand Down
Loading

0 comments on commit 2778968

Please sign in to comment.