Skip to content

Commit

Permalink
Merge pull request #1839 from rouault/rfc4_utf8
Browse files Browse the repository at this point in the history
[RFC4_dev] Use Win32 Unicode APIs and expect all strings to be UTF-8 (fixes #1765)
  • Loading branch information
rouault authored Jan 22, 2020
2 parents a6390b5 + 66fd99a commit c5fb541
Show file tree
Hide file tree
Showing 49 changed files with 4,737 additions and 3,085 deletions.
2 changes: 0 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,6 @@ elseif("${CMAKE_C_COMPILER_ID}" STREQUAL "Intel")
endif()
endif()

add_definitions(-DNOMINMAX)

set(PROJ_C_WARN_FLAGS "${PROJ_C_WARN_FLAGS}"
CACHE STRING "C flags used to compile PROJ targets")
set(PROJ_CXX_WARN_FLAGS "${PROJ_CXX_WARN_FLAGS}"
Expand Down
2 changes: 1 addition & 1 deletion Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -772,7 +772,7 @@ WARN_LOGFILE =
# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING
# Note: If this tag is empty the current directory is searched.

INPUT = src/iso19111 include/proj src/proj.h src/proj_experimental.h src/general_doc.dox src/filemanager.cpp
INPUT = src/iso19111 include/proj src/proj.h src/proj_experimental.h src/general_doc.dox src/filemanager.cpp src/networkfilemanager.cpp

# This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
Expand Down
27 changes: 12 additions & 15 deletions cmake/ProjTest.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@
# add test with sh script
#

function(proj_test_set_properties TESTNAME)
if(MSVC)
set_tests_properties( ${TESTNAME}
PROPERTIES ENVIRONMENT "PROJ_IGNORE_USER_WRITABLE_DIRECTORY=YES;PROJ_LIB=${PROJECT_BINARY_DIR}/data\\;${PROJECT_SOURCE_DIR}/data")
else()
set_tests_properties( ${TESTNAME}
PROPERTIES ENVIRONMENT "PROJ_IGNORE_USER_WRITABLE_DIRECTORY=YES;PROJ_LIB=${PROJECT_BINARY_DIR}/data:${PROJECT_SOURCE_DIR}/data")
endif()
endfunction()

function(proj_add_test_script_sh SH_NAME BIN_USE)
if(UNIX)
get_filename_component(testname ${SH_NAME} NAME_WE)
Expand All @@ -26,13 +36,7 @@ function(proj_add_test_script_sh SH_NAME BIN_USE)
COMMAND ${PROJECT_SOURCE_DIR}/test/cli/${SH_NAME}
${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${${BIN_USE}}
)
if(MSVC)
set_tests_properties( ${testname}
PROPERTIES ENVIRONMENT "PROJ_IGNORE_USER_WRITABLE_DIRECTORY=YES;PROJ_LIB=${PROJECT_BINARY_DIR}/data\\;${PROJECT_SOURCE_DIR}/data")
else()
set_tests_properties( ${testname}
PROPERTIES ENVIRONMENT "PROJ_IGNORE_USER_WRITABLE_DIRECTORY=YES;PROJ_LIB=${PROJECT_BINARY_DIR}/data:${PROJECT_SOURCE_DIR}/data")
endif()
proj_test_set_properties(${testname})
endif()

endif()
Expand All @@ -49,13 +53,6 @@ function(proj_add_gie_test TESTNAME TESTCASE)
${TESTFILE}
)

if(MSVC)
set_tests_properties( ${TESTNAME}
PROPERTIES ENVIRONMENT "PROJ_IGNORE_USER_WRITABLE_DIRECTORY=YES;PROJ_LIB=${PROJECT_BINARY_DIR}/data\\;${PROJECT_SOURCE_DIR}/data")
else()
set_tests_properties( ${TESTNAME}
PROPERTIES ENVIRONMENT "PROJ_IGNORE_USER_WRITABLE_DIRECTORY=YES;PROJ_LIB=${PROJECT_BINARY_DIR}/data:${PROJECT_SOURCE_DIR}/data")
endif()

proj_test_set_properties(${TESTNAME})

endfunction()
13 changes: 11 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,17 @@ AC_SUBST(C_WFLAGS,$C_WFLAGS)
AC_SUBST(CXX_WFLAGS,$CXX_WFLAGS)
AC_SUBST(NO_ZERO_AS_NULL_POINTER_CONSTANT_FLAG,$NO_ZERO_AS_NULL_POINTER_CONSTANT_FLAG)

CFLAGS="${CFLAGS} -fvisibility=hidden -DNOMINMAX"
CXXFLAGS="${CXXFLAGS} -fvisibility=hidden -DNOMINMAX"
CFLAGS="${CFLAGS} -fvisibility=hidden"
CXXFLAGS="${CXXFLAGS} -fvisibility=hidden"

case "${host_os}" in
cygwin* | mingw32* | pw32* | beos* | darwin*)
CFLAGS="${CFLAGS} -DNOMINMAX"
CXXFLAGS="${CXXFLAGS} -DNOMINMAX"
;;
*)
;;
esac

