snowflake-connector-python 3.16.0__cp313-cp313-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- snowflake/connector/__init__.py +96 -0
- snowflake/connector/_query_context_cache.py +276 -0
- snowflake/connector/_sql_util.py +48 -0
- snowflake/connector/_utils.py +70 -0
- snowflake/connector/arrow_context.py +203 -0
- snowflake/connector/auth/__init__.py +53 -0
- snowflake/connector/auth/_auth.py +586 -0
- snowflake/connector/auth/_http_server.py +220 -0
- snowflake/connector/auth/_oauth_base.py +400 -0
- snowflake/connector/auth/by_plugin.py +219 -0
- snowflake/connector/auth/default.py +36 -0
- snowflake/connector/auth/idtoken.py +72 -0
- snowflake/connector/auth/keypair.py +222 -0
- snowflake/connector/auth/no_auth.py +39 -0
- snowflake/connector/auth/oauth.py +49 -0
- snowflake/connector/auth/oauth_code.py +479 -0
- snowflake/connector/auth/oauth_credentials.py +66 -0
- snowflake/connector/auth/okta.py +335 -0
- snowflake/connector/auth/pat.py +39 -0
- snowflake/connector/auth/usrpwdmfa.py +69 -0
- snowflake/connector/auth/webbrowser.py +502 -0
- snowflake/connector/auth/workload_identity.py +94 -0
- snowflake/connector/azure_storage_client.py +276 -0
- snowflake/connector/backoff_policies.py +141 -0
- snowflake/connector/bind_upload_agent.py +89 -0
- snowflake/connector/cache.py +696 -0
- snowflake/connector/compat.py +127 -0
- snowflake/connector/config_manager.py +496 -0
- snowflake/connector/connection.py +2273 -0
- snowflake/connector/connection_diagnostic.py +776 -0
- snowflake/connector/constants.py +442 -0
- snowflake/connector/converter.py +785 -0
- snowflake/connector/converter_issue23517.py +87 -0
- snowflake/connector/converter_null.py +14 -0
- snowflake/connector/converter_snowsql.py +205 -0
- snowflake/connector/cursor.py +1951 -0
- snowflake/connector/dbapi.py +53 -0
- snowflake/connector/description.py +19 -0
- snowflake/connector/direct_file_operation_utils.py +88 -0
- snowflake/connector/encryption_util.py +220 -0
- snowflake/connector/errorcode.py +91 -0
- snowflake/connector/errors.py +615 -0
- snowflake/connector/externals_utils/__init__.py +0 -0
- snowflake/connector/externals_utils/externals_setup.py +27 -0
- snowflake/connector/feature.py +4 -0
- snowflake/connector/file_compression_type.py +118 -0
- snowflake/connector/file_lock.py +72 -0
- snowflake/connector/file_transfer_agent.py +1215 -0
- snowflake/connector/file_util.py +153 -0
- snowflake/connector/gcs_storage_client.py +474 -0
- snowflake/connector/gzip_decoder.py +85 -0
- snowflake/connector/local_storage_client.py +90 -0
- snowflake/connector/log_configuration.py +60 -0
- snowflake/connector/logging_utils/__init__.py +0 -0
- snowflake/connector/logging_utils/filters.py +72 -0
- snowflake/connector/nanoarrow_arrow_iterator.cp313-win_amd64.pyd +0 -0
- snowflake/connector/nanoarrow_cpp/ArrowIterator/ArrayConverter.cpp +60 -0
- snowflake/connector/nanoarrow_cpp/ArrowIterator/ArrayConverter.hpp +29 -0
- snowflake/connector/nanoarrow_cpp/ArrowIterator/BinaryConverter.cpp +19 -0
- snowflake/connector/nanoarrow_cpp/ArrowIterator/BinaryConverter.hpp +26 -0
- snowflake/connector/nanoarrow_cpp/ArrowIterator/BooleanConverter.cpp +21 -0
- snowflake/connector/nanoarrow_cpp/ArrowIterator/BooleanConverter.hpp +23 -0
- snowflake/connector/nanoarrow_cpp/ArrowIterator/CArrowChunkIterator.cpp +557 -0
- snowflake/connector/nanoarrow_cpp/ArrowIterator/CArrowChunkIterator.hpp +98 -0
- snowflake/connector/nanoarrow_cpp/ArrowIterator/CArrowIterator.cpp +125 -0
- snowflake/connector/nanoarrow_cpp/ArrowIterator/CArrowIterator.hpp +115 -0
- snowflake/connector/nanoarrow_cpp/ArrowIterator/CArrowTableIterator.cpp +1005 -0
- snowflake/connector/nanoarrow_cpp/ArrowIterator/CArrowTableIterator.hpp +127 -0
- snowflake/connector/nanoarrow_cpp/ArrowIterator/DateConverter.cpp +47 -0
- snowflake/connector/nanoarrow_cpp/ArrowIterator/DateConverter.hpp +46 -0
- snowflake/connector/nanoarrow_cpp/ArrowIterator/DecFloatConverter.cpp +83 -0
- snowflake/connector/nanoarrow_cpp/ArrowIterator/DecFloatConverter.hpp +35 -0
- snowflake/connector/nanoarrow_cpp/ArrowIterator/DecimalConverter.cpp +97 -0
- snowflake/connector/nanoarrow_cpp/ArrowIterator/DecimalConverter.hpp +72 -0
- snowflake/connector/nanoarrow_cpp/ArrowIterator/FixedSizeListConverter.cpp +73 -0
- snowflake/connector/nanoarrow_cpp/ArrowIterator/FixedSizeListConverter.hpp +28 -0
- snowflake/connector/nanoarrow_cpp/ArrowIterator/FloatConverter.cpp +30 -0
- snowflake/connector/nanoarrow_cpp/ArrowIterator/FloatConverter.hpp +35 -0
- snowflake/connector/nanoarrow_cpp/ArrowIterator/IColumnConverter.hpp +17 -0
- snowflake/connector/nanoarrow_cpp/ArrowIterator/IntConverter.cpp +23 -0
- snowflake/connector/nanoarrow_cpp/ArrowIterator/IntConverter.hpp +45 -0
- snowflake/connector/nanoarrow_cpp/ArrowIterator/IntervalConverter.cpp +71 -0
- snowflake/connector/nanoarrow_cpp/ArrowIterator/IntervalConverter.hpp +56 -0
- snowflake/connector/nanoarrow_cpp/ArrowIterator/LICENSE.txt +209 -0
- snowflake/connector/nanoarrow_cpp/ArrowIterator/MapConverter.cpp +75 -0
- snowflake/connector/nanoarrow_cpp/ArrowIterator/MapConverter.hpp +30 -0
- snowflake/connector/nanoarrow_cpp/ArrowIterator/ObjectConverter.cpp +46 -0
- snowflake/connector/nanoarrow_cpp/ArrowIterator/ObjectConverter.hpp +29 -0
- snowflake/connector/nanoarrow_cpp/ArrowIterator/Python/Common.cpp +8 -0
- snowflake/connector/nanoarrow_cpp/ArrowIterator/Python/Common.hpp +95 -0
- snowflake/connector/nanoarrow_cpp/ArrowIterator/Python/Helpers.cpp +57 -0
- snowflake/connector/nanoarrow_cpp/ArrowIterator/Python/Helpers.hpp +36 -0
- snowflake/connector/nanoarrow_cpp/ArrowIterator/SnowflakeType.cpp +34 -0
- snowflake/connector/nanoarrow_cpp/ArrowIterator/SnowflakeType.hpp +48 -0
- snowflake/connector/nanoarrow_cpp/ArrowIterator/StringConverter.cpp +19 -0
- snowflake/connector/nanoarrow_cpp/ArrowIterator/StringConverter.hpp +26 -0
- snowflake/connector/nanoarrow_cpp/ArrowIterator/TimeConverter.cpp +36 -0
- snowflake/connector/nanoarrow_cpp/ArrowIterator/TimeConverter.hpp +31 -0
- snowflake/connector/nanoarrow_cpp/ArrowIterator/TimeStampConverter.cpp +346 -0
- snowflake/connector/nanoarrow_cpp/ArrowIterator/TimeStampConverter.hpp +145 -0
- snowflake/connector/nanoarrow_cpp/ArrowIterator/Util/macros.hpp +14 -0
- snowflake/connector/nanoarrow_cpp/ArrowIterator/Util/time.cpp +65 -0
- snowflake/connector/nanoarrow_cpp/ArrowIterator/Util/time.hpp +68 -0
- snowflake/connector/nanoarrow_cpp/ArrowIterator/flatcc/flatcc_accessors.h +101 -0
- snowflake/connector/nanoarrow_cpp/ArrowIterator/flatcc/flatcc_alloc.h +127 -0
- snowflake/connector/nanoarrow_cpp/ArrowIterator/flatcc/flatcc_assert.h +45 -0
- snowflake/connector/nanoarrow_cpp/ArrowIterator/flatcc/flatcc_builder.h +1908 -0
- snowflake/connector/nanoarrow_cpp/ArrowIterator/flatcc/flatcc_emitter.h +215 -0
- snowflake/connector/nanoarrow_cpp/ArrowIterator/flatcc/flatcc_endian.h +125 -0
- snowflake/connector/nanoarrow_cpp/ArrowIterator/flatcc/flatcc_epilogue.h +7 -0
- snowflake/connector/nanoarrow_cpp/ArrowIterator/flatcc/flatcc_flatbuffers.h +55 -0
- snowflake/connector/nanoarrow_cpp/ArrowIterator/flatcc/flatcc_identifier.h +148 -0
- snowflake/connector/nanoarrow_cpp/ArrowIterator/flatcc/flatcc_iov.h +31 -0
- snowflake/connector/nanoarrow_cpp/ArrowIterator/flatcc/flatcc_prologue.h +8 -0
- snowflake/connector/nanoarrow_cpp/ArrowIterator/flatcc/flatcc_refmap.h +144 -0
- snowflake/connector/nanoarrow_cpp/ArrowIterator/flatcc/flatcc_rtconfig.h +162 -0
- snowflake/connector/nanoarrow_cpp/ArrowIterator/flatcc/flatcc_types.h +97 -0
- snowflake/connector/nanoarrow_cpp/ArrowIterator/flatcc/flatcc_verifier.h +239 -0
- snowflake/connector/nanoarrow_cpp/ArrowIterator/flatcc/portable/flatcc_portable.h +14 -0
- snowflake/connector/nanoarrow_cpp/ArrowIterator/flatcc/portable/paligned_alloc.h +210 -0
- snowflake/connector/nanoarrow_cpp/ArrowIterator/flatcc/portable/pattributes.h +84 -0
- snowflake/connector/nanoarrow_cpp/ArrowIterator/flatcc/portable/pdiagnostic.h +84 -0
- snowflake/connector/nanoarrow_cpp/ArrowIterator/flatcc/portable/pdiagnostic_pop.h +20 -0
- snowflake/connector/nanoarrow_cpp/ArrowIterator/flatcc/portable/pdiagnostic_push.h +51 -0
- snowflake/connector/nanoarrow_cpp/ArrowIterator/flatcc/portable/pendian.h +206 -0
- snowflake/connector/nanoarrow_cpp/ArrowIterator/flatcc/portable/pendian_detect.h +118 -0
- snowflake/connector/nanoarrow_cpp/ArrowIterator/flatcc/portable/pinline.h +19 -0
- snowflake/connector/nanoarrow_cpp/ArrowIterator/flatcc/portable/pinttypes.h +52 -0
- snowflake/connector/nanoarrow_cpp/ArrowIterator/flatcc/portable/portable.h +2 -0
- snowflake/connector/nanoarrow_cpp/ArrowIterator/flatcc/portable/portable_basic.h +25 -0
- snowflake/connector/nanoarrow_cpp/ArrowIterator/flatcc/portable/pstatic_assert.h +67 -0
- snowflake/connector/nanoarrow_cpp/ArrowIterator/flatcc/portable/pstdalign.h +162 -0
- snowflake/connector/nanoarrow_cpp/ArrowIterator/flatcc/portable/pstdint.h +898 -0
- snowflake/connector/nanoarrow_cpp/ArrowIterator/flatcc/portable/punaligned.h +190 -0
- snowflake/connector/nanoarrow_cpp/ArrowIterator/flatcc/portable/pversion.h +6 -0
- snowflake/connector/nanoarrow_cpp/ArrowIterator/flatcc/portable/pwarnings.h +52 -0
- snowflake/connector/nanoarrow_cpp/ArrowIterator/flatcc.c +3204 -0
- snowflake/connector/nanoarrow_cpp/ArrowIterator/nanoarrow.c +3217 -0
- snowflake/connector/nanoarrow_cpp/ArrowIterator/nanoarrow.h +3618 -0
- snowflake/connector/nanoarrow_cpp/ArrowIterator/nanoarrow.hpp +379 -0
- snowflake/connector/nanoarrow_cpp/ArrowIterator/nanoarrow_arrow_iterator.pyx +256 -0
- snowflake/connector/nanoarrow_cpp/ArrowIterator/nanoarrow_device.c +512 -0
- snowflake/connector/nanoarrow_cpp/ArrowIterator/nanoarrow_device.h +350 -0
- snowflake/connector/nanoarrow_cpp/ArrowIterator/nanoarrow_ipc.c +33273 -0
- snowflake/connector/nanoarrow_cpp/ArrowIterator/nanoarrow_ipc.h +397 -0
- snowflake/connector/nanoarrow_cpp/Logging/logging.cpp +100 -0
- snowflake/connector/nanoarrow_cpp/Logging/logging.hpp +49 -0
- snowflake/connector/network.py +1297 -0
- snowflake/connector/ocsp_asn1crypto.py +447 -0
- snowflake/connector/ocsp_snowflake.py +1883 -0
- snowflake/connector/options.py +131 -0
- snowflake/connector/pandas_tools.py +732 -0
- snowflake/connector/proxy.py +43 -0
- snowflake/connector/py.typed +0 -0
- snowflake/connector/result_batch.py +786 -0
- snowflake/connector/result_set.py +319 -0
- snowflake/connector/s3_storage_client.py +605 -0
- snowflake/connector/secret_detector.py +181 -0
- snowflake/connector/sf_dirs.py +64 -0
- snowflake/connector/sfbinaryformat.py +35 -0
- snowflake/connector/sfdatetime.py +345 -0
- snowflake/connector/snow_logging.py +144 -0
- snowflake/connector/sqlstate.py +9 -0
- snowflake/connector/ssd_internal_keys.py +30 -0
- snowflake/connector/ssl_wrap_socket.py +134 -0
- snowflake/connector/storage_client.py +478 -0
- snowflake/connector/telemetry.py +249 -0
- snowflake/connector/telemetry_oob.py +543 -0
- snowflake/connector/test_util.py +30 -0
- snowflake/connector/time_util.py +159 -0
- snowflake/connector/token_cache.py +402 -0
- snowflake/connector/tool/__init__.py +0 -0
- snowflake/connector/tool/dump_certs.py +57 -0
- snowflake/connector/tool/dump_ocsp_response.py +139 -0
- snowflake/connector/tool/dump_ocsp_response_cache.py +194 -0
- snowflake/connector/tool/probe_connection.py +69 -0
- snowflake/connector/url_util.py +49 -0
- snowflake/connector/util_text.py +301 -0
- snowflake/connector/vendored/__init__.py +3 -0
- snowflake/connector/vendored/requests/LICENSE +175 -0
- snowflake/connector/vendored/requests/__init__.py +169 -0
- snowflake/connector/vendored/requests/__version__.py +14 -0
- snowflake/connector/vendored/requests/_internal_utils.py +50 -0
- snowflake/connector/vendored/requests/adapters.py +537 -0
- snowflake/connector/vendored/requests/api.py +157 -0
- snowflake/connector/vendored/requests/auth.py +315 -0
- snowflake/connector/vendored/requests/certs.py +17 -0
- snowflake/connector/vendored/requests/compat.py +79 -0
- snowflake/connector/vendored/requests/cookies.py +561 -0
- snowflake/connector/vendored/requests/exceptions.py +140 -0
- snowflake/connector/vendored/requests/help.py +134 -0
- snowflake/connector/vendored/requests/hooks.py +33 -0
- snowflake/connector/vendored/requests/models.py +1033 -0
- snowflake/connector/vendored/requests/sessions.py +833 -0
- snowflake/connector/vendored/requests/status_codes.py +128 -0
- snowflake/connector/vendored/requests/structures.py +99 -0
- snowflake/connector/vendored/requests/utils.py +1093 -0
- snowflake/connector/vendored/urllib3/LICENSE.txt +21 -0
- snowflake/connector/vendored/urllib3/__init__.py +85 -0
- snowflake/connector/vendored/urllib3/_collections.py +355 -0
- snowflake/connector/vendored/urllib3/_version.py +2 -0
- snowflake/connector/vendored/urllib3/connection.py +572 -0
- snowflake/connector/vendored/urllib3/connectionpool.py +1137 -0
- snowflake/connector/vendored/urllib3/contrib/__init__.py +0 -0
- snowflake/connector/vendored/urllib3/contrib/_appengine_environ.py +36 -0
- snowflake/connector/vendored/urllib3/contrib/_securetransport/__init__.py +0 -0
- snowflake/connector/vendored/urllib3/contrib/_securetransport/bindings.py +519 -0
- snowflake/connector/vendored/urllib3/contrib/_securetransport/low_level.py +397 -0
- snowflake/connector/vendored/urllib3/contrib/appengine.py +314 -0
- snowflake/connector/vendored/urllib3/contrib/ntlmpool.py +130 -0
- snowflake/connector/vendored/urllib3/contrib/pyopenssl.py +509 -0
- snowflake/connector/vendored/urllib3/contrib/securetransport.py +920 -0
- snowflake/connector/vendored/urllib3/contrib/socks.py +216 -0
- snowflake/connector/vendored/urllib3/exceptions.py +323 -0
- snowflake/connector/vendored/urllib3/fields.py +274 -0
- snowflake/connector/vendored/urllib3/filepost.py +98 -0
- snowflake/connector/vendored/urllib3/packages/__init__.py +0 -0
- snowflake/connector/vendored/urllib3/packages/backports/__init__.py +0 -0
- snowflake/connector/vendored/urllib3/packages/backports/makefile.py +51 -0
- snowflake/connector/vendored/urllib3/packages/backports/weakref_finalize.py +155 -0
- snowflake/connector/vendored/urllib3/packages/six.py +1076 -0
- snowflake/connector/vendored/urllib3/poolmanager.py +540 -0
- snowflake/connector/vendored/urllib3/request.py +191 -0
- snowflake/connector/vendored/urllib3/response.py +885 -0
- snowflake/connector/vendored/urllib3/util/__init__.py +49 -0
- snowflake/connector/vendored/urllib3/util/connection.py +156 -0
- snowflake/connector/vendored/urllib3/util/proxy.py +57 -0
- snowflake/connector/vendored/urllib3/util/queue.py +22 -0
- snowflake/connector/vendored/urllib3/util/request.py +146 -0
- snowflake/connector/vendored/urllib3/util/response.py +107 -0
- snowflake/connector/vendored/urllib3/util/retry.py +620 -0
- snowflake/connector/vendored/urllib3/util/ssl_.py +495 -0
- snowflake/connector/vendored/urllib3/util/ssl_match_hostname.py +159 -0
- snowflake/connector/vendored/urllib3/util/ssltransport.py +221 -0
- snowflake/connector/vendored/urllib3/util/timeout.py +271 -0
- snowflake/connector/vendored/urllib3/util/url.py +435 -0
- snowflake/connector/vendored/urllib3/util/wait.py +152 -0
- snowflake/connector/version.py +3 -0
- snowflake/connector/wif_util.py +407 -0
- snowflake_connector_python-3.16.0.dist-info/METADATA +1475 -0
- snowflake_connector_python-3.16.0.dist-info/RECORD +246 -0
- snowflake_connector_python-3.16.0.dist-info/WHEEL +5 -0
- snowflake_connector_python-3.16.0.dist-info/entry_points.txt +4 -0
- snowflake_connector_python-3.16.0.dist-info/licenses/LICENSE.txt +202 -0
- snowflake_connector_python-3.16.0.dist-info/licenses/NOTICE +8 -0
- snowflake_connector_python-3.16.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2016 Mikkel Fahnøe Jørgensen, dvide.com
|
|
3
|
+
*
|
|
4
|
+
* (MIT License)
|
|
5
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
6
|
+
* this software and associated documentation files (the "Software"), to deal in
|
|
7
|
+
* the Software without restriction, including without limitation the rights to
|
|
8
|
+
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
|
9
|
+
* the Software, and to permit persons to whom the Software is furnished to do so,
|
|
10
|
+
* subject to the following conditions:
|
|
11
|
+
* - The above copyright notice and this permission notice shall be included in
|
|
12
|
+
* all copies or substantial portions of the Software.
|
|
13
|
+
* - The Software is provided "as is", without warranty of any kind, express or
|
|
14
|
+
* implied, including but not limited to the warranties of merchantability,
|
|
15
|
+
* fitness for a particular purpose and noninfringement. In no event shall the
|
|
16
|
+
* authors or copyright holders be liable for any claim, damages or other
|
|
17
|
+
* liability, whether in an action of contract, tort or otherwise, arising from,
|
|
18
|
+
* out of or in connection with the Software or the use or other dealings in the
|
|
19
|
+
* Software.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
#ifndef PUNLIGNED_H
|
|
23
|
+
#define PUNLIGNED_H
|
|
24
|
+
|
|
25
|
+
#ifdef __cplusplus
|
|
26
|
+
extern "C" {
|
|
27
|
+
#endif
|
|
28
|
+
|
|
29
|
+
#ifndef PORTABLE_UNALIGNED_ACCESS
|
|
30
|
+
|
|
31
|
+
#if defined(__i386__) || defined(__x86_64__) || defined(_M_IX86) || defined(_M_X64)
|
|
32
|
+
#define PORTABLE_UNALIGNED_ACCESS 1
|
|
33
|
+
#else
|
|
34
|
+
#define PORTABLE_UNALIGNED_ACCESS 0
|
|
35
|
+
#endif
|
|
36
|
+
|
|
37
|
+
#endif
|
|
38
|
+
|
|
39
|
+
/* `unaligned_read_16` might not be defined if endianness was not determined. */
|
|
40
|
+
#if !defined(unaligned_read_le16toh)
|
|
41
|
+
|
|
42
|
+
#include "pendian.h"
|
|
43
|
+
|
|
44
|
+
#ifndef UINT8_MAX
|
|
45
|
+
#include <stdint.h>
|
|
46
|
+
#endif
|
|
47
|
+
|
|
48
|
+
#if PORTABLE_UNALIGNED_ACCESS
|
|
49
|
+
|
|
50
|
+
#define unaligned_read_16(p) (*(uint16_t*)(p))
|
|
51
|
+
#define unaligned_read_32(p) (*(uint32_t*)(p))
|
|
52
|
+
#define unaligned_read_64(p) (*(uint64_t*)(p))
|
|
53
|
+
|
|
54
|
+
#define unaligned_read_le16toh(p) le16toh(*(uint16_t*)(p))
|
|
55
|
+
#define unaligned_read_le32toh(p) le32toh(*(uint32_t*)(p))
|
|
56
|
+
#define unaligned_read_le64toh(p) le64toh(*(uint64_t*)(p))
|
|
57
|
+
|
|
58
|
+
#define unaligned_read_be16toh(p) be16toh(*(uint16_t*)(p))
|
|
59
|
+
#define unaligned_read_be32toh(p) be32toh(*(uint32_t*)(p))
|
|
60
|
+
#define unaligned_read_be64toh(p) be64toh(*(uint64_t*)(p))
|
|
61
|
+
|
|
62
|
+
#define unaligned_write_16(p, v) (*(uint16_t*)(p) = (uint16_t)(v))
|
|
63
|
+
#define unaligned_write_32(p, v) (*(uint32_t*)(p) = (uint32_t)(v))
|
|
64
|
+
#define unaligned_write_64(p, v) (*(uint64_t*)(p) = (uint64_t)(v))
|
|
65
|
+
|
|
66
|
+
#define unaligned_write_htole16(p, v) (*(uint16_t*)(p) = htole16(v))
|
|
67
|
+
#define unaligned_write_htole32(p, v) (*(uint32_t*)(p) = htole32(v))
|
|
68
|
+
#define unaligned_write_htole64(p, v) (*(uint64_t*)(p) = htole64(v))
|
|
69
|
+
|
|
70
|
+
#define unaligned_write_htobe16(p, v) (*(uint16_t*)(p) = htobe16(v))
|
|
71
|
+
#define unaligned_write_htobe32(p, v) (*(uint32_t*)(p) = htobe32(v))
|
|
72
|
+
#define unaligned_write_htobe64(p, v) (*(uint64_t*)(p) = htobe64(v))
|
|
73
|
+
|
|
74
|
+
#else
|
|
75
|
+
|
|
76
|
+
#define unaligned_read_le16toh(p) ( \
|
|
77
|
+
(((uint16_t)(((uint8_t *)(p))[0])) << 0) | \
|
|
78
|
+
(((uint16_t)(((uint8_t *)(p))[1])) << 8))
|
|
79
|
+
|
|
80
|
+
#define unaligned_read_le32toh(p) ( \
|
|
81
|
+
(((uint32_t)(((uint8_t *)(p))[0])) << 0) | \
|
|
82
|
+
(((uint32_t)(((uint8_t *)(p))[1])) << 8) | \
|
|
83
|
+
(((uint32_t)(((uint8_t *)(p))[2])) << 16) | \
|
|
84
|
+
(((uint32_t)(((uint8_t *)(p))[3])) << 24))
|
|
85
|
+
|
|
86
|
+
#define unaligned_read_le64toh(p) ( \
|
|
87
|
+
(((uint64_t)(((uint8_t *)(p))[0])) << 0) | \
|
|
88
|
+
(((uint64_t)(((uint8_t *)(p))[1])) << 8) | \
|
|
89
|
+
(((uint64_t)(((uint8_t *)(p))[2])) << 16) | \
|
|
90
|
+
(((uint64_t)(((uint8_t *)(p))[3])) << 24) | \
|
|
91
|
+
(((uint64_t)(((uint8_t *)(p))[4])) << 32) | \
|
|
92
|
+
(((uint64_t)(((uint8_t *)(p))[5])) << 40) | \
|
|
93
|
+
(((uint64_t)(((uint8_t *)(p))[6])) << 48) | \
|
|
94
|
+
(((uint64_t)(((uint8_t *)(p))[7])) << 56))
|
|
95
|
+
|
|
96
|
+
#define unaligned_read_be16toh(p) ( \
|
|
97
|
+
(((uint16_t)(((uint8_t *)(p))[0])) << 8) | \
|
|
98
|
+
(((uint16_t)(((uint8_t *)(p))[1])) << 0))
|
|
99
|
+
|
|
100
|
+
#define unaligned_read_be32toh(p) ( \
|
|
101
|
+
(((uint32_t)(((uint8_t *)(p))[0])) << 24) | \
|
|
102
|
+
(((uint32_t)(((uint8_t *)(p))[1])) << 16) | \
|
|
103
|
+
(((uint32_t)(((uint8_t *)(p))[2])) << 8) | \
|
|
104
|
+
(((uint32_t)(((uint8_t *)(p))[3])) << 0))
|
|
105
|
+
|
|
106
|
+
#define unaligned_read_be64toh(p) ( \
|
|
107
|
+
(((uint64_t)(((uint8_t *)(p))[0])) << 56) | \
|
|
108
|
+
(((uint64_t)(((uint8_t *)(p))[1])) << 48) | \
|
|
109
|
+
(((uint64_t)(((uint8_t *)(p))[2])) << 40) | \
|
|
110
|
+
(((uint64_t)(((uint8_t *)(p))[3])) << 32) | \
|
|
111
|
+
(((uint64_t)(((uint8_t *)(p))[4])) << 24) | \
|
|
112
|
+
(((uint64_t)(((uint8_t *)(p))[5])) << 16) | \
|
|
113
|
+
(((uint64_t)(((uint8_t *)(p))[6])) << 8) | \
|
|
114
|
+
(((uint64_t)(((uint8_t *)(p))[7])) << 0))
|
|
115
|
+
|
|
116
|
+
#define unaligned_write_htole16(p, v) do { \
|
|
117
|
+
((uint8_t *)(p))[0] = (uint8_t)(((uint16_t)(v)) >> 0); \
|
|
118
|
+
((uint8_t *)(p))[1] = (uint8_t)(((uint16_t)(v)) >> 8); \
|
|
119
|
+
} while (0)
|
|
120
|
+
|
|
121
|
+
#define unaligned_write_htole32(p, v) do { \
|
|
122
|
+
((uint8_t *)(p))[0] = (uint8_t)(((uint32_t)(v)) >> 0); \
|
|
123
|
+
((uint8_t *)(p))[1] = (uint8_t)(((uint32_t)(v)) >> 8); \
|
|
124
|
+
((uint8_t *)(p))[2] = (uint8_t)(((uint32_t)(v)) >> 16); \
|
|
125
|
+
((uint8_t *)(p))[3] = (uint8_t)(((uint32_t)(v)) >> 24); \
|
|
126
|
+
} while (0)
|
|
127
|
+
|
|
128
|
+
#define unaligned_write_htole64(p) do { \
|
|
129
|
+
((uint8_t *)(p))[0] = (uint8_t)(((uint64_t)(v)) >> 0); \
|
|
130
|
+
((uint8_t *)(p))[1] = (uint8_t)(((uint64_t)(v)) >> 8); \
|
|
131
|
+
((uint8_t *)(p))[2] = (uint8_t)(((uint64_t)(v)) >> 16); \
|
|
132
|
+
((uint8_t *)(p))[3] = (uint8_t)(((uint64_t)(v)) >> 24); \
|
|
133
|
+
((uint8_t *)(p))[4] = (uint8_t)(((uint64_t)(v)) >> 32); \
|
|
134
|
+
((uint8_t *)(p))[5] = (uint8_t)(((uint64_t)(v)) >> 40); \
|
|
135
|
+
((uint8_t *)(p))[6] = (uint8_t)(((uint64_t)(v)) >> 48); \
|
|
136
|
+
((uint8_t *)(p))[7] = (uint8_t)(((uint64_t)(v)) >> 56); \
|
|
137
|
+
} while (0)
|
|
138
|
+
|
|
139
|
+
#define unaligned_write_htobe16(p, v) do { \
|
|
140
|
+
((uint8_t *)(p))[0] = (uint8_t)(((uint16_t)(v)) >> 8); \
|
|
141
|
+
((uint8_t *)(p))[1] = (uint8_t)(((uint16_t)(v)) >> 0); \
|
|
142
|
+
} while (0)
|
|
143
|
+
|
|
144
|
+
#define unaligned_write_htobe32(p, v) do { \
|
|
145
|
+
((uint8_t *)(p))[0] = (uint8_t)(((uint32_t)(v)) >> 24); \
|
|
146
|
+
((uint8_t *)(p))[1] = (uint8_t)(((uint32_t)(v)) >> 16); \
|
|
147
|
+
((uint8_t *)(p))[2] = (uint8_t)(((uint32_t)(v)) >> 8); \
|
|
148
|
+
((uint8_t *)(p))[3] = (uint8_t)(((uint32_t)(v)) >> 0); \
|
|
149
|
+
} while (0)
|
|
150
|
+
|
|
151
|
+
#define unaligned_write_htobe64(p) do { \
|
|
152
|
+
((uint8_t *)(p))[0] = (uint8_t)(((uint64_t)(v)) >> 56); \
|
|
153
|
+
((uint8_t *)(p))[1] = (uint8_t)(((uint64_t)(v)) >> 48); \
|
|
154
|
+
((uint8_t *)(p))[2] = (uint8_t)(((uint64_t)(v)) >> 40); \
|
|
155
|
+
((uint8_t *)(p))[3] = (uint8_t)(((uint64_t)(v)) >> 32); \
|
|
156
|
+
((uint8_t *)(p))[4] = (uint8_t)(((uint64_t)(v)) >> 24); \
|
|
157
|
+
((uint8_t *)(p))[5] = (uint8_t)(((uint64_t)(v)) >> 16); \
|
|
158
|
+
((uint8_t *)(p))[6] = (uint8_t)(((uint64_t)(v)) >> 8); \
|
|
159
|
+
((uint8_t *)(p))[7] = (uint8_t)(((uint64_t)(v)) >> 0); \
|
|
160
|
+
} while (0)
|
|
161
|
+
|
|
162
|
+
#if __LITTLE_ENDIAN__
|
|
163
|
+
#define unaligned_read_16(p) unaligned_read_le16toh(p)
|
|
164
|
+
#define unaligned_read_32(p) unaligned_read_le32toh(p)
|
|
165
|
+
#define unaligned_read_64(p) unaligned_read_le64toh(p)
|
|
166
|
+
|
|
167
|
+
#define unaligned_write_16(p) unaligned_write_htole16(p)
|
|
168
|
+
#define unaligned_write_32(p) unaligned_write_htole32(p)
|
|
169
|
+
#define unaligned_write_64(p) unaligned_write_htole64(p)
|
|
170
|
+
#endif
|
|
171
|
+
|
|
172
|
+
#if __BIG_ENDIAN__
|
|
173
|
+
#define unaligned_read_16(p) unaligned_read_be16toh(p)
|
|
174
|
+
#define unaligned_read_32(p) unaligned_read_be32toh(p)
|
|
175
|
+
#define unaligned_read_64(p) unaligned_read_be64toh(p)
|
|
176
|
+
|
|
177
|
+
#define unaligned_write_16(p) unaligned_write_htobe16(p)
|
|
178
|
+
#define unaligned_write_32(p) unaligned_write_htobe32(p)
|
|
179
|
+
#define unaligned_write_64(p) unaligned_write_htobe64(p)
|
|
180
|
+
#endif
|
|
181
|
+
|
|
182
|
+
#endif
|
|
183
|
+
|
|
184
|
+
#endif
|
|
185
|
+
|
|
186
|
+
#ifdef __cplusplus
|
|
187
|
+
}
|
|
188
|
+
#endif
|
|
189
|
+
|
|
190
|
+
#endif /* PUNALIGNED_H */
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
#ifndef PWARNINGS_H
|
|
2
|
+
#define PWARNINGS_H
|
|
3
|
+
|
|
4
|
+
#ifdef __cplusplus
|
|
5
|
+
extern "C" {
|
|
6
|
+
#endif
|
|
7
|
+
|
|
8
|
+
/*
|
|
9
|
+
* See also pdiagnostics.h headers for per file control of common
|
|
10
|
+
* warnings.
|
|
11
|
+
*
|
|
12
|
+
* This file is intended for global disabling of warnings that shouldn't
|
|
13
|
+
* be present in C11 or perhaps C99, or a generally just noise where
|
|
14
|
+
* recent clang / gcc compile cleanly with high warning levels.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
#if defined(_MSC_VER)
|
|
18
|
+
/* Needed when flagging code in or out and more. */
|
|
19
|
+
#pragma warning(disable: 4127) /* conditional expression is constant */
|
|
20
|
+
/* happens also in MS's own headers. */
|
|
21
|
+
#pragma warning(disable: 4668) /* preprocessor name not defined */
|
|
22
|
+
/* MSVC does not respect double parenthesis for intent */
|
|
23
|
+
#pragma warning(disable: 4706) /* assignment within conditional expression */
|
|
24
|
+
/* `inline` only advisory anyway. */
|
|
25
|
+
#pragma warning(disable: 4710) /* function not inlined */
|
|
26
|
+
/* Well, we don't intend to add the padding manually. */
|
|
27
|
+
#pragma warning(disable: 4820) /* x bytes padding added in struct */
|
|
28
|
+
|
|
29
|
+
/*
|
|
30
|
+
* Don't warn that fopen etc. are unsafe
|
|
31
|
+
*
|
|
32
|
+
* Define a compiler flag like `-D_CRT_SECURE_NO_WARNINGS` in the build.
|
|
33
|
+
* For some reason it doesn't work when defined here.
|
|
34
|
+
*
|
|
35
|
+
* #define _CRT_SECURE_NO_WARNINGS
|
|
36
|
+
*/
|
|
37
|
+
|
|
38
|
+
/*
|
|
39
|
+
* Anonymous union in struct is valid in C11 and has been supported in
|
|
40
|
+
* GCC and Clang for a while, but it is not C99. MSVC also handles it,
|
|
41
|
+
* but warns. Truly portable code should perhaps not use this feature,
|
|
42
|
+
* but this is not the place to complain about it.
|
|
43
|
+
*/
|
|
44
|
+
#pragma warning(disable: 4201) /* nonstandard extension used: nameless struct/union */
|
|
45
|
+
|
|
46
|
+
#endif /* _MSV_VER */
|
|
47
|
+
|
|
48
|
+
#ifdef __cplusplus
|
|
49
|
+
}
|
|
50
|
+
#endif
|
|
51
|
+
|
|
52
|
+
#endif /* PWARNINGS_H */
|