Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 233447
Collapse All | Expand All

(-)krystaldrop/Sources/KDpp/Resources/ArchiveReader.h.old (-1 / +20 lines)
Lines 2-8 Link Here
2
#define ArchiveReader_H
2
#define ArchiveReader_H
3
3
4
#include <map>
4
#include <map>
5
#include <string>
5
#include <cstring>
6
#include <locale>
7
8
/* 
9
 * structs needed for std::transform() 
10
 * See: http://gcc.gnu.org/onlinedocs/libstdc++/22_locale/howto.html#7 
11
 */ 
12
struct ToUpper { 
13
	ToUpper(std::locale const& l) : loc(l) {;} 
14
	char operator() (char c) const  { return std::toupper(c,loc); } 
15
private: 
16
	std::locale const& loc; 
17
}; 
18
	 
19
struct ToLower { 
20
	ToLower(std::locale const& l) : loc(l) {;} 
21
	char operator() (char c) const  { return std::tolower(c,loc); } 
22
private: 
23
	std::locale const& loc; 
24
}; 
6
25
7
/** \c KD_ArchiveReader is a generic abstract class which reads a specific kind of archive
26
/** \c KD_ArchiveReader is a generic abstract class which reads a specific kind of archive
8
    (`.zip' for instance)
27
    (`.zip' for instance)
(-)krystaldrop/Sources/KDpp/Resources/ArchiveManager.cpp.old (-5 / +6 lines)
Lines 1-10 Link Here
1
#include <assert.h>
1
#include <cassert>
2
#include <algorithm>
2
3
3
#include "ArchiveManager.h"
4
#include "ArchiveManager.h"
4
#include "../Tools/Logfile.h"
5
#include "../Tools/Logfile.h"
5
6
6
#ifndef _WIN32
7
#ifndef _WIN32
7
#include <ctype.h>
8
#include <cctype>
8
#endif
9
#endif
9
10
10
std::map<std::string,KD_ArchiveReader*> KD_ArchiveManager::opened_archives;
11
std::map<std::string,KD_ArchiveReader*> KD_ArchiveManager::opened_archives;
Lines 25-31 Link Here
25
  opened_archives.clear();
26
  opened_archives.clear();
26
}
27
}
27
28
28
29
void KD_ArchiveManager::RegisterArchiveFormat (std::string suffix, T_ArchiveReaderFactory reader_factory)
29
void KD_ArchiveManager::RegisterArchiveFormat (std::string suffix, T_ArchiveReaderFactory reader_factory)
30
{
30
{
31
  NormalizeSuffix (suffix);
31
  NormalizeSuffix (suffix);
Lines 36-44 Link Here
36
36
37
37
38
void KD_ArchiveManager::NormalizeSuffix (std::string& suffix)
38
void KD_ArchiveManager::NormalizeSuffix (std::string& suffix)
39
{
39
{  
40
  ToLower __tolower(std::locale::classic());
40
  // stores the suffix lower-case
41
  // stores the suffix lower-case
41
  transform (suffix.begin(), suffix.end(), suffix.begin(), tolower);
42
  transform (suffix.begin(), suffix.end(), suffix.begin(), __tolower);
42
43
43
   // add the dot character `.' if it is missing
44
   // add the dot character `.' if it is missing
44
  if (suffix[0]!= '.') suffix= '.'+ suffix;
45
  if (suffix[0]!= '.') suffix= '.'+ suffix;
(-)krystaldrop/Sources/KDpp/Tools/FilePath.cpp.old (-5 / +7 lines)
Lines 1-12 Link Here
1
#include "FilePath.h"
1
#include "FilePath.h"
2
2
3
#include <stdio.h>
3
#include <cstdio>
4
#include <algorithm>
4
5
5
#ifndef _WIN32
6
#ifndef _WIN32
6
#include <ctype.h>
7
#include <cctype>
7
#endif
8
#endif
8
9
9
10
KD_FilePath::KD_FilePath() : fileName("") , filePath(""), archiveName(""), archiveSuffix("")
10
KD_FilePath::KD_FilePath() : fileName("") , filePath(""), archiveName(""), archiveSuffix("")
11
{
11
{
12
}
12
}
Lines 165-172 Link Here
165
	// (*not* the first one found scanning from left to right)
165
	// (*not* the first one found scanning from left to right)
166
166
167
	// the search is case-insensitive -> lower-casificator in action
167
	// the search is case-insensitive -> lower-casificator in action
168
	ToLower __tolower(std::locale::classic());
168
	string copy_directory = directory;
169
	string copy_directory = directory;
169
	transform (copy_directory.begin(), copy_directory.end(), copy_directory.begin(), tolower);
170
	transform (copy_directory.begin(), copy_directory.end(), copy_directory.begin(), __tolower);
170
171
171
	map<string,T_ArchiveReaderFactory>::iterator suffix_iter=
172
	map<string,T_ArchiveReaderFactory>::iterator suffix_iter=
172
		KD_ArchiveManager::known_suffixes.begin();
173
		KD_ArchiveManager::known_suffixes.begin();
Lines 271-276 Link Here
271
272
272
string KD_FilePath::GetFileExtension() const
273
string KD_FilePath::GetFileExtension() const
273
{
274
{
275
	ToLower __tolower(std::locale::classic());
274
	size_t pos = fileName.rfind('.');
276
	size_t pos = fileName.rfind('.');
275
	if (pos == fileName.npos)
277
	if (pos == fileName.npos)
276
		return "";
278
		return "";
Lines 280-286 Link Here
280
	for (unsigned int i=0; i<ext.size(); i++)
282
	for (unsigned int i=0; i<ext.size(); i++)
281
		ext[i] = tolower(ext[i]);
283
		ext[i] = tolower(ext[i]);
282
*/
284
*/
283
	transform (ext.begin(), ext.end(), ext.begin(), tolower);
285
	transform (ext.begin(), ext.end(), ext.begin(), __tolower);
284
	return ext;
286
	return ext;
285
}
287
}
286
288

Return to bug 233447