dnl Checks for libraries.
save_CFLAGS="$CFLAGS"
Expand Down
1 change: 1 addition & 0 deletions data/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ EXTRA_DIST = proj.ini GL27 nad.lst nad27 nad83 \
tests/nkgrf03vel_realigned_extract.tif \
tests/nkgrf03vel_realigned_xy_extract.ct2 \
tests/nkgrf03vel_realigned_z_extract.gtx \
tests/test_hgrid_with_two_level_of_subgrids_no_grid_name.tif \
null \
generate_all_sql_in.cmake sql_filelist.cmake \
$(SQL_ORDERED_LIST)
Expand Down
2 changes: 1 addition & 1 deletion data/proj.ini
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ cdn_endpoint = https://cdn.proj.org

cache_enabled = on

cache_size_MB = 100
cache_size_MB = 300

cache_ttl_sec = 86400
Binary file not shown.
9 changes: 9 additions & 0 deletions docs/source/apps/cct.rst
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,15 @@ cartesian coordinates) and
*Coordinate Transformations*, which are coordinate operations where
input and output datums differ (e.g. change of reference frame).

Use of remote grids
*******************

.. versionadded:: 7.0.0

If the :envvar:`PROJ_NETWORK` environment variable is set to ``ON``,
:program:`cct` will attempt to use remote grids stored on CDN (Content
Delivery Network) storage, when they are not available locally.

Examples
********

Expand Down
2 changes: 1 addition & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@
#texinfo_no_detailmenu = False

breathe_projects = {
"cpp_stuff":"../build/xml/",
"doxygen_api":"../build/xml/",
}

import redirects
Expand Down
2 changes: 1 addition & 1 deletion docs/source/development/reference/cpp/common.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ common namespace
----------------

.. doxygennamespace:: osgeo::proj::common
:project: cpp_stuff
:project: doxygen_api
:members:
2 changes: 1 addition & 1 deletion docs/source/development/reference/cpp/cpp_general.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ General documentation
---------------------

.. doxygenfile:: general_doc.dox.reworked.h
:project: cpp_stuff
:project: doxygen_api
2 changes: 1 addition & 1 deletion docs/source/development/reference/cpp/crs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ crs namespace
-------------

.. doxygennamespace:: osgeo::proj::crs
:project: cpp_stuff
:project: doxygen_api
:members:
2 changes: 1 addition & 1 deletion docs/source/development/reference/cpp/cs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ cs namespace
------------

.. doxygennamespace:: osgeo::proj::cs
:project: cpp_stuff
:project: doxygen_api
:members:
2 changes: 1 addition & 1 deletion docs/source/development/reference/cpp/datum.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ datum namespace
---------------

.. doxygennamespace:: osgeo::proj::datum
:project: cpp_stuff
:project: doxygen_api
:members:
2 changes: 1 addition & 1 deletion docs/source/development/reference/cpp/io.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ io namespace
------------

.. doxygennamespace:: osgeo::proj::io
:project: cpp_stuff
:project: doxygen_api
:members:
2 changes: 1 addition & 1 deletion docs/source/development/reference/cpp/metadata.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ metadata namespace
------------------

