#106 closed defect (fixed)
return value of psImageWriteSection
| Reported by: | Owned by: | Paul Price | |
|---|---|---|---|
| Priority: | high | Milestone: | |
| Component: | PSLib SDRS | Version: | unspecified |
| Severity: | trivial | Keywords: | |
| Cc: |
Description
Abit petty, but could we tweak the definition of the return value of
psImageWriteSection to 0 for success (as it is now) and non-zero (instead of
just 1) for error? This matches the more traditional C definition of such a
status return, where a non-zero return can signify one of many possible error
conditions.
Additionally, the C99 bool could be used instead, but then I'd recommend TRUE
for success. I'd prefer to use int, however, as it is handy for debugging to
have multiple non-zero return values cooresponding to the various error conditions.
-rdd
Change History (8)
comment:1 by , 22 years ago
| Status: | new → assigned |
|---|
comment:2 by , 22 years ago
Made change in the implementation; make sure the SDRS text reflects this change
as well.
comment:3 by , 22 years ago
| Resolution: | → fixed |
|---|---|
| Status: | assigned → closed |
added to latest (05) SDRS.
comment:4 by , 22 years ago
| Resolution: | fixed |
|---|---|
| Status: | closed → reopened |
The resolution specifies function psImageWriteSection should return type bool,
but this is not currently specified in SDR-06 section 4.6.5.
comment:5 by , 22 years ago
| Owner: | changed from to |
|---|---|
| Status: | reopened → new |
comment:6 by , 22 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
Changed SDRS so that psImageWriteSection returns a bool:
bool psImageWriteSection(const psImage *input, int x, int y, int z,
const char *extname, int extnum, const char *filename);
comment:7 by , 22 years ago
| Keywords: | VERIFIED added |
|---|
Should be fixed in SDRS-07 and ADD-06 (7 September 2004).
comment:8 by , 22 years ago
| Keywords: | VERIFIED removed |
|---|

we have been moving to bool for the return value for most of the other
functions. you are supposed to get error information from psError if an error
is raised, at least that is the way it is supposed to work. let's go with bool
for return type and TRUE for success, FALSE for failure. I think we should be
consistent on that, and a quick look through the other functions gives:
bool psListAdd(psList *list, void *data, int where); (not specified)
bool psListRemove(psList *list, void *data, int which); (TRUE = success)
bool psHashAdd(psHash *table, char *key, void *data); (not specified)
bool psHashRemove(psHash *table, char *key);(TRUE = success)
bool psMetadataAddItem();(TRUE = success)
bool psMetadataAdd(); (TRUE = success)
bool psMetadataRemove(); (TRUE = success)