Browse Source

Fix compile warnings on OSX

The following warnings were fixed:
* implicit conversion of NULL constant to 'bool'
* enumeration value '...' not handled in switch
John-Philip Johansson 9 years ago
parent
commit
dc2bf4479d
3 changed files with 11 additions and 2 deletions
  1. 1 0
      core/shape-description.cpp
  2. 2 2
      ext/import-font.cpp
  3. 8 0
      main.cpp

+ 1 - 0
core/shape-description.cpp

@@ -235,6 +235,7 @@ bool writeShapeDescription(FILE *output, const Shape &shape) {
                     case MAGENTA: colorCode = 'm'; break;
                     case CYAN: colorCode = 'c'; break;
                     case WHITE: colorCode = 'w'; break;
+                    default: break;
                 }
                 {
                     const LinearSegment *e = dynamic_cast<const LinearSegment *>(&**edge);

+ 2 - 2
ext/import-font.cpp

@@ -94,10 +94,10 @@ bool loadGlyph(Shape &output, FontHandle *font, int unicode, double *advance) {
     };
 
     if (!font)
-        return NULL;
+        return false;
     FT_Error error = FT_Load_Char(font->face, unicode, FT_LOAD_NO_SCALE);
     if (error)
-        return NULL;
+        return false;
     output.contours.clear();
     output.inverseYAxis = false;
     if (advance)

+ 8 - 0
main.cpp

@@ -221,6 +221,8 @@ static const char * writeOutput(const Bitmap<T> &bitmap, const char *filename, F
                 fclose(file);
                 return NULL;
             }
+            default:
+              break;
         }
     } else {
         if (format == AUTO || format == TEXT)
@@ -597,6 +599,8 @@ int main(int argc, const char * const *argv) {
             fclose(file);
             break;
         }
+        default:
+          break;
     }
 
     // Validate and normalize shape
@@ -695,6 +699,8 @@ int main(int argc, const char * const *argv) {
             generateMSDF(msdf, shape, range, scale, translate, edgeThreshold);
             break;
         }
+        default:
+          break;
     }
 
     // Save output
@@ -747,6 +753,8 @@ int main(int argc, const char * const *argv) {
                     ABORT("Failed to write test render file.");
             }
             break;
+          default:
+            break;
     }
 
     return 0;