.. doxygennamespace:: osgeo::proj::metadata
:project: cpp_stuff
:project: doxygen_api
:members:
2 changes: 1 addition & 1 deletion docs/source/development/reference/cpp/operation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ operation namespace
-------------------

.. doxygennamespace:: osgeo::proj::operation
:project: cpp_stuff
:project: doxygen_api
:members:
2 changes: 1 addition & 1 deletion docs/source/development/reference/cpp/util.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ util namespace
--------------

.. doxygennamespace:: osgeo::proj::util
:project: cpp_stuff
:project: doxygen_api
:members:
39 changes: 38 additions & 1 deletion docs/source/development/reference/datatypes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -797,11 +797,48 @@ Logging
.. versionadded:: 5.1.0


Setting custom I/O functions
-------------------------------------------------------------------------------

.. versionadded:: 7.0.0

.. doxygenstruct:: PROJ_FILE_API
:project: doxygen_api
:members:

.. doxygentypedef:: PROJ_FILE_HANDLE
:project: doxygen_api

.. doxygenenum:: PROJ_OPEN_ACCESS
:project: doxygen_api


Network related functionality
-------------------------------------------------------------------------------

.. versionadded:: 7.0.0

.. doxygentypedef:: PROJ_NETWORK_HANDLE
:project: doxygen_api

.. doxygentypedef:: proj_network_open_cbk_type
:project: doxygen_api

.. doxygentypedef:: proj_network_close_cbk_type
:project: doxygen_api

.. doxygentypedef:: proj_network_get_header_value_cbk_type
:project: doxygen_api

.. doxygentypedef:: proj_network_read_range_type
:project: doxygen_api


C API for ISO-19111 functionality
-------------------------------------------------------------------------------

.. doxygengroup:: iso19111_types
:project: cpp_stuff
:project: doxygen_api
:content-only:


50 changes: 49 additions & 1 deletion docs/source/development/reference/functions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -697,6 +697,54 @@ Various
:returns: :c:type:`int` 1 if output units is expected in radians, otherwise 0
Setting custom I/O functions
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
.. versionadded:: 7.0.0
.. doxygenfunction:: proj_context_set_fileapi
:project: doxygen_api
.. doxygenfunction:: proj_context_set_sqlite3_vfs_name
:project: doxygen_api
Network related functionality
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
.. versionadded:: 7.0.0
.. doxygenfunction:: proj_context_set_network_callbacks
:project: doxygen_api
.. doxygenfunction:: proj_context_set_enable_network
:project: doxygen_api
.. doxygenfunction:: proj_context_set_url_endpoint
:project: doxygen_api
.. doxygenfunction:: proj_grid_cache_set_enable
:project: doxygen_api
.. doxygenfunction:: proj_grid_cache_set_filename
:project: doxygen_api
.. doxygenfunction:: proj_grid_cache_set_max_size
:project: doxygen_api
.. doxygenfunction:: proj_grid_cache_set_ttl
:project: doxygen_api
.. doxygenfunction:: proj_grid_cache_clear
:project: doxygen_api
.. doxygenfunction:: proj_is_download_needed
:project: doxygen_api
.. doxygenfunction:: proj_download_file
:project: doxygen_api
Cleanup
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Expand Down Expand Up @@ -727,6 +775,6 @@ which are not of type CRS (can be tested with :c:func:`proj_is_crs`),
will return an error when used with functions of this section.
.. doxygengroup:: iso19111_functions
:project: cpp_stuff
:project: doxygen_api
:content-only:
4 changes: 4 additions & 0 deletions docs/source/operations/transformations/deformation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ Parameters
Grids for the horizontal component of a deformation model is expected to be
in CTable2 format.

.. note:: :option:`+xy_grids` is mutually exclusive with :option:`+grids`

.. option:: +z_grids=<list>

Comma-separated list of grids to load. If a grid is prefixed by an `@` the
Expand All @@ -108,6 +110,8 @@ Parameters
Grids for the vertical component of a deformation model is expected to be
in either GTX format.

.. note:: :option:`+z_grids` is mutually exclusive with :option:`+grids`

.. option:: +grids=<list>

