Decouple <cstddef>

This commit is contained in:
Martin Natano
2023-04-19 23:04:25 +02:00
parent 093675cdc3
commit 78fb2e9fc3
171 changed files with 2012 additions and 1786 deletions
+7 -5
View File
@@ -8,10 +8,12 @@
#include "SpecialFiles.h"
#include "CommonMetrics.h"
#include <cstddef>
/*
* A quick explanation of song cache hashes: Each song has two hashes; a hash of the
* song path, and a hash of the song directory. The former is Song::GetCacheFilePath;
* it stays the same if the contents of the directory change. The latter is
* it stays the same if the contents of the directory change. The latter is
* GetHashForDirectory(m_sSongDir), and changes on each modification.
*
* The file hash is used as the cache filename. We don't want to use the directory
@@ -35,7 +37,7 @@ RString SongCacheIndex::GetCacheFilePath( const RString &sGroup, const RString &
/* Don't use GetHashForFile, since we don't want to spend time
* checking the file size and date. */
RString s;
if( sPath.size() > 2 && sPath[0] == '/' && sPath[sPath.size()-1] == '/' )
s.assign( sPath, 1, sPath.size() - 2 );
else if( sPath.size() > 1 && sPath[0] == '/' )
@@ -48,7 +50,7 @@ RString SongCacheIndex::GetCacheFilePath( const RString &sGroup, const RString &
* so we should probably replace them with combining diacritics.
* XXX How do we do this and is it even worth it? */
const char *invalid = "/\xc0\xc1\xfe\xff\xf8\xf9\xfa\xfb\xfc\xfd\xf5\xf6\xf7";
for( size_t pos = s.find_first_of(invalid); pos != RString::npos; pos = s.find_first_of(invalid, pos) )
for( std::size_t pos = s.find_first_of(invalid); pos != RString::npos; pos = s.find_first_of(invalid, pos) )
s[pos] = '_';
// CACHE_DIR ends with a /.
return ssprintf( "%s%s/%s", SpecialFiles::CACHE_DIR.c_str(), sGroup.c_str(), s.c_str() );
@@ -148,7 +150,7 @@ RString SongCacheIndex::MangleName( const RString &Name )
/*
* (c) 2002-2003 Glenn Maynard
* All rights reserved.
*
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
@@ -158,7 +160,7 @@ RString SongCacheIndex::MangleName( const RString &Name )
* copyright notice(s) and this permission notice appear in all copies of
* the Software and that both the above copyright notice(s) and this
* permission notice appear in supporting documentation.
*
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF