diff options
| author | Even Rouault <even.rouault@spatialys.com> | 2020-12-15 15:55:06 +0100 |
|---|---|---|
| committer | Even Rouault <even.rouault@spatialys.com> | 2020-12-15 17:24:55 +0100 |
| commit | 41c4e54f036d0f8fcc37920fac4b0fa462fd92b2 (patch) | |
| tree | ea2d9a32f6620cef24f669b902f55c57032d7577 | |
| parent | df96a13d2c9b70bc18cec1b08eea5b2b068127d7 (diff) | |
| download | PROJ-41c4e54f036d0f8fcc37920fac4b0fa462fd92b2.tar.gz PROJ-41c4e54f036d0f8fcc37920fac4b0fa462fd92b2.zip | |
Remove internal use of PJ_LOG_DEBUG_MINOR and PJ_LOG_DEBUG_MAJOR
| -rw-r--r-- | src/ctx.cpp | 4 | ||||
| -rw-r--r-- | src/filemanager.cpp | 9 | ||||
| -rw-r--r-- | src/grids.cpp | 66 | ||||
| -rw-r--r-- | src/log.cpp | 6 | ||||
| -rw-r--r-- | src/proj_internal.h | 9 |
5 files changed, 41 insertions, 53 deletions
diff --git a/src/ctx.cpp b/src/ctx.cpp index 2093950b..b774a40a 100644 --- a/src/ctx.cpp +++ b/src/ctx.cpp @@ -93,10 +93,10 @@ pj_ctx pj_ctx::createDefault() if( getenv("PROJ_DEBUG") != nullptr ) { - if( atoi(getenv("PROJ_DEBUG")) >= -PJ_LOG_DEBUG_MINOR ) + if( atoi(getenv("PROJ_DEBUG")) >= -PJ_LOG_TRACE ) ctx.debug_level = atoi(getenv("PROJ_DEBUG")); else - ctx.debug_level = PJ_LOG_DEBUG_MINOR; + ctx.debug_level = PJ_LOG_TRACE; } return ctx; } diff --git a/src/filemanager.cpp b/src/filemanager.cpp index b51205eb..0a0af8cf 100644 --- a/src/filemanager.cpp +++ b/src/filemanager.cpp @@ -1489,13 +1489,13 @@ static void *pj_open_lib_internal( if (ctx->last_errno == 0 && errno != 0) proj_context_errno_set(ctx, errno); - pj_log(ctx, PJ_LOG_DEBUG_MAJOR, "pj_open_lib(%s): call fopen(%s) - %s", - name, sysname, fid == nullptr ? "failed" : "succeeded"); + pj_log(ctx, PJ_LOG_DEBUG, "pj_open_lib(%s): call fopen(%s) - %s", name, + sysname, fid == nullptr ? "failed" : "succeeded"); return (fid); } catch (const std::exception &) { - pj_log(ctx, PJ_LOG_DEBUG_MAJOR, "pj_open_lib(%s): out of memory", name); + pj_log(ctx, PJ_LOG_DEBUG, "pj_open_lib(%s): out of memory", name); return nullptr; } @@ -1640,8 +1640,7 @@ NS_PROJ::FileManager::open_resource_file(PJ_CONTEXT *ctx, const char *name) { file = open(ctx, remote_file.c_str(), NS_PROJ::FileAccess::READ_ONLY); if (file) { - pj_log(ctx, PJ_LOG_DEBUG_MAJOR, "Using %s", - remote_file.c_str()); + pj_log(ctx, PJ_LOG_DEBUG, "Using %s", remote_file.c_str()); proj_context_errno_set(ctx, 0); } } diff --git a/src/grids.cpp b/src/grids.cpp index fb5966eb..b7ab526a 100644 --- a/src/grids.cpp +++ b/src/grids.cpp @@ -237,7 +237,7 @@ GTXVerticalShiftGrid *GTXVerticalShiftGrid::open(PJ_CONTEXT *ctx, xorigin -= 360.0; if (xorigin >= 0.0 && xorigin + xstep * columns > 180.0) { - pj_log(ctx, PJ_LOG_DEBUG_MAJOR, + pj_log(ctx, PJ_LOG_DEBUG, "This GTX spans the dateline! This will cause problems."); } @@ -941,7 +941,7 @@ std::unique_ptr<GTiffGrid> GTiffDataset::nextGrid() { extent.isGeographic = true; if (!TIFFGetField(m_hTIFF, TIFFTAG_GEOKEYDIRECTORY, &count, &geokeys)) { - pj_log(m_ctx, PJ_LOG_DEBUG_MINOR, "No GeoKeys tag"); + pj_log(m_ctx, PJ_LOG_TRACE, "No GeoKeys tag"); } else { if (count < 4 || (count % 4) != 0) { pj_log(m_ctx, PJ_LOG_ERROR, @@ -955,9 +955,8 @@ std::unique_ptr<GTiffGrid> GTiffDataset::nextGrid() { } // We only know that we support GeoTIFF 1.0 and 1.1 at that time if (geokeys[1] != 1 || geokeys[2] > 1) { - pj_log(m_ctx, PJ_LOG_DEBUG_MINOR, - "GeoTIFF %d.%d possibly not handled", geokeys[1], - geokeys[2]); + pj_log(m_ctx, PJ_LOG_TRACE, "GeoTIFF %d.%d possibly not handled", + geokeys[1], geokeys[2]); } for (unsigned int i = 4; i + 3 < count; i += 4) { @@ -1100,7 +1099,7 @@ class GTiffVGridShiftSet : public VerticalShiftGridSet { } bool reopen(PJ_CONTEXT *ctx) override { - pj_log(ctx, PJ_LOG_DEBUG_MAJOR, "Grid %s has changed. Re-loading it", + pj_log(ctx, PJ_LOG_DEBUG, "Grid %s has changed. Re-loading it", m_name.c_str()); m_grids.clear(); m_GTiffDataset.reset(); @@ -1133,7 +1132,7 @@ insertIntoHierarchy(PJ_CONTEXT *ctx, std::unique_ptr<GridType> &&grid, // the names to recreate the hierarchy if (!gridName.empty()) { if (mapGrids.find(gridName) != mapGrids.end()) { - pj_log(ctx, PJ_LOG_DEBUG_MAJOR, "Several grids called %s found!", + pj_log(ctx, PJ_LOG_DEBUG, "Several grids called %s found!", gridName.c_str()); } mapGrids[gridName] = grid.get(); @@ -1142,7 +1141,7 @@ insertIntoHierarchy(PJ_CONTEXT *ctx, std::unique_ptr<GridType> &&grid, if (!parentName.empty()) { auto iter = mapGrids.find(parentName); if (iter == mapGrids.end()) { - pj_log(ctx, PJ_LOG_DEBUG_MAJOR, + pj_log(ctx, PJ_LOG_DEBUG, "Grid %s refers to non-existing parent %s. " "Using bounding-box method.", gridName.c_str(), parentName.c_str()); @@ -1151,7 +1150,7 @@ insertIntoHierarchy(PJ_CONTEXT *ctx, std::unique_ptr<GridType> &&grid, iter->second->m_children.emplace_back(std::move(grid)); gridInserted = true; } else { - pj_log(ctx, PJ_LOG_DEBUG_MAJOR, + pj_log(ctx, PJ_LOG_DEBUG, "Grid %s refers to parent %s, but its extent is " "not included in it. Using bounding-box method.", gridName.c_str(), parentName.c_str()); @@ -1172,7 +1171,7 @@ insertIntoHierarchy(PJ_CONTEXT *ctx, std::unique_ptr<GridType> &&grid, gridInserted = true; break; } else if (candidateParentExtent.intersects(extent)) { - pj_log(ctx, PJ_LOG_DEBUG_MAJOR, + pj_log(ctx, PJ_LOG_DEBUG, "Partially intersecting grids found!"); } } @@ -1246,8 +1245,7 @@ void GTiffVGrid::insertGrid(PJ_CONTEXT *ctx, gridInserted = true; break; } else if (candidateParentExtent.intersects(extent)) { - pj_log(ctx, PJ_LOG_DEBUG_MAJOR, - "Partially intersecting grids found!"); + pj_log(ctx, PJ_LOG_DEBUG, "Partially intersecting grids found!"); } } if (!gridInserted) { @@ -1285,7 +1283,7 @@ GTiffVGridShiftSet::open(PJ_CONTEXT *ctx, std::unique_ptr<File> fp, pj_log(ctx, PJ_LOG_ERROR, _("Invalid subfileType")); return nullptr; } else { - pj_log(ctx, PJ_LOG_DEBUG_MAJOR, + pj_log(ctx, PJ_LOG_DEBUG, "Ignoring IFD %d as it has a unsupported subfileType", ifd); continue; @@ -1313,13 +1311,13 @@ GTiffVGridShiftSet::open(PJ_CONTEXT *ctx, std::unique_ptr<File> fp, // can be ignored // One could imagine to put the accuracy values in separate // IFD for example - pj_log(ctx, PJ_LOG_DEBUG_MAJOR, + pj_log(ctx, PJ_LOG_DEBUG, "Ignoring IFD %d as it has no " "geoid_undulation/vertical_offset channel", ifd); continue; } else { - pj_log(ctx, PJ_LOG_DEBUG_MAJOR, + pj_log(ctx, PJ_LOG_DEBUG, "IFD 0 has channel descriptions, but no " "geoid_undulation/vertical_offset channel"); return nullptr; @@ -1409,7 +1407,7 @@ VerticalShiftGridSet::open(PJ_CONTEXT *ctx, const std::string &filename) { // --------------------------------------------------------------------------- bool VerticalShiftGridSet::reopen(PJ_CONTEXT *ctx) { - pj_log(ctx, PJ_LOG_DEBUG_MAJOR, "Grid %s has changed. Re-loading it", + pj_log(ctx, PJ_LOG_DEBUG, "Grid %s has changed. Re-loading it", m_name.c_str()); auto newGS = open(ctx, m_name); m_grids.clear(); @@ -1972,7 +1970,7 @@ std::unique_ptr<NTv2GridSet> NTv2GridSet::open(PJ_CONTEXT *ctx, const int rows = static_cast<int>( fabs((extent.north - extent.south) / extent.resY + 0.5) + 1); - pj_log(ctx, PJ_LOG_DEBUG_MINOR, + pj_log(ctx, PJ_LOG_TRACE, "NTv2 %s %dx%d: LL=(%.9g,%.9g) UR=(%.9g,%.9g)", gridName.c_str(), columns, rows, extent.west * RAD_TO_DEG, extent.south * RAD_TO_DEG, extent.east * RAD_TO_DEG, @@ -2037,7 +2035,7 @@ class GTiffHGridShiftSet : public HorizontalShiftGridSet { } bool reopen(PJ_CONTEXT *ctx) override { - pj_log(ctx, PJ_LOG_DEBUG_MAJOR, "Grid %s has changed. Re-loading it", + pj_log(ctx, PJ_LOG_DEBUG, "Grid %s has changed. Re-loading it", m_name.c_str()); m_grids.clear(); m_GTiffDataset.reset(); @@ -2138,8 +2136,7 @@ void GTiffHGrid::insertGrid(PJ_CONTEXT *ctx, gridInserted = true; break; } else if (candidateParentExtent.intersects(extent)) { - pj_log(ctx, PJ_LOG_DEBUG_MAJOR, - "Partially intersecting grids found!"); + pj_log(ctx, PJ_LOG_DEBUG, "Partially intersecting grids found!"); } } if (!gridInserted) { @@ -2183,7 +2180,7 @@ GTiffHGridShiftSet::open(PJ_CONTEXT *ctx, std::unique_ptr<File> fp, pj_log(ctx, PJ_LOG_ERROR, _("Invalid subfileType")); return nullptr; } else { - pj_log(ctx, PJ_LOG_DEBUG_MAJOR, + pj_log(ctx, PJ_LOG_DEBUG, _("Ignoring IFD %d as it has a unsupported subfileType"), ifd); continue; @@ -2196,7 +2193,7 @@ GTiffHGridShiftSet::open(PJ_CONTEXT *ctx, std::unique_ptr<File> fp, _("At least 2 samples per pixel needed")); return nullptr; } else { - pj_log(ctx, PJ_LOG_DEBUG_MAJOR, + pj_log(ctx, PJ_LOG_DEBUG, _("Ignoring IFD %d as it has not at least 2 samples"), ifd); continue; @@ -2229,13 +2226,13 @@ GTiffHGridShiftSet::open(PJ_CONTEXT *ctx, std::unique_ptr<File> fp, // longitude_offset/latitude_offset can be ignored // One could imagine to put the accuracy values in separate // IFD for example - pj_log(ctx, PJ_LOG_DEBUG_MAJOR, + pj_log(ctx, PJ_LOG_DEBUG, "Ignoring IFD %d as it has no " "longitude_offset/latitude_offset channel", ifd); continue; } else { - pj_log(ctx, PJ_LOG_DEBUG_MAJOR, + pj_log(ctx, PJ_LOG_DEBUG, "IFD 0 has channel descriptions, but no " "longitude_offset/latitude_offset channel"); return nullptr; @@ -2346,7 +2343,7 @@ HorizontalShiftGridSet::open(PJ_CONTEXT *ctx, const std::string &filename) { if (header_size != sizeof(header)) { /* some files may be smaller that sizeof(header), eg 160, so */ ctx->last_errno = 0; /* don't treat as a persistent error */ - pj_log(ctx, PJ_LOG_DEBUG_MAJOR, + pj_log(ctx, PJ_LOG_DEBUG, "pj_gridinfo_init: short header read of %d bytes", (int)header_size); } @@ -2406,7 +2403,7 @@ HorizontalShiftGridSet::open(PJ_CONTEXT *ctx, const std::string &filename) { // --------------------------------------------------------------------------- bool HorizontalShiftGridSet::reopen(PJ_CONTEXT *ctx) { - pj_log(ctx, PJ_LOG_DEBUG_MAJOR, "Grid %s has changed. Re-loading it", + pj_log(ctx, PJ_LOG_DEBUG, "Grid %s has changed. Re-loading it", m_name.c_str()); auto newGS = open(ctx, m_name); m_grids.clear(); @@ -2483,7 +2480,7 @@ class GTiffGenericGridShiftSet : public GenericShiftGridSet { } bool reopen(PJ_CONTEXT *ctx) override { - pj_log(ctx, PJ_LOG_DEBUG_MAJOR, "Grid %s has changed. Re-loading it", + pj_log(ctx, PJ_LOG_DEBUG, "Grid %s has changed. Re-loading it", m_name.c_str()); m_grids.clear(); m_GTiffDataset.reset(); @@ -2581,8 +2578,7 @@ void GTiffGenericGrid::insertGrid(PJ_CONTEXT *ctx, gridInserted = true; break; } else if (candidateParentExtent.intersects(extent)) { - pj_log(ctx, PJ_LOG_DEBUG_MAJOR, - "Partially intersecting grids found!"); + pj_log(ctx, PJ_LOG_DEBUG, "Partially intersecting grids found!"); } } if (!gridInserted) { @@ -2654,7 +2650,7 @@ GTiffGenericGridShiftSet::open(PJ_CONTEXT *ctx, std::unique_ptr<File> fp, pj_log(ctx, PJ_LOG_ERROR, _("Invalid subfileType")); return nullptr; } else { - pj_log(ctx, PJ_LOG_DEBUG_MAJOR, + pj_log(ctx, PJ_LOG_DEBUG, _("Ignoring IFD %d as it has a unsupported subfileType"), ifd); continue; @@ -2743,7 +2739,7 @@ GenericShiftGridSet::open(PJ_CONTEXT *ctx, const std::string &filename) { // --------------------------------------------------------------------------- bool GenericShiftGridSet::reopen(PJ_CONTEXT *ctx) { - pj_log(ctx, PJ_LOG_DEBUG_MAJOR, "Grid %s has changed. Re-loading it", + pj_log(ctx, PJ_LOG_DEBUG, "Grid %s has changed. Re-loading it", m_name.c_str()); auto newGS = open(ctx, m_name); m_grids.clear(); @@ -2809,7 +2805,8 @@ ListOfGenericGrids pj_generic_grid_init(PJ *P, const char *gridkey) { auto gridSet = GenericShiftGridSet::open(P->ctx, gridname); if (!gridSet) { if (!canFail) { - if (proj_context_errno(P->ctx) != PROJ_ERR_OTHER_NETWORK_ERROR) { + if (proj_context_errno(P->ctx) != + PROJ_ERR_OTHER_NETWORK_ERROR) { proj_context_errno_set( P->ctx, PROJ_ERR_INVALID_OP_FILE_NOT_FOUND_OR_INVALID); } @@ -3034,7 +3031,7 @@ static PJ_LP pj_hgrid_apply_internal(PJ_CONTEXT *ctx, PJ_LP in, auto newGrid = findGrid(grids, lp, gridset); if (newGrid == nullptr || newGrid == grid || newGrid->isNullGrid()) break; - pj_log(ctx, PJ_LOG_DEBUG_MINOR, "Switching from grid %s to grid %s", + pj_log(ctx, PJ_LOG_TRACE, "Switching from grid %s to grid %s", grid->name().c_str(), newGrid->name().c_str()); grid = newGrid; extent = &(grid->extentAndRes()); @@ -3338,7 +3335,8 @@ ListOfVGrids pj_vgrid_init(PJ *P, const char *gridkey) { auto gridSet = VerticalShiftGridSet::open(P->ctx, gridname); if (!gridSet) { if (!canFail) { - if (proj_context_errno(P->ctx) != PROJ_ERR_OTHER_NETWORK_ERROR) { + if (proj_context_errno(P->ctx) != + PROJ_ERR_OTHER_NETWORK_ERROR) { proj_context_errno_set( P->ctx, PROJ_ERR_INVALID_OP_FILE_NOT_FOUND_OR_INVALID); } diff --git a/src/log.cpp b/src/log.cpp index d2c9f430..c50b0ebc 100644 --- a/src/log.cpp +++ b/src/log.cpp @@ -147,7 +147,7 @@ void proj_log_debug (PJ *P, const char *fmt, ...) { ******************************************************************************/ va_list args; va_start( args, fmt ); - pj_vlog (pj_get_ctx (P), PJ_LOG_DEBUG_MAJOR , add_short_name_prefix(P, fmt).c_str(), args); + pj_vlog (pj_get_ctx (P), PJ_LOG_DEBUG , add_short_name_prefix(P, fmt).c_str(), args); va_end( args ); } @@ -158,7 +158,7 @@ void proj_context_log_debug (PJ_CONTEXT *ctx, const char *fmt, ...) { ******************************************************************************/ va_list args; va_start( args, fmt ); - pj_vlog (ctx, PJ_LOG_DEBUG_MAJOR , fmt, args); + pj_vlog (ctx, PJ_LOG_DEBUG , fmt, args); va_end( args ); } @@ -169,7 +169,7 @@ void proj_log_trace (PJ *P, const char *fmt, ...) { ******************************************************************************/ va_list args; va_start( args, fmt ); - pj_vlog (pj_get_ctx (P), PJ_LOG_DEBUG_MINOR , add_short_name_prefix(P, fmt).c_str(), args); + pj_vlog (pj_get_ctx (P), PJ_LOG_TRACE , add_short_name_prefix(P, fmt).c_str(), args); va_end( args ); } diff --git a/src/proj_internal.h b/src/proj_internal.h index f0d3c8b3..795db036 100644 --- a/src/proj_internal.h +++ b/src/proj_internal.h @@ -862,15 +862,6 @@ PJ_LP pj_generic_inverse_2d(PJ_XY xy, PJ *P, PJ_LP lpInitial); extern char const PROJ_DLL pj_release[]; /* global release id string */ -#ifndef PROJ_INTERNAL_H -/* replaced by enum proj_log_level in proj_internal.h */ -#define PJ_LOG_NONE 0 -#define PJ_LOG_ERROR 1 -#define PJ_LOG_DEBUG_MAJOR 2 -#define PJ_LOG_DEBUG_MINOR 3 -#endif - - /* procedure prototypes */ PJ_CONTEXT PROJ_DLL *pj_get_default_ctx(void); |
