Skip to content

Commit 01bac24

Browse files
committed
Removed always-true checks (unsiged vs signed)
1 parent 3250e19 commit 01bac24

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

src/Flasher.cpp

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,6 @@ Flasher::write(const char* filename)
107107
if (pageNum == numPages || fbytes != pageSize)
108108
break;
109109
}
110-
if (fbytes < 0)
111-
throw FileIoError(errno);
112110
progressBar(pageNum, numPages);
113111
printf("\n");
114112
}
@@ -176,8 +174,6 @@ Flasher::verify(const char* filename)
176174
if (pageNum == numPages || fbytes != pageSize)
177175
break;
178176
}
179-
if (fbytes < 0)
180-
throw FileIoError(errno);
181177
progressBar(pageNum, numPages);
182178
printf("\n");
183179
}
@@ -235,8 +231,6 @@ Flasher::read(const char* filename, long fsize)
235231
if (pageNum == numPages - 1 && fsize % pageSize > 0)
236232
pageSize = fsize % pageSize;
237233
fbytes = fwrite(buffer, 1, pageSize, outfile);
238-
if (fbytes < 0)
239-
throw FileIoError(errno);
240234
if (fbytes != pageSize)
241235
throw FileShortError();
242236
}
@@ -272,7 +266,7 @@ Flasher::lock(string& regionArg, bool enable)
272266
do
273267
{
274268
delim = regionArg.find(',', pos);
275-
sub = regionArg.substr(pos, delim < 0 ? -1 : delim - pos);
269+
sub = regionArg.substr(pos, delim - pos);
276270
region = strtol(sub.c_str(), NULL, 0);
277271
printf("%s region %d\n", enable ? "Lock" : "Unlock", region);
278272
_flash->setLockRegion(region, enable);

0 commit comments

Comments
 (0)