Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MapScript] Inconsistent return values (0/-1 vs MS_SUCCESS/FAILURE) #244

Closed
mapserver-bot opened this issue Apr 3, 2012 · 8 comments
Closed
Assignees
Milestone

Comments

@mapserver-bot
Copy link

Reporter: dmorissette
Date: 2002/12/10 - 14:27
Trac URL: http://trac.osgeo.org/mapserver/ticket/244

This is a problem that's been around for quite a while: some functions in
MapScript return 0/-1, and others return MS_SUCCESS/MS_FAILURE.

We should eventually walk through the MapScript API and list all functions that
still return 0/-1. Then for every function we should make required changes to
return MS_SUCCESS/FAILURE and also make sure that we look for and update every
location where the function is called.

We have talked about this between me and Steve, and it would be a good idea to
clean this us before the 3.7 release if possible.

@mapserver-bot
Copy link
Author

Author: dmorissette
Date: 2002/12/11 - 20:19

Whoever has time first between me, Steve, Assefa or Julien (hopefully Julien ;) 
should assign this bug to himself and walk through the MapScript API and 
identify all functions that return 0/-1 and should be returning 
MS_SUCCESS/FAILURE.

Then report the list of functions in the bug report and we'll split the job of 
fixing things.

@mapserver-bot
Copy link
Author

Author: jlacroix
Date: 2002/12/16 - 18:39

I pass through mapscript.i and found many functions that doesn't return
MS_SUCCESS or MS_FAILURE. I report all this function here. 
The way I report them:

Class
  (mapscript function) => (mapserver function called) return value



Function list
-------------
mapObj
  addColor => msAddColor doesn't exist
  embedScalebar => msEmbedScalebar return 0 or -1
  embedLegend => msEmbedLegend return 0 or -1
  drawLabelCache => msDrawLabelCache return MS_SUCCESS or
                        msDrawLabelCacheGD return 0 or -1
                        msDrawLabelCacheSWF return 0 or -1
                        msDrawLabelCachePDF return 0 or -1
  setProjection => msLoadProjectionString return -1 or 
                     msProcessProjection return 0 or -1
  save => msSaveMap return 0 or -1
  setSymbolSet => msLoadSymbolSet return 0 or -1
  setFontSet => msLoadFontSet return 0 or -1
  moveLayerup => msMoveLayerUp return 0 or -1
  moveLayerdown => msMoveLayerDown return 0 or -1
  setLayersdrawingOrder => msSetLayersdrawingOrder return 1 or 0
layerObj
  draw => msDrawLayer return MS_SUCCESS or MS_FAILURE or
              msDrawRasterLayer return MS_FAILURE or
                  msDrawRasterLayerLow return 0 or -1
                  msDrawRasterLayerSWF return 0 or -1
                  msDrawRasterLayerPDF return 0 or -1
  drawQuery => msDrawLayer return MS_SUCCESS or MS_FAILURE or
                   msDrawRasterLayer return MS_FAILURE or
                       msDrawRasterLayerLow return 0 or -1
                       msDrawRasterLayerSWF return 0 or -1
                       msDrawRasterLayerPDF return 0 or -1
  setFilter => loadExpressionString return 0 or -1
  addFeature => return 0 or -1
classObj
  setExpression => loadExpressionString return 0 or -1
  setText => loadExpressionString return 0 or -1
pointObj
  draw => msDrawPoint return MS_SUCCESS or MS_FAILURE or 0
lineObj
  add => return 0 or -1
shapeObj
  add => msAddLine return 0 or -1
  copy => msCopyShape return 0 or -1
  contains => msIntersectPointPolygon return MS_FALSE or !MS_FALSE
  intersects => return -1 or
                    msIntersectPolylines return MS_FALSE or MS_TRUE
                    msIntersectPolygons return MS_FALSE or MS_TRUE
                    msIntersectPolylinePolygon return MS_[FALSE/TRUE]
rectObj
  contrain => msConstrainRect doesn't exist
  draw => return 0
shapefileObj
  get => return 0 or -1
  getPoint => return 0 or -1
  getTransformed => return 0 or -1
  add => msSHPWriteShape record number
  addPoint => msSHPWritePoint record number or -1
imageObj
  saveToString => need #if defined (SWIGPYTHON) || defined (SWIGTCL8)
DBFInfo
  getFieldType => msDBFGetFieldInfo return DBFFieldType

@mapserver-bot
Copy link
Author

Author: dmorissette
Date: 2003/07/10 - 05:22

Definitely too late for 4.0... setting version to 4.1

@mapserver-bot
Copy link
Author

Author: hobu
Date: 2007/05/22 - 23:49
Should we try and revisit this for 5.0? CC'ing Tamas...

@mapserver-bot
Copy link
Author

Author: hobu
Date: 2007/08/17 - 08:14
This should be done as part of the MapServer C API effort (should that ever happen). Pushing it forward to 5.2...

@mapserver-bot
Copy link
Author

Author: dmorissette
Date: 2009/03/08 - 16:58
This ticket was discussed at the TO Code Sprint and the consensus is to leave the existing functions unchanged, and come up with a RFC to provide guidelines for future functions (i.e. new methods should use MS_SUCCESS/MS_FAILURE instead of 0/-1)

@mapserver-bot
Copy link
Author

Author: dmorissette
Date: 2009/03/08 - 21:47
Created RFC 53:
http://www.mapserver.org/development/rfc/ms-rfc-53.html

@mapserver-bot
Copy link
Author

Author: dmorissette
Date: 2009/03/13 - 21:11
Closing. RFC-53 has been approved and defines guidelines for future function defns.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants