[SCM] Development for GoFind! branch, master, updated. 55f61099fe16ea0c9572c7473dbe3509ac064db6

Miriam Ruiz miriam at debian.org
Wed May 6 17:19:55 UTC 2009


The following commit has been merged in the master branch:
commit 55f61099fe16ea0c9572c7473dbe3509ac064db6
Author: Miriam Ruiz <miriam at debian.org>
Date:   Wed May 6 19:27:04 2009 +0200

    Started integration of utf8::html and pkgdata

diff --git a/pkgdata.cpp b/pkgdata.cpp
index a4eb595..91e77f7 100644
--- a/pkgdata.cpp
+++ b/pkgdata.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2008  Miriam Ruiz <little_miry at yahoo.es>
+ * Copyright (C) 2008-2009  Miriam Ruiz <little_miry at yahoo.es>
  *
  * http://www.jdkoftinoff.com/main/Articles/Linux_Articles/ELF_Plugins/ 
  *
@@ -22,6 +22,7 @@
 
 #include "pkgdata.h"
 #include "common.h"
+#include "utf8/html.h"
 
 #include "Environment.h"
 #include "GamesOptions.h"
@@ -34,6 +35,7 @@
 #include <xapian.h>
 
 #include <iostream>
+#include <string>
 #include <cmath>
 #include <vector>
 
@@ -104,6 +106,10 @@ static const char legalchars[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghij
 
 void PackageData::AddTextAsHTML(const std::string &in_text, std::string &out_html)
 {
+	std::ostringstream os;
+	utf8::html::QuoteHTML(std::cout, in_text.c_str());
+	std::cout << os.str() << std::endl;
+
 	const char *text = in_text.c_str();
 	const char *src = text;
 	//out_html.erase();
diff --git a/pkgdata.h b/pkgdata.h
index ea229ff..93bfba9 100644
--- a/pkgdata.h
+++ b/pkgdata.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2008  Miriam Ruiz <little_miry at yahoo.es>
+ * Copyright (C) 2008-2009  Miriam Ruiz <little_miry at yahoo.es>
  *
  * http://www.jdkoftinoff.com/main/Articles/Linux_Articles/ELF_Plugins/ 
  *
diff --git a/utf8/html.cpp b/utf8/html.cpp
index 0ecb308..1e735ad 100644
--- a/utf8/html.cpp
+++ b/utf8/html.cpp
@@ -1,5 +1,26 @@
+/*
+ * Copyright (C) 2009  Miriam Ruiz <little_miry at yahoo.es>
+ *
+ * http://www.jdkoftinoff.com/main/Articles/Linux_Articles/ELF_Plugins/ 
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
 #include "../common.h"
 #include "parser.h"
+#include "html.h"
 
 #include <stdlib.h>
 #include <stdint.h>
@@ -9,6 +30,8 @@
 #include <string>
 #include <map>
 
+namespace utf8 { namespace html {
+
 typedef struct {
 	const char * Name;
 	unsigned int Char;
@@ -323,7 +346,7 @@ void QuoteHTML(std::ostream &out, const char *in)
 	{
 		unsigned long int ch;
 		int adv = utf8::parser::utf8_to_char(&ch, ptr, len);
-		if (adv && len > adv)
+		if (adv && len >= adv)
 		{
 			Char2UTF8Map::iterator it = char2utf8.find(ch);
 			if (ch < 128)
@@ -346,9 +369,12 @@ void QuoteHTML(std::ostream &out, const char *in)
 	}
 }
 
+} } // Close namespaces
 
 #ifdef UNIT_TEST
 
+using namespace utf8::html;
+
 static uint32_t Ch2UTF8(unsigned int ch) // Writes ch in UTF-8 encoding. Only 16 bits
 {
 	if (ch >= 0x800)
diff --git a/cfgmanager.cpp b/utf8/html.h
similarity index 65%
copy from cfgmanager.cpp
copy to utf8/html.h
index e88b595..17cab36 100644
--- a/cfgmanager.cpp
+++ b/utf8/html.h
@@ -1,5 +1,7 @@
 /*
- * Copyright (C) 2008  Miriam Ruiz <little_miry at yahoo.es>
+ * Copyright (C) 2009  Miriam Ruiz <little_miry at yahoo.es>
+ *
+ * http://www.jdkoftinoff.com/main/Articles/Linux_Articles/ELF_Plugins/ 
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -16,19 +18,19 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-#include "common.h"
-#include "cfgmanager.h"
+#ifndef _GOPLAY_UTF8_PARSER_H
+#define _GOPLAY_UTF8_PARSER_H
 
-ConfigManager::ConfigManager()
-{
-}
+#include <cstdlib>
 
-ConfigManager::~ConfigManager()
+namespace utf8
 {
-}
+	namespace html
+	{
 
-#ifdef UNIT_TEST
-TEST_FUNCTION TestCuConfigManager(CuTest* tc)
-{
-}
-#endif
+		void QuoteHTML(std::ostream &out, const char *in);
+
+	} // namespace utf8::html
+} // namespace utf8
+
+#endif // _GOPLAY_UTF8_PARSER_H
diff --git a/utf8/parser.h b/utf8/parser.h
index 19d0153..a4d5e59 100644
--- a/utf8/parser.h
+++ b/utf8/parser.h
@@ -46,6 +46,7 @@ namespace utf8
 		int is_nfc(const char *input, size_t length);
 		int check(const char *string, size_t length);
 
-	}							 // namespace utf8::parser
-}								 // namespace utf8
-#endif							 // _GOPLAY_UTF8_PARSER_H
+	} // namespace utf8::parser
+} // namespace utf8
+
+#endif // _GOPLAY_UTF8_PARSER_H

-- 
Development for GoFind!



More information about the Pkg-games-commits mailing list