Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sword: remove comparisons between pointers and ints
This causes errors on certain versions of Clang. No revbump since the port either builds correctly or not at all.
- Loading branch information
1 parent
12796ee
commit b1def42
Showing
2 changed files
with
180 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,178 @@ | ||
--- src/mgr/swmgr.cpp.orig 2014-04-16 20:50:37.000000000 -0700 | ||
+++ src/mgr/swmgr.cpp 2019-09-12 08:14:52.000000000 -0700 | ||
@@ -1362,7 +1362,7 @@ | ||
else { | ||
if (!conffd) { | ||
conffd = FileMgr::getSystemFileMgr()->open(config->filename.c_str(), FileMgr::WRONLY|FileMgr::APPEND); | ||
- if (conffd > 0) | ||
+ if (conffd) | ||
conffd->seek(0L, SEEK_END); | ||
else { | ||
FileMgr::getSystemFileMgr()->close(conffd); | ||
--- src/keys/treekeyidx.cpp.orig 2013-09-14 14:51:47.000000000 -0700 | ||
+++ src/keys/treekeyidx.cpp 2019-09-12 08:13:02.000000000 -0700 | ||
@@ -61,7 +61,7 @@ | ||
buf.setFormatted("%s.dat", path); | ||
datfd = FileMgr::getSystemFileMgr()->open(buf, fileMode, true); | ||
|
||
- if (datfd <= 0) { | ||
+ if (!datfd) { | ||
SWLog::getSystemLog()->logError("%d", errno); | ||
error = errno; | ||
} | ||
@@ -331,7 +331,7 @@ | ||
__s32 tmp; | ||
__u16 tmp2; | ||
|
||
- if (datfd > 0) { | ||
+ if (datfd) { | ||
|
||
datfd->seek(ioffset, SEEK_SET); | ||
|
||
@@ -385,7 +385,7 @@ | ||
} | ||
|
||
node->offset = ioffset; | ||
- if (idxfd > 0) { | ||
+ if (idxfd) { | ||
if (idxfd->getFd() > 0) { | ||
idxfd->seek(ioffset, SEEK_SET); | ||
if (idxfd->read(&offset, 4) == 4) { | ||
@@ -422,7 +422,7 @@ | ||
long datOffset = 0; | ||
__s32 tmp; | ||
|
||
- if (idxfd > 0) { | ||
+ if (idxfd) { | ||
idxfd->seek(node->offset, SEEK_SET); | ||
if (idxfd->read(&tmp, 4) != 4) { | ||
datOffset = datfd->seek(0, SEEK_END); | ||
@@ -488,7 +488,7 @@ | ||
void TreeKeyIdx::saveTreeNode(TreeNode *node) { | ||
long datOffset = 0; | ||
__s32 tmp; | ||
- if (idxfd > 0) { | ||
+ if (idxfd) { | ||
|
||
idxfd->seek(node->offset, SEEK_SET); | ||
datOffset = datfd->seek(0, SEEK_END); | ||
--- src/modules/common/rawstr.cpp.orig 2014-04-16 21:27:57.000000000 -0700 | ||
+++ src/modules/common/rawstr.cpp 2019-09-12 08:36:48.000000000 -0700 | ||
@@ -74,7 +74,7 @@ | ||
buf.setFormatted("%s.dat", path); | ||
datfd = FileMgr::getSystemFileMgr()->open(buf, fileMode, true); | ||
|
||
- if (datfd < 0) { | ||
+ if (!datfd) { | ||
SWLog::getSystemLog()->logError("%d", errno); | ||
} | ||
|
||
@@ -111,7 +111,7 @@ | ||
{ | ||
int size; | ||
char ch; | ||
- if (datfd > 0) { | ||
+ if (datfd) { | ||
datfd->seek(ioffset, SEEK_SET); | ||
for (size = 0; datfd->read(&ch, 1) == 1; size++) { | ||
if ((ch == '\\') || (ch == 10) || (ch == 13)) | ||
@@ -145,7 +145,7 @@ | ||
{ | ||
__u32 offset; | ||
|
||
- if (idxfd > 0) { | ||
+ if (idxfd) { | ||
idxfd->seek(ioffset, SEEK_SET); | ||
idxfd->read(&offset, 4); | ||
|
||
--- src/modules/common/rawstr4.cpp.orig 2014-04-16 21:27:57.000000000 -0700 | ||
+++ src/modules/common/rawstr4.cpp 2019-09-12 08:38:07.000000000 -0700 | ||
@@ -74,7 +74,7 @@ | ||
buf.setFormatted("%s.dat", path); | ||
datfd = FileMgr::getSystemFileMgr()->open(buf, fileMode, true); | ||
|
||
- if (datfd < 0) { | ||
+ if (!datfd) { | ||
SWLog::getSystemLog()->logError("%d", errno); | ||
} | ||
|
||
@@ -111,7 +111,7 @@ | ||
{ | ||
int size; | ||
char ch; | ||
- if (datfd > 0) { | ||
+ if (datfd) { | ||
datfd->seek(ioffset, SEEK_SET); | ||
for (size = 0; datfd->read(&ch, 1) == 1; size++) { | ||
if ((ch == '\\') || (ch == 10) || (ch == 13)) | ||
@@ -145,7 +145,7 @@ | ||
{ | ||
__u32 offset; | ||
|
||
- if (idxfd > 0) { | ||
+ if (idxfd) { | ||
idxfd->seek(ioffset, SEEK_SET); | ||
|
||
idxfd->read(&offset, 4); | ||
--- src/modules/common/zstr.cpp.orig 2013-09-14 14:51:47.000000000 -0700 | ||
+++ src/modules/common/zstr.cpp 2019-09-12 08:39:03.000000000 -0700 | ||
@@ -83,7 +83,7 @@ | ||
buf.setFormatted("%s.zdt", path); | ||
zdtfd = FileMgr::getSystemFileMgr()->open(buf, fileMode, true); | ||
|
||
- if (datfd <= 0) { | ||
+ if (!datfd) { | ||
SWLog::getSystemLog()->logError("%d", errno); | ||
} | ||
|
||
@@ -133,7 +133,7 @@ | ||
{ | ||
int size; | ||
char ch; | ||
- if (datfd > 0) { | ||
+ if (datfd) { | ||
datfd->seek(ioffset, SEEK_SET); | ||
for (size = 0; datfd->read(&ch, 1) == 1; size++) { | ||
if ((ch == '\\') || (ch == 10) || (ch == 13)) | ||
@@ -167,7 +167,7 @@ | ||
{ | ||
__u32 offset; | ||
|
||
- if (idxfd > 0) { | ||
+ if (idxfd) { | ||
idxfd->seek(ioffset, SEEK_SET); | ||
idxfd->read(&offset, 4); | ||
offset = swordtoarch32(offset); | ||
--- src/modules/lexdict/zld/zld.cpp.orig 2013-09-14 14:51:47.000000000 -0700 | ||
+++ src/modules/lexdict/zld/zld.cpp 2019-09-12 08:42:11.000000000 -0700 | ||
@@ -166,7 +166,7 @@ | ||
|
||
long zLD::getEntryCount() const | ||
{ | ||
- if (idxfd < 0) return 0; | ||
+ if (!idxfd) return 0; | ||
return idxfd->seek(0, SEEK_END) / IDXENTRYSIZE; | ||
} | ||
|
||
--- src/modules/lexdict/rawld4/rawld4.cpp.orig 2013-09-14 14:51:47.000000000 -0700 | ||
+++ src/modules/lexdict/rawld4/rawld4.cpp 2019-09-12 08:41:37.000000000 -0700 | ||
@@ -166,7 +166,7 @@ | ||
|
||
|
||
long RawLD4::getEntryCount() const { | ||
- if (idxfd < 0) return 0; | ||
+ if (!idxfd) return 0; | ||
return idxfd->seek(0, SEEK_END) / IDXENTRYSIZE; | ||
} | ||
|
||
--- src/modules/lexdict/rawld/rawld.cpp.orig 2013-09-14 14:51:47.000000000 -0700 | ||
+++ src/modules/lexdict/rawld/rawld.cpp 2019-09-12 08:40:46.000000000 -0700 | ||
@@ -168,7 +168,7 @@ | ||
|
||
|
||
long RawLD::getEntryCount() const { | ||
- if (idxfd < 0) return 0; | ||
+ if (!idxfd) return 0; | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
MarcusCalhoun-Lopez
Author
Contributor
|
||
return idxfd->seek(0, SEEK_END) / IDXENTRYSIZE; | ||
} | ||
|
This looks like a change in the code that would warrant a revbump.