Use size_t for indexing where appropriate.
MSVC (rightly) complains about this.pull/4/head
parent
062344e40d
commit
8c83a4a212
|
@ -890,7 +890,7 @@ void SolveSpaceUI::ExportMeshAsThreeJsTo(FILE *f, const std::string &filename,
|
|||
if(lastSlash == std::string::npos) oops();
|
||||
baseFilename.erase(0, lastSlash + 1);
|
||||
|
||||
for(int i = 0; i < baseFilename.length(); i++) {
|
||||
for(size_t i = 0; i < baseFilename.length(); i++) {
|
||||
if(!isalpha(baseFilename[i]) &&
|
||||
/* also permit UTF-8 */ !((unsigned char)baseFilename[i] >= 0x80))
|
||||
baseFilename[i] = '_';
|
||||
|
|
10
src/file.cpp
10
src/file.cpp
|
@ -695,13 +695,13 @@ static std::string MakePathRelative(const std::string &base, const std::string &
|
|||
resultParts;
|
||||
baseParts.pop_back();
|
||||
|
||||
int common;
|
||||
size_t common;
|
||||
for(common = 0; common < baseParts.size() && common < pathParts.size(); common++) {
|
||||
if(!PlatformPathEqual(baseParts[common], pathParts[common]))
|
||||
break;
|
||||
}
|
||||
|
||||
for(int i = common; i < baseParts.size(); i++)
|
||||
for(size_t i = common; i < baseParts.size(); i++)
|
||||
resultParts.push_back("..");
|
||||
|
||||
resultParts.insert(resultParts.end(),
|
||||
|
@ -732,7 +732,7 @@ static std::string MakePathAbsolute(const std::string &base, const std::string &
|
|||
|
||||
static void PathSepNormalize(std::string &filename)
|
||||
{
|
||||
for(int i = 0; i < filename.length(); i++) {
|
||||
for(size_t i = 0; i < filename.length(); i++) {
|
||||
if(filename[i] == '\\')
|
||||
filename[i] = '/';
|
||||
}
|
||||
|
@ -742,7 +742,7 @@ static std::string PathSepPlatformToUNIX(const std::string &filename)
|
|||
{
|
||||
#if defined(WIN32)
|
||||
std::string result = filename;
|
||||
for(int i = 0; i < result.length(); i++) {
|
||||
for(size_t i = 0; i < result.length(); i++) {
|
||||
if(result[i] == '\\')
|
||||
result[i] = '/';
|
||||
}
|
||||
|
@ -756,7 +756,7 @@ static std::string PathSepUNIXToPlatform(const std::string &filename)
|
|||
{
|
||||
#if defined(WIN32)
|
||||
std::string result = filename;
|
||||
for(int i = 0; i < result.length(); i++) {
|
||||
for(size_t i = 0; i < result.length(); i++) {
|
||||
if(result[i] == '/')
|
||||
result[i] = '\\';
|
||||
}
|
||||
|
|
|
@ -204,7 +204,7 @@ void Group::MenuGroup(int id) {
|
|||
if(pos != std::string::npos)
|
||||
groupName.erase(pos);
|
||||
|
||||
for(int i = 0; i < groupName.length(); i++) {
|
||||
for(size_t i = 0; i < groupName.length(); i++) {
|
||||
if(!(isalnum(groupName[i]) || (unsigned)groupName[i] >= 0x80)) {
|
||||
// convert punctuation to dashes
|
||||
groupName[i] = '-';
|
||||
|
|
|
@ -35,7 +35,7 @@ std::string Style::CnfWidth(const std::string &prefix) {
|
|||
std::string Style::CnfPrefixToName(const std::string &prefix) {
|
||||
std::string name = "#def-";
|
||||
|
||||
for(int i = 0; i < prefix.length(); i++) {
|
||||
for(size_t i = 0; i < prefix.length(); i++) {
|
||||
if(isupper(prefix[i]) && i != 0)
|
||||
name += '-';
|
||||
name += tolower(prefix[i]);
|
||||
|
|
|
@ -217,7 +217,7 @@ int main(int argc, char** argv) {
|
|||
deflate(&stream, Z_FINISH);
|
||||
|
||||
chunk_output_size[chunk_index] += sizeof(compressed_chunk_data) - stream.avail_out;
|
||||
for(int i = 0; i < sizeof(compressed_chunk_data) - stream.avail_out; i += 16) {
|
||||
for(size_t i = 0; i < sizeof(compressed_chunk_data) - stream.avail_out; i += 16) {
|
||||
unsigned char *d = &compressed_chunk_data[i];
|
||||
fprintf(source, " %3d, %3d, %3d, %3d, %3d, %3d, %3d, %3d, "
|
||||
"%3d, %3d, %3d, %3d, %3d, %3d, %3d, %3d,\n",
|
||||
|
|
Loading…
Reference in New Issue