Browse Source

Suppress compiler warnings for non-sensical unit conversions

Neal Wilson 10 years ago
parent
commit
341032e980
1 changed files with 13 additions and 0 deletions
  1. 13
    0
      src/units.w

+ 13
- 0
src/units.w View File

@@ -41,6 +41,7 @@ class Units: public QObject@/
41 41
 
42 42
 @(units.cpp@>=
43 43
 #include "units.h"
44
+#include <QtDebug>
44 45
 
45 46
 @ The |isTemperatureUnit()| method may seem counter-intuitive while the enum
46 47
 only contains represenations of temperature measurements, but there are plans
@@ -90,6 +91,9 @@ double Units::convertTemperature(double value, Unit fromUnit, Unit toUnit)@/
90 91
 					break;
91 92
 				case Rankine:@/
92 93
 					return value + 459.67;
94
+					break;
95
+				default:@/
96
+					qDebug() << "Warning: Non-sensical unit conversion.";
93 97
 					break;@t\2@>@/
94 98
 			}@/
95 99
 			break;
@@ -107,6 +111,9 @@ double Units::convertTemperature(double value, Unit fromUnit, Unit toUnit)@/
107 111
 					break;
108 112
 				case Rankine:@/
109 113
 					return (value + 273.15) * 9.0 / 5.0;
114
+					break;
115
+				default:@/
116
+					qDebug() << "Warning: Non-sensical unit conversion.";
110 117
 					break;@t\2@>@/
111 118
 			}@/
112 119
 			break;
@@ -124,6 +131,9 @@ double Units::convertTemperature(double value, Unit fromUnit, Unit toUnit)@/
124 131
 					break;
125 132
 				case Rankine:@/
126 133
 					return value * 9.0 / 5.0;
134
+					break;
135
+				default:@/
136
+					qDebug() << "Warning: Non-sensical unit conversion.";
127 137
 					break;@t\2@>@/
128 138
 			}@/
129 139
 			break;
@@ -141,6 +151,9 @@ double Units::convertTemperature(double value, Unit fromUnit, Unit toUnit)@/
141 151
 					break;
142 152
 				case Rankine:@/
143 153
 					return value;
154
+					break;
155
+				default:@/
156
+					qDebug() << "Warning: Non-sensical unit conversion.";
144 157
 					break;@t\2@>@/
145 158
 			}@/
146 159
 			break;

Loading…
Cancel
Save