~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/pbms/src/cslib/CSXML.cc

  • Committer: Brian Aker
  • Date: 2010-07-09 21:43:25 UTC
  • mfrom: (1643.5.1 dr-bug-600624)
  • Revision ID: brian@gaz-20100709214325-4rllc5yyo6bku5sh
Merge Prafulla Tekawade

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* Copyright (C) 2010 PrimeBase Technologies GmbH, Germany
 
1
/* Copyright (c) 2010 PrimeBase Technologies GmbH, Germany
2
2
 *
3
3
 * PrimeBase Media Stream for MySQL
4
4
 *
14
14
 *
15
15
 * You should have received a copy of the GNU General Public License
16
16
 * along with this program; if not, write to the Free Software
17
 
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 
17
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
18
 *
19
19
 * Paul McCullagh (H&G2JCtL)
20
20
 *
35
35
#include <stdio.h>
36
36
#include <errno.h>
37
37
 
38
 
#ifdef DRIZZLED
39
38
#include <boost/algorithm/string.hpp>
40
 
#define STRCASESTR(s1, s2) boost::ifind_first(s1, s2)
41
 
#else
42
 
#define STRCASESTR(s1, s2) strcasestr(s1, s2)
43
 
#endif
44
39
 
45
40
#include "CSXML.h"
46
41
 
1218
1213
                        if (this->ip) {
1219
1214
                                if (strcasecmp(this->pr_name, "encoding") == 0) {
1220
1215
                                        strcpy(this->charset, this->pr_value);
1221
 
                                        if (STRCASESTR(this->charset, "utf-8"))
 
1216
                                        if (boost::ifind_first(this->charset, "utf-8"))
1222
1217
                                                this->charset_type = CHARSET_UTF_8;
1223
 
                                        else if (STRCASESTR(this->charset, "ucs-2") ||
1224
 
                                                STRCASESTR(this->charset, "ucs-4") ||
1225
 
                                                STRCASESTR(this->charset, "unicode"))
 
1218
                                        else if (boost::ifind_first(this->charset, "ucs-2") ||
 
1219
                                                boost::ifind_first(this->charset, "ucs-4") ||
 
1220
                                                boost::ifind_first(this->charset, "unicode"))
1226
1221
                                                this->charset_type = CHARSET_STANDARD;
1227
1222
                                        else {
1228
1223
                                                this->charset_type = CHARSET_TO_CONVERT_8_BIT;
1293
1288
 
1294
1289
        switch (err) {
1295
1290
                case CS_XML_ERR_OUT_OF_MEMORY:
1296
 
                        snprintf(err_message, CS_XML_ERR_MSG_SIZE, "AES parse error- insufficient memory");                     
 
1291
                        sprintf(err_message, "AES parse error- insufficient memory");                   
1297
1292
                        break;
1298
1293
                case CS_XML_ERR_CHAR_TOO_LARGE:
1299
 
                        snprintf(err_message, CS_XML_ERR_MSG_SIZE, "AES parse error- UNICODE character too large to be encoded as UTF-8");                      
 
1294
                        sprintf(err_message, "AES parse error- UNICODE character too large to be encoded as UTF-8");                    
1300
1295
                        break;
1301
1296
                default:
1302
 
                        snprintf(err_message, CS_XML_ERR_MSG_SIZE, "AES parse error- %s", strerror(err));
 
1297
                        sprintf(err_message, "AES parse error- %s", strerror(err));
1303
1298
                        break;
1304
1299
        }
1305
1300
}