summaryrefslogtreecommitdiffstats
path: root/src/util/support
diff options
context:
space:
mode:
authorTom Yu <tlyu@mit.edu>2009-10-31 00:48:38 +0000
committerTom Yu <tlyu@mit.edu>2009-10-31 00:48:38 +0000
commit02d6bcbc98a214e7aeaaa9f45f0db8784a7b743b (patch)
tree61b9147863cd8be3eff63903dc36cae168254bd5 /src/util/support
parent162ab371748cba0cc6f172419bd6e71fa04bb878 (diff)
downloadkrb5-02d6bcbc98a214e7aeaaa9f45f0db8784a7b743b.tar.gz
krb5-02d6bcbc98a214e7aeaaa9f45f0db8784a7b743b.tar.xz
krb5-02d6bcbc98a214e7aeaaa9f45f0db8784a7b743b.zip
make mark-cstyle
make reindent git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@23100 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/util/support')
-rw-r--r--src/util/support/cache-addrinfo.h54
-rw-r--r--src/util/support/errors.c14
-rw-r--r--src/util/support/fake-addrinfo.c56
-rw-r--r--src/util/support/init-addrinfo.c54
-rw-r--r--src/util/support/ipc_stream.c182
-rw-r--r--src/util/support/plugins.c164
-rw-r--r--src/util/support/printf.c4
-rw-r--r--src/util/support/supp-int.h4
-rw-r--r--src/util/support/threads.c14
-rw-r--r--src/util/support/utf8.c6
-rw-r--r--src/util/support/utf8_conv.c25
11 files changed, 288 insertions, 289 deletions
diff --git a/src/util/support/cache-addrinfo.h b/src/util/support/cache-addrinfo.h
index 0a4e44385..95f522dcb 100644
--- a/src/util/support/cache-addrinfo.h
+++ b/src/util/support/cache-addrinfo.h
@@ -1,42 +1,42 @@
/*
* Copyright (C) 2004 by the Massachusetts Institute of Technology,
* Cambridge, MA, USA. All Rights Reserved.
- *
- * This software is being provided to you, the LICENSEE, by the
- * Massachusetts Institute of Technology (M.I.T.) under the following
- * license. By obtaining, using and/or copying this software, you agree
- * that you have read, understood, and will comply with these terms and
- * conditions:
- *
+ *
+ * This software is being provided to you, the LICENSEE, by the
+ * Massachusetts Institute of Technology (M.I.T.) under the following
+ * license. By obtaining, using and/or copying this software, you agree
+ * that you have read, understood, and will comply with these terms and
+ * conditions:
+ *
* Export of this software from the United States of America may
* require a specific license from the United States Government.
* It is the responsibility of any person or organization contemplating
* export to obtain such a license before exporting.
- *
- * WITHIN THAT CONSTRAINT, permission to use, copy, modify and distribute
- * this software and its documentation for any purpose and without fee or
- * royalty is hereby granted, provided that you agree to comply with the
- * following copyright notice and statements, including the disclaimer, and
- * that the same appear on ALL copies of the software and documentation,
- * including modifications that you make for internal use or for
+ *
+ * WITHIN THAT CONSTRAINT, permission to use, copy, modify and distribute
+ * this software and its documentation for any purpose and without fee or
+ * royalty is hereby granted, provided that you agree to comply with the
+ * following copyright notice and statements, including the disclaimer, and
+ * that the same appear on ALL copies of the software and documentation,
+ * including modifications that you make for internal use or for
* distribution:
- *
- * THIS SOFTWARE IS PROVIDED "AS IS", AND M.I.T. MAKES NO REPRESENTATIONS
- * OR WARRANTIES, EXPRESS OR IMPLIED. By way of example, but not
- * limitation, M.I.T. MAKES NO REPRESENTATIONS OR WARRANTIES OF
- * MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF
- * THE LICENSED SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY
- * PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.
- *
- * The name of the Massachusetts Institute of Technology or M.I.T. may NOT
- * be used in advertising or publicity pertaining to distribution of the
- * software. Title to copyright in this software and any associated
- * documentation shall at all times remain with M.I.T., and USER agrees to
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS", AND M.I.T. MAKES NO REPRESENTATIONS
+ * OR WARRANTIES, EXPRESS OR IMPLIED. By way of example, but not
+ * limitation, M.I.T. MAKES NO REPRESENTATIONS OR WARRANTIES OF
+ * MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF
+ * THE LICENSED SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY
+ * PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.
+ *
+ * The name of the Massachusetts Institute of Technology or M.I.T. may NOT
+ * be used in advertising or publicity pertaining to distribution of the
+ * software. Title to copyright in this software and any associated
+ * documentation shall at all times remain with M.I.T., and USER agrees to
* preserve same.
*
* Furthermore if you modify this software you must label
* your software as modified software and not distribute it in such a
- * fashion that it might be confused with the original M.I.T. software.
+ * fashion that it might be confused with the original M.I.T. software.
*/
/* Approach overview:
diff --git a/src/util/support/errors.c b/src/util/support/errors.c
index 8d523b98b..e89d8ad45 100644
--- a/src/util/support/errors.c
+++ b/src/util/support/errors.c
@@ -69,7 +69,7 @@ krb5int_vset_error_fl (struct errinfo *ep, long code,
va_list args2;
char *str = NULL, *str2, *slash;
const char *loc_fmt = NULL;
-
+
#ifdef USE_KIM
/* Try to localize the format string */
if (kim_os_string_create_localized(&loc_fmt, fmt) != KIM_NO_ERROR) {
@@ -78,7 +78,7 @@ krb5int_vset_error_fl (struct errinfo *ep, long code,
#else
loc_fmt = fmt;
#endif
-
+
/* try vasprintf first */
va_copy(args2, args);
if (vasprintf(&str, loc_fmt, args2) < 0) {
@@ -96,21 +96,21 @@ krb5int_vset_error_fl (struct errinfo *ep, long code,
str = str2;
}
}
-
+
/* If that failed, try using scratch_buf */
if (str == NULL) {
vsnprintf(ep->scratch_buf, sizeof(ep->scratch_buf), loc_fmt, args);
str = strdup(ep->scratch_buf); /* try allocating again */
}
-
+
/* free old string before setting new one */
if (ep->msg && ep->msg != ep->scratch_buf) {
free ((char *) ep->msg);
ep->msg = NULL;
- }
+ }
ep->code = code;
ep->msg = str ? str : ep->scratch_buf;
-
+
#ifdef USE_KIM
if (loc_fmt != fmt) { kim_string_free(&loc_fmt); }
#else
@@ -197,7 +197,7 @@ krb5int_get_error (struct errinfo *ep, long code)
unlock();
goto format_number;
}
-
+
r2 = strdup(r);
if (r2 == NULL) {
strncpy(ep->scratch_buf, r, sizeof(ep->scratch_buf));
diff --git a/src/util/support/fake-addrinfo.c b/src/util/support/fake-addrinfo.c
index 34ce7701b..5d90e7217 100644
--- a/src/util/support/fake-addrinfo.c
+++ b/src/util/support/fake-addrinfo.c
@@ -1,42 +1,42 @@
/*
* Copyright (C) 2001,2002,2003,2004,2005,2006 by the Massachusetts Institute of Technology,
* Cambridge, MA, USA. All Rights Reserved.
- *
- * This software is being provided to you, the LICENSEE, by the
- * Massachusetts Institute of Technology (M.I.T.) under the following
- * license. By obtaining, using and/or copying this software, you agree
- * that you have read, understood, and will comply with these terms and
- * conditions:
- *
+ *
+ * This software is being provided to you, the LICENSEE, by the
+ * Massachusetts Institute of Technology (M.I.T.) under the following
+ * license. By obtaining, using and/or copying this software, you agree
+ * that you have read, understood, and will comply with these terms and
+ * conditions:
+ *
* Export of this software from the United States of America may
* require a specific license from the United States Government.
* It is the responsibility of any person or organization contemplating
* export to obtain such a license before exporting.
- *
- * WITHIN THAT CONSTRAINT, permission to use, copy, modify and distribute
- * this software and its documentation for any purpose and without fee or
- * royalty is hereby granted, provided that you agree to comply with the
- * following copyright notice and statements, including the disclaimer, and
- * that the same appear on ALL copies of the software and documentation,
- * including modifications that you make for internal use or for
+ *
+ * WITHIN THAT CONSTRAINT, permission to use, copy, modify and distribute
+ * this software and its documentation for any purpose and without fee or
+ * royalty is hereby granted, provided that you agree to comply with the
+ * following copyright notice and statements, including the disclaimer, and
+ * that the same appear on ALL copies of the software and documentation,
+ * including modifications that you make for internal use or for
* distribution:
- *
- * THIS SOFTWARE IS PROVIDED "AS IS", AND M.I.T. MAKES NO REPRESENTATIONS
- * OR WARRANTIES, EXPRESS OR IMPLIED. By way of example, but not
- * limitation, M.I.T. MAKES NO REPRESENTATIONS OR WARRANTIES OF
- * MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF
- * THE LICENSED SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY
- * PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.
- *
- * The name of the Massachusetts Institute of Technology or M.I.T. may NOT
- * be used in advertising or publicity pertaining to distribution of the
- * software. Title to copyright in this software and any associated
- * documentation shall at all times remain with M.I.T., and USER agrees to
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS", AND M.I.T. MAKES NO REPRESENTATIONS
+ * OR WARRANTIES, EXPRESS OR IMPLIED. By way of example, but not
+ * limitation, M.I.T. MAKES NO REPRESENTATIONS OR WARRANTIES OF
+ * MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF
+ * THE LICENSED SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY
+ * PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.
+ *
+ * The name of the Massachusetts Institute of Technology or M.I.T. may NOT
+ * be used in advertising or publicity pertaining to distribution of the
+ * software. Title to copyright in this software and any associated
+ * documentation shall at all times remain with M.I.T., and USER agrees to
* preserve same.
*
* Furthermore if you modify this software you must label
* your software as modified software and not distribute it in such a
- * fashion that it might be confused with the original M.I.T. software.
+ * fashion that it might be confused with the original M.I.T. software.
*/
/* Approach overview:
@@ -383,7 +383,7 @@ static const char *protoname (int p, char *buf, size_t bufsize) {
snprintf(buf, bufsize, " %-2d", p);
return buf;
-}
+}
static const char *socktypename (int t, char *buf, size_t bufsize) {
switch (t) {
diff --git a/src/util/support/init-addrinfo.c b/src/util/support/init-addrinfo.c
index 186950fb8..af8746762 100644
--- a/src/util/support/init-addrinfo.c
+++ b/src/util/support/init-addrinfo.c
@@ -1,42 +1,42 @@
/*
* Copyright (C) 2004 by the Massachusetts Institute of Technology,
* Cambridge, MA, USA. All Rights Reserved.
- *
- * This software is being provided to you, the LICENSEE, by the
- * Massachusetts Institute of Technology (M.I.T.) under the following
- * license. By obtaining, using and/or copying this software, you agree
- * that you have read, understood, and will comply with these terms and
- * conditions:
- *
+ *
+ * This software is being provided to you, the LICENSEE, by the
+ * Massachusetts Institute of Technology (M.I.T.) under the following
+ * license. By obtaining, using and/or copying this software, you agree
+ * that you have read, understood, and will comply with these terms and
+ * conditions:
+ *
* Export of this software from the United States of America may
* require a specific license from the United States Government.
* It is the responsibility of any person or organization contemplating
* export to obtain such a license before exporting.
- *
- * WITHIN THAT CONSTRAINT, permission to use, copy, modify and distribute
- * this software and its documentation for any purpose and without fee or
- * royalty is hereby granted, provided that you agree to comply with the
- * following copyright notice and statements, including the disclaimer, and
- * that the same appear on ALL copies of the software and documentation,
- * including modifications that you make for internal use or for
+ *
+ * WITHIN THAT CONSTRAINT, permission to use, copy, modify and distribute
+ * this software and its documentation for any purpose and without fee or
+ * royalty is hereby granted, provided that you agree to comply with the
+ * following copyright notice and statements, including the disclaimer, and
+ * that the same appear on ALL copies of the software and documentation,
+ * including modifications that you make for internal use or for
* distribution:
- *
- * THIS SOFTWARE IS PROVIDED "AS IS", AND M.I.T. MAKES NO REPRESENTATIONS
- * OR WARRANTIES, EXPRESS OR IMPLIED. By way of example, but not
- * limitation, M.I.T. MAKES NO REPRESENTATIONS OR WARRANTIES OF
- * MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF
- * THE LICENSED SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY
- * PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.
- *
- * The name of the Massachusetts Institute of Technology or M.I.T. may NOT
- * be used in advertising or publicity pertaining to distribution of the
- * software. Title to copyright in this software and any associated
- * documentation shall at all times remain with M.I.T., and USER agrees to
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS", AND M.I.T. MAKES NO REPRESENTATIONS
+ * OR WARRANTIES, EXPRESS OR IMPLIED. By way of example, but not
+ * limitation, M.I.T. MAKES NO REPRESENTATIONS OR WARRANTIES OF
+ * MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF
+ * THE LICENSED SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY
+ * PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.
+ *
+ * The name of the Massachusetts Institute of Technology or M.I.T. may NOT
+ * be used in advertising or publicity pertaining to distribution of the
+ * software. Title to copyright in this software and any associated
+ * documentation shall at all times remain with M.I.T., and USER agrees to
* preserve same.
*
* Furthermore if you modify this software you must label
* your software as modified software and not distribute it in such a
- * fashion that it might be confused with the original M.I.T. software.
+ * fashion that it might be confused with the original M.I.T. software.
*/
/* Stuff that needs initialization for fake-addrinfo.c.
diff --git a/src/util/support/ipc_stream.c b/src/util/support/ipc_stream.c
index 92d47e6ec..778d6f1f2 100644
--- a/src/util/support/ipc_stream.c
+++ b/src/util/support/ipc_stream.c
@@ -57,20 +57,20 @@ static uint32_t krb5int_ipc_stream_reallocate (k5_ipc_stream io_stream,
{
int32_t err = 0;
uint64_t new_max_size = 0;
-
+
if (!io_stream) { err = k5_check_error (EINVAL); }
-
+
if (!err) {
uint64_t old_max_size = io_stream->max_size;
new_max_size = io_stream->max_size;
-
+
if (in_new_size > old_max_size) {
/* Expand the stream */
while (in_new_size > new_max_size) {
new_max_size += K5_IPC_STREAM_SIZE_INCREMENT;
}
-
-
+
+
} else if ((in_new_size + K5_IPC_STREAM_SIZE_INCREMENT) < old_max_size) {
/* Shrink the array, but never drop below K5_IPC_STREAM_SIZE_INCREMENT */
while ((in_new_size + K5_IPC_STREAM_SIZE_INCREMENT) < new_max_size &&
@@ -79,25 +79,25 @@ static uint32_t krb5int_ipc_stream_reallocate (k5_ipc_stream io_stream,
}
}
}
-
+
if (!err && new_max_size != io_stream->max_size) {
char *data = io_stream->data;
-
+
if (!data) {
data = malloc (new_max_size * sizeof (*data));
} else {
data = realloc (data, new_max_size * sizeof (*data));
}
-
- if (data) {
+
+ if (data) {
io_stream->data = data;
io_stream->max_size = new_max_size;
} else {
- err = k5_check_error (ENOMEM);
+ err = k5_check_error (ENOMEM);
}
}
-
- return k5_check_error (err);
+
+ return k5_check_error (err);
}
/* ------------------------------------------------------------------------ */
@@ -106,41 +106,41 @@ int32_t krb5int_ipc_stream_new (k5_ipc_stream *out_stream)
{
int32_t err = 0;
k5_ipc_stream stream = NULL;
-
+
if (!out_stream) { err = k5_check_error (EINVAL); }
-
+
if (!err) {
stream = malloc (sizeof (*stream));
- if (stream) {
+ if (stream) {
*stream = k5_ipc_stream_initializer;
} else {
- err = k5_check_error (ENOMEM);
+ err = k5_check_error (ENOMEM);
}
}
-
+
if (!err) {
*out_stream = stream;
stream = NULL;
}
-
+
krb5int_ipc_stream_release (stream);
-
- return k5_check_error (err);
+
+ return k5_check_error (err);
}
/* ------------------------------------------------------------------------ */
uint32_t krb5int_ipc_stream_release (k5_ipc_stream io_stream)
-{
+{
int32_t err = 0;
-
+
if (!err && io_stream) {
free (io_stream->data);
free (io_stream);
}
-
- return err;
+
+ return err;
}
/* ------------------------------------------------------------------------ */
@@ -164,63 +164,63 @@ const char *krb5int_ipc_stream_data (k5_ipc_stream in_stream)
/* ------------------------------------------------------------------------ */
-uint32_t krb5int_ipc_stream_read (k5_ipc_stream io_stream,
- void *io_data,
+uint32_t krb5int_ipc_stream_read (k5_ipc_stream io_stream,
+ void *io_data,
uint64_t in_size)
{
int32_t err = 0;
-
+
if (!io_stream) { err = k5_check_error (EINVAL); }
if (!io_data ) { err = k5_check_error (EINVAL); }
-
+
if (!err) {
- if (in_size > io_stream->size) {
- err = k5_check_error (EINVAL);
+ if (in_size > io_stream->size) {
+ err = k5_check_error (EINVAL);
}
}
-
+
if (!err) {
memcpy (io_data, io_stream->data, in_size);
- memmove (io_stream->data, &io_stream->data[in_size],
+ memmove (io_stream->data, &io_stream->data[in_size],
io_stream->size - in_size);
-
+
err = krb5int_ipc_stream_reallocate (io_stream, io_stream->size - in_size);
-
+
if (!err) {
io_stream->size -= in_size;
}
}
-
+
return k5_check_error (err);
}
/* ------------------------------------------------------------------------ */
uint32_t krb5int_ipc_stream_write (k5_ipc_stream io_stream,
- const void *in_data,
+ const void *in_data,
uint64_t in_size)
{
int32_t err = 0;
-
+
if (!io_stream) { err = k5_check_error (EINVAL); }
if (!in_data ) { err = k5_check_error (EINVAL); }
-
+
if (!err) {
/* Security check: Do not let the caller overflow the length */
if (in_size > (UINT64_MAX - io_stream->size)) {
err = k5_check_error (EINVAL);
}
}
-
+
if (!err) {
err = krb5int_ipc_stream_reallocate (io_stream, io_stream->size + in_size);
}
-
+
if (!err) {
memcpy (&io_stream->data[io_stream->size], in_data, in_size);
io_stream->size += in_size;
}
-
+
return k5_check_error (err);
}
@@ -237,60 +237,60 @@ void krb5int_ipc_stream_free_string (char *in_string)
/* ------------------------------------------------------------------------ */
-uint32_t krb5int_ipc_stream_read_string (k5_ipc_stream io_stream,
+uint32_t krb5int_ipc_stream_read_string (k5_ipc_stream io_stream,
char **out_string)
{
int32_t err = 0;
uint32_t length = 0;
char *string = NULL;
-
+
if (!io_stream ) { err = k5_check_error (EINVAL); }
if (!out_string) { err = k5_check_error (EINVAL); }
-
+
if (!err) {
err = krb5int_ipc_stream_read_uint32 (io_stream, &length);
}
-
+
if (!err) {
string = malloc (length);
if (!string) { err = k5_check_error (ENOMEM); }
}
-
+
if (!err) {
err = krb5int_ipc_stream_read (io_stream, string, length);
}
-
+
if (!err) {
*out_string = string;
string = NULL;
}
-
+
free (string);
-
+
return k5_check_error (err);
}
/* ------------------------------------------------------------------------ */
-uint32_t krb5int_ipc_stream_write_string (k5_ipc_stream io_stream,
+uint32_t krb5int_ipc_stream_write_string (k5_ipc_stream io_stream,
const char *in_string)
{
int32_t err = 0;
uint32_t length = 0;
-
+
if (!io_stream) { err = k5_check_error (EINVAL); }
if (!in_string) { err = k5_check_error (EINVAL); }
-
+
if (!err) {
length = strlen (in_string) + 1;
-
+
err = krb5int_ipc_stream_write_uint32 (io_stream, length);
}
-
+
if (!err) {
err = krb5int_ipc_stream_write (io_stream, in_string, length);
}
-
+
return k5_check_error (err);
}
@@ -300,40 +300,40 @@ uint32_t krb5int_ipc_stream_write_string (k5_ipc_stream io_stream,
/* ------------------------------------------------------------------------ */
-uint32_t krb5int_ipc_stream_read_int32 (k5_ipc_stream io_stream,
+uint32_t krb5int_ipc_stream_read_int32 (k5_ipc_stream io_stream,
int32_t *out_int32)
{
int32_t err = 0;
int32_t int32 = 0;
-
+
if (!io_stream) { err = k5_check_error (EINVAL); }
if (!out_int32) { err = k5_check_error (EINVAL); }
-
+
if (!err) {
err = krb5int_ipc_stream_read (io_stream, &int32, sizeof (int32));
}
-
+
if (!err) {
*out_int32 = ntohl (int32);
}
-
+
return k5_check_error (err);
}
/* ------------------------------------------------------------------------ */
-uint32_t krb5int_ipc_stream_write_int32 (k5_ipc_stream io_stream,
+uint32_t krb5int_ipc_stream_write_int32 (k5_ipc_stream io_stream,
int32_t in_int32)
{
int32_t err = 0;
int32_t int32 = htonl (in_int32);
-
+
if (!io_stream) { err = k5_check_error (EINVAL); }
-
+
if (!err) {
err = krb5int_ipc_stream_write (io_stream, &int32, sizeof (int32));
}
-
+
return k5_check_error (err);
}
@@ -343,40 +343,40 @@ uint32_t krb5int_ipc_stream_write_int32 (k5_ipc_stream io_stream,
/* ------------------------------------------------------------------------ */
-uint32_t krb5int_ipc_stream_read_uint32 (k5_ipc_stream io_stream,
+uint32_t krb5int_ipc_stream_read_uint32 (k5_ipc_stream io_stream,
uint32_t *out_uint32)
{
int32_t err = 0;
uint32_t uint32 = 0;
-
+
if (!io_stream) { err = k5_check_error (EINVAL); }
if (!out_uint32) { err = k5_check_error (EINVAL); }
-
+
if (!err) {
err = krb5int_ipc_stream_read (io_stream, &uint32, sizeof (uint32));
}
-
+
if (!err) {
*out_uint32 = ntohl (uint32);
}
-
+
return k5_check_error (err);
}
/* ------------------------------------------------------------------------ */
-uint32_t krb5int_ipc_stream_write_uint32 (k5_ipc_stream io_stream,
+uint32_t krb5int_ipc_stream_write_uint32 (k5_ipc_stream io_stream,
uint32_t in_uint32)
{
int32_t err = 0;
int32_t uint32 = htonl (in_uint32);
-
+
if (!io_stream) { err = k5_check_error (EINVAL); }
-
+
if (!err) {
err = krb5int_ipc_stream_write (io_stream, &uint32, sizeof (uint32));
}
-
+
return k5_check_error (err);
}
@@ -386,40 +386,40 @@ uint32_t krb5int_ipc_stream_write_uint32 (k5_ipc_stream io_stream,
/* ------------------------------------------------------------------------ */
-uint32_t krb5int_ipc_stream_read_int64 (k5_ipc_stream io_stream,
+uint32_t krb5int_ipc_stream_read_int64 (k5_ipc_stream io_stream,
int64_t *out_int64)
{
int32_t err = 0;
uint64_t int64 = 0;
-
+
if (!io_stream) { err = k5_check_error (EINVAL); }
if (!out_int64) { err = k5_check_error (EINVAL); }
-
+
if (!err) {
err = krb5int_ipc_stream_read (io_stream, &int64, sizeof (int64));
}
-
+
if (!err) {
*out_int64 = ntohll (int64);
}
-
+
return k5_check_error (err);
}
/* ------------------------------------------------------------------------ */
-uint32_t krb5int_ipc_stream_write_int64 (k5_ipc_stream io_stream,
+uint32_t krb5int_ipc_stream_write_int64 (k5_ipc_stream io_stream,
int64_t in_int64)
{
int32_t err = 0;
int64_t int64 = htonll (in_int64);
-
+
if (!io_stream) { err = k5_check_error (EINVAL); }
-
+
if (!err) {
err = krb5int_ipc_stream_write (io_stream, &int64, sizeof (int64));
}
-
+
return k5_check_error (err);
}
@@ -430,39 +430,39 @@ uint32_t krb5int_ipc_stream_write_int64 (k5_ipc_stream io_stream,
/* ------------------------------------------------------------------------ */
-uint32_t krb5int_ipc_stream_read_uint64 (k5_ipc_stream io_stream,
+uint32_t krb5int_ipc_stream_read_uint64 (k5_ipc_stream io_stream,
uint64_t *out_uint64)
{
int32_t err = 0;
uint64_t uint64 = 0;
-
+
if (!io_stream) { err = k5_check_error (EINVAL); }
if (!out_uint64) { err = k5_check_error (EINVAL); }
-
+
if (!err) {
err = krb5int_ipc_stream_read (io_stream, &uint64, sizeof (uint64));
}
-
+
if (!err) {
*out_uint64 = ntohll (uint64);
}
-
+
return k5_check_error (err);
}
/* ------------------------------------------------------------------------ */
-uint32_t krb5int_ipc_stream_write_uint64 (k5_ipc_stream io_stream,
+uint32_t krb5int_ipc_stream_write_uint64 (k5_ipc_stream io_stream,
uint64_t in_uint64)
{
int32_t err = 0;
int64_t uint64 = htonll (in_uint64);
-
+
if (!io_stream) { err = k5_check_error (EINVAL); }
-
+
if (!err) {
err = krb5int_ipc_stream_write (io_stream, &uint64, sizeof (uint64));
}
-
+
return k5_check_error (err);
}
diff --git a/src/util/support/plugins.c b/src/util/support/plugins.c
index 26ec3912f..8c7fb5ffe 100644
--- a/src/util/support/plugins.c
+++ b/src/util/support/plugins.c
@@ -8,7 +8,7 @@
* require a specific license from the United States Government.
* It is the responsibility of any person or organization contemplating
* export to obtain such a license before exporting.
- *
+ *
* WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
* distribute this software and its documentation for any purpose and
* without fee is hereby granted, provided that the above copyright
@@ -22,7 +22,7 @@
* M.I.T. makes no representations about the suitability of
* this software for any purpose. It is provided "as is" without express
* or implied warranty.
- *
+ *
*
* Plugin module support, and shims around dlopen/whatever.
*/
@@ -192,10 +192,10 @@ krb5int_open_plugin (const char *filepath, struct plugin_file_handle **h, struct
#endif /* USE_CFBUNDLE */
)) {
void *handle = NULL;
-
+
#if USE_CFBUNDLE
char executablepath[MAXPATHLEN];
-
+
if ((statbuf.st_mode & S_IFMT) == S_IFDIR) {
int lock_err = 0;
CFStringRef pluginString = NULL;
@@ -208,51 +208,51 @@ krb5int_open_plugin (const char *filepath, struct plugin_file_handle **h, struct
* because this code is Mac-specific */
lock_err = pthread_mutex_lock(&krb5int_bundle_mutex);
if (lock_err) { err = lock_err; }
-
+
if (!err) {
- pluginString = CFStringCreateWithCString (kCFAllocatorDefault,
- filepath,
+ pluginString = CFStringCreateWithCString (kCFAllocatorDefault,
+ filepath,
kCFStringEncodingASCII);
if (pluginString == NULL) { err = ENOMEM; }
}
-
+
if (!err) {
- pluginURL = CFURLCreateWithFileSystemPath (kCFAllocatorDefault,
- pluginString,
- kCFURLPOSIXPathStyle,
+ pluginURL = CFURLCreateWithFileSystemPath (kCFAllocatorDefault,
+ pluginString,
+ kCFURLPOSIXPathStyle,
true);
if (pluginURL == NULL) { err = ENOMEM; }
}
-
+
if (!err) {
pluginBundle = CFBundleCreate (kCFAllocatorDefault, pluginURL);
if (pluginBundle == NULL) { err = ENOENT; } /* XXX need better error */
}
-
+
if (!err) {
executableURL = CFBundleCopyExecutableURL (pluginBundle);
if (executableURL == NULL) { err = ENOMEM; }
}
-
+
if (!err) {
if (!CFURLGetFileSystemRepresentation (executableURL,
true, /* absolute */
- (UInt8 *)executablepath,
+ (UInt8 *)executablepath,
sizeof (executablepath))) {
err = ENOMEM;
}
}
-
+
if (!err) {
/* override the path the caller passed in */
filepath = executablepath;
}
-
+
if (executableURL != NULL) { CFRelease (executableURL); }
if (pluginBundle != NULL) { CFRelease (pluginBundle); }
if (pluginURL != NULL) { CFRelease (pluginURL); }
if (pluginString != NULL) { CFRelease (pluginString); }
-
+
/* unlock after CFRelease calls since they modify refcounts */
if (!lock_err) { pthread_mutex_unlock (&krb5int_bundle_mutex); }
}
@@ -282,7 +282,7 @@ krb5int_open_plugin (const char *filepath, struct plugin_file_handle **h, struct
if (handle != NULL) { dlclose (handle); }
}
#endif /* USE_DLOPEN */
-
+
#ifdef _WIN32
if (!err && (statbuf.st_mode & S_IFMT) == S_IFREG) {
HMODULE handle = NULL;
@@ -300,33 +300,33 @@ krb5int_open_plugin (const char *filepath, struct plugin_file_handle **h, struct
handle = NULL;
}
- if (handle != NULL)
- FreeLibrary(handle);
+ if (handle != NULL)
+ FreeLibrary(handle);
}
#endif
if (!err && !got_plugin) {
err = ENOENT; /* no plugin or no way to load plugins */
}
-
+
if (!err) {
*h = htmp;
htmp = NULL; /* h takes ownership */
}
-
+
if (htmp != NULL) { free (htmp); }
-
+
return err;
}
static long
-krb5int_get_plugin_sym (struct plugin_file_handle *h,
+krb5int_get_plugin_sym (struct plugin_file_handle *h,
const char *csymname, int isfunc, void **ptr,
struct errinfo *ep)
{
long err = 0;
void *sym = NULL;
-
+
#if USE_DLOPEN
if (!err && !sym && (h->dlhandle != NULL)) {
/* XXX Do we need to add a leading "_" to the symbol name on any
@@ -340,7 +340,7 @@ krb5int_get_plugin_sym (struct plugin_file_handle *h,
}
}
#endif
-
+
#ifdef _WIN32
LPVOID lpMsgBuf;
DWORD dw;
@@ -354,7 +354,7 @@ krb5int_get_plugin_sym (struct plugin_file_handle *h,
krb5int_set_error(ep, err, "%s", e);
dw = GetLastError();
- if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
+ if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM,
NULL,
dw,
@@ -372,11 +372,11 @@ krb5int_get_plugin_sym (struct plugin_file_handle *h,
if (!err && (sym == NULL)) {
err = ENOENT; /* unimplemented */
}
-
+
if (!err) {
*ptr = sym;
}
-
+
return err;
}
@@ -391,7 +391,7 @@ long KRB5_CALLCONV
krb5int_get_plugin_func (struct plugin_file_handle *h, const char *csymname,
void (**ptr)(), struct errinfo *ep)
{
- void *dptr = NULL;
+ void *dptr = NULL;
long err = krb5int_get_plugin_sym (h, csymname, 1, &dptr, ep);
if (!err) {
/* Cast function pointers to avoid code duplication */
@@ -453,15 +453,15 @@ krb5int_plugin_file_handle_array_init (struct plugin_file_handle ***harray)
}
static long
-krb5int_plugin_file_handle_array_add (struct plugin_file_handle ***harray, size_t *count,
+krb5int_plugin_file_handle_array_add (struct plugin_file_handle ***harray, size_t *count,
struct plugin_file_handle *p)
{
long err = 0;
struct plugin_file_handle **newharray = NULL;
size_t newcount = *count + 1;
-
+
newharray = realloc (*harray, ((newcount + 1) * sizeof (**harray))); /* +1 for NULL */
- if (newharray == NULL) {
+ if (newharray == NULL) {
err = ENOMEM;
} else {
newharray[newcount - 1] = p;
@@ -470,7 +470,7 @@ krb5int_plugin_file_handle_array_add (struct plugin_file_handle ***harray, size_
*harray = newharray;
}
- return err;
+ return err;
}
static void
@@ -494,20 +494,20 @@ krb5int_plugin_file_handle_array_free (struct plugin_file_handle **harray)
#endif
-static void
+static void
krb5int_free_plugin_filenames (char **filenames)
{
- if (filenames != NULL) {
+ if (filenames != NULL) {
int i;
for (i = 0; filenames[i] != NULL; i++) {
free (filenames[i]);
}
- free (filenames);
- }
+ free (filenames);
+ }
}
-static long
+static long
krb5int_get_plugin_filenames (const char * const *filebases, char ***filenames)
{
long err = 0;
@@ -519,7 +519,7 @@ krb5int_get_plugin_filenames (const char * const *filebases, char ***filenames)
if (!filebases) { err = EINVAL; }
if (!filenames) { err = EINVAL; }
-
+
if (!err) {
for (i = 0; filebases[i]; i++) { bases_count++; }
for (i = 0; fileexts[i]; i++) { exts_count++; }
@@ -531,7 +531,7 @@ krb5int_get_plugin_filenames (const char * const *filebases, char ***filenames)
size_t j;
for (i = 0; !err && filebases[i]; i++) {
for (j = 0; !err && fileexts[j]; j++) {
- if (asprintf(&tempnames[(i*exts_count)+j], "%s%s",
+ if (asprintf(&tempnames[(i*exts_count)+j], "%s%s",
filebases[i], fileexts[j]) < 0) {
tempnames[(i*exts_count)+j] = NULL;
err = ENOMEM;
@@ -540,20 +540,20 @@ krb5int_get_plugin_filenames (const char * const *filebases, char ***filenames)
}
tempnames[bases_count * exts_count] = NULL; /* NUL-terminate */
}
-
+
if (!err) {
*filenames = tempnames;
tempnames = NULL;
}
-
+
if (tempnames) { krb5int_free_plugin_filenames (tempnames); }
-
+
return err;
}
/* Takes a NULL-terminated list of directories. If filebases is NULL, filebases is ignored
- * all plugins in the directories are loaded. If filebases is a NULL-terminated array of names,
+ * all plugins in the directories are loaded. If filebases is a NULL-terminated array of names,
* only plugins in the directories with those name (plus any platform extension) are loaded. */
long KRB5_CALLCONV
@@ -571,52 +571,52 @@ krb5int_open_plugin_dirs (const char * const *dirnames,
if (!err) {
err = krb5int_plugin_file_handle_array_init (&h);
}
-
+
if (!err && (filebases != NULL)) {
err = krb5int_get_plugin_filenames (filebases, &filenames);
}
-
+
for (i = 0; !err && dirnames[i] != NULL; i++) {
if (filenames != NULL) {
/* load plugins with names from filenames from each directory */
int j;
-
+
for (j = 0; !err && filenames[j] != NULL; j++) {
struct plugin_file_handle *handle = NULL;
char *filepath = NULL;
-
+
if (!err) {
if (asprintf(&filepath, "%s/%s", dirnames[i], filenames[j]) < 0) {
filepath = NULL;
err = ENOMEM;
}
}
-
+
if (krb5int_open_plugin (filepath, &handle, ep) == 0) {
err = krb5int_plugin_file_handle_array_add (&h, &count, handle);
if (!err) { handle = NULL; } /* h takes ownership */
}
-
+
if (filepath != NULL) { free (filepath); }
if (handle != NULL) { krb5int_close_plugin (handle); }
}
} else {
/* load all plugins in each directory */
DIR *dir = opendir (dirnames[i]);
-
+
while (dir != NULL && !err) {
struct dirent *d = NULL;
char *filepath = NULL;
struct plugin_file_handle *handle = NULL;
-
+
d = readdir (dir);
if (d == NULL) { break; }
-
- if ((strcmp (d->d_name, ".") == 0) ||
+
+ if ((strcmp (d->d_name, ".") == 0) ||
(strcmp (d->d_name, "..") == 0)) {
continue;
}
-
+
if (!err) {
int len = NAMELEN (d);
if (asprintf(&filepath, "%s/%*s", dirnames[i], len, d->d_name) < 0) {
@@ -624,34 +624,34 @@ krb5int_open_plugin_dirs (const char * const *dirnames,
err = ENOMEM;
}
}
-
- if (!err) {
+
+ if (!err) {
if (krb5int_open_plugin (filepath, &handle, ep) == 0) {
err = krb5int_plugin_file_handle_array_add (&h, &count, handle);
if (!err) { handle = NULL; } /* h takes ownership */
}
}
-
+
if (filepath != NULL) { free (filepath); }
if (handle != NULL) { krb5int_close_plugin (handle); }
}
-
+
if (dir != NULL) { closedir (dir); }
}
}
-
+
if (err == ENOENT) {
err = 0; /* ran out of plugins -- do nothing */
}
-
+
if (!err) {
dirhandle->files = h;
h = NULL; /* dirhandle->files takes ownership */
}
-
+
if (filenames != NULL) { krb5int_free_plugin_filenames (filenames); }
if (h != NULL) { krb5int_plugin_file_handle_array_free (h); }
-
+
return err;
}
@@ -687,14 +687,14 @@ krb5int_get_plugin_dir_data (struct plugin_dir_handle *dirhandle,
/* XXX Do we need to add a leading "_" to the symbol name on any
modern platforms? */
-
+
Tprintf("get_plugin_data_sym(%s)\n", symname);
if (!err) {
p = calloc (1, sizeof (*p)); /* calloc initializes to NULL */
if (p == NULL) { err = ENOMEM; }
}
-
+
if (!err && (dirhandle != NULL) && (dirhandle->files != NULL)) {
int i = 0;
@@ -706,8 +706,8 @@ krb5int_get_plugin_dir_data (struct plugin_dir_handle *dirhandle,
count++;
newp = realloc (p, ((count + 1) * sizeof (*p))); /* +1 for NULL */
- if (newp == NULL) {
- err = ENOMEM;
+ if (newp == NULL) {
+ err = ENOMEM;
} else {
p = newp;
p[count - 1] = sym;
@@ -716,14 +716,14 @@ krb5int_get_plugin_dir_data (struct plugin_dir_handle *dirhandle,
}
}
}
-
+
if (!err) {
*ptrs = p;
p = NULL; /* ptrs takes ownership */
}
-
+
if (p != NULL) { free (p); }
-
+
return err;
}
@@ -743,29 +743,29 @@ krb5int_get_plugin_dir_func (struct plugin_dir_handle *dirhandle,
long err = 0;
void (**p)() = NULL;
size_t count = 0;
-
+
/* XXX Do we need to add a leading "_" to the symbol name on any
modern platforms? */
-
+
Tprintf("get_plugin_data_sym(%s)\n", symname);
-
+
if (!err) {
p = calloc (1, sizeof (*p)); /* calloc initializes to NULL */
if (p == NULL) { err = ENOMEM; }
}
-
+
if (!err && (dirhandle != NULL) && (dirhandle->files != NULL)) {
int i = 0;
-
+
for (i = 0; !err && (dirhandle->files[i] != NULL); i++) {
void (*sym)() = NULL;
-
+
if (krb5int_get_plugin_func (dirhandle->files[i], symname, &sym, ep) == 0) {
void (**newp)() = NULL;
count++;
newp = realloc (p, ((count + 1) * sizeof (*p))); /* +1 for NULL */
- if (newp == NULL) {
+ if (newp == NULL) {
err = ENOMEM;
} else {
p = newp;
@@ -775,13 +775,13 @@ krb5int_get_plugin_dir_func (struct plugin_dir_handle *dirhandle,
}
}
}
-
+
if (!err) {
*ptrs = p;
p = NULL; /* ptrs takes ownership */
}
-
+
if (p != NULL) { free (p); }
-
+
return err;
}
diff --git a/src/util/support/printf.c b/src/util/support/printf.c
index 0df8c84ca..88552d297 100644
--- a/src/util/support/printf.c
+++ b/src/util/support/printf.c
@@ -8,7 +8,7 @@
* require a specific license from the United States Government.
* It is the responsibility of any person or organization contemplating
* export to obtain such a license before exporting.
- *
+ *
* WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
* distribute this software and its documentation for any purpose and
* without fee is hereby granted, provided that the above copyright
@@ -22,7 +22,7 @@
* M.I.T. makes no representations about the suitability of
* this software for any purpose. It is provided "as is" without express
* or implied warranty.
- *
+ *
*
* Provide {,v}asprintf for platforms that don't have them.
*/
diff --git a/src/util/support/supp-int.h b/src/util/support/supp-int.h
index ffc0e6455..85641005f 100644
--- a/src/util/support/supp-int.h
+++ b/src/util/support/supp-int.h
@@ -8,7 +8,7 @@
* require a specific license from the United States Government.
* It is the responsibility of any person or organization contemplating
* export to obtain such a license before exporting.
- *
+ *
* WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
* distribute this software and its documentation for any purpose and
* without fee is hereby granted, provided that the above copyright
@@ -22,7 +22,7 @@
* M.I.T. makes no representations about the suitability of
* this software for any purpose. It is provided "as is" without express
* or implied warranty.
- *
+ *
*
* Internal prototypes for the krb5support library
*/
diff --git a/src/util/support/threads.c b/src/util/support/threads.c
index 316be8a1c..12b549286 100644
--- a/src/util/support/threads.c
+++ b/src/util/support/threads.c
@@ -8,7 +8,7 @@
* require a specific license from the United States Government.
* It is the responsibility of any person or organization contemplating
* export to obtain such a license before exporting.
- *
+ *
* WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
* distribute this software and its documentation for any purpose and
* without fee is hereby granted, provided that the above copyright
@@ -22,7 +22,7 @@
* M.I.T. makes no representations about the suitability of
* this software for any purpose. It is provided "as is" without express
* or implied warranty.
- *
+ *
*
* Preliminary thread support.
*/
@@ -83,7 +83,7 @@ void krb5int_thread_detach_hook (void)
}
}
-/* Stub function not used on Windows. */
+/* Stub function not used on Windows. */
int krb5int_pthread_loaded (void)
{
return 0;
@@ -187,15 +187,15 @@ static void thread_termination (void *tptr)
if (err == 0) {
int i, pass, none_found;
struct tsd_block *t = tptr;
-
+
/* Make multiple passes in case, for example, a libkrb5 cleanup
function wants to print out an error message, which causes
com_err to allocate a thread-specific buffer, after we just
freed up the old one.
-
+
Shouldn't actually happen, if we're careful, but check just in
case. */
-
+
pass = 0;
none_found = 0;
while (pass < 4 && !none_found) {
@@ -212,7 +212,7 @@ static void thread_termination (void *tptr)
free (t);
err = k5_mutex_unlock(&key_lock);
}
-
+
/* remove thread from global linked list */
}
diff --git a/src/util/support/utf8.c b/src/util/support/utf8.c
index 4468673dc..3d9021317 100644
--- a/src/util/support/utf8.c
+++ b/src/util/support/utf8.c
@@ -8,7 +8,7 @@
* require a specific license from the United States Government.
* It is the responsibility of any person or organization contemplating
* export to obtain such a license before exporting.
- *
+ *
* WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
* distribute this software and its documentation for any purpose and
* without fee is hereby granted, provided that the above copyright
@@ -117,7 +117,7 @@ int krb5int_utf8_charlen(const char *p)
/*
* Make sure the UTF-8 char used the shortest possible encoding
- * returns charlen if valid, 0 if not.
+ * returns charlen if valid, 0 if not.
*
* Here are the valid UTF-8 encodings, taken from RFC 2279 page 4.
* The table is slightly modified from that of the RFC.
@@ -336,7 +336,7 @@ int krb5int_utf8_copy(char* dst, const char *src)
for (i=1; i<6; i++) {
if ((u[i] & 0xc0) != 0x80) {
- return i;
+ return i;
}
dst[i] = src[i];
}
diff --git a/src/util/support/utf8_conv.c b/src/util/support/utf8_conv.c
index f972565f9..03303d744 100644
--- a/src/util/support/utf8_conv.c
+++ b/src/util/support/utf8_conv.c
@@ -8,7 +8,7 @@
* require a specific license from the United States Government.
* It is the responsibility of any person or organization contemplating
* export to obtain such a license before exporting.
- *
+ *
* WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
* distribute this software and its documentation for any purpose and
* without fee is hereby granted, provided that the above copyright
@@ -37,7 +37,7 @@
* <http://www.OpenLDAP.org/license.html>.
*/
/* Portions Copyright (C) 1999, 2000 Novell, Inc. All Rights Reserved.
- *
+ *
* THIS WORK IS SUBJECT TO U.S. AND INTERNATIONAL COPYRIGHT LAWS AND
* TREATIES. USE, MODIFICATION, AND REDISTRIBUTION OF THIS WORK IS SUBJECT
* TO VERSION 2.0.1 OF THE OPENLDAP PUBLIC LICENSE, A COPY OF WHICH IS
@@ -45,7 +45,7 @@
* IN THE TOP-LEVEL DIRECTORY OF THE DISTRIBUTION. ANY USE OR EXPLOITATION
* OF THIS WORK OTHER THAN AS AUTHORIZED IN VERSION 2.0.1 OF THE OPENLDAP
* PUBLIC LICENSE, OR OTHER PRIOR WRITTEN CONSENT FROM NOVELL, COULD SUBJECT
- * THE PERPETRATOR TO CRIMINAL AND CIVIL LIABILITY.
+ * THE PERPETRATOR TO CRIMINAL AND CIVIL LIABILITY.
*/
/*
@@ -86,22 +86,22 @@ k5_utf8s_to_ucs2s(krb5_ucs2 *ucs2str,
while (*utf8str && ucs2len < count) {
/* Get UTF-8 sequence length from 1st byte */
utflen = KRB5_UTF8_CHARLEN2(utf8str, utflen);
-
+
if (utflen == 0 || utflen > KRB5_MAX_UTF8_LEN)
return -1;
/* First byte minus length tag */
ch = (krb5_ucs2)(utf8str[0] & mask[utflen]);
-
+
for (i = 1; i < utflen; i++) {
/* Subsequent bytes must start with 10 */
if ((utf8str[i] & 0xc0) != 0x80)
return -1;
-
+
ch <<= 6; /* 6 bits of data in each subsequent byte */
ch |= (krb5_ucs2)(utf8str[i] & 0x3f);
}
-
+
if (ucs2str != NULL) {
#ifdef K5_BE
#ifndef SWAP16
@@ -119,7 +119,7 @@ k5_utf8s_to_ucs2s(krb5_ucs2 *ucs2str,
}
assert(ucs2len < count);
-
+
if (ucs2str != NULL) {
/* Add null terminator if there's room in the buffer. */
ucs2str[ucs2len] = 0;
@@ -284,7 +284,7 @@ k5_ucs2s_to_utf8s(char *utf8str, const krb5_ucs2 *ucs2str,
return len;
}
-
+
/* Do the actual conversion. */
n = 1; /* In case of empty ucs2str */
@@ -296,10 +296,10 @@ k5_ucs2s_to_utf8s(char *utf8str, const krb5_ucs2 *ucs2str,
#endif
n = krb5int_ucs2_to_utf8(ch, p);
-
+
if (n < 1)
break;
-
+
p += n;
count -= n; /* Space left in output buffer */
}
@@ -317,7 +317,7 @@ k5_ucs2s_to_utf8s(char *utf8str, const krb5_ucs2 *ucs2str,
if (n == -1) /* Conversion encountered invalid wide char. */
return -1;
- /* Return the number of bytes written to output buffer, excl null. */
+ /* Return the number of bytes written to output buffer, excl null. */
return (p - utf8str);
}
@@ -453,4 +453,3 @@ krb5int_ucs2lecs_to_utf8s(const unsigned char *ucs2les,
return 0;
}
-