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