/[projects]/smsdaemon/Util.cpp
ViewVC logotype

Diff of /smsdaemon/Util.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 141 by torben, Sun Dec 7 13:28:52 2008 UTC revision 183 by torben, Fri Dec 12 13:57:10 2008 UTC
# Line 13  Line 13 
13  #include <stdlib.h>  #include <stdlib.h>
14    
15  #include <cstring>  #include <cstring>
16  #include "util.h"  #include "Util.h"
17    
18  using namespace std;  using namespace std;
19    
# Line 168  namespace Util Line 168  namespace Util
168                  return retval;                  return retval;
169          }          }
170    
171          char my_toupper(char ch)          char danish_map[3][2] = { {198,230}, {216,248}, {197,229} }; // aelig, oslash, aring
172    
173            unsigned char my_toupper(unsigned char ch)
174          {          {
175                  if (ch == 'æ')                  if (ch == 230)
176                          return 'Æ';                          return 198;
177                  if (ch == 'ø')                  if (ch == 248)
178                          return 'Ø';                          return 216;
179                  if (ch == 'å')                  if (ch == 229)
180                          return 'Å';                          return 197;
181    
182                  return ::toupper(ch);                  return ::toupper(ch);
183          }          }
184    
185          char my_tolower(char ch)          unsigned char my_tolower(unsigned char ch)
186          {          {
187                  if (ch == 'Æ')                  if (ch == 198)
188                          return 'æ';                          return 230;
189                  if (ch == 'Ø')                  if (ch == 216)
190                          return 'ø';                          return 248;
191                  if (ch == 'Å')                  if (ch == 197)
192                          return 'å';                          return 229;
193    
194                  return ::tolower(ch);                  return ::tolower(ch);
195          }          }
# Line 403  namespace Util Line 405  namespace Util
405                  ifstream in(filename.c_str());                  ifstream in(filename.c_str());
406                  if (in)                  if (in)
407                  {                  {
408                          char buffer[2048];                          char buffer[4096];
409                          in.read(buffer, 2047);                          in.read(buffer, 4095);
410                          buffer[ in.gcount() ] = 0;                          buffer[ in.gcount() ] = 0;
411                          str = string(buffer);                          str = string(buffer);
412                          in.close();                          in.close();
413                  }                  }
414                  else                  else
415                  {                  {
416                          string message =  "Could no open ";                          string message =  "Could not open ";
417                          message +=  filename;                          message +=  filename;
418                          throw std::runtime_error(message);                          throw std::runtime_error(message);
419                  }                  }

Legend:
Removed from v.141  
changed lines
  Added in v.183

  ViewVC Help
Powered by ViewVC 1.1.20