aboutsummaryrefslogtreecommitdiffstats
path: root/src/utils/charset.cpp
diff options
context:
space:
mode:
authorlloyd <[email protected]>2009-03-30 18:27:18 +0000
committerlloyd <[email protected]>2009-03-30 18:27:18 +0000
commit96d6eb6f29c55e16a37cf11899547886f735b065 (patch)
tree9f13901e9b44c98d58b2589c9b09c6a7443eb7cd /src/utils/charset.cpp
parent3cc3dd72c5f87b76852a55c1f2d1821dba967d8c (diff)
Thomas Moschny passed along a request from the Fedora packagers which came
up during the Fedora submission review, that each source file include some text about the license. One handy Perl script later and each file now has the line Distributed under the terms of the Botan license after the copyright notices. While I was in there modifying every file anyway, I also stripped out the remainder of the block comments (lots of astericks before and after the text); this is stylistic thing I picked up when I was first learning C++ but in retrospect it is not a good style as the structure makes it harder to modify comments (with the result that comments become fewer, shorter and are less likely to be updated, which are not good things).
Diffstat (limited to 'src/utils/charset.cpp')
-rw-r--r--src/utils/charset.cpp64
1 files changed, 33 insertions, 31 deletions
diff --git a/src/utils/charset.cpp b/src/utils/charset.cpp
index 73c520be1..53125cad1 100644
--- a/src/utils/charset.cpp
+++ b/src/utils/charset.cpp
@@ -1,7 +1,9 @@
-/*************************************************
-* Character Set Handling Source File *
-* (C) 1999-2007 Jack Lloyd *
-*************************************************/
+/*
+* Character Set Handling
+* (C) 1999-2007 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
#include <botan/charset.h>
#include <botan/parsing.h>
@@ -14,9 +16,9 @@ namespace Charset {
namespace {
-/*************************************************
-* Convert from UCS-2 to ISO 8859-1 *
-*************************************************/
+/*
+* Convert from UCS-2 to ISO 8859-1
+*/
std::string ucs2_to_latin1(const std::string& ucs2)
{
if(ucs2.size() % 2 == 1)
@@ -38,9 +40,9 @@ std::string ucs2_to_latin1(const std::string& ucs2)
return latin1;
}
-/*************************************************
-* Convert from UTF-8 to ISO 8859-1 *
-*************************************************/
+/*
+* Convert from UTF-8 to ISO 8859-1
+*/
std::string utf8_to_latin1(const std::string& utf8)
{
std::string iso8859;
@@ -72,9 +74,9 @@ std::string utf8_to_latin1(const std::string& utf8)
return iso8859;
}
-/*************************************************
-* Convert from ISO 8859-1 to UTF-8 *
-*************************************************/
+/*
+* Convert from ISO 8859-1 to UTF-8
+*/
std::string latin1_to_utf8(const std::string& iso8859)
{
std::string utf8;
@@ -95,9 +97,9 @@ std::string latin1_to_utf8(const std::string& iso8859)
}
-/*************************************************
-* Perform character set transcoding *
-*************************************************/
+/*
+* Perform character set transcoding
+*/
std::string transcode(const std::string& str,
Character_Set to, Character_Set from)
{
@@ -120,9 +122,9 @@ std::string transcode(const std::string& str,
to_string(from) + " to " + to_string(to));
}
-/*************************************************
-* Check if a character represents a digit *
-*************************************************/
+/*
+* Check if a character represents a digit
+*/
bool is_digit(char c)
{
if(c == '0' || c == '1' || c == '2' || c == '3' || c == '4' ||
@@ -131,9 +133,9 @@ bool is_digit(char c)
return false;
}
-/*************************************************
-* Check if a character represents whitespace *
-*************************************************/
+/*
+* Check if a character represents whitespace
+*/
bool is_space(char c)
{
if(c == ' ' || c == '\t' || c == '\n' || c == '\r')
@@ -141,9 +143,9 @@ bool is_space(char c)
return false;
}
-/*************************************************
-* Convert a character to a digit *
-*************************************************/
+/*
+* Convert a character to a digit
+*/
byte char2digit(char c)
{
switch(c)
@@ -163,9 +165,9 @@ byte char2digit(char c)
throw Invalid_Argument("char2digit: Input is not a digit character");
}
-/*************************************************
-* Convert a digit to a character *
-*************************************************/
+/*
+* Convert a digit to a character
+*/
char digit2char(byte b)
{
switch(b)
@@ -185,9 +187,9 @@ char digit2char(byte b)
throw Invalid_Argument("digit2char: Input is not a digit");
}
-/*************************************************
-* Case-insensitive character comparison *
-*************************************************/
+/*
+* Case-insensitive character comparison
+*/
bool caseless_cmp(char a, char b)
{
return (std::tolower(static_cast<unsigned char>(a)) ==