Gentoo Archives: gentoo-commits

From: "Michael Sterrett (mr_bones_)" <mr_bones_@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in games-puzzle/krystaldrop/files: krystaldrop-0.7.2-gcc43.patch
Date: Thu, 31 Jul 2008 04:21:58
Message-Id: E1KOPfo-0003mZ-4w@stork.gentoo.org
1 mr_bones_ 08/07/31 04:21:56
2
3 Added: krystaldrop-0.7.2-gcc43.patch
4 Log:
5 patch for building with gcc-4.3 submitted by Jabari R. Roberts via bug #233447
6 (Portage version: 2.1.4.4)
7
8 Revision Changes Path
9 1.1 games-puzzle/krystaldrop/files/krystaldrop-0.7.2-gcc43.patch
10
11 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/games-puzzle/krystaldrop/files/krystaldrop-0.7.2-gcc43.patch?rev=1.1&view=markup
12 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/games-puzzle/krystaldrop/files/krystaldrop-0.7.2-gcc43.patch?rev=1.1&content-type=text/plain
13
14 Index: krystaldrop-0.7.2-gcc43.patch
15 ===================================================================
16 --- krystaldrop/Sources/KDpp/Resources/ArchiveReader.h.old 2008-07-30 22:05:18.000000000 -0500
17 +++ krystaldrop/Sources/KDpp/Resources/ArchiveReader.h 2008-07-30 22:27:20.000000000 -0500
18 @@ -2,7 +2,26 @@
19 #define ArchiveReader_H
20
21 #include <map>
22 -#include <string>
23 +#include <cstring>
24 +#include <locale>
25 +
26 +/*
27 + * structs needed for std::transform()
28 + * See: http://gcc.gnu.org/onlinedocs/libstdc++/22_locale/howto.html#7
29 + */
30 +struct ToUpper {
31 + ToUpper(std::locale const& l) : loc(l) {;}
32 + char operator() (char c) const { return std::toupper(c,loc); }
33 +private:
34 + std::locale const& loc;
35 +};
36 +
37 +struct ToLower {
38 + ToLower(std::locale const& l) : loc(l) {;}
39 + char operator() (char c) const { return std::tolower(c,loc); }
40 +private:
41 + std::locale const& loc;
42 +};
43
44 /** \c KD_ArchiveReader is a generic abstract class which reads a specific kind of archive
45 (`.zip' for instance)
46 --- krystaldrop/Sources/KDpp/Resources/ArchiveManager.cpp.old 2008-07-30 20:53:19.000000000 -0500
47 +++ krystaldrop/Sources/KDpp/Resources/ArchiveManager.cpp 2008-07-30 22:35:54.000000000 -0500
48 @@ -1,10 +1,11 @@
49 -#include <assert.h>
50 +#include <cassert>
51 +#include <algorithm>
52
53 #include "ArchiveManager.h"
54 #include "../Tools/Logfile.h"
55
56 #ifndef _WIN32
57 -#include <ctype.h>
58 +#include <cctype>
59 #endif
60
61 std::map<std::string,KD_ArchiveReader*> KD_ArchiveManager::opened_archives;
62 @@ -25,7 +26,6 @@
63 opened_archives.clear();
64 }
65
66 -
67 void KD_ArchiveManager::RegisterArchiveFormat (std::string suffix, T_ArchiveReaderFactory reader_factory)
68 {
69 NormalizeSuffix (suffix);
70 @@ -36,9 +36,10 @@
71
72
73 void KD_ArchiveManager::NormalizeSuffix (std::string& suffix)
74 -{
75 +{
76 + ToLower __tolower(std::locale::classic());
77 // stores the suffix lower-case
78 - transform (suffix.begin(), suffix.end(), suffix.begin(), tolower);
79 + transform (suffix.begin(), suffix.end(), suffix.begin(), __tolower);
80
81 // add the dot character `.' if it is missing
82 if (suffix[0]!= '.') suffix= '.'+ suffix;
83 --- krystaldrop/Sources/KDpp/Tools/FilePath.cpp.old 2008-07-30 20:55:13.000000000 -0500
84 +++ krystaldrop/Sources/KDpp/Tools/FilePath.cpp 2008-07-30 22:37:05.000000000 -0500
85 @@ -1,12 +1,12 @@
86 #include "FilePath.h"
87
88 -#include <stdio.h>
89 +#include <cstdio>
90 +#include <algorithm>
91
92 #ifndef _WIN32
93 -#include <ctype.h>
94 +#include <cctype>
95 #endif
96
97 -
98 KD_FilePath::KD_FilePath() : fileName("") , filePath(""), archiveName(""), archiveSuffix("")
99 {
100 }
101 @@ -165,8 +165,9 @@
102 // (*not* the first one found scanning from left to right)
103
104 // the search is case-insensitive -> lower-casificator in action
105 + ToLower __tolower(std::locale::classic());
106 string copy_directory = directory;
107 - transform (copy_directory.begin(), copy_directory.end(), copy_directory.begin(), tolower);
108 + transform (copy_directory.begin(), copy_directory.end(), copy_directory.begin(), __tolower);
109
110 map<string,T_ArchiveReaderFactory>::iterator suffix_iter=
111 KD_ArchiveManager::known_suffixes.begin();
112 @@ -271,6 +272,7 @@
113
114 string KD_FilePath::GetFileExtension() const
115 {
116 + ToLower __tolower(std::locale::classic());
117 size_t pos = fileName.rfind('.');
118 if (pos == fileName.npos)
119 return "";
120 @@ -280,7 +282,7 @@
121 for (unsigned int i=0; i<ext.size(); i++)
122 ext[i] = tolower(ext[i]);
123 */
124 - transform (ext.begin(), ext.end(), ext.begin(), tolower);
125 + transform (ext.begin(), ext.end(), ext.begin(), __tolower);
126 return ext;
127 }