.. versionadded:: 7.0.0
Expand Down
4 changes: 3 additions & 1 deletion docs/source/resource_files.rst
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ A proj installation includes a SQLite database of transformation information
that must be accessible for the library to work properly. The library will
print an error if the database can't be found.

.. _proj-ini:

proj.ini
-------------------------------------------------------------------------------

Expand All @@ -92,7 +94,7 @@ Its default content is:

cache_enabled = on

cache_size_MB = 100
cache_size_MB = 300

cache_ttl_sec = 86400

Expand Down
6 changes: 6 additions & 0 deletions docs/source/usage/differences.rst
Original file line number Diff line number Diff line change
Expand Up @@ -114,3 +114,9 @@ exclusive with :option:`+t_epoch`. :option:`+dt` is used when deformation
for a set amount of time is needed and :option:`+t_epoch` is used (in
conjunction with the observation time of the input coordinate) when
deformation from a specific epoch to the observation time is needed.

Version 7.0.0
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

The value of all path, filenames passed to PROJ through function calls, PROJ
strings or environment variables should be encoded in UTF-8.
10 changes: 9 additions & 1 deletion scripts/doxygen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,11 @@ fi
mkdir -p docs/build/tmp_breathe
python scripts/generate_breathe_friendly_general_doc.py
rm -rf docs/build/xml/
(cat Doxyfile; printf "GENERATE_HTML=NO\nGENERATE_XML=YES\nINPUT= src/iso19111 include/proj src/proj.h src/filemanager.cpp docs/build/tmp_breathe/general_doc.dox.reworked.h") | doxygen - > docs/build/tmp_breathe/docs_log.txt 2>&1

# Ugly hack to workaround a bug of Doxygen 1.8.17 that erroneously detect proj_network_get_header_value_cbk_type/ as a variable
sed "s/const char\* (\*proj_network_get_header_value_cbk_type/CONST_CHAR\* (\*proj_network_get_header_value_cbk_type/" < src/proj.h > docs/build/tmp_breathe/proj.h

(cat Doxyfile; printf "GENERATE_HTML=NO\nGENERATE_XML=YES\nINPUT= src/iso19111 include/proj docs/build/tmp_breathe/proj.h src/filemanager.cpp src/networkfilemanager.cpp docs/build/tmp_breathe/general_doc.dox.reworked.h") | doxygen - > docs/build/tmp_breathe/docs_log.txt 2>&1
if grep -i warning docs/build/tmp_breathe/docs_log.txt; then
echo "Doxygen warnings found" && cat docs/build/tmp_breathe/docs_log.txt && /bin/false;
else
Expand All @@ -56,5 +60,9 @@ done
sed "s/Convention/Convention_/g" < ${TOPDIR}/docs/build/xml/classosgeo_1_1proj_1_1io_1_1WKTFormatter.xml | sed "s/WKT2_2018/_WKT2_2018/g" | sed "s/WKT2_2019/_WKT2_2019/g" | sed "s/WKT2_2015/_WKT2_2015/g" | sed "s/WKT1_GDAL/_WKT1_GDAL/g" | sed "s/WKT1_ESRI/_WKT1_ESRI/g" > ${TOPDIR}/docs/build/xml/classosgeo_1_1proj_1_1io_1_1WKTFormatter.xml.tmp
mv ${TOPDIR}/docs/build/xml/classosgeo_1_1proj_1_1io_1_1WKTFormatter.xml.tmp ${TOPDIR}/docs/build/xml/classosgeo_1_1proj_1_1io_1_1WKTFormatter.xml

# Ugly hack to workaround a bug of Doxygen 1.8.17 that erroneously detect proj_network_get_header_value_cbk_type/ as a variable
sed "s/CONST_CHAR/const char/" < ${TOPDIR}/docs/build/xml/proj_8h.xml > ${TOPDIR}/docs/build/xml/proj_8h.xml.tmp
mv ${TOPDIR}/docs/build/xml/proj_8h.xml.tmp ${TOPDIR}/docs/build/xml/proj_8h.xml

popd > /dev/null || exit

Loading

0 comments on commit c5fb541

Please sign in to comment.