Ignore:
Timestamp:
May 2, 2011 4:58:39 AM (9 years ago)
Author:
stefan
Message:

fix compiler warnings, including one that pointed to a bug

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Clp/src/CbcOrClpParam.cpp

    r1724 r1726  
    44// This code is licensed under the terms of the Eclipse Public License (EPL).
    55
    6 #if defined(_MSC_VER)
    7 // Turn off compiler warning about long names
    8 #  pragma warning(disable:4786)
    9 #endif
    10 
     6#include "CoinPragma.hpp"
    117#include "CbcOrClpParam.hpp"
    128
     
    537533#endif
    538534     case CLP_PARAM_DBL_ZEROTOLERANCE:
    539           model->setSmallElementValue(value);
     535          value = model->getSmallElementValue();
    540536          break;
    541537     case CLP_PARAM_DBL_DUALBOUND:
     
    10201016extern int CbcOrClpRead_mode;
    10211017int CbcOrClpEnvironmentIndex = -1;
    1022 static int fillEnv()
     1018static size_t fillEnv()
    10231019{
    10241020#if defined(_MSC_VER) || defined(__MSVCRT__)
     
    10271023     // Don't think it will work on Windows
    10281024     char * environ = getenv("CBC_CLP_ENVIRONMENT");
    1029      int length = 0;
     1025     size_t length = 0;
    10301026     if (environ) {
    10311027          length = strlen(environ);
    1032           if (CbcOrClpEnvironmentIndex < length) {
     1028          if (CbcOrClpEnvironmentIndex < static_cast<int>(length)) {
    10331029               // find next non blank
    10341030               char * whereEnv = environ + CbcOrClpEnvironmentIndex;
     
    10471043                    whereEnv++;
    10481044               }
    1049                CbcOrClpEnvironmentIndex = whereEnv - environ;
     1045               CbcOrClpEnvironmentIndex = static_cast<int>(whereEnv - environ);
    10501046               *put = '\0';
    10511047               length = strlen(line);
     
    12361232          afterEquals = "";
    12371233     }
    1238      int value = 0;
     1234     long int value = 0;
    12391235     //std::cout<<field<<std::endl;
    12401236     if (field != "EOL") {
     
    12521248          *valid = 2;
    12531249     }
    1254      return value;
     1250     return static_cast<int>(value);
    12551251}
    12561252double
     
    34053401               if (numberRows == numberRowsFile && numberColumns == numberColumnsFile) {
    34063402                    nRead = fread(primalRowSolution, sizeof(double), numberRows, fp);
    3407                     if (nRead != numberRows)
     3403                    if (nRead != static_cast<size_t>(numberRows))
    34083404                         throw("Error in fread");
    34093405                    nRead = fread(dualRowSolution, sizeof(double), numberRows, fp);
    3410                     if (nRead != numberRows)
     3406                    if (nRead != static_cast<size_t>(numberRows))
    34113407                         throw("Error in fread");
    34123408                    nRead = fread(primalColumnSolution, sizeof(double), numberColumns, fp);
    3413                     if (nRead != numberColumns)
     3409                    if (nRead != static_cast<size_t>(numberColumns))
    34143410                         throw("Error in fread");
    34153411                    nRead = fread(dualColumnSolution, sizeof(double), numberColumns, fp);
    3416                     if (nRead != numberColumns)
     3412                    if (nRead != static_cast<size_t>(numberColumns))
    34173413                         throw("Error in fread");
    34183414               } else {
     
    34203416                    double * temp = new double [CoinMax(numberRowsFile, numberColumnsFile)];
    34213417                    nRead = fread(temp, sizeof(double), numberRowsFile, fp);
    3422                     if (nRead != numberRowsFile)
     3418                    if (nRead != static_cast<size_t>(numberRowsFile))
    34233419                         throw("Error in fread");
    34243420                    CoinMemcpyN(temp, numberRows, primalRowSolution);
    34253421                    nRead = fread(temp, sizeof(double), numberRowsFile, fp);
    3426                     if (nRead != numberRowsFile)
     3422                    if (nRead != static_cast<size_t>(numberRowsFile))
    34273423                         throw("Error in fread");
    34283424                    CoinMemcpyN(temp, numberRows, dualRowSolution);
    34293425                    nRead = fread(temp, sizeof(double), numberColumnsFile, fp);
    3430                     if (nRead != numberColumnsFile)
     3426                    if (nRead != static_cast<size_t>(numberColumnsFile))
    34313427                         throw("Error in fread");
    34323428                    CoinMemcpyN(temp, numberColumns, primalColumnSolution);
    34333429                    nRead = fread(temp, sizeof(double), numberColumnsFile, fp);
    3434                     if (nRead != numberColumnsFile)
     3430                    if (nRead != static_cast<size_t>(numberColumnsFile))
    34353431                         throw("Error in fread");
    34363432                    CoinMemcpyN(temp, numberColumns, dualColumnSolution);
     
    35073503          double * primalRowSolution = lpSolver->primalRowSolution();
    35083504          nWrite = fwrite(primalRowSolution, sizeof(double), numberRows, fp);
    3509           if (nWrite != numberRows)
     3505          if (nWrite != static_cast<size_t>(numberRows))
    35103506               throw("Error in fwrite");
    35113507          nWrite = fwrite(dualRowSolution, sizeof(double), numberRows, fp);
    3512           if (nWrite != numberRows)
     3508          if (nWrite != static_cast<size_t>(numberRows))
    35133509               throw("Error in fwrite");
    35143510          double * dualColumnSolution = lpSolver->dualColumnSolution();
    35153511          double * primalColumnSolution = lpSolver->primalColumnSolution();
    35163512          nWrite = fwrite(primalColumnSolution, sizeof(double), numberColumns, fp);
    3517           if (nWrite != numberColumns)
     3513          if (nWrite != static_cast<size_t>(numberColumns))
    35183514               throw("Error in fwrite");
    35193515          nWrite = fwrite(dualColumnSolution, sizeof(double), numberColumns, fp);
    3520           if (nWrite != numberColumns)
     3516          if (nWrite != static_cast<size_t>(numberColumns))
    35213517               throw("Error in fwrite");
    35223518          fclose(fp);
Note: See TracChangeset for help on using the changeset viewer.