- upgrade libidn

This commit is contained in:
Giuseppe Nucifora 2016-02-26 03:02:52 +01:00
parent 2b8d4ff66b
commit 9ef9394bd0
1015 changed files with 44748 additions and 132401 deletions

View File

@ -21,6 +21,7 @@ PODS:
- KissXML/Core (5.0.3)
- KissXML/Standard (5.0.3):
- KissXML/Core
- libidn (1.32.1)
- PNXMPPFramework (0.1.0):
- PNXMPPFramework/Authentication (= 0.1.0)
- PNXMPPFramework/BandwidthMonitor (= 0.1.0)
@ -74,6 +75,7 @@ PODS:
- CocoaAsyncSocket
- CocoaLumberjack (~> 1.9)
- KissXML
- libidn
- PNXMPPFramework/CoreDataStorage (0.1.0):
- PNXMPPFramework/Core
- PNXMPPFramework/GoogleSharedStatus (0.1.0):
@ -175,8 +177,9 @@ SPEC CHECKSUMS:
CocoaLumberjack: 628fca2e88ef06f7cf6817309aa405f325d9a6fa
FBSnapshotTestCase: 7e85180d0d141a0cf472352edda7e80d7eaeb547
KissXML: d19dd6dc65e0dc721ba92b3077b8ebdd240f1c1e
PNXMPPFramework: 69989a4b1f7470763acd3e9a3d982ddfa5c161df
libidn: fdf56b4958f08f8544c4cf45b3ed28bfe45c2b05
PNXMPPFramework: 74877c04ff3b2ee176ee8f766ceb84eeee5fa9be
PODFILE CHECKSUM: c24dacdc80a49fe0e0fea049a6d762eb76667498
COCOAPODS: 1.0.0.beta.3
COCOAPODS: 1.0.0.beta.4

View File

@ -1,7 +1,7 @@
{
"name": "PNXMPPFramework",
"version": "0.1.0",
"summary": "A short of PNXMPPFramework.",
"summary": "PNXMPPFramework is a fork of original framework https://github.com/robbiehanson/XMPPFramework with KissXML and CocoaAsyncSocket upgrade",
"homepage": "https://github.com/giuseppenucifora/PNXMPPFramework",
"license": "MIT",
"authors": {
@ -31,19 +31,16 @@
"source_files": [
"XMPPFramework.h",
"Core/**/*.{h,m}",
"Vendor/libidn/*.h",
"Authentication/**/*.{h,m}",
"Categories/**/*.{h,m}",
"Utilities/**/*.{h,m}"
],
"vendored_libraries": "Vendor/libidn/libidn.a",
"libraries": [
"xml2",
"resolv"
],
"xcconfig": {
"HEADER_SEARCH_PATHS": "$(inherited) $(SDKROOT)/usr/include/libxml2 $(PODS_ROOT)/XMPPFramework/module $(SDKROOT)/usr/include/libresolv",
"LIBRARY_SEARCH_PATHS": "\"$(PODS_ROOT)/Vendor/libidn\"",
"CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES": "YES",
"OTHER_LDFLAGS": "\"-lxml2\"",
"ENABLE_BITCODE": "NO"
@ -57,6 +54,9 @@
],
"KissXML": [
],
"libidn": [
]
}
},

View File

@ -21,6 +21,7 @@ PODS:
- KissXML/Core (5.0.3)
- KissXML/Standard (5.0.3):
- KissXML/Core
- libidn (1.32.1)
- PNXMPPFramework (0.1.0):
- PNXMPPFramework/Authentication (= 0.1.0)
- PNXMPPFramework/BandwidthMonitor (= 0.1.0)
@ -74,6 +75,7 @@ PODS:
- CocoaAsyncSocket
- CocoaLumberjack (~> 1.9)
- KissXML
- libidn
- PNXMPPFramework/CoreDataStorage (0.1.0):
- PNXMPPFramework/Core
- PNXMPPFramework/GoogleSharedStatus (0.1.0):
@ -175,8 +177,9 @@ SPEC CHECKSUMS:
CocoaLumberjack: 628fca2e88ef06f7cf6817309aa405f325d9a6fa
FBSnapshotTestCase: 7e85180d0d141a0cf472352edda7e80d7eaeb547
KissXML: d19dd6dc65e0dc721ba92b3077b8ebdd240f1c1e
PNXMPPFramework: 69989a4b1f7470763acd3e9a3d982ddfa5c161df
libidn: fdf56b4958f08f8544c4cf45b3ed28bfe45c2b05
PNXMPPFramework: 74877c04ff3b2ee176ee8f766ceb84eeee5fa9be
PODFILE CHECKSUM: c24dacdc80a49fe0e0fea049a6d762eb76667498
COCOAPODS: 1.0.0.beta.3
COCOAPODS: 1.0.0.beta.4

File diff suppressed because it is too large Load Diff

View File

@ -14,7 +14,7 @@
buildForArchiving = "YES">
<BuildableReference
BuildableIdentifier = 'primary'
BlueprintIdentifier = '188DC26053F39001ADD409E9BD3B63A8'
BlueprintIdentifier = '5A47A49BC81CD43B3A6B9F35F8D21AB9'
BlueprintName = 'PNXMPPFramework'
ReferencedContainer = 'container:Pods.xcodeproj'
BuildableName = 'PNXMPPFramework.framework'>

View File

@ -1,6 +1,8 @@
CONFIGURATION_BUILD_DIR = $PODS_SHARED_BUILD_DIR/CocoaAsyncSocket
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Public"
OTHER_LDFLAGS = -framework "CFNetwork" -framework "Security"
PODS_ROOT = ${SRCROOT}
PODS_SHARED_BUILD_DIR = $(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}
SKIP_INSTALL = YES

View File

@ -1,5 +1,7 @@
CONFIGURATION_BUILD_DIR = $PODS_SHARED_BUILD_DIR/CocoaLumberjack
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Public"
PODS_ROOT = ${SRCROOT}
PODS_SHARED_BUILD_DIR = $(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}
SKIP_INSTALL = YES

View File

@ -1,3 +1,4 @@
CONFIGURATION_BUILD_DIR = $PODS_SHARED_BUILD_DIR/FBSnapshotTestCase
ENABLE_BITCODE = NO
FRAMEWORK_SEARCH_PATHS = $(inherited) "$(PLATFORM_DIR)/Developer/Library/Frameworks"
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
@ -5,5 +6,6 @@ HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Publi
OTHER_LDFLAGS = -framework "Foundation" -framework "QuartzCore" -framework "UIKit" -framework "XCTest"
OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS"
PODS_ROOT = ${SRCROOT}
PODS_SHARED_BUILD_DIR = $(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}
SKIP_INSTALL = YES

View File

@ -1,8 +1,10 @@
CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = YES
CONFIGURATION_BUILD_DIR = $PODS_SHARED_BUILD_DIR/KissXML
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Public" $(SDKROOT)/usr/include/libxml2
OTHER_CFLAGS = $(inherited) -DDDXML_LIBXML_MODULE_ENABLED=0
OTHER_LDFLAGS = -l"xml2"
PODS_ROOT = ${SRCROOT}
PODS_SHARED_BUILD_DIR = $(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}
SKIP_INSTALL = YES

View File

@ -14,8 +14,6 @@
#import "XMPPParser.h"
#import "XMPPPresence.h"
#import "XMPPStream.h"
#import "idn-int.h"
#import "stringprep.h"
#import "XMPPAnonymousAuthentication.h"
#import "XMPPDeprecatedDigestAuthentication.h"
#import "XMPPDeprecatedPlainAuthentication.h"

View File

@ -1,9 +1,11 @@
CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = YES
CONFIGURATION_BUILD_DIR = $PODS_SHARED_BUILD_DIR/PNXMPPFramework
ENABLE_BITCODE = NO
FRAMEWORK_SEARCH_PATHS = $(inherited) "$PODS_SHARED_BUILD_DIR/CocoaAsyncSocket" "$PODS_SHARED_BUILD_DIR/CocoaLumberjack" "$PODS_SHARED_BUILD_DIR/KissXML" "$PODS_SHARED_BUILD_DIR/libidn"
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Public" $(inherited) $(SDKROOT)/usr/include/libxml2 $(PODS_ROOT)/XMPPFramework/module $(SDKROOT)/usr/include/libresolv
LIBRARY_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/../../Vendor/libidn" "$(PODS_ROOT)/Vendor/libidn"
OTHER_LDFLAGS = -l"idn" -l"resolv" -l"xml2" -framework "CoreData" -framework "CoreLocation" -framework "SystemConfiguration"
OTHER_LDFLAGS = -l"resolv" -l"xml2" -framework "CoreData" -framework "CoreLocation" -framework "SystemConfiguration"
PODS_ROOT = ${SRCROOT}
PODS_SHARED_BUILD_DIR = $(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}
SKIP_INSTALL = YES

View File

@ -65,4 +65,38 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
## libidn
Libidn COPYING -- Explanation of licensing conditions.
Copyright (C) 2002-2015 Simon Josefsson
See the end for copying conditions.
The source code for the C library (libidn.a or libidn.so), the C#
library (Libidn.dll) and the Java library (libidn-*.jar) are licensed
under the terms of either the GNU General Public License version 2.0
or later (see the file COPYINGv2) or the GNU Lesser General Public
License version 3.0 or later (see the file COPYING.LESSERv3), or both
in parallel as here.
The author of the Java library has agreed to also distribute it under
the Apache License Version 2.0 (see the file java/LICENSE-2.0).
The manual is licensed under the GNU Free Documentation License,
Version 1.3 or any later.
The command line tool, self tests, examples, and other auxilliary
files, are licensed under the GNU General Public License version 3.0
or later.
Other files are licensed as indicated in each file.
There may be exceptions to these general rules, see each file for
precise information.
----------------------------------------------------------------------
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
notice and this notice are preserved.
Generated by CocoaPods - https://cocoapods.org

View File

@ -93,6 +93,44 @@ THE SOFTWARE.
<key>Type</key>
<string>PSGroupSpecifier</string>
</dict>
<dict>
<key>FooterText</key>
<string>Libidn COPYING -- Explanation of licensing conditions.
Copyright (C) 2002-2015 Simon Josefsson
See the end for copying conditions.
The source code for the C library (libidn.a or libidn.so), the C#
library (Libidn.dll) and the Java library (libidn-*.jar) are licensed
under the terms of either the GNU General Public License version 2.0
or later (see the file COPYINGv2) or the GNU Lesser General Public
License version 3.0 or later (see the file COPYING.LESSERv3), or both
in parallel as here.
The author of the Java library has agreed to also distribute it under
the Apache License Version 2.0 (see the file java/LICENSE-2.0).
The manual is licensed under the GNU Free Documentation License,
Version 1.3 or any later.
The command line tool, self tests, examples, and other auxilliary
files, are licensed under the GNU General Public License version 3.0
or later.
Other files are licensed as indicated in each file.
There may be exceptions to these general rules, see each file for
precise information.
----------------------------------------------------------------------
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
notice and this notice are preserved.
</string>
<key>Title</key>
<string>libidn</string>
<key>Type</key>
<string>PSGroupSpecifier</string>
</dict>
<dict>
<key>FooterText</key>
<string>Generated by CocoaPods - https://cocoapods.org</string>

View File

@ -84,14 +84,16 @@ strip_invalid_archs() {
if [[ "$CONFIGURATION" == "Debug" ]]; then
install_framework "Pods-PNXMPPFramework_Example/CocoaAsyncSocket.framework"
install_framework "Pods-PNXMPPFramework_Example/CocoaLumberjack.framework"
install_framework "Pods-PNXMPPFramework_Example/KissXML.framework"
install_framework "Pods-PNXMPPFramework_Example/PNXMPPFramework.framework"
install_framework "$CONFIGURATION_BUILD_DIR/CocoaAsyncSocket/CocoaAsyncSocket.framework"
install_framework "$CONFIGURATION_BUILD_DIR/CocoaLumberjack/CocoaLumberjack.framework"
install_framework "$CONFIGURATION_BUILD_DIR/KissXML/KissXML.framework"
install_framework "$CONFIGURATION_BUILD_DIR/PNXMPPFramework/PNXMPPFramework.framework"
install_framework "$CONFIGURATION_BUILD_DIR/libidn/libidn.framework"
fi
if [[ "$CONFIGURATION" == "Release" ]]; then
install_framework "Pods-PNXMPPFramework_Example/CocoaAsyncSocket.framework"
install_framework "Pods-PNXMPPFramework_Example/CocoaLumberjack.framework"
install_framework "Pods-PNXMPPFramework_Example/KissXML.framework"
install_framework "Pods-PNXMPPFramework_Example/PNXMPPFramework.framework"
install_framework "$CONFIGURATION_BUILD_DIR/CocoaAsyncSocket/CocoaAsyncSocket.framework"
install_framework "$CONFIGURATION_BUILD_DIR/CocoaLumberjack/CocoaLumberjack.framework"
install_framework "$CONFIGURATION_BUILD_DIR/KissXML/KissXML.framework"
install_framework "$CONFIGURATION_BUILD_DIR/PNXMPPFramework/PNXMPPFramework.framework"
install_framework "$CONFIGURATION_BUILD_DIR/libidn/libidn.framework"
fi

View File

@ -8,6 +8,21 @@ RESOURCES_TO_COPY=${PODS_ROOT}/resources-to-copy-${TARGETNAME}.txt
XCASSET_FILES=()
case "${TARGETED_DEVICE_FAMILY}" in
1,2)
TARGET_DEVICE_ARGS="--target-device ipad --target-device iphone"
;;
1)
TARGET_DEVICE_ARGS="--target-device iphone"
;;
2)
TARGET_DEVICE_ARGS="--target-device ipad"
;;
*)
TARGET_DEVICE_ARGS="--target-device mac"
;;
esac
realpath() {
DIRECTORY="$(cd "${1%/*}" && pwd)"
FILENAME="${1##*/}"
@ -29,8 +44,8 @@ EOM
fi
case $RESOURCE_PATH in
*.storyboard)
echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc $RESOURCE_PATH --sdk ${SDKROOT}"
ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc" "$RESOURCE_PATH" --sdk "${SDKROOT}"
echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}"
ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc" "$RESOURCE_PATH" --sdk "${SDKROOT} ${TARGET_DEVICE_ARGS}"
;;
*.xib)
echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib $RESOURCE_PATH --sdk ${SDKROOT}"
@ -75,21 +90,6 @@ rm -f "$RESOURCES_TO_COPY"
if [[ -n "${WRAPPER_EXTENSION}" ]] && [ "`xcrun --find actool`" ] && [ -n "$XCASSET_FILES" ]
then
case "${TARGETED_DEVICE_FAMILY}" in
1,2)
TARGET_DEVICE_ARGS="--target-device ipad --target-device iphone"
;;
1)
TARGET_DEVICE_ARGS="--target-device iphone"
;;
2)
TARGET_DEVICE_ARGS="--target-device ipad"
;;
*)
TARGET_DEVICE_ARGS="--target-device mac"
;;
esac
# Find all other xcassets (this unfortunately includes those of path pods and other targets).
OTHER_XCASSETS=$(find "$PWD" -iname "*.xcassets" -type d)
while read line; do

View File

@ -1,10 +1,9 @@
CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = YES
ENABLE_BITCODE = NO
FRAMEWORK_SEARCH_PATHS = $(inherited) "$CONFIGURATION_BUILD_DIR/CocoaAsyncSocket" "$CONFIGURATION_BUILD_DIR/CocoaLumberjack" "$CONFIGURATION_BUILD_DIR/KissXML" "$CONFIGURATION_BUILD_DIR/PNXMPPFramework" "$CONFIGURATION_BUILD_DIR/libidn"
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
HEADER_SEARCH_PATHS = $(SDKROOT)/usr/include/libxml2 $(inherited) $(SDKROOT)/usr/include/libxml2 $(PODS_ROOT)/XMPPFramework/module $(SDKROOT)/usr/include/libresolv
HEADER_SEARCH_PATHS = $(SDKROOT)/usr/include/libxml2 $(inherited) $(SDKROOT)/usr/include/libxml2 $(PODS_ROOT)/XMPPFramework/module $(SDKROOT)/usr/include/libresolv $(inherited) ${SRCROOT} ${SRCROOT}/lib ${SRCROOT}/lib/gl
LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks'
LIBRARY_SEARCH_PATHS = "$(PODS_ROOT)/Vendor/libidn"
OTHER_CFLAGS = $(inherited) -DDDXML_LIBXML_MODULE_ENABLED=0 $(inherited) -iquote "$CONFIGURATION_BUILD_DIR/CocoaAsyncSocket.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/CocoaLumberjack.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/KissXML.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/PNXMPPFramework.framework/Headers"
OTHER_LDFLAGS = $(inherited) -ObjC -l"xml2" -framework "CocoaAsyncSocket" -framework "CocoaLumberjack" -framework "KissXML" -framework "PNXMPPFramework"
PODS_FRAMEWORK_BUILD_PATH = "$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/Pods-PNXMPPFramework_Example"
OTHER_CFLAGS = $(inherited) -DDDXML_LIBXML_MODULE_ENABLED=0 $(inherited) -iquote "$CONFIGURATION_BUILD_DIR/CocoaAsyncSocket/CocoaAsyncSocket.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/CocoaLumberjack/CocoaLumberjack.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/KissXML/KissXML.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/PNXMPPFramework/PNXMPPFramework.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/libidn/libidn.framework/Headers"
OTHER_LDFLAGS = $(inherited) -l"xml2" -framework "CocoaAsyncSocket" -framework "CocoaLumberjack" -framework "KissXML" -framework "PNXMPPFramework" -framework "libidn"
PODS_ROOT = ${SRCROOT}/Pods

View File

@ -1,10 +1,9 @@
CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = YES
ENABLE_BITCODE = NO
FRAMEWORK_SEARCH_PATHS = $(inherited) "$CONFIGURATION_BUILD_DIR/CocoaAsyncSocket" "$CONFIGURATION_BUILD_DIR/CocoaLumberjack" "$CONFIGURATION_BUILD_DIR/KissXML" "$CONFIGURATION_BUILD_DIR/PNXMPPFramework" "$CONFIGURATION_BUILD_DIR/libidn"
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
HEADER_SEARCH_PATHS = $(SDKROOT)/usr/include/libxml2 $(inherited) $(SDKROOT)/usr/include/libxml2 $(PODS_ROOT)/XMPPFramework/module $(SDKROOT)/usr/include/libresolv
HEADER_SEARCH_PATHS = $(SDKROOT)/usr/include/libxml2 $(inherited) $(SDKROOT)/usr/include/libxml2 $(PODS_ROOT)/XMPPFramework/module $(SDKROOT)/usr/include/libresolv $(inherited) ${SRCROOT} ${SRCROOT}/lib ${SRCROOT}/lib/gl
LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks'
LIBRARY_SEARCH_PATHS = "$(PODS_ROOT)/Vendor/libidn"
OTHER_CFLAGS = $(inherited) -DDDXML_LIBXML_MODULE_ENABLED=0 $(inherited) -iquote "$CONFIGURATION_BUILD_DIR/CocoaAsyncSocket.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/CocoaLumberjack.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/KissXML.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/PNXMPPFramework.framework/Headers"
OTHER_LDFLAGS = $(inherited) -ObjC -l"xml2" -framework "CocoaAsyncSocket" -framework "CocoaLumberjack" -framework "KissXML" -framework "PNXMPPFramework"
PODS_FRAMEWORK_BUILD_PATH = "$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/Pods-PNXMPPFramework_Example"
OTHER_CFLAGS = $(inherited) -DDDXML_LIBXML_MODULE_ENABLED=0 $(inherited) -iquote "$CONFIGURATION_BUILD_DIR/CocoaAsyncSocket/CocoaAsyncSocket.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/CocoaLumberjack/CocoaLumberjack.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/KissXML/KissXML.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/PNXMPPFramework/PNXMPPFramework.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/libidn/libidn.framework/Headers"
OTHER_LDFLAGS = $(inherited) -l"xml2" -framework "CocoaAsyncSocket" -framework "CocoaLumberjack" -framework "KissXML" -framework "PNXMPPFramework" -framework "libidn"
PODS_ROOT = ${SRCROOT}/Pods

View File

@ -66,6 +66,40 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
## libidn
Libidn COPYING -- Explanation of licensing conditions.
Copyright (C) 2002-2015 Simon Josefsson
See the end for copying conditions.
The source code for the C library (libidn.a or libidn.so), the C#
library (Libidn.dll) and the Java library (libidn-*.jar) are licensed
under the terms of either the GNU General Public License version 2.0
or later (see the file COPYINGv2) or the GNU Lesser General Public
License version 3.0 or later (see the file COPYING.LESSERv3), or both
in parallel as here.
The author of the Java library has agreed to also distribute it under
the Apache License Version 2.0 (see the file java/LICENSE-2.0).
The manual is licensed under the GNU Free Documentation License,
Version 1.3 or any later.
The command line tool, self tests, examples, and other auxilliary
files, are licensed under the GNU General Public License version 3.0
or later.
Other files are licensed as indicated in each file.
There may be exceptions to these general rules, see each file for
precise information.
----------------------------------------------------------------------
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
notice and this notice are preserved.
## FBSnapshotTestCase
BSD License

View File

@ -93,6 +93,44 @@ THE SOFTWARE.
<key>Type</key>
<string>PSGroupSpecifier</string>
</dict>
<dict>
<key>FooterText</key>
<string>Libidn COPYING -- Explanation of licensing conditions.
Copyright (C) 2002-2015 Simon Josefsson
See the end for copying conditions.
The source code for the C library (libidn.a or libidn.so), the C#
library (Libidn.dll) and the Java library (libidn-*.jar) are licensed
under the terms of either the GNU General Public License version 2.0
or later (see the file COPYINGv2) or the GNU Lesser General Public
License version 3.0 or later (see the file COPYING.LESSERv3), or both
in parallel as here.
The author of the Java library has agreed to also distribute it under
the Apache License Version 2.0 (see the file java/LICENSE-2.0).
The manual is licensed under the GNU Free Documentation License,
Version 1.3 or any later.
The command line tool, self tests, examples, and other auxilliary
files, are licensed under the GNU General Public License version 3.0
or later.
Other files are licensed as indicated in each file.
There may be exceptions to these general rules, see each file for
precise information.
----------------------------------------------------------------------
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
notice and this notice are preserved.
</string>
<key>Title</key>
<string>libidn</string>
<key>Type</key>
<string>PSGroupSpecifier</string>
</dict>
<dict>
<key>FooterText</key>
<string>BSD License

View File

@ -84,16 +84,18 @@ strip_invalid_archs() {
if [[ "$CONFIGURATION" == "Debug" ]]; then
install_framework "Pods-PNXMPPFramework_Tests/CocoaAsyncSocket.framework"
install_framework "Pods-PNXMPPFramework_Tests/CocoaLumberjack.framework"
install_framework "Pods-PNXMPPFramework_Tests/KissXML.framework"
install_framework "Pods-PNXMPPFramework_Tests/PNXMPPFramework.framework"
install_framework "Pods-PNXMPPFramework_Tests/FBSnapshotTestCase.framework"
install_framework "$CONFIGURATION_BUILD_DIR/CocoaAsyncSocket/CocoaAsyncSocket.framework"
install_framework "$CONFIGURATION_BUILD_DIR/CocoaLumberjack/CocoaLumberjack.framework"
install_framework "$CONFIGURATION_BUILD_DIR/KissXML/KissXML.framework"
install_framework "$CONFIGURATION_BUILD_DIR/PNXMPPFramework/PNXMPPFramework.framework"
install_framework "$CONFIGURATION_BUILD_DIR/libidn/libidn.framework"
install_framework "$CONFIGURATION_BUILD_DIR/FBSnapshotTestCase/FBSnapshotTestCase.framework"
fi
if [[ "$CONFIGURATION" == "Release" ]]; then
install_framework "Pods-PNXMPPFramework_Tests/CocoaAsyncSocket.framework"
install_framework "Pods-PNXMPPFramework_Tests/CocoaLumberjack.framework"
install_framework "Pods-PNXMPPFramework_Tests/KissXML.framework"
install_framework "Pods-PNXMPPFramework_Tests/PNXMPPFramework.framework"
install_framework "Pods-PNXMPPFramework_Tests/FBSnapshotTestCase.framework"
install_framework "$CONFIGURATION_BUILD_DIR/CocoaAsyncSocket/CocoaAsyncSocket.framework"
install_framework "$CONFIGURATION_BUILD_DIR/CocoaLumberjack/CocoaLumberjack.framework"
install_framework "$CONFIGURATION_BUILD_DIR/KissXML/KissXML.framework"
install_framework "$CONFIGURATION_BUILD_DIR/PNXMPPFramework/PNXMPPFramework.framework"
install_framework "$CONFIGURATION_BUILD_DIR/libidn/libidn.framework"
install_framework "$CONFIGURATION_BUILD_DIR/FBSnapshotTestCase/FBSnapshotTestCase.framework"
fi

View File

@ -8,6 +8,21 @@ RESOURCES_TO_COPY=${PODS_ROOT}/resources-to-copy-${TARGETNAME}.txt
XCASSET_FILES=()
case "${TARGETED_DEVICE_FAMILY}" in
1,2)
TARGET_DEVICE_ARGS="--target-device ipad --target-device iphone"
;;
1)
TARGET_DEVICE_ARGS="--target-device iphone"
;;
2)
TARGET_DEVICE_ARGS="--target-device ipad"
;;
*)
TARGET_DEVICE_ARGS="--target-device mac"
;;
esac
realpath() {
DIRECTORY="$(cd "${1%/*}" && pwd)"
FILENAME="${1##*/}"
@ -29,8 +44,8 @@ EOM
fi
case $RESOURCE_PATH in
*.storyboard)
echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc $RESOURCE_PATH --sdk ${SDKROOT}"
ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc" "$RESOURCE_PATH" --sdk "${SDKROOT}"
echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}"
ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc" "$RESOURCE_PATH" --sdk "${SDKROOT} ${TARGET_DEVICE_ARGS}"
;;
*.xib)
echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib $RESOURCE_PATH --sdk ${SDKROOT}"
@ -75,21 +90,6 @@ rm -f "$RESOURCES_TO_COPY"
if [[ -n "${WRAPPER_EXTENSION}" ]] && [ "`xcrun --find actool`" ] && [ -n "$XCASSET_FILES" ]
then
case "${TARGETED_DEVICE_FAMILY}" in
1,2)
TARGET_DEVICE_ARGS="--target-device ipad --target-device iphone"
;;
1)
TARGET_DEVICE_ARGS="--target-device iphone"
;;
2)
TARGET_DEVICE_ARGS="--target-device ipad"
;;
*)
TARGET_DEVICE_ARGS="--target-device mac"
;;
esac
# Find all other xcassets (this unfortunately includes those of path pods and other targets).
OTHER_XCASSETS=$(find "$PWD" -iname "*.xcassets" -type d)
while read line; do

View File

@ -1,12 +1,11 @@
CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = YES
EMBEDDED_CONTENT_CONTAINS_SWIFT = YES
ENABLE_BITCODE = NO
FRAMEWORK_SEARCH_PATHS = $(inherited) "$CONFIGURATION_BUILD_DIR/CocoaAsyncSocket" "$CONFIGURATION_BUILD_DIR/CocoaLumberjack" "$CONFIGURATION_BUILD_DIR/FBSnapshotTestCase" "$CONFIGURATION_BUILD_DIR/KissXML" "$CONFIGURATION_BUILD_DIR/PNXMPPFramework" "$CONFIGURATION_BUILD_DIR/libidn"
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
HEADER_SEARCH_PATHS = $(SDKROOT)/usr/include/libxml2 $(inherited) $(SDKROOT)/usr/include/libxml2 $(PODS_ROOT)/XMPPFramework/module $(SDKROOT)/usr/include/libresolv
HEADER_SEARCH_PATHS = $(SDKROOT)/usr/include/libxml2 $(inherited) $(SDKROOT)/usr/include/libxml2 $(PODS_ROOT)/XMPPFramework/module $(SDKROOT)/usr/include/libresolv $(inherited) ${SRCROOT} ${SRCROOT}/lib ${SRCROOT}/lib/gl
LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks'
LIBRARY_SEARCH_PATHS = "$(PODS_ROOT)/Vendor/libidn"
OTHER_CFLAGS = $(inherited) -DDDXML_LIBXML_MODULE_ENABLED=0 $(inherited) -iquote "$CONFIGURATION_BUILD_DIR/CocoaAsyncSocket.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/CocoaLumberjack.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/FBSnapshotTestCase.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/KissXML.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/PNXMPPFramework.framework/Headers"
OTHER_LDFLAGS = $(inherited) -ObjC -l"xml2" -framework "CocoaAsyncSocket" -framework "CocoaLumberjack" -framework "FBSnapshotTestCase" -framework "KissXML" -framework "PNXMPPFramework"
OTHER_CFLAGS = $(inherited) -DDDXML_LIBXML_MODULE_ENABLED=0 $(inherited) -iquote "$CONFIGURATION_BUILD_DIR/CocoaAsyncSocket/CocoaAsyncSocket.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/CocoaLumberjack/CocoaLumberjack.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/FBSnapshotTestCase/FBSnapshotTestCase.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/KissXML/KissXML.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/PNXMPPFramework/PNXMPPFramework.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/libidn/libidn.framework/Headers"
OTHER_LDFLAGS = $(inherited) -l"xml2" -framework "CocoaAsyncSocket" -framework "CocoaLumberjack" -framework "FBSnapshotTestCase" -framework "KissXML" -framework "PNXMPPFramework" -framework "libidn"
OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS"
PODS_FRAMEWORK_BUILD_PATH = "$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/Pods-PNXMPPFramework_Tests"
PODS_ROOT = ${SRCROOT}/Pods

View File

@ -1,12 +1,11 @@
CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = YES
EMBEDDED_CONTENT_CONTAINS_SWIFT = YES
ENABLE_BITCODE = NO
FRAMEWORK_SEARCH_PATHS = $(inherited) "$CONFIGURATION_BUILD_DIR/CocoaAsyncSocket" "$CONFIGURATION_BUILD_DIR/CocoaLumberjack" "$CONFIGURATION_BUILD_DIR/FBSnapshotTestCase" "$CONFIGURATION_BUILD_DIR/KissXML" "$CONFIGURATION_BUILD_DIR/PNXMPPFramework" "$CONFIGURATION_BUILD_DIR/libidn"
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
HEADER_SEARCH_PATHS = $(SDKROOT)/usr/include/libxml2 $(inherited) $(SDKROOT)/usr/include/libxml2 $(PODS_ROOT)/XMPPFramework/module $(SDKROOT)/usr/include/libresolv
HEADER_SEARCH_PATHS = $(SDKROOT)/usr/include/libxml2 $(inherited) $(SDKROOT)/usr/include/libxml2 $(PODS_ROOT)/XMPPFramework/module $(SDKROOT)/usr/include/libresolv $(inherited) ${SRCROOT} ${SRCROOT}/lib ${SRCROOT}/lib/gl
LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks'
LIBRARY_SEARCH_PATHS = "$(PODS_ROOT)/Vendor/libidn"
OTHER_CFLAGS = $(inherited) -DDDXML_LIBXML_MODULE_ENABLED=0 $(inherited) -iquote "$CONFIGURATION_BUILD_DIR/CocoaAsyncSocket.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/CocoaLumberjack.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/FBSnapshotTestCase.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/KissXML.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/PNXMPPFramework.framework/Headers"
OTHER_LDFLAGS = $(inherited) -ObjC -l"xml2" -framework "CocoaAsyncSocket" -framework "CocoaLumberjack" -framework "FBSnapshotTestCase" -framework "KissXML" -framework "PNXMPPFramework"
OTHER_CFLAGS = $(inherited) -DDDXML_LIBXML_MODULE_ENABLED=0 $(inherited) -iquote "$CONFIGURATION_BUILD_DIR/CocoaAsyncSocket/CocoaAsyncSocket.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/CocoaLumberjack/CocoaLumberjack.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/FBSnapshotTestCase/FBSnapshotTestCase.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/KissXML/KissXML.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/PNXMPPFramework/PNXMPPFramework.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/libidn/libidn.framework/Headers"
OTHER_LDFLAGS = $(inherited) -l"xml2" -framework "CocoaAsyncSocket" -framework "CocoaLumberjack" -framework "FBSnapshotTestCase" -framework "KissXML" -framework "PNXMPPFramework" -framework "libidn"
OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS"
PODS_FRAMEWORK_BUILD_PATH = "$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/Pods-PNXMPPFramework_Tests"
PODS_ROOT = ${SRCROOT}/Pods

View File

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key>
<string>${PRODUCT_BUNDLE_IDENTIFIER}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.32.1</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>${CURRENT_PROJECT_VERSION}</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>
</plist>

View File

@ -0,0 +1,5 @@
#import <Foundation/Foundation.h>
@interface PodsDummy_libidn : NSObject
@end
@implementation PodsDummy_libidn
@end

View File

@ -0,0 +1,4 @@
#ifdef __OBJC__
#import <UIKit/UIKit.h>
#endif

View File

@ -0,0 +1,12 @@
#import <UIKit/UIKit.h>
#import "idn-int.h"
#import "idna.h"
#import "pr29.h"
#import "punycode.h"
#import "stringprep.h"
#import "tld.h"
FOUNDATION_EXPORT double libidnVersionNumber;
FOUNDATION_EXPORT const unsigned char libidnVersionString[];

View File

@ -0,0 +1,6 @@
framework module libidn {
umbrella header "libidn-umbrella.h"
export *
module * { export * }
}

View File

@ -0,0 +1,8 @@
CONFIGURATION_BUILD_DIR = $PODS_SHARED_BUILD_DIR/libidn
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Public" $(inherited) ${SRCROOT} ${SRCROOT}/lib ${SRCROOT}/lib/gl
OTHER_LDFLAGS = -l"iconv"
PODS_ROOT = ${SRCROOT}
PODS_SHARED_BUILD_DIR = $(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}
SKIP_INSTALL = YES

30
Example/Pods/libidn/COPYING generated Normal file
View File

@ -0,0 +1,30 @@
Libidn COPYING -- Explanation of licensing conditions.
Copyright (C) 2002-2015 Simon Josefsson
See the end for copying conditions.
The source code for the C library (libidn.a or libidn.so), the C#
library (Libidn.dll) and the Java library (libidn-*.jar) are licensed
under the terms of either the GNU General Public License version 2.0
or later (see the file COPYINGv2) or the GNU Lesser General Public
License version 3.0 or later (see the file COPYING.LESSERv3), or both
in parallel as here.
The author of the Java library has agreed to also distribute it under
the Apache License Version 2.0 (see the file java/LICENSE-2.0).
The manual is licensed under the GNU Free Documentation License,
Version 1.3 or any later.
The command line tool, self tests, examples, and other auxilliary
files, are licensed under the GNU General Public License version 3.0
or later.
Other files are licensed as indicated in each file.
There may be exceptions to these general rules, see each file for
precise information.
----------------------------------------------------------------------
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
notice and this notice are preserved.

502
Example/Pods/libidn/COPYING.LESSERv2 generated Normal file
View File

@ -0,0 +1,502 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 2.1, February 1999
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
[This is the first released version of the Lesser GPL. It also counts
as the successor of the GNU Library Public License, version 2, hence
the version number 2.1.]
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
Licenses are intended to guarantee your freedom to share and change
free software--to make sure the software is free for all its users.
This license, the Lesser General Public License, applies to some
specially designated software packages--typically libraries--of the
Free Software Foundation and other authors who decide to use it. You
can use it too, but we suggest you first think carefully about whether
this license or the ordinary General Public License is the better
strategy to use in any particular case, based on the explanations below.
When we speak of free software, we are referring to freedom of use,
not price. Our General Public Licenses are designed to make sure that
you have the freedom to distribute copies of free software (and charge
for this service if you wish); that you receive source code or can get
it if you want it; that you can change the software and use pieces of
it in new free programs; and that you are informed that you can do
these things.
To protect your rights, we need to make restrictions that forbid
distributors to deny you these rights or to ask you to surrender these
rights. These restrictions translate to certain responsibilities for
you if you distribute copies of the library or if you modify it.
For example, if you distribute copies of the library, whether gratis
or for a fee, you must give the recipients all the rights that we gave
you. You must make sure that they, too, receive or can get the source
code. If you link other code with the library, you must provide
complete object files to the recipients, so that they can relink them
with the library after making changes to the library and recompiling
it. And you must show them these terms so they know their rights.
We protect your rights with a two-step method: (1) we copyright the
library, and (2) we offer you this license, which gives you legal
permission to copy, distribute and/or modify the library.
To protect each distributor, we want to make it very clear that
there is no warranty for the free library. Also, if the library is
modified by someone else and passed on, the recipients should know
that what they have is not the original version, so that the original
author's reputation will not be affected by problems that might be
introduced by others.
Finally, software patents pose a constant threat to the existence of
any free program. We wish to make sure that a company cannot
effectively restrict the users of a free program by obtaining a
restrictive license from a patent holder. Therefore, we insist that
any patent license obtained for a version of the library must be
consistent with the full freedom of use specified in this license.
Most GNU software, including some libraries, is covered by the
ordinary GNU General Public License. This license, the GNU Lesser
General Public License, applies to certain designated libraries, and
is quite different from the ordinary General Public License. We use
this license for certain libraries in order to permit linking those
libraries into non-free programs.
When a program is linked with a library, whether statically or using
a shared library, the combination of the two is legally speaking a
combined work, a derivative of the original library. The ordinary
General Public License therefore permits such linking only if the
entire combination fits its criteria of freedom. The Lesser General
Public License permits more lax criteria for linking other code with
the library.
We call this license the "Lesser" General Public License because it
does Less to protect the user's freedom than the ordinary General
Public License. It also provides other free software developers Less
of an advantage over competing non-free programs. These disadvantages
are the reason we use the ordinary General Public License for many
libraries. However, the Lesser license provides advantages in certain
special circumstances.
For example, on rare occasions, there may be a special need to
encourage the widest possible use of a certain library, so that it becomes
a de-facto standard. To achieve this, non-free programs must be
allowed to use the library. A more frequent case is that a free
library does the same job as widely used non-free libraries. In this
case, there is little to gain by limiting the free library to free
software only, so we use the Lesser General Public License.
In other cases, permission to use a particular library in non-free
programs enables a greater number of people to use a large body of
free software. For example, permission to use the GNU C Library in
non-free programs enables many more people to use the whole GNU
operating system, as well as its variant, the GNU/Linux operating
system.
Although the Lesser General Public License is Less protective of the
users' freedom, it does ensure that the user of a program that is
linked with the Library has the freedom and the wherewithal to run
that program using a modified version of the Library.
The precise terms and conditions for copying, distribution and
modification follow. Pay close attention to the difference between a
"work based on the library" and a "work that uses the library". The
former contains code derived from the library, whereas the latter must
be combined with the library in order to run.
GNU LESSER GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any software library or other
program which contains a notice placed by the copyright holder or
other authorized party saying it may be distributed under the terms of
this Lesser General Public License (also called "this License").
Each licensee is addressed as "you".
A "library" means a collection of software functions and/or data
prepared so as to be conveniently linked with application programs
(which use some of those functions and data) to form executables.
The "Library", below, refers to any such software library or work
which has been distributed under these terms. A "work based on the
Library" means either the Library or any derivative work under
copyright law: that is to say, a work containing the Library or a
portion of it, either verbatim or with modifications and/or translated
straightforwardly into another language. (Hereinafter, translation is
included without limitation in the term "modification".)
"Source code" for a work means the preferred form of the work for
making modifications to it. For a library, complete source code means
all the source code for all modules it contains, plus any associated
interface definition files, plus the scripts used to control compilation
and installation of the library.
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running a program using the Library is not restricted, and output from
such a program is covered only if its contents constitute a work based
on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does.
1. You may copy and distribute verbatim copies of the Library's
complete source code as you receive it, in any medium, provided that
you conspicuously and appropriately publish on each copy an
appropriate copyright notice and disclaimer of warranty; keep intact
all the notices that refer to this License and to the absence of any
warranty; and distribute a copy of this License along with the
Library.
You may charge a fee for the physical act of transferring a copy,
and you may at your option offer warranty protection in exchange for a
fee.
2. You may modify your copy or copies of the Library or any portion
of it, thus forming a work based on the Library, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) The modified work must itself be a software library.
b) You must cause the files modified to carry prominent notices
stating that you changed the files and the date of any change.
c) You must cause the whole of the work to be licensed at no
charge to all third parties under the terms of this License.
d) If a facility in the modified Library refers to a function or a
table of data to be supplied by an application program that uses
the facility, other than as an argument passed when the facility
is invoked, then you must make a good faith effort to ensure that,
in the event an application does not supply such function or
table, the facility still operates, and performs whatever part of
its purpose remains meaningful.
(For example, a function in a library to compute square roots has
a purpose that is entirely well-defined independent of the
application. Therefore, Subsection 2d requires that any
application-supplied function or table used by this function must
be optional: if the application does not supply it, the square
root function must still compute square roots.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Library,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Library, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote
it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Library.
In addition, mere aggregation of another work not based on the Library
with the Library (or with a work based on the Library) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may opt to apply the terms of the ordinary GNU General Public
License instead of this License to a given copy of the Library. To do
this, you must alter all the notices that refer to this License, so
that they refer to the ordinary GNU General Public License, version 2,
instead of to this License. (If a newer version than version 2 of the
ordinary GNU General Public License has appeared, then you can specify
that version instead if you wish.) Do not make any other change in
these notices.
Once this change is made in a given copy, it is irreversible for
that copy, so the ordinary GNU General Public License applies to all
subsequent copies and derivative works made from that copy.
This option is useful when you wish to copy part of the code of
the Library into a program that is not a library.
4. You may copy and distribute the Library (or a portion or
derivative of it, under Section 2) in object code or executable form
under the terms of Sections 1 and 2 above provided that you accompany
it with the complete corresponding machine-readable source code, which
must be distributed under the terms of Sections 1 and 2 above on a
medium customarily used for software interchange.
If distribution of object code is made by offering access to copy
from a designated place, then offering equivalent access to copy the
source code from the same place satisfies the requirement to
distribute the source code, even though third parties are not
compelled to copy the source along with the object code.
5. A program that contains no derivative of any portion of the
Library, but is designed to work with the Library by being compiled or
linked with it, is called a "work that uses the Library". Such a
work, in isolation, is not a derivative work of the Library, and
therefore falls outside the scope of this License.
However, linking a "work that uses the Library" with the Library
creates an executable that is a derivative of the Library (because it
contains portions of the Library), rather than a "work that uses the
library". The executable is therefore covered by this License.
Section 6 states terms for distribution of such executables.
When a "work that uses the Library" uses material from a header file
that is part of the Library, the object code for the work may be a
derivative work of the Library even though the source code is not.
Whether this is true is especially significant if the work can be
linked without the Library, or if the work is itself a library. The
threshold for this to be true is not precisely defined by law.
If such an object file uses only numerical parameters, data
structure layouts and accessors, and small macros and small inline
functions (ten lines or less in length), then the use of the object
file is unrestricted, regardless of whether it is legally a derivative
work. (Executables containing this object code plus portions of the
Library will still fall under Section 6.)
Otherwise, if the work is a derivative of the Library, you may
distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself.
6. As an exception to the Sections above, you may also combine or
link a "work that uses the Library" with the Library to produce a
work containing portions of the Library, and distribute that work
under terms of your choice, provided that the terms permit
modification of the work for the customer's own use and reverse
engineering for debugging such modifications.
You must give prominent notice with each copy of the work that the
Library is used in it and that the Library and its use are covered by
this License. You must supply a copy of this License. If the work
during execution displays copyright notices, you must include the
copyright notice for the Library among them, as well as a reference
directing the user to the copy of this License. Also, you must do one
of these things:
a) Accompany the work with the complete corresponding
machine-readable source code for the Library including whatever
changes were used in the work (which must be distributed under
Sections 1 and 2 above); and, if the work is an executable linked
with the Library, with the complete machine-readable "work that
uses the Library", as object code and/or source code, so that the
user can modify the Library and then relink to produce a modified
executable containing the modified Library. (It is understood
that the user who changes the contents of definitions files in the
Library will not necessarily be able to recompile the application
to use the modified definitions.)
b) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (1) uses at run time a
copy of the library already present on the user's computer system,
rather than copying library functions into the executable, and (2)
will operate properly with a modified version of the library, if
the user installs one, as long as the modified version is
interface-compatible with the version that the work was made with.
c) Accompany the work with a written offer, valid for at
least three years, to give the same user the materials
specified in Subsection 6a, above, for a charge no more
than the cost of performing this distribution.
d) If distribution of the work is made by offering access to copy
from a designated place, offer equivalent access to copy the above
specified materials from the same place.
e) Verify that the user has already received a copy of these
materials or that you have already sent this user a copy.
For an executable, the required form of the "work that uses the
Library" must include any data and utility programs needed for
reproducing the executable from it. However, as a special exception,
the materials to be distributed need not include anything that is
normally distributed (in either source or binary form) with the major
components (compiler, kernel, and so on) of the operating system on
which the executable runs, unless that component itself accompanies
the executable.
It may happen that this requirement contradicts the license
restrictions of other proprietary libraries that do not normally
accompany the operating system. Such a contradiction means you cannot
use both them and the Library together in an executable that you
distribute.
7. You may place library facilities that are a work based on the
Library side-by-side in a single library together with other library
facilities not covered by this License, and distribute such a combined
library, provided that the separate distribution of the work based on
the Library and of the other library facilities is otherwise
permitted, and provided that you do these two things:
a) Accompany the combined library with a copy of the same work
based on the Library, uncombined with any other library
facilities. This must be distributed under the terms of the
Sections above.
b) Give prominent notice with the combined library of the fact
that part of it is a work based on the Library, and explaining
where to find the accompanying uncombined form of the same work.
8. You may not copy, modify, sublicense, link with, or distribute
the Library except as expressly provided under this License. Any
attempt otherwise to copy, modify, sublicense, link with, or
distribute the Library is void, and will automatically terminate your
rights under this License. However, parties who have received copies,
or rights, from you under this License will not have their licenses
terminated so long as such parties remain in full compliance.
9. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Library or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Library (or any work based on the
Library), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Library or works based on it.
10. Each time you redistribute the Library (or any work based on the
Library), the recipient automatically receives a license from the
original licensor to copy, distribute, link with or modify the Library
subject to these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties with
this License.
11. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Library at all. For example, if a patent
license would not permit royalty-free redistribution of the Library by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Library.
If any portion of this section is held invalid or unenforceable under any
particular circumstance, the balance of the section is intended to apply,
and the section as a whole is intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
12. If the distribution and/or use of the Library is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Library under this License may add
an explicit geographical distribution limitation excluding those countries,
so that distribution is permitted only in or among countries not thus
excluded. In such case, this License incorporates the limitation as if
written in the body of this License.
13. The Free Software Foundation may publish revised and/or new
versions of the Lesser General Public License from time to time.
Such new versions will be similar in spirit to the present version,
but may differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Library
specifies a version number of this License which applies to it and
"any later version", you have the option of following the terms and
conditions either of that version or of any later version published by
the Free Software Foundation. If the Library does not specify a
license version number, you may choose any version ever published by
the Free Software Foundation.
14. If you wish to incorporate parts of the Library into other free
programs whose distribution conditions are incompatible with these,
write to the author to ask for permission. For software which is
copyrighted by the Free Software Foundation, write to the Free
Software Foundation; we sometimes make exceptions for this. Our
decision will be guided by the two goals of preserving the free status
of all derivatives of our free software and of promoting the sharing
and reuse of software generally.
NO WARRANTY
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Libraries
If you develop a new library, and you want it to be of the greatest
possible use to the public, we recommend making it free software that
everyone can redistribute and change. You can do so by permitting
redistribution under these terms (or, alternatively, under the terms of the
ordinary General Public License).
To apply these terms, attach the following notices to the library. It is
safest to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least the
"copyright" line and a pointer to where the full notice is found.
<one line to give the library's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Also add information on how to contact you by electronic and paper mail.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the library, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
<signature of Ty Coon>, 1 April 1990
Ty Coon, President of Vice
That's all there is to it!

165
Example/Pods/libidn/COPYING.LESSERv3 generated Normal file
View File

@ -0,0 +1,165 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
This version of the GNU Lesser General Public License incorporates
the terms and conditions of version 3 of the GNU General Public
License, supplemented by the additional permissions listed below.
0. Additional Definitions.
As used herein, "this License" refers to version 3 of the GNU Lesser
General Public License, and the "GNU GPL" refers to version 3 of the GNU
General Public License.
"The Library" refers to a covered work governed by this License,
other than an Application or a Combined Work as defined below.
An "Application" is any work that makes use of an interface provided
by the Library, but which is not otherwise based on the Library.
Defining a subclass of a class defined by the Library is deemed a mode
of using an interface provided by the Library.
A "Combined Work" is a work produced by combining or linking an
Application with the Library. The particular version of the Library
with which the Combined Work was made is also called the "Linked
Version".
The "Minimal Corresponding Source" for a Combined Work means the
Corresponding Source for the Combined Work, excluding any source code
for portions of the Combined Work that, considered in isolation, are
based on the Application, and not on the Linked Version.
The "Corresponding Application Code" for a Combined Work means the
object code and/or source code for the Application, including any data
and utility programs needed for reproducing the Combined Work from the
Application, but excluding the System Libraries of the Combined Work.
1. Exception to Section 3 of the GNU GPL.
You may convey a covered work under sections 3 and 4 of this License
without being bound by section 3 of the GNU GPL.
2. Conveying Modified Versions.
If you modify a copy of the Library, and, in your modifications, a
facility refers to a function or data to be supplied by an Application
that uses the facility (other than as an argument passed when the
facility is invoked), then you may convey a copy of the modified
version:
a) under this License, provided that you make a good faith effort to
ensure that, in the event an Application does not supply the
function or data, the facility still operates, and performs
whatever part of its purpose remains meaningful, or
b) under the GNU GPL, with none of the additional permissions of
this License applicable to that copy.
3. Object Code Incorporating Material from Library Header Files.
The object code form of an Application may incorporate material from
a header file that is part of the Library. You may convey such object
code under terms of your choice, provided that, if the incorporated
material is not limited to numerical parameters, data structure
layouts and accessors, or small macros, inline functions and templates
(ten or fewer lines in length), you do both of the following:
a) Give prominent notice with each copy of the object code that the
Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the object code with a copy of the GNU GPL and this license
document.
4. Combined Works.
You may convey a Combined Work under terms of your choice that,
taken together, effectively do not restrict modification of the
portions of the Library contained in the Combined Work and reverse
engineering for debugging such modifications, if you also do each of
the following:
a) Give prominent notice with each copy of the Combined Work that
the Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the Combined Work with a copy of the GNU GPL and this license
document.
c) For a Combined Work that displays copyright notices during
execution, include the copyright notice for the Library among
these notices, as well as a reference directing the user to the
copies of the GNU GPL and this license document.
d) Do one of the following:
0) Convey the Minimal Corresponding Source under the terms of this
License, and the Corresponding Application Code in a form
suitable for, and under terms that permit, the user to
recombine or relink the Application with a modified version of
the Linked Version to produce a modified Combined Work, in the
manner specified by section 6 of the GNU GPL for conveying
Corresponding Source.
1) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (a) uses at run time
a copy of the Library already present on the user's computer
system, and (b) will operate properly with a modified version
of the Library that is interface-compatible with the Linked
Version.
e) Provide Installation Information, but only if you would otherwise
be required to provide such information under section 6 of the
GNU GPL, and only to the extent that such information is
necessary to install and execute a modified version of the
Combined Work produced by recombining or relinking the
Application with a modified version of the Linked Version. (If
you use option 4d0, the Installation Information must accompany
the Minimal Corresponding Source and Corresponding Application
Code. If you use option 4d1, you must provide the Installation
Information in the manner specified by section 6 of the GNU GPL
for conveying Corresponding Source.)
5. Combined Libraries.
You may place library facilities that are a work based on the
Library side by side in a single library together with other library
facilities that are not Applications and are not covered by this
License, and convey such a combined library under terms of your
choice, if you do both of the following:
a) Accompany the combined library with a copy of the same work based
on the Library, uncombined with any other library facilities,
conveyed under the terms of this License.
b) Give prominent notice with the combined library that part of it
is a work based on the Library, and explaining where to find the
accompanying uncombined form of the same work.
6. Revised Versions of the GNU Lesser General Public License.
The Free Software Foundation may publish revised and/or new versions
of the GNU Lesser General Public License from time to time. Such new
versions will be similar in spirit to the present version, but may
differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the
Library as you received it specifies that a certain numbered version
of the GNU Lesser General Public License "or any later version"
applies to it, you have the option of following the terms and
conditions either of that published version or of any later version
published by the Free Software Foundation. If the Library as you
received it does not specify a version number of the GNU Lesser
General Public License, you may choose any version of the GNU Lesser
General Public License ever published by the Free Software Foundation.
If the Library as you received it specifies that a proxy can decide
whether future versions of the GNU Lesser General Public License shall
apply, that proxy's public statement of acceptance of any version is
permanent authorization for you to choose that version for the
Library.

339
Example/Pods/libidn/COPYINGv2 generated Normal file
View File

@ -0,0 +1,339 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.

674
Example/Pods/libidn/COPYINGv3 generated Normal file
View File

@ -0,0 +1,674 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.

27
Example/Pods/libidn/README generated Normal file
View File

@ -0,0 +1,27 @@
Libidn README -- Important introductory notes.
Copyright (C) 2002-2015 Simon Josefsson
See the end for copying conditions.
Libidn is a package for internationalized string handling based on the
Stringprep, Punycode, IDNA and TLD specifications. Libidn is a GNU
project. See the file COPYING for licensing information.
Read INSTALL for installation instructions, and doc/libidn.* for the
manual in various formats (including Info, HTML, PostScript, and PDF).
Libidn will not be stable without your help. Report bugs, proof read
the manual, or make a monetary donation.
If you need help to use Libidn, or wish to help others, you are
invited to join our mailing list help-libidn@gnu.org, see
<https://lists.gnu.org/mailman/listinfo/help-libidn>.
For more information, see <https://www.gnu.org/software/libidn/>.
For any copyright year range specified as YYYY-ZZZZ in this package
note that the range specifies every single year in that closed interval.
----------------------------------------------------------------------
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
notice and this notice are preserved.

View File

@ -0,0 +1,36 @@
/* A C macro for declaring that specific function parameters are not used.
Copyright (C) 2008-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published
by the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* _GL_UNUSED_PARAMETER is a marker that can be appended to function parameter
declarations for parameters that are not used. This helps to reduce
warnings, such as from GCC -Wunused-parameter. The syntax is as follows:
type param _GL_UNUSED_PARAMETER
or more generally
param_decl _GL_UNUSED_PARAMETER
For example:
int param _GL_UNUSED_PARAMETER
int *(*param)(void) _GL_UNUSED_PARAMETER
Other possible, but obscure and discouraged syntaxes:
int _GL_UNUSED_PARAMETER *(*param)(void)
_GL_UNUSED_PARAMETER int *(*param)(void)
*/
#ifndef _GL_UNUSED_PARAMETER
# if __GNUC__ >= 3 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
# define _GL_UNUSED_PARAMETER __attribute__ ((__unused__))
# else
# define _GL_UNUSED_PARAMETER
# endif
#endif

1297
Example/Pods/libidn/config.h generated Normal file

File diff suppressed because it is too large Load Diff

395
Example/Pods/libidn/lib/gl/c-ctype.c generated Normal file
View File

@ -0,0 +1,395 @@
/* Character handling in C locale.
Copyright 2000-2003, 2006, 2009-2015 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program; if not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
/* Specification. */
#define NO_C_CTYPE_MACROS
#include "c-ctype.h"
/* The function isascii is not locale dependent. Its use in EBCDIC is
questionable. */
bool
c_isascii (int c)
{
return (c >= 0x00 && c <= 0x7f);
}
bool
c_isalnum (int c)
{
#if C_CTYPE_CONSECUTIVE_DIGITS \
&& C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE
#if C_CTYPE_ASCII
return ((c >= '0' && c <= '9')
|| ((c & ~0x20) >= 'A' && (c & ~0x20) <= 'Z'));
#else
return ((c >= '0' && c <= '9')
|| (c >= 'A' && c <= 'Z')
|| (c >= 'a' && c <= 'z'));
#endif
#else
switch (c)
{
case '0': case '1': case '2': case '3': case '4': case '5':
case '6': case '7': case '8': case '9':
case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
case 'G': case 'H': case 'I': case 'J': case 'K': case 'L':
case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R':
case 'S': case 'T': case 'U': case 'V': case 'W': case 'X':
case 'Y': case 'Z':
case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
case 'g': case 'h': case 'i': case 'j': case 'k': case 'l':
case 'm': case 'n': case 'o': case 'p': case 'q': case 'r':
case 's': case 't': case 'u': case 'v': case 'w': case 'x':
case 'y': case 'z':
return 1;
default:
return 0;
}
#endif
}
bool
c_isalpha (int c)
{
#if C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE
#if C_CTYPE_ASCII
return ((c & ~0x20) >= 'A' && (c & ~0x20) <= 'Z');
#else
return ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z'));
#endif
#else
switch (c)
{
case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
case 'G': case 'H': case 'I': case 'J': case 'K': case 'L':
case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R':
case 'S': case 'T': case 'U': case 'V': case 'W': case 'X':
case 'Y': case 'Z':
case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
case 'g': case 'h': case 'i': case 'j': case 'k': case 'l':
case 'm': case 'n': case 'o': case 'p': case 'q': case 'r':
case 's': case 't': case 'u': case 'v': case 'w': case 'x':
case 'y': case 'z':
return 1;
default:
return 0;
}
#endif
}
bool
c_isblank (int c)
{
return (c == ' ' || c == '\t');
}
bool
c_iscntrl (int c)
{
#if C_CTYPE_ASCII
return ((c & ~0x1f) == 0 || c == 0x7f);
#else
switch (c)
{
case ' ': case '!': case '"': case '#': case '$': case '%':
case '&': case '\'': case '(': case ')': case '*': case '+':
case ',': case '-': case '.': case '/':
case '0': case '1': case '2': case '3': case '4': case '5':
case '6': case '7': case '8': case '9':
case ':': case ';': case '<': case '=': case '>': case '?':
case '@':
case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
case 'G': case 'H': case 'I': case 'J': case 'K': case 'L':
case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R':
case 'S': case 'T': case 'U': case 'V': case 'W': case 'X':
case 'Y': case 'Z':
case '[': case '\\': case ']': case '^': case '_': case '`':
case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
case 'g': case 'h': case 'i': case 'j': case 'k': case 'l':
case 'm': case 'n': case 'o': case 'p': case 'q': case 'r':
case 's': case 't': case 'u': case 'v': case 'w': case 'x':
case 'y': case 'z':
case '{': case '|': case '}': case '~':
return 0;
default:
return 1;
}
#endif
}
bool
c_isdigit (int c)
{
#if C_CTYPE_CONSECUTIVE_DIGITS
return (c >= '0' && c <= '9');
#else
switch (c)
{
case '0': case '1': case '2': case '3': case '4': case '5':
case '6': case '7': case '8': case '9':
return 1;
default:
return 0;
}
#endif
}
bool
c_islower (int c)
{
#if C_CTYPE_CONSECUTIVE_LOWERCASE
return (c >= 'a' && c <= 'z');
#else
switch (c)
{
case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
case 'g': case 'h': case 'i': case 'j': case 'k': case 'l':
case 'm': case 'n': case 'o': case 'p': case 'q': case 'r':
case 's': case 't': case 'u': case 'v': case 'w': case 'x':
case 'y': case 'z':
return 1;
default:
return 0;
}
#endif
}
bool
c_isgraph (int c)
{
#if C_CTYPE_ASCII
return (c >= '!' && c <= '~');
#else
switch (c)
{
case '!': case '"': case '#': case '$': case '%': case '&':
case '\'': case '(': case ')': case '*': case '+': case ',':
case '-': case '.': case '/':
case '0': case '1': case '2': case '3': case '4': case '5':
case '6': case '7': case '8': case '9':
case ':': case ';': case '<': case '=': case '>': case '?':
case '@':
case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
case 'G': case 'H': case 'I': case 'J': case 'K': case 'L':
case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R':
case 'S': case 'T': case 'U': case 'V': case 'W': case 'X':
case 'Y': case 'Z':
case '[': case '\\': case ']': case '^': case '_': case '`':
case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
case 'g': case 'h': case 'i': case 'j': case 'k': case 'l':
case 'm': case 'n': case 'o': case 'p': case 'q': case 'r':
case 's': case 't': case 'u': case 'v': case 'w': case 'x':
case 'y': case 'z':
case '{': case '|': case '}': case '~':
return 1;
default:
return 0;
}
#endif
}
bool
c_isprint (int c)
{
#if C_CTYPE_ASCII
return (c >= ' ' && c <= '~');
#else
switch (c)
{
case ' ': case '!': case '"': case '#': case '$': case '%':
case '&': case '\'': case '(': case ')': case '*': case '+':
case ',': case '-': case '.': case '/':
case '0': case '1': case '2': case '3': case '4': case '5':
case '6': case '7': case '8': case '9':
case ':': case ';': case '<': case '=': case '>': case '?':
case '@':
case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
case 'G': case 'H': case 'I': case 'J': case 'K': case 'L':
case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R':
case 'S': case 'T': case 'U': case 'V': case 'W': case 'X':
case 'Y': case 'Z':
case '[': case '\\': case ']': case '^': case '_': case '`':
case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
case 'g': case 'h': case 'i': case 'j': case 'k': case 'l':
case 'm': case 'n': case 'o': case 'p': case 'q': case 'r':
case 's': case 't': case 'u': case 'v': case 'w': case 'x':
case 'y': case 'z':
case '{': case '|': case '}': case '~':
return 1;
default:
return 0;
}
#endif
}
bool
c_ispunct (int c)
{
#if C_CTYPE_ASCII
return ((c >= '!' && c <= '~')
&& !((c >= '0' && c <= '9')
|| ((c & ~0x20) >= 'A' && (c & ~0x20) <= 'Z')));
#else
switch (c)
{
case '!': case '"': case '#': case '$': case '%': case '&':
case '\'': case '(': case ')': case '*': case '+': case ',':
case '-': case '.': case '/':
case ':': case ';': case '<': case '=': case '>': case '?':
case '@':
case '[': case '\\': case ']': case '^': case '_': case '`':
case '{': case '|': case '}': case '~':
return 1;
default:
return 0;
}
#endif
}
bool
c_isspace (int c)
{
return (c == ' ' || c == '\t'
|| c == '\n' || c == '\v' || c == '\f' || c == '\r');
}
bool
c_isupper (int c)
{
#if C_CTYPE_CONSECUTIVE_UPPERCASE
return (c >= 'A' && c <= 'Z');
#else
switch (c)
{
case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
case 'G': case 'H': case 'I': case 'J': case 'K': case 'L':
case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R':
case 'S': case 'T': case 'U': case 'V': case 'W': case 'X':
case 'Y': case 'Z':
return 1;
default:
return 0;
}
#endif
}
bool
c_isxdigit (int c)
{
#if C_CTYPE_CONSECUTIVE_DIGITS \
&& C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE
#if C_CTYPE_ASCII
return ((c >= '0' && c <= '9')
|| ((c & ~0x20) >= 'A' && (c & ~0x20) <= 'F'));
#else
return ((c >= '0' && c <= '9')
|| (c >= 'A' && c <= 'F')
|| (c >= 'a' && c <= 'f'));
#endif
#else
switch (c)
{
case '0': case '1': case '2': case '3': case '4': case '5':
case '6': case '7': case '8': case '9':
case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
return 1;
default:
return 0;
}
#endif
}
int
c_tolower (int c)
{
#if C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE
return (c >= 'A' && c <= 'Z' ? c - 'A' + 'a' : c);
#else
switch (c)
{
case 'A': return 'a';
case 'B': return 'b';
case 'C': return 'c';
case 'D': return 'd';
case 'E': return 'e';
case 'F': return 'f';
case 'G': return 'g';
case 'H': return 'h';
case 'I': return 'i';
case 'J': return 'j';
case 'K': return 'k';
case 'L': return 'l';
case 'M': return 'm';
case 'N': return 'n';
case 'O': return 'o';
case 'P': return 'p';
case 'Q': return 'q';
case 'R': return 'r';
case 'S': return 's';
case 'T': return 't';
case 'U': return 'u';
case 'V': return 'v';
case 'W': return 'w';
case 'X': return 'x';
case 'Y': return 'y';
case 'Z': return 'z';
default: return c;
}
#endif
}
int
c_toupper (int c)
{
#if C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE
return (c >= 'a' && c <= 'z' ? c - 'a' + 'A' : c);
#else
switch (c)
{
case 'a': return 'A';
case 'b': return 'B';
case 'c': return 'C';
case 'd': return 'D';
case 'e': return 'E';
case 'f': return 'F';
case 'g': return 'G';
case 'h': return 'H';
case 'i': return 'I';
case 'j': return 'J';
case 'k': return 'K';
case 'l': return 'L';
case 'm': return 'M';
case 'n': return 'N';
case 'o': return 'O';
case 'p': return 'P';
case 'q': return 'Q';
case 'r': return 'R';
case 's': return 'S';
case 't': return 'T';
case 'u': return 'U';
case 'v': return 'V';
case 'w': return 'W';
case 'x': return 'X';
case 'y': return 'Y';
case 'z': return 'Z';
default: return c;
}
#endif
}

295
Example/Pods/libidn/lib/gl/c-ctype.h generated Normal file
View File

@ -0,0 +1,295 @@
/* Character handling in C locale.
These functions work like the corresponding functions in <ctype.h>,
except that they have the C (POSIX) locale hardwired, whereas the
<ctype.h> functions' behaviour depends on the current locale set via
setlocale.
Copyright (C) 2000-2003, 2006, 2008-2015 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program; if not, see <http://www.gnu.org/licenses/>. */
#ifndef C_CTYPE_H
#define C_CTYPE_H
#include <stdbool.h>
#ifdef __cplusplus
extern "C" {
#endif
/* The functions defined in this file assume the "C" locale and a character
set without diacritics (ASCII-US or EBCDIC-US or something like that).
Even if the "C" locale on a particular system is an extension of the ASCII
character set (like on BeOS, where it is UTF-8, or on AmigaOS, where it
is ISO-8859-1), the functions in this file recognize only the ASCII
characters. */
/* Check whether the ASCII optimizations apply. */
/* ANSI C89 (and ISO C99 5.2.1.3 too) already guarantees that
'0', '1', ..., '9' have consecutive integer values. */
#define C_CTYPE_CONSECUTIVE_DIGITS 1
#if ('A' <= 'Z') \
&& ('A' + 1 == 'B') && ('B' + 1 == 'C') && ('C' + 1 == 'D') \
&& ('D' + 1 == 'E') && ('E' + 1 == 'F') && ('F' + 1 == 'G') \
&& ('G' + 1 == 'H') && ('H' + 1 == 'I') && ('I' + 1 == 'J') \
&& ('J' + 1 == 'K') && ('K' + 1 == 'L') && ('L' + 1 == 'M') \
&& ('M' + 1 == 'N') && ('N' + 1 == 'O') && ('O' + 1 == 'P') \
&& ('P' + 1 == 'Q') && ('Q' + 1 == 'R') && ('R' + 1 == 'S') \
&& ('S' + 1 == 'T') && ('T' + 1 == 'U') && ('U' + 1 == 'V') \
&& ('V' + 1 == 'W') && ('W' + 1 == 'X') && ('X' + 1 == 'Y') \
&& ('Y' + 1 == 'Z')
#define C_CTYPE_CONSECUTIVE_UPPERCASE 1
#endif
#if ('a' <= 'z') \
&& ('a' + 1 == 'b') && ('b' + 1 == 'c') && ('c' + 1 == 'd') \
&& ('d' + 1 == 'e') && ('e' + 1 == 'f') && ('f' + 1 == 'g') \
&& ('g' + 1 == 'h') && ('h' + 1 == 'i') && ('i' + 1 == 'j') \
&& ('j' + 1 == 'k') && ('k' + 1 == 'l') && ('l' + 1 == 'm') \
&& ('m' + 1 == 'n') && ('n' + 1 == 'o') && ('o' + 1 == 'p') \
&& ('p' + 1 == 'q') && ('q' + 1 == 'r') && ('r' + 1 == 's') \
&& ('s' + 1 == 't') && ('t' + 1 == 'u') && ('u' + 1 == 'v') \
&& ('v' + 1 == 'w') && ('w' + 1 == 'x') && ('x' + 1 == 'y') \
&& ('y' + 1 == 'z')
#define C_CTYPE_CONSECUTIVE_LOWERCASE 1
#endif
#if (' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
&& ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \
&& (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \
&& ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \
&& ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \
&& ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \
&& ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \
&& ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \
&& ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \
&& ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \
&& ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \
&& ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \
&& ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \
&& ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \
&& ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \
&& ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \
&& ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \
&& ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \
&& ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \
&& ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \
&& ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \
&& ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \
&& ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126)
/* The character set is ASCII or one of its variants or extensions, not EBCDIC.
Testing the value of '\n' and '\r' is not relevant. */
#define C_CTYPE_ASCII 1
#endif
/* Function declarations. */
/* Unlike the functions in <ctype.h>, which require an argument in the range
of the 'unsigned char' type, the functions here operate on values that are
in the 'unsigned char' range or in the 'char' range. In other words,
when you have a 'char' value, you need to cast it before using it as
argument to a <ctype.h> function:
const char *s = ...;
if (isalpha ((unsigned char) *s)) ...
but you don't need to cast it for the functions defined in this file:
const char *s = ...;
if (c_isalpha (*s)) ...
*/
extern bool c_isascii (int c) _GL_ATTRIBUTE_CONST; /* not locale dependent */
extern bool c_isalnum (int c) _GL_ATTRIBUTE_CONST;
extern bool c_isalpha (int c) _GL_ATTRIBUTE_CONST;
extern bool c_isblank (int c) _GL_ATTRIBUTE_CONST;
extern bool c_iscntrl (int c) _GL_ATTRIBUTE_CONST;
extern bool c_isdigit (int c) _GL_ATTRIBUTE_CONST;
extern bool c_islower (int c) _GL_ATTRIBUTE_CONST;
extern bool c_isgraph (int c) _GL_ATTRIBUTE_CONST;
extern bool c_isprint (int c) _GL_ATTRIBUTE_CONST;
extern bool c_ispunct (int c) _GL_ATTRIBUTE_CONST;
extern bool c_isspace (int c) _GL_ATTRIBUTE_CONST;
extern bool c_isupper (int c) _GL_ATTRIBUTE_CONST;
extern bool c_isxdigit (int c) _GL_ATTRIBUTE_CONST;
extern int c_tolower (int c) _GL_ATTRIBUTE_CONST;
extern int c_toupper (int c) _GL_ATTRIBUTE_CONST;
#if (defined __GNUC__ && !defined __STRICT_ANSI__ && defined __OPTIMIZE__ \
&& !defined __OPTIMIZE_SIZE__ && !defined NO_C_CTYPE_MACROS)
/* ASCII optimizations. */
#undef c_isascii
#define c_isascii(c) \
({ int __c = (c); \
(__c >= 0x00 && __c <= 0x7f); \
})
#if C_CTYPE_CONSECUTIVE_DIGITS \
&& C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE
#if C_CTYPE_ASCII
#undef c_isalnum
#define c_isalnum(c) \
({ int __c = (c); \
((__c >= '0' && __c <= '9') \
|| ((__c & ~0x20) >= 'A' && (__c & ~0x20) <= 'Z')); \
})
#else
#undef c_isalnum
#define c_isalnum(c) \
({ int __c = (c); \
((__c >= '0' && __c <= '9') \
|| (__c >= 'A' && __c <= 'Z') \
|| (__c >= 'a' && __c <= 'z')); \
})
#endif
#endif
#if C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE
#if C_CTYPE_ASCII
#undef c_isalpha
#define c_isalpha(c) \
({ int __c = (c); \
((__c & ~0x20) >= 'A' && (__c & ~0x20) <= 'Z'); \
})
#else
#undef c_isalpha
#define c_isalpha(c) \
({ int __c = (c); \
((__c >= 'A' && __c <= 'Z') || (__c >= 'a' && __c <= 'z')); \
})
#endif
#endif
#undef c_isblank
#define c_isblank(c) \
({ int __c = (c); \
(__c == ' ' || __c == '\t'); \
})
#if C_CTYPE_ASCII
#undef c_iscntrl
#define c_iscntrl(c) \
({ int __c = (c); \
((__c & ~0x1f) == 0 || __c == 0x7f); \
})
#endif
#if C_CTYPE_CONSECUTIVE_DIGITS
#undef c_isdigit
#define c_isdigit(c) \
({ int __c = (c); \
(__c >= '0' && __c <= '9'); \
})
#endif
#if C_CTYPE_CONSECUTIVE_LOWERCASE
#undef c_islower
#define c_islower(c) \
({ int __c = (c); \
(__c >= 'a' && __c <= 'z'); \
})
#endif
#if C_CTYPE_ASCII
#undef c_isgraph
#define c_isgraph(c) \
({ int __c = (c); \
(__c >= '!' && __c <= '~'); \
})
#endif
#if C_CTYPE_ASCII
#undef c_isprint
#define c_isprint(c) \
({ int __c = (c); \
(__c >= ' ' && __c <= '~'); \
})
#endif
#if C_CTYPE_ASCII
#undef c_ispunct
#define c_ispunct(c) \
({ int _c = (c); \
(c_isgraph (_c) && ! c_isalnum (_c)); \
})
#endif
#undef c_isspace
#define c_isspace(c) \
({ int __c = (c); \
(__c == ' ' || __c == '\t' \
|| __c == '\n' || __c == '\v' || __c == '\f' || __c == '\r'); \
})
#if C_CTYPE_CONSECUTIVE_UPPERCASE
#undef c_isupper
#define c_isupper(c) \
({ int __c = (c); \
(__c >= 'A' && __c <= 'Z'); \
})
#endif
#if C_CTYPE_CONSECUTIVE_DIGITS \
&& C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE
#if C_CTYPE_ASCII
#undef c_isxdigit
#define c_isxdigit(c) \
({ int __c = (c); \
((__c >= '0' && __c <= '9') \
|| ((__c & ~0x20) >= 'A' && (__c & ~0x20) <= 'F')); \
})
#else
#undef c_isxdigit
#define c_isxdigit(c) \
({ int __c = (c); \
((__c >= '0' && __c <= '9') \
|| (__c >= 'A' && __c <= 'F') \
|| (__c >= 'a' && __c <= 'f')); \
})
#endif
#endif
#if C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE
#undef c_tolower
#define c_tolower(c) \
({ int __c = (c); \
(__c >= 'A' && __c <= 'Z' ? __c - 'A' + 'a' : __c); \
})
#undef c_toupper
#define c_toupper(c) \
({ int __c = (c); \
(__c >= 'a' && __c <= 'z' ? __c - 'a' + 'A' : __c); \
})
#endif
#endif /* optimizing for speed */
#ifdef __cplusplus
}
#endif
#endif /* C_CTYPE_H */

56
Example/Pods/libidn/lib/gl/c-strcase.h generated Normal file
View File

@ -0,0 +1,56 @@
/* Case-insensitive string comparison functions in C locale.
Copyright (C) 1995-1996, 2001, 2003, 2005, 2009-2015 Free Software
Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program; if not, see <http://www.gnu.org/licenses/>. */
#ifndef C_STRCASE_H
#define C_STRCASE_H
#include <stddef.h>
/* The functions defined in this file assume the "C" locale and a character
set without diacritics (ASCII-US or EBCDIC-US or something like that).
Even if the "C" locale on a particular system is an extension of the ASCII
character set (like on BeOS, where it is UTF-8, or on AmigaOS, where it
is ISO-8859-1), the functions in this file recognize only the ASCII
characters. More precisely, one of the string arguments must be an ASCII
string; the other one can also contain non-ASCII characters (but then
the comparison result will be nonzero). */
#ifdef __cplusplus
extern "C" {
#endif
/* Compare strings S1 and S2, ignoring case, returning less than, equal to or
greater than zero if S1 is lexicographically less than, equal to or greater
than S2. */
extern int c_strcasecmp (const char *s1, const char *s2) _GL_ATTRIBUTE_PURE;
/* Compare no more than N characters of strings S1 and S2, ignoring case,
returning less than, equal to or greater than zero if S1 is
lexicographically less than, equal to or greater than S2. */
extern int c_strncasecmp (const char *s1, const char *s2, size_t n)
_GL_ATTRIBUTE_PURE;
#ifdef __cplusplus
}
#endif
#endif /* C_STRCASE_H */

View File

@ -0,0 +1,56 @@
/* c-strcasecmp.c -- case insensitive string comparator in C locale
Copyright (C) 1998-1999, 2005-2006, 2009-2015 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program; if not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
/* Specification. */
#include "c-strcase.h"
#include <limits.h>
#include "c-ctype.h"
int
c_strcasecmp (const char *s1, const char *s2)
{
register const unsigned char *p1 = (const unsigned char *) s1;
register const unsigned char *p2 = (const unsigned char *) s2;
unsigned char c1, c2;
if (p1 == p2)
return 0;
do
{
c1 = c_tolower (*p1);
c2 = c_tolower (*p2);
if (c1 == '\0')
break;
++p1;
++p2;
}
while (c1 == c2);
if (UCHAR_MAX <= INT_MAX)
return c1 - c2;
else
/* On machines where 'char' and 'int' are types of the same size, the
difference of two 'unsigned char' values - including the sign bit -
doesn't fit in an 'int'. */
return (c1 > c2 ? 1 : c1 < c2 ? -1 : 0);
}

View File

@ -0,0 +1,56 @@
/* c-strncasecmp.c -- case insensitive string comparator in C locale
Copyright (C) 1998-1999, 2005-2006, 2009-2015 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program; if not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
/* Specification. */
#include "c-strcase.h"
#include <limits.h>
#include "c-ctype.h"
int
c_strncasecmp (const char *s1, const char *s2, size_t n)
{
register const unsigned char *p1 = (const unsigned char *) s1;
register const unsigned char *p2 = (const unsigned char *) s2;
unsigned char c1, c2;
if (p1 == p2 || n == 0)
return 0;
do
{
c1 = c_tolower (*p1);
c2 = c_tolower (*p2);
if (--n == 0 || c1 == '\0')
break;
++p1;
++p2;
}
while (c1 == c2);
if (UCHAR_MAX <= INT_MAX)
return c1 - c2;
else
/* On machines where 'char' and 'int' are types of the same size, the
difference of two 'unsigned char' values - including the sign bit -
doesn't fit in an 'int'. */
return (c1 > c2 ? 1 : c1 < c2 ? -1 : 0);
}

110
Example/Pods/libidn/lib/gl/gettext.h generated Normal file
View File

@ -0,0 +1,110 @@
/* Convenience header for conditional use of GNU <libintl.h>.
Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009-2015 Free Software
Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along
with this program; if not, see <http://www.gnu.org/licenses/>. */
#ifndef _LIBGETTEXT_H
#define _LIBGETTEXT_H 1
/* NLS can be disabled through the configure --disable-nls option. */
#if ENABLE_NLS
/* Get declarations of GNU message catalog functions. */
# include <libintl.h>
/* You can set the DEFAULT_TEXT_DOMAIN macro to specify the domain used by
the gettext() and ngettext() macros. This is an alternative to calling
textdomain(), and is useful for libraries. */
# ifdef DEFAULT_TEXT_DOMAIN
# undef gettext
# define gettext(Msgid) \
dgettext (DEFAULT_TEXT_DOMAIN, Msgid)
# undef ngettext
# define ngettext(Msgid1, Msgid2, N) \
dngettext (DEFAULT_TEXT_DOMAIN, Msgid1, Msgid2, N)
# endif
#else
/* Solaris /usr/include/locale.h includes /usr/include/libintl.h, which
chokes if dcgettext is defined as a macro. So include it now, to make
later inclusions of <locale.h> a NOP. We don't include <libintl.h>
as well because people using "gettext.h" will not include <libintl.h>,
and also including <libintl.h> would fail on SunOS 4, whereas <locale.h>
is OK. */
#if defined(__sun)
# include <locale.h>
#endif
/* Many header files from the libstdc++ coming with g++ 3.3 or newer include
<libintl.h>, which chokes if dcgettext is defined as a macro. So include
it now, to make later inclusions of <libintl.h> a NOP. */
#if defined(__cplusplus) && defined(__GNUG__) && (__GNUC__ >= 3)
# include <cstdlib>
# if (__GLIBC__ >= 2 && !defined __UCLIBC__) || _GLIBCXX_HAVE_LIBINTL_H
# include <libintl.h>
# endif
#endif
/* Disabled NLS.
The casts to 'const char *' serve the purpose of producing warnings
for invalid uses of the value returned from these functions.
On pre-ANSI systems without 'const', the config.h file is supposed to
contain "#define const". */
# undef gettext
# define gettext(Msgid) ((const char *) (Msgid))
# undef dgettext
# define dgettext(Domainname, Msgid) ((void) (Domainname), gettext (Msgid))
# undef dcgettext
# define dcgettext(Domainname, Msgid, Category) \
((void) (Category), dgettext (Domainname, Msgid))
# undef ngettext
# define ngettext(Msgid1, Msgid2, N) \
((N) == 1 \
? ((void) (Msgid2), (const char *) (Msgid1)) \
: ((void) (Msgid1), (const char *) (Msgid2)))
# undef dngettext
# define dngettext(Domainname, Msgid1, Msgid2, N) \
((void) (Domainname), ngettext (Msgid1, Msgid2, N))
# undef dcngettext
# define dcngettext(Domainname, Msgid1, Msgid2, N, Category) \
((void) (Category), dngettext (Domainname, Msgid1, Msgid2, N))
# undef textdomain
# define textdomain(Domainname) ((const char *) (Domainname))
# undef bindtextdomain
# define bindtextdomain(Domainname, Dirname) \
((void) (Domainname), (const char *) (Dirname))
# undef bind_textdomain_codeset
# define bind_textdomain_codeset(Domainname, Codeset) \
((void) (Domainname), (const char *) (Codeset))
#endif
/* Prefer gnulib's setlocale override over libintl's setlocale override. */
#ifdef GNULIB_defined_setlocale
# undef setlocale
# define setlocale rpl_setlocale
#endif
/* A pseudo function call that serves as a marker for the automated
extraction of messages, but does not call gettext(). The run-time
translation is done at a different place in the code.
The argument, String, should be a literal string. Concatenated strings
and other string expressions won't work.
The macro's expansion is not parenthesized, so that it is suitable as
initializer for static 'char[]' or 'const char[]' variables. */
#define gettext_noop(String) String
#endif /* _LIBGETTEXT_H */

449
Example/Pods/libidn/lib/gl/iconv.c generated Normal file
View File

@ -0,0 +1,449 @@
/* Character set conversion.
Copyright (C) 1999-2001, 2007, 2009-2015 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along
with this program; if not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
/* Specification. */
#include <iconv.h>
#include <stddef.h>
#if REPLACE_ICONV_UTF
# include <errno.h>
# include <stdint.h>
# include <stdlib.h>
# include "unistr.h"
# ifndef uintptr_t
# define uintptr_t unsigned long
# endif
#endif
#if REPLACE_ICONV_UTF
/* UTF-{16,32}{BE,LE} converters taken from GNU libiconv 1.11. */
/* Return code if invalid. (xxx_mbtowc) */
# define RET_ILSEQ -1
/* Return code if no bytes were read. (xxx_mbtowc) */
# define RET_TOOFEW -2
/* Return code if invalid. (xxx_wctomb) */
# define RET_ILUNI -1
/* Return code if output buffer is too small. (xxx_wctomb, xxx_reset) */
# define RET_TOOSMALL -2
/*
* UTF-16BE
*/
/* Specification: RFC 2781 */
static int
utf16be_mbtowc (ucs4_t *pwc, const unsigned char *s, size_t n)
{
if (n >= 2)
{
ucs4_t wc = (s[0] << 8) + s[1];
if (wc >= 0xd800 && wc < 0xdc00)
{
if (n >= 4)
{
ucs4_t wc2 = (s[2] << 8) + s[3];
if (!(wc2 >= 0xdc00 && wc2 < 0xe000))
return RET_ILSEQ;
*pwc = 0x10000 + ((wc - 0xd800) << 10) + (wc2 - 0xdc00);
return 4;
}
}
else if (wc >= 0xdc00 && wc < 0xe000)
{
return RET_ILSEQ;
}
else
{
*pwc = wc;
return 2;
}
}
return RET_TOOFEW;
}
static int
utf16be_wctomb (unsigned char *r, ucs4_t wc, size_t n)
{
if (!(wc >= 0xd800 && wc < 0xe000))
{
if (wc < 0x10000)
{
if (n >= 2)
{
r[0] = (unsigned char) (wc >> 8);
r[1] = (unsigned char) wc;
return 2;
}
else
return RET_TOOSMALL;
}
else if (wc < 0x110000)
{
if (n >= 4)
{
ucs4_t wc1 = 0xd800 + ((wc - 0x10000) >> 10);
ucs4_t wc2 = 0xdc00 + ((wc - 0x10000) & 0x3ff);
r[0] = (unsigned char) (wc1 >> 8);
r[1] = (unsigned char) wc1;
r[2] = (unsigned char) (wc2 >> 8);
r[3] = (unsigned char) wc2;
return 4;
}
else
return RET_TOOSMALL;
}
}
return RET_ILUNI;
}
/*
* UTF-16LE
*/
/* Specification: RFC 2781 */
static int
utf16le_mbtowc (ucs4_t *pwc, const unsigned char *s, size_t n)
{
if (n >= 2)
{
ucs4_t wc = s[0] + (s[1] << 8);
if (wc >= 0xd800 && wc < 0xdc00)
{
if (n >= 4)
{
ucs4_t wc2 = s[2] + (s[3] << 8);
if (!(wc2 >= 0xdc00 && wc2 < 0xe000))
return RET_ILSEQ;
*pwc = 0x10000 + ((wc - 0xd800) << 10) + (wc2 - 0xdc00);
return 4;
}
}
else if (wc >= 0xdc00 && wc < 0xe000)
{
return RET_ILSEQ;
}
else
{
*pwc = wc;
return 2;
}
}
return RET_TOOFEW;
}
static int
utf16le_wctomb (unsigned char *r, ucs4_t wc, size_t n)
{
if (!(wc >= 0xd800 && wc < 0xe000))
{
if (wc < 0x10000)
{
if (n >= 2)
{
r[0] = (unsigned char) wc;
r[1] = (unsigned char) (wc >> 8);
return 2;
}
else
return RET_TOOSMALL;
}
else if (wc < 0x110000)
{
if (n >= 4)
{
ucs4_t wc1 = 0xd800 + ((wc - 0x10000) >> 10);
ucs4_t wc2 = 0xdc00 + ((wc - 0x10000) & 0x3ff);
r[0] = (unsigned char) wc1;
r[1] = (unsigned char) (wc1 >> 8);
r[2] = (unsigned char) wc2;
r[3] = (unsigned char) (wc2 >> 8);
return 4;
}
else
return RET_TOOSMALL;
}
}
return RET_ILUNI;
}
/*
* UTF-32BE
*/
/* Specification: Unicode 3.1 Standard Annex #19 */
static int
utf32be_mbtowc (ucs4_t *pwc, const unsigned char *s, size_t n)
{
if (n >= 4)
{
ucs4_t wc = (s[0] << 24) + (s[1] << 16) + (s[2] << 8) + s[3];
if (wc < 0x110000 && !(wc >= 0xd800 && wc < 0xe000))
{
*pwc = wc;
return 4;
}
else
return RET_ILSEQ;
}
return RET_TOOFEW;
}
static int
utf32be_wctomb (unsigned char *r, ucs4_t wc, size_t n)
{
if (wc < 0x110000 && !(wc >= 0xd800 && wc < 0xe000))
{
if (n >= 4)
{
r[0] = 0;
r[1] = (unsigned char) (wc >> 16);
r[2] = (unsigned char) (wc >> 8);
r[3] = (unsigned char) wc;
return 4;
}
else
return RET_TOOSMALL;
}
return RET_ILUNI;
}
/*
* UTF-32LE
*/
/* Specification: Unicode 3.1 Standard Annex #19 */
static int
utf32le_mbtowc (ucs4_t *pwc, const unsigned char *s, size_t n)
{
if (n >= 4)
{
ucs4_t wc = s[0] + (s[1] << 8) + (s[2] << 16) + (s[3] << 24);
if (wc < 0x110000 && !(wc >= 0xd800 && wc < 0xe000))
{
*pwc = wc;
return 4;
}
else
return RET_ILSEQ;
}
return RET_TOOFEW;
}
static int
utf32le_wctomb (unsigned char *r, ucs4_t wc, size_t n)
{
if (wc < 0x110000 && !(wc >= 0xd800 && wc < 0xe000))
{
if (n >= 4)
{
r[0] = (unsigned char) wc;
r[1] = (unsigned char) (wc >> 8);
r[2] = (unsigned char) (wc >> 16);
r[3] = 0;
return 4;
}
else
return RET_TOOSMALL;
}
return RET_ILUNI;
}
#endif
size_t
rpl_iconv (iconv_t cd,
ICONV_CONST char **inbuf, size_t *inbytesleft,
char **outbuf, size_t *outbytesleft)
#undef iconv
{
#if REPLACE_ICONV_UTF
switch ((uintptr_t) cd)
{
{
int (*xxx_wctomb) (unsigned char *, ucs4_t, size_t);
case (uintptr_t) _ICONV_UTF8_UTF16BE:
xxx_wctomb = utf16be_wctomb;
goto loop_from_utf8;
case (uintptr_t) _ICONV_UTF8_UTF16LE:
xxx_wctomb = utf16le_wctomb;
goto loop_from_utf8;
case (uintptr_t) _ICONV_UTF8_UTF32BE:
xxx_wctomb = utf32be_wctomb;
goto loop_from_utf8;
case (uintptr_t) _ICONV_UTF8_UTF32LE:
xxx_wctomb = utf32le_wctomb;
goto loop_from_utf8;
loop_from_utf8:
if (inbuf == NULL || *inbuf == NULL)
return 0;
{
ICONV_CONST char *inptr = *inbuf;
size_t inleft = *inbytesleft;
char *outptr = *outbuf;
size_t outleft = *outbytesleft;
size_t res = 0;
while (inleft > 0)
{
ucs4_t uc;
int m = u8_mbtoucr (&uc, (const uint8_t *) inptr, inleft);
if (m <= 0)
{
if (m == -1)
{
errno = EILSEQ;
res = (size_t)(-1);
break;
}
if (m == -2)
{
errno = EINVAL;
res = (size_t)(-1);
break;
}
abort ();
}
else
{
int n = xxx_wctomb ((uint8_t *) outptr, uc, outleft);
if (n < 0)
{
if (n == RET_ILUNI)
{
errno = EILSEQ;
res = (size_t)(-1);
break;
}
if (n == RET_TOOSMALL)
{
errno = E2BIG;
res = (size_t)(-1);
break;
}
abort ();
}
else
{
inptr += m;
inleft -= m;
outptr += n;
outleft -= n;
}
}
}
*inbuf = inptr;
*inbytesleft = inleft;
*outbuf = outptr;
*outbytesleft = outleft;
return res;
}
}
{
int (*xxx_mbtowc) (ucs4_t *, const unsigned char *, size_t);
case (uintptr_t) _ICONV_UTF16BE_UTF8:
xxx_mbtowc = utf16be_mbtowc;
goto loop_to_utf8;
case (uintptr_t) _ICONV_UTF16LE_UTF8:
xxx_mbtowc = utf16le_mbtowc;
goto loop_to_utf8;
case (uintptr_t) _ICONV_UTF32BE_UTF8:
xxx_mbtowc = utf32be_mbtowc;
goto loop_to_utf8;
case (uintptr_t) _ICONV_UTF32LE_UTF8:
xxx_mbtowc = utf32le_mbtowc;
goto loop_to_utf8;
loop_to_utf8:
if (inbuf == NULL || *inbuf == NULL)
return 0;
{
ICONV_CONST char *inptr = *inbuf;
size_t inleft = *inbytesleft;
char *outptr = *outbuf;
size_t outleft = *outbytesleft;
size_t res = 0;
while (inleft > 0)
{
ucs4_t uc;
int m = xxx_mbtowc (&uc, (const uint8_t *) inptr, inleft);
if (m <= 0)
{
if (m == RET_ILSEQ)
{
errno = EILSEQ;
res = (size_t)(-1);
break;
}
if (m == RET_TOOFEW)
{
errno = EINVAL;
res = (size_t)(-1);
break;
}
abort ();
}
else
{
int n = u8_uctomb ((uint8_t *) outptr, uc, outleft);
if (n < 0)
{
if (n == -1)
{
errno = EILSEQ;
res = (size_t)(-1);
break;
}
if (n == -2)
{
errno = E2BIG;
res = (size_t)(-1);
break;
}
abort ();
}
else
{
inptr += m;
inleft -= m;
outptr += n;
outleft -= n;
}
}
}
*inbuf = inptr;
*inbytesleft = inleft;
*outbuf = outptr;
*outbytesleft = outleft;
return res;
}
}
}
#endif
return iconv (cd, inbuf, inbytesleft, outbuf, outbytesleft);
}

110
Example/Pods/libidn/lib/gl/iconv.in.h generated Normal file
View File

@ -0,0 +1,110 @@
/* A GNU-like <iconv.h>.
Copyright (C) 2007-2015 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program; if not, see <http://www.gnu.org/licenses/>. */
#ifndef _@GUARD_PREFIX@_ICONV_H
#if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
#endif
@PRAGMA_COLUMNS@
/* The include_next requires a split double-inclusion guard. */
#@INCLUDE_NEXT@ @NEXT_ICONV_H@
#ifndef _@GUARD_PREFIX@_ICONV_H
#define _@GUARD_PREFIX@_ICONV_H
/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
/* The definition of _GL_ARG_NONNULL is copied here. */
/* The definition of _GL_WARN_ON_USE is copied here. */
#if @GNULIB_ICONV@
# if @REPLACE_ICONV_OPEN@
/* An iconv_open wrapper that supports the IANA standardized encoding names
("ISO-8859-1" etc.) as far as possible. */
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# define iconv_open rpl_iconv_open
# endif
_GL_FUNCDECL_RPL (iconv_open, iconv_t,
(const char *tocode, const char *fromcode)
_GL_ARG_NONNULL ((1, 2)));
_GL_CXXALIAS_RPL (iconv_open, iconv_t,
(const char *tocode, const char *fromcode));
# else
_GL_CXXALIAS_SYS (iconv_open, iconv_t,
(const char *tocode, const char *fromcode));
# endif
_GL_CXXALIASWARN (iconv_open);
#endif
#if @REPLACE_ICONV_UTF@
/* Special constants for supporting UTF-{16,32}{BE,LE} encodings.
Not public. */
# define _ICONV_UTF8_UTF16BE (iconv_t)(-161)
# define _ICONV_UTF8_UTF16LE (iconv_t)(-162)
# define _ICONV_UTF8_UTF32BE (iconv_t)(-163)
# define _ICONV_UTF8_UTF32LE (iconv_t)(-164)
# define _ICONV_UTF16BE_UTF8 (iconv_t)(-165)
# define _ICONV_UTF16LE_UTF8 (iconv_t)(-166)
# define _ICONV_UTF32BE_UTF8 (iconv_t)(-167)
# define _ICONV_UTF32LE_UTF8 (iconv_t)(-168)
#endif
#if @GNULIB_ICONV@
# if @REPLACE_ICONV@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# define iconv rpl_iconv
# endif
_GL_FUNCDECL_RPL (iconv, size_t,
(iconv_t cd,
@ICONV_CONST@ char **inbuf, size_t *inbytesleft,
char **outbuf, size_t *outbytesleft));
_GL_CXXALIAS_RPL (iconv, size_t,
(iconv_t cd,
@ICONV_CONST@ char **inbuf, size_t *inbytesleft,
char **outbuf, size_t *outbytesleft));
# else
_GL_CXXALIAS_SYS (iconv, size_t,
(iconv_t cd,
@ICONV_CONST@ char **inbuf, size_t *inbytesleft,
char **outbuf, size_t *outbytesleft));
# endif
_GL_CXXALIASWARN (iconv);
# ifndef ICONV_CONST
# define ICONV_CONST @ICONV_CONST@
# endif
#endif
#if @GNULIB_ICONV@
# if @REPLACE_ICONV@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# define iconv_close rpl_iconv_close
# endif
_GL_FUNCDECL_RPL (iconv_close, int, (iconv_t cd));
_GL_CXXALIAS_RPL (iconv_close, int, (iconv_t cd));
# else
_GL_CXXALIAS_SYS (iconv_close, int, (iconv_t cd));
# endif
_GL_CXXALIASWARN (iconv_close);
#endif
#endif /* _@GUARD_PREFIX@_ICONV_H */
#endif /* _@GUARD_PREFIX@_ICONV_H */

46
Example/Pods/libidn/lib/gl/iconv_close.c generated Normal file
View File

@ -0,0 +1,46 @@
/* Character set conversion.
Copyright (C) 2007, 2009-2015 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along
with this program; if not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
/* Specification. */
#include <iconv.h>
#include <stdint.h>
#ifndef uintptr_t
# define uintptr_t unsigned long
#endif
int
rpl_iconv_close (iconv_t cd)
#undef iconv_close
{
#if REPLACE_ICONV_UTF
switch ((uintptr_t) cd)
{
case (uintptr_t) _ICONV_UTF8_UTF16BE:
case (uintptr_t) _ICONV_UTF8_UTF16LE:
case (uintptr_t) _ICONV_UTF8_UTF32BE:
case (uintptr_t) _ICONV_UTF8_UTF32LE:
case (uintptr_t) _ICONV_UTF16BE_UTF8:
case (uintptr_t) _ICONV_UTF16LE_UTF8:
case (uintptr_t) _ICONV_UTF32BE_UTF8:
case (uintptr_t) _ICONV_UTF32LE_UTF8:
return 0;
}
#endif
return iconv_close (cd);
}

172
Example/Pods/libidn/lib/gl/iconv_open.c generated Normal file
View File

@ -0,0 +1,172 @@
/* Character set conversion.
Copyright (C) 2007, 2009-2015 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along
with this program; if not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
/* Specification. */
#include <iconv.h>
#include <errno.h>
#include <string.h>
#include "c-ctype.h"
#include "c-strcase.h"
#define SIZEOF(a) (sizeof(a) / sizeof(a[0]))
/* Namespace cleanliness. */
#define mapping_lookup rpl_iconv_open_mapping_lookup
/* The macro ICONV_FLAVOR is defined to one of these or undefined. */
#define ICONV_FLAVOR_AIX "iconv_open-aix.h"
#define ICONV_FLAVOR_HPUX "iconv_open-hpux.h"
#define ICONV_FLAVOR_IRIX "iconv_open-irix.h"
#define ICONV_FLAVOR_OSF "iconv_open-osf.h"
#define ICONV_FLAVOR_SOLARIS "iconv_open-solaris.h"
#ifdef ICONV_FLAVOR
# include ICONV_FLAVOR
#endif
iconv_t
rpl_iconv_open (const char *tocode, const char *fromcode)
#undef iconv_open
{
char fromcode_upper[32];
char tocode_upper[32];
char *fromcode_upper_end;
char *tocode_upper_end;
#if REPLACE_ICONV_UTF
/* Special handling of conversion between UTF-8 and UTF-{16,32}{BE,LE}.
Do this here, before calling the real iconv_open(), because OSF/1 5.1
iconv() to these encoding inserts a BOM, which is wrong.
We do not need to handle conversion between arbitrary encodings and
UTF-{16,32}{BE,LE}, because the 'striconveh' module implements two-step
conversion through UTF-8.
The _ICONV_* constants are chosen to be disjoint from any iconv_t
returned by the system's iconv_open() functions. Recall that iconv_t
is a scalar type. */
if (c_toupper (fromcode[0]) == 'U'
&& c_toupper (fromcode[1]) == 'T'
&& c_toupper (fromcode[2]) == 'F'
&& fromcode[3] == '-')
{
if (c_toupper (tocode[0]) == 'U'
&& c_toupper (tocode[1]) == 'T'
&& c_toupper (tocode[2]) == 'F'
&& tocode[3] == '-')
{
if (strcmp (fromcode + 4, "8") == 0)
{
if (c_strcasecmp (tocode + 4, "16BE") == 0)
return _ICONV_UTF8_UTF16BE;
if (c_strcasecmp (tocode + 4, "16LE") == 0)
return _ICONV_UTF8_UTF16LE;
if (c_strcasecmp (tocode + 4, "32BE") == 0)
return _ICONV_UTF8_UTF32BE;
if (c_strcasecmp (tocode + 4, "32LE") == 0)
return _ICONV_UTF8_UTF32LE;
}
else if (strcmp (tocode + 4, "8") == 0)
{
if (c_strcasecmp (fromcode + 4, "16BE") == 0)
return _ICONV_UTF16BE_UTF8;
if (c_strcasecmp (fromcode + 4, "16LE") == 0)
return _ICONV_UTF16LE_UTF8;
if (c_strcasecmp (fromcode + 4, "32BE") == 0)
return _ICONV_UTF32BE_UTF8;
if (c_strcasecmp (fromcode + 4, "32LE") == 0)
return _ICONV_UTF32LE_UTF8;
}
}
}
#endif
/* Do *not* add special support for 8-bit encodings like ASCII or ISO-8859-1
here. This would lead to programs that work in some locales (such as the
"C" or "en_US" locales) but do not work in East Asian locales. It is
better if programmers make their programs depend on GNU libiconv (except
on glibc systems), e.g. by using the AM_ICONV macro and documenting the
dependency in an INSTALL or DEPENDENCIES file. */
/* Try with the original names first.
This covers the case when fromcode or tocode is a lowercase encoding name
that is understood by the system's iconv_open but not listed in our
mappings table. */
{
iconv_t cd = iconv_open (tocode, fromcode);
if (cd != (iconv_t)(-1))
return cd;
}
/* Convert the encodings to upper case, because
1. in the arguments of iconv_open() on AIX, HP-UX, and OSF/1 the case
matters,
2. it makes searching in the table faster. */
{
const char *p = fromcode;
char *q = fromcode_upper;
while ((*q = c_toupper (*p)) != '\0')
{
p++;
q++;
if (q == &fromcode_upper[SIZEOF (fromcode_upper)])
{
errno = EINVAL;
return (iconv_t)(-1);
}
}
fromcode_upper_end = q;
}
{
const char *p = tocode;
char *q = tocode_upper;
while ((*q = c_toupper (*p)) != '\0')
{
p++;
q++;
if (q == &tocode_upper[SIZEOF (tocode_upper)])
{
errno = EINVAL;
return (iconv_t)(-1);
}
}
tocode_upper_end = q;
}
#ifdef ICONV_FLAVOR
/* Apply the mappings. */
{
const struct mapping *m =
mapping_lookup (fromcode_upper, fromcode_upper_end - fromcode_upper);
fromcode = (m != NULL ? m->vendor_name : fromcode_upper);
}
{
const struct mapping *m =
mapping_lookup (tocode_upper, tocode_upper_end - tocode_upper);
tocode = (m != NULL ? m->vendor_name : tocode_upper);
}
#else
fromcode = fromcode_upper;
tocode = tocode_upper;
#endif
return iconv_open (tocode, fromcode);
}

132
Example/Pods/libidn/lib/gl/stdbool.in.h generated Normal file
View File

@ -0,0 +1,132 @@
/* Copyright (C) 2001-2003, 2006-2015 Free Software Foundation, Inc.
Written by Bruno Haible <haible@clisp.cons.org>, 2001.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program; if not, see <http://www.gnu.org/licenses/>. */
#ifndef _GL_STDBOOL_H
#define _GL_STDBOOL_H
/* ISO C 99 <stdbool.h> for platforms that lack it. */
/* Usage suggestions:
Programs that use <stdbool.h> should be aware of some limitations
and standards compliance issues.
Standards compliance:
- <stdbool.h> must be #included before 'bool', 'false', 'true'
can be used.
- You cannot assume that sizeof (bool) == 1.
- Programs should not undefine the macros bool, true, and false,
as C99 lists that as an "obsolescent feature".
Limitations of this substitute, when used in a C89 environment:
- <stdbool.h> must be #included before the '_Bool' type can be used.
- You cannot assume that _Bool is a typedef; it might be a macro.
- Bit-fields of type 'bool' are not supported. Portable code
should use 'unsigned int foo : 1;' rather than 'bool foo : 1;'.
- In C99, casts and automatic conversions to '_Bool' or 'bool' are
performed in such a way that every nonzero value gets converted
to 'true', and zero gets converted to 'false'. This doesn't work
with this substitute. With this substitute, only the values 0 and 1
give the expected result when converted to _Bool' or 'bool'.
- C99 allows the use of (_Bool)0.0 in constant expressions, but
this substitute cannot always provide this property.
Also, it is suggested that programs use 'bool' rather than '_Bool';
this isn't required, but 'bool' is more common. */
/* 7.16. Boolean type and values */
/* BeOS <sys/socket.h> already #defines false 0, true 1. We use the same
definitions below, but temporarily we have to #undef them. */
#if defined __BEOS__ && !defined __HAIKU__
# include <OS.h> /* defines bool but not _Bool */
# undef false
# undef true
#endif
#ifdef __cplusplus
# define _Bool bool
# define bool bool
#else
# if defined __BEOS__ && !defined __HAIKU__
/* A compiler known to have 'bool'. */
/* If the compiler already has both 'bool' and '_Bool', we can assume they
are the same types. */
# if !@HAVE__BOOL@
typedef bool _Bool;
# endif
# else
# if !defined __GNUC__
/* If @HAVE__BOOL@:
Some HP-UX cc and AIX IBM C compiler versions have compiler bugs when
the built-in _Bool type is used. See
http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html
http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html
http://lists.gnu.org/archive/html/bug-coreutils/2005-10/msg00086.html
Similar bugs are likely with other compilers as well; this file
wouldn't be used if <stdbool.h> was working.
So we override the _Bool type.
If !@HAVE__BOOL@:
Need to define _Bool ourselves. As 'signed char' or as an enum type?
Use of a typedef, with SunPRO C, leads to a stupid
"warning: _Bool is a keyword in ISO C99".
Use of an enum type, with IRIX cc, leads to a stupid
"warning(1185): enumerated type mixed with another type".
Even the existence of an enum type, without a typedef,
"Invalid enumerator. (badenum)" with HP-UX cc on Tru64.
The only benefit of the enum, debuggability, is not important
with these compilers. So use 'signed char' and no enum. */
# define _Bool signed char
# else
/* With this compiler, trust the _Bool type if the compiler has it. */
# if !@HAVE__BOOL@
/* For the sake of symbolic names in gdb, define true and false as
enum constants, not only as macros.
It is tempting to write
typedef enum { false = 0, true = 1 } _Bool;
so that gdb prints values of type 'bool' symbolically. But then
values of type '_Bool' might promote to 'int' or 'unsigned int'
(see ISO C 99 6.7.2.2.(4)); however, '_Bool' must promote to 'int'
(see ISO C 99 6.3.1.1.(2)). So add a negative value to the
enum; this ensures that '_Bool' promotes to 'int'. */
typedef enum { _Bool_must_promote_to_int = -1, false = 0, true = 1 } _Bool;
# endif
# endif
# endif
# define bool _Bool
#endif
/* The other macros must be usable in preprocessor directives. */
#ifdef __cplusplus
# define false false
# define true true
#else
# define false 0
# define true 1
#endif
#define __bool_true_false_are_defined 1
#endif /* _GL_STDBOOL_H */

108
Example/Pods/libidn/lib/gl/stddef.in.h generated Normal file
View File

@ -0,0 +1,108 @@
/* A substitute for POSIX 2008 <stddef.h>, for platforms that have issues.
Copyright (C) 2009-2015 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program; if not, see <http://www.gnu.org/licenses/>. */
/* Written by Eric Blake. */
/*
* POSIX 2008 <stddef.h> for platforms that have issues.
* <http://www.opengroup.org/susv3xbd/stddef.h.html>
*/
#if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
#endif
@PRAGMA_COLUMNS@
#if defined __need_wchar_t || defined __need_size_t \
|| defined __need_ptrdiff_t || defined __need_NULL \
|| defined __need_wint_t
/* Special invocation convention inside gcc header files. In
particular, gcc provides a version of <stddef.h> that blindly
redefines NULL even when __need_wint_t was defined, even though
wint_t is not normally provided by <stddef.h>. Hence, we must
remember if special invocation has ever been used to obtain wint_t,
in which case we need to clean up NULL yet again. */
# if !(defined _@GUARD_PREFIX@_STDDEF_H && defined _GL_STDDEF_WINT_T)
# ifdef __need_wint_t
# define _GL_STDDEF_WINT_T
# endif
# @INCLUDE_NEXT@ @NEXT_STDDEF_H@
# endif
#else
/* Normal invocation convention. */
# ifndef _@GUARD_PREFIX@_STDDEF_H
/* The include_next requires a split double-inclusion guard. */
# @INCLUDE_NEXT@ @NEXT_STDDEF_H@
/* On NetBSD 5.0, the definition of NULL lacks proper parentheses. */
# if (@REPLACE_NULL@ \
&& (!defined _@GUARD_PREFIX@_STDDEF_H || defined _GL_STDDEF_WINT_T))
# undef NULL
# ifdef __cplusplus
/* ISO C++ says that the macro NULL must expand to an integer constant
expression, hence '((void *) 0)' is not allowed in C++. */
# if __GNUG__ >= 3
/* GNU C++ has a __null macro that behaves like an integer ('int' or
'long') but has the same size as a pointer. Use that, to avoid
warnings. */
# define NULL __null
# else
# define NULL 0L
# endif
# else
# define NULL ((void *) 0)
# endif
# endif
# ifndef _@GUARD_PREFIX@_STDDEF_H
# define _@GUARD_PREFIX@_STDDEF_H
/* Some platforms lack wchar_t. */
#if !@HAVE_WCHAR_T@
# define wchar_t int
#endif
/* Some platforms lack max_align_t. */
#if !@HAVE_MAX_ALIGN_T@
/* On the x86, the maximum storage alignment of double, long, etc. is 4,
but GCC's C11 ABI for x86 says that max_align_t has an alignment of 8,
and the C11 standard allows this. Work around this problem by
using __alignof__ (which returns 8 for double) rather than _Alignof
(which returns 4), and align each union member accordingly. */
# ifdef __GNUC__
# define _GL_STDDEF_ALIGNAS(type) \
__attribute__ ((__aligned__ (__alignof__ (type))))
# else
# define _GL_STDDEF_ALIGNAS(type) /* */
# endif
typedef union
{
char *__p _GL_STDDEF_ALIGNAS (char *);
double __d _GL_STDDEF_ALIGNAS (double);
long double __ld _GL_STDDEF_ALIGNAS (long double);
long int __i _GL_STDDEF_ALIGNAS (long int);
} max_align_t;
#endif
# endif /* _@GUARD_PREFIX@_STDDEF_H */
# endif /* _@GUARD_PREFIX@_STDDEF_H */
#endif /* __need_XXX */

636
Example/Pods/libidn/lib/gl/stdint.in.h generated Normal file
View File

@ -0,0 +1,636 @@
/* Copyright (C) 2001-2002, 2004-2015 Free Software Foundation, Inc.
Written by Paul Eggert, Bruno Haible, Sam Steingold, Peter Burwood.
This file is part of gnulib.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program; if not, see <http://www.gnu.org/licenses/>. */
/*
* ISO C 99 <stdint.h> for platforms that lack it.
* <http://www.opengroup.org/susv3xbd/stdint.h.html>
*/
#ifndef _@GUARD_PREFIX@_STDINT_H
#if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
#endif
@PRAGMA_COLUMNS@
/* When including a system file that in turn includes <inttypes.h>,
use the system <inttypes.h>, not our substitute. This avoids
problems with (for example) VMS, whose <sys/bitypes.h> includes
<inttypes.h>. */
#define _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H
/* On Android (Bionic libc), <sys/types.h> includes this file before
having defined 'time_t'. Therefore in this case avoid including
other system header files; just include the system's <stdint.h>.
Ideally we should test __BIONIC__ here, but it is only defined after
<sys/cdefs.h> has been included; hence test __ANDROID__ instead. */
#if defined __ANDROID__ && defined _GL_INCLUDING_SYS_TYPES_H
# @INCLUDE_NEXT@ @NEXT_STDINT_H@
#else
/* Get those types that are already defined in other system include
files, so that we can "#define int8_t signed char" below without
worrying about a later system include file containing a "typedef
signed char int8_t;" that will get messed up by our macro. Our
macros should all be consistent with the system versions, except
for the "fast" types and macros, which we recommend against using
in public interfaces due to compiler differences. */
#if @HAVE_STDINT_H@
# if defined __sgi && ! defined __c99
/* Bypass IRIX's <stdint.h> if in C89 mode, since it merely annoys users
with "This header file is to be used only for c99 mode compilations"
diagnostics. */
# define __STDINT_H__
# endif
/* Some pre-C++11 <stdint.h> implementations need this. */
# ifdef __cplusplus
# ifndef __STDC_CONSTANT_MACROS
# define __STDC_CONSTANT_MACROS 1
# endif
# ifndef __STDC_LIMIT_MACROS
# define __STDC_LIMIT_MACROS 1
# endif
# endif
/* Other systems may have an incomplete or buggy <stdint.h>.
Include it before <inttypes.h>, since any "#include <stdint.h>"
in <inttypes.h> would reinclude us, skipping our contents because
_@GUARD_PREFIX@_STDINT_H is defined.
The include_next requires a split double-inclusion guard. */
# @INCLUDE_NEXT@ @NEXT_STDINT_H@
#endif
#if ! defined _@GUARD_PREFIX@_STDINT_H && ! defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H
#define _@GUARD_PREFIX@_STDINT_H
/* <sys/types.h> defines some of the stdint.h types as well, on glibc,
IRIX 6.5, and OpenBSD 3.8 (via <machine/types.h>).
AIX 5.2 <sys/types.h> isn't needed and causes troubles.
Mac OS X 10.4.6 <sys/types.h> includes <stdint.h> (which is us), but
relies on the system <stdint.h> definitions, so include
<sys/types.h> after @NEXT_STDINT_H@. */
#if @HAVE_SYS_TYPES_H@ && ! defined _AIX
# include <sys/types.h>
#endif
/* Get SCHAR_MIN, SCHAR_MAX, UCHAR_MAX, INT_MIN, INT_MAX,
LONG_MIN, LONG_MAX, ULONG_MAX. */
#include <limits.h>
#if @HAVE_INTTYPES_H@
/* In OpenBSD 3.8, <inttypes.h> includes <machine/types.h>, which defines
int{8,16,32,64}_t, uint{8,16,32,64}_t and __BIT_TYPES_DEFINED__.
<inttypes.h> also defines intptr_t and uintptr_t. */
# include <inttypes.h>
#elif @HAVE_SYS_INTTYPES_H@
/* Solaris 7 <sys/inttypes.h> has the types except the *_fast*_t types, and
the macros except for *_FAST*_*, INTPTR_MIN, PTRDIFF_MIN, PTRDIFF_MAX. */
# include <sys/inttypes.h>
#endif
#if @HAVE_SYS_BITYPES_H@ && ! defined __BIT_TYPES_DEFINED__
/* Linux libc4 >= 4.6.7 and libc5 have a <sys/bitypes.h> that defines
int{8,16,32,64}_t and __BIT_TYPES_DEFINED__. In libc5 >= 5.2.2 it is
included by <sys/types.h>. */
# include <sys/bitypes.h>
#endif
#undef _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H
/* Minimum and maximum values for an integer type under the usual assumption.
Return an unspecified value if BITS == 0, adding a check to pacify
picky compilers. */
#define _STDINT_MIN(signed, bits, zero) \
((signed) ? (- ((zero) + 1) << ((bits) ? (bits) - 1 : 0)) : (zero))
#define _STDINT_MAX(signed, bits, zero) \
((signed) \
? ~ _STDINT_MIN (signed, bits, zero) \
: /* The expression for the unsigned case. The subtraction of (signed) \
is a nop in the unsigned case and avoids "signed integer overflow" \
warnings in the signed case. */ \
((((zero) + 1) << ((bits) ? (bits) - 1 - (signed) : 0)) - 1) * 2 + 1)
#if !GNULIB_defined_stdint_types
/* 7.18.1.1. Exact-width integer types */
/* Here we assume a standard architecture where the hardware integer
types have 8, 16, 32, optionally 64 bits. */
#undef int8_t
#undef uint8_t
typedef signed char gl_int8_t;
typedef unsigned char gl_uint8_t;
#define int8_t gl_int8_t
#define uint8_t gl_uint8_t
#undef int16_t
#undef uint16_t
typedef short int gl_int16_t;
typedef unsigned short int gl_uint16_t;
#define int16_t gl_int16_t
#define uint16_t gl_uint16_t
#undef int32_t
#undef uint32_t
typedef int gl_int32_t;
typedef unsigned int gl_uint32_t;
#define int32_t gl_int32_t
#define uint32_t gl_uint32_t
/* If the system defines INT64_MAX, assume int64_t works. That way,
if the underlying platform defines int64_t to be a 64-bit long long
int, the code below won't mistakenly define it to be a 64-bit long
int, which would mess up C++ name mangling. We must use #ifdef
rather than #if, to avoid an error with HP-UX 10.20 cc. */
#ifdef INT64_MAX
# define GL_INT64_T
#else
/* Do not undefine int64_t if gnulib is not being used with 64-bit
types, since otherwise it breaks platforms like Tandem/NSK. */
# if LONG_MAX >> 31 >> 31 == 1
# undef int64_t
typedef long int gl_int64_t;
# define int64_t gl_int64_t
# define GL_INT64_T
# elif defined _MSC_VER
# undef int64_t
typedef __int64 gl_int64_t;
# define int64_t gl_int64_t
# define GL_INT64_T
# elif @HAVE_LONG_LONG_INT@
# undef int64_t
typedef long long int gl_int64_t;
# define int64_t gl_int64_t
# define GL_INT64_T
# endif
#endif
#ifdef UINT64_MAX
# define GL_UINT64_T
#else
# if ULONG_MAX >> 31 >> 31 >> 1 == 1
# undef uint64_t
typedef unsigned long int gl_uint64_t;
# define uint64_t gl_uint64_t
# define GL_UINT64_T
# elif defined _MSC_VER
# undef uint64_t
typedef unsigned __int64 gl_uint64_t;
# define uint64_t gl_uint64_t
# define GL_UINT64_T
# elif @HAVE_UNSIGNED_LONG_LONG_INT@
# undef uint64_t
typedef unsigned long long int gl_uint64_t;
# define uint64_t gl_uint64_t
# define GL_UINT64_T
# endif
#endif
/* Avoid collision with Solaris 2.5.1 <pthread.h> etc. */
#define _UINT8_T
#define _UINT32_T
#define _UINT64_T
/* 7.18.1.2. Minimum-width integer types */
/* Here we assume a standard architecture where the hardware integer
types have 8, 16, 32, optionally 64 bits. Therefore the leastN_t types
are the same as the corresponding N_t types. */
#undef int_least8_t
#undef uint_least8_t
#undef int_least16_t
#undef uint_least16_t
#undef int_least32_t
#undef uint_least32_t
#undef int_least64_t
#undef uint_least64_t
#define int_least8_t int8_t
#define uint_least8_t uint8_t
#define int_least16_t int16_t
#define uint_least16_t uint16_t
#define int_least32_t int32_t
#define uint_least32_t uint32_t
#ifdef GL_INT64_T
# define int_least64_t int64_t
#endif
#ifdef GL_UINT64_T
# define uint_least64_t uint64_t
#endif
/* 7.18.1.3. Fastest minimum-width integer types */
/* Note: Other <stdint.h> substitutes may define these types differently.
It is not recommended to use these types in public header files. */
/* Here we assume a standard architecture where the hardware integer
types have 8, 16, 32, optionally 64 bits. Therefore the fastN_t types
are taken from the same list of types. The following code normally
uses types consistent with glibc, as that lessens the chance of
incompatibility with older GNU hosts. */
#undef int_fast8_t
#undef uint_fast8_t
#undef int_fast16_t
#undef uint_fast16_t
#undef int_fast32_t
#undef uint_fast32_t
#undef int_fast64_t
#undef uint_fast64_t
typedef signed char gl_int_fast8_t;
typedef unsigned char gl_uint_fast8_t;
#ifdef __sun
/* Define types compatible with SunOS 5.10, so that code compiled under
earlier SunOS versions works with code compiled under SunOS 5.10. */
typedef int gl_int_fast32_t;
typedef unsigned int gl_uint_fast32_t;
#else
typedef long int gl_int_fast32_t;
typedef unsigned long int gl_uint_fast32_t;
#endif
typedef gl_int_fast32_t gl_int_fast16_t;
typedef gl_uint_fast32_t gl_uint_fast16_t;
#define int_fast8_t gl_int_fast8_t
#define uint_fast8_t gl_uint_fast8_t
#define int_fast16_t gl_int_fast16_t
#define uint_fast16_t gl_uint_fast16_t
#define int_fast32_t gl_int_fast32_t
#define uint_fast32_t gl_uint_fast32_t
#ifdef GL_INT64_T
# define int_fast64_t int64_t
#endif
#ifdef GL_UINT64_T
# define uint_fast64_t uint64_t
#endif
/* 7.18.1.4. Integer types capable of holding object pointers */
#undef intptr_t
#undef uintptr_t
typedef long int gl_intptr_t;
typedef unsigned long int gl_uintptr_t;
#define intptr_t gl_intptr_t
#define uintptr_t gl_uintptr_t
/* 7.18.1.5. Greatest-width integer types */
/* Note: These types are compiler dependent. It may be unwise to use them in
public header files. */
/* If the system defines INTMAX_MAX, assume that intmax_t works, and
similarly for UINTMAX_MAX and uintmax_t. This avoids problems with
assuming one type where another is used by the system. */
#ifndef INTMAX_MAX
# undef INTMAX_C
# undef intmax_t
# if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1
typedef long long int gl_intmax_t;
# define intmax_t gl_intmax_t
# elif defined GL_INT64_T
# define intmax_t int64_t
# else
typedef long int gl_intmax_t;
# define intmax_t gl_intmax_t
# endif
#endif
#ifndef UINTMAX_MAX
# undef UINTMAX_C
# undef uintmax_t
# if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1
typedef unsigned long long int gl_uintmax_t;
# define uintmax_t gl_uintmax_t
# elif defined GL_UINT64_T
# define uintmax_t uint64_t
# else
typedef unsigned long int gl_uintmax_t;
# define uintmax_t gl_uintmax_t
# endif
#endif
/* Verify that intmax_t and uintmax_t have the same size. Too much code
breaks if this is not the case. If this check fails, the reason is likely
to be found in the autoconf macros. */
typedef int _verify_intmax_size[sizeof (intmax_t) == sizeof (uintmax_t)
? 1 : -1];
#define GNULIB_defined_stdint_types 1
#endif /* !GNULIB_defined_stdint_types */
/* 7.18.2. Limits of specified-width integer types */
/* 7.18.2.1. Limits of exact-width integer types */
/* Here we assume a standard architecture where the hardware integer
types have 8, 16, 32, optionally 64 bits. */
#undef INT8_MIN
#undef INT8_MAX
#undef UINT8_MAX
#define INT8_MIN (~ INT8_MAX)
#define INT8_MAX 127
#define UINT8_MAX 255
#undef INT16_MIN
#undef INT16_MAX
#undef UINT16_MAX
#define INT16_MIN (~ INT16_MAX)
#define INT16_MAX 32767
#define UINT16_MAX 65535
#undef INT32_MIN
#undef INT32_MAX
#undef UINT32_MAX
#define INT32_MIN (~ INT32_MAX)
#define INT32_MAX 2147483647
#define UINT32_MAX 4294967295U
#if defined GL_INT64_T && ! defined INT64_MAX
/* Prefer (- INTMAX_C (1) << 63) over (~ INT64_MAX) because SunPRO C 5.0
evaluates the latter incorrectly in preprocessor expressions. */
# define INT64_MIN (- INTMAX_C (1) << 63)
# define INT64_MAX INTMAX_C (9223372036854775807)
#endif
#if defined GL_UINT64_T && ! defined UINT64_MAX
# define UINT64_MAX UINTMAX_C (18446744073709551615)
#endif
/* 7.18.2.2. Limits of minimum-width integer types */
/* Here we assume a standard architecture where the hardware integer
types have 8, 16, 32, optionally 64 bits. Therefore the leastN_t types
are the same as the corresponding N_t types. */
#undef INT_LEAST8_MIN
#undef INT_LEAST8_MAX
#undef UINT_LEAST8_MAX
#define INT_LEAST8_MIN INT8_MIN
#define INT_LEAST8_MAX INT8_MAX
#define UINT_LEAST8_MAX UINT8_MAX
#undef INT_LEAST16_MIN
#undef INT_LEAST16_MAX
#undef UINT_LEAST16_MAX
#define INT_LEAST16_MIN INT16_MIN
#define INT_LEAST16_MAX INT16_MAX
#define UINT_LEAST16_MAX UINT16_MAX
#undef INT_LEAST32_MIN
#undef INT_LEAST32_MAX
#undef UINT_LEAST32_MAX
#define INT_LEAST32_MIN INT32_MIN
#define INT_LEAST32_MAX INT32_MAX
#define UINT_LEAST32_MAX UINT32_MAX
#undef INT_LEAST64_MIN
#undef INT_LEAST64_MAX
#ifdef GL_INT64_T
# define INT_LEAST64_MIN INT64_MIN
# define INT_LEAST64_MAX INT64_MAX
#endif
#undef UINT_LEAST64_MAX
#ifdef GL_UINT64_T
# define UINT_LEAST64_MAX UINT64_MAX
#endif
/* 7.18.2.3. Limits of fastest minimum-width integer types */
/* Here we assume a standard architecture where the hardware integer
types have 8, 16, 32, optionally 64 bits. Therefore the fastN_t types
are taken from the same list of types. */
#undef INT_FAST8_MIN
#undef INT_FAST8_MAX
#undef UINT_FAST8_MAX
#define INT_FAST8_MIN SCHAR_MIN
#define INT_FAST8_MAX SCHAR_MAX
#define UINT_FAST8_MAX UCHAR_MAX
#undef INT_FAST16_MIN
#undef INT_FAST16_MAX
#undef UINT_FAST16_MAX
#define INT_FAST16_MIN INT_FAST32_MIN
#define INT_FAST16_MAX INT_FAST32_MAX
#define UINT_FAST16_MAX UINT_FAST32_MAX
#undef INT_FAST32_MIN
#undef INT_FAST32_MAX
#undef UINT_FAST32_MAX
#ifdef __sun
# define INT_FAST32_MIN INT_MIN
# define INT_FAST32_MAX INT_MAX
# define UINT_FAST32_MAX UINT_MAX
#else
# define INT_FAST32_MIN LONG_MIN
# define INT_FAST32_MAX LONG_MAX
# define UINT_FAST32_MAX ULONG_MAX
#endif
#undef INT_FAST64_MIN
#undef INT_FAST64_MAX
#ifdef GL_INT64_T
# define INT_FAST64_MIN INT64_MIN
# define INT_FAST64_MAX INT64_MAX
#endif
#undef UINT_FAST64_MAX
#ifdef GL_UINT64_T
# define UINT_FAST64_MAX UINT64_MAX
#endif
/* 7.18.2.4. Limits of integer types capable of holding object pointers */
#undef INTPTR_MIN
#undef INTPTR_MAX
#undef UINTPTR_MAX
#define INTPTR_MIN LONG_MIN
#define INTPTR_MAX LONG_MAX
#define UINTPTR_MAX ULONG_MAX
/* 7.18.2.5. Limits of greatest-width integer types */
#ifndef INTMAX_MAX
# undef INTMAX_MIN
# ifdef INT64_MAX
# define INTMAX_MIN INT64_MIN
# define INTMAX_MAX INT64_MAX
# else
# define INTMAX_MIN INT32_MIN
# define INTMAX_MAX INT32_MAX
# endif
#endif
#ifndef UINTMAX_MAX
# ifdef UINT64_MAX
# define UINTMAX_MAX UINT64_MAX
# else
# define UINTMAX_MAX UINT32_MAX
# endif
#endif
/* 7.18.3. Limits of other integer types */
/* ptrdiff_t limits */
#undef PTRDIFF_MIN
#undef PTRDIFF_MAX
#if @APPLE_UNIVERSAL_BUILD@
# ifdef _LP64
# define PTRDIFF_MIN _STDINT_MIN (1, 64, 0l)
# define PTRDIFF_MAX _STDINT_MAX (1, 64, 0l)
# else
# define PTRDIFF_MIN _STDINT_MIN (1, 32, 0)
# define PTRDIFF_MAX _STDINT_MAX (1, 32, 0)
# endif
#else
# define PTRDIFF_MIN \
_STDINT_MIN (1, @BITSIZEOF_PTRDIFF_T@, 0@PTRDIFF_T_SUFFIX@)
# define PTRDIFF_MAX \
_STDINT_MAX (1, @BITSIZEOF_PTRDIFF_T@, 0@PTRDIFF_T_SUFFIX@)
#endif
/* sig_atomic_t limits */
#undef SIG_ATOMIC_MIN
#undef SIG_ATOMIC_MAX
#define SIG_ATOMIC_MIN \
_STDINT_MIN (@HAVE_SIGNED_SIG_ATOMIC_T@, @BITSIZEOF_SIG_ATOMIC_T@, \
0@SIG_ATOMIC_T_SUFFIX@)
#define SIG_ATOMIC_MAX \
_STDINT_MAX (@HAVE_SIGNED_SIG_ATOMIC_T@, @BITSIZEOF_SIG_ATOMIC_T@, \
0@SIG_ATOMIC_T_SUFFIX@)
/* size_t limit */
#undef SIZE_MAX
#if @APPLE_UNIVERSAL_BUILD@
# ifdef _LP64
# define SIZE_MAX _STDINT_MAX (0, 64, 0ul)
# else
# define SIZE_MAX _STDINT_MAX (0, 32, 0ul)
# endif
#else
# define SIZE_MAX _STDINT_MAX (0, @BITSIZEOF_SIZE_T@, 0@SIZE_T_SUFFIX@)
#endif
/* wchar_t limits */
/* Get WCHAR_MIN, WCHAR_MAX.
This include is not on the top, above, because on OSF/1 4.0 we have a
sequence of nested includes
<wchar.h> -> <stdio.h> -> <getopt.h> -> <stdlib.h>, and the latter includes
<stdint.h> and assumes its types are already defined. */
#if @HAVE_WCHAR_H@ && ! (defined WCHAR_MIN && defined WCHAR_MAX)
/* BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be
included before <wchar.h>. */
# include <stddef.h>
# include <stdio.h>
# include <time.h>
# define _GL_JUST_INCLUDE_SYSTEM_WCHAR_H
/* We don't need WCHAR_* in libidn, so to avoid problems with
missing wchar.h, don't include wchar.h here. */
# undef _GL_JUST_INCLUDE_SYSTEM_WCHAR_H
#endif
#undef WCHAR_MIN
#undef WCHAR_MAX
#define WCHAR_MIN \
_STDINT_MIN (@HAVE_SIGNED_WCHAR_T@, @BITSIZEOF_WCHAR_T@, 0@WCHAR_T_SUFFIX@)
#define WCHAR_MAX \
_STDINT_MAX (@HAVE_SIGNED_WCHAR_T@, @BITSIZEOF_WCHAR_T@, 0@WCHAR_T_SUFFIX@)
/* wint_t limits */
#undef WINT_MIN
#undef WINT_MAX
#define WINT_MIN \
_STDINT_MIN (@HAVE_SIGNED_WINT_T@, @BITSIZEOF_WINT_T@, 0@WINT_T_SUFFIX@)
#define WINT_MAX \
_STDINT_MAX (@HAVE_SIGNED_WINT_T@, @BITSIZEOF_WINT_T@, 0@WINT_T_SUFFIX@)
/* 7.18.4. Macros for integer constants */
/* 7.18.4.1. Macros for minimum-width integer constants */
/* According to ISO C 99 Technical Corrigendum 1 */
/* Here we assume a standard architecture where the hardware integer
types have 8, 16, 32, optionally 64 bits, and int is 32 bits. */
#undef INT8_C
#undef UINT8_C
#define INT8_C(x) x
#define UINT8_C(x) x
#undef INT16_C
#undef UINT16_C
#define INT16_C(x) x
#define UINT16_C(x) x
#undef INT32_C
#undef UINT32_C
#define INT32_C(x) x
#define UINT32_C(x) x ## U
#undef INT64_C
#undef UINT64_C
#if LONG_MAX >> 31 >> 31 == 1
# define INT64_C(x) x##L
#elif defined _MSC_VER
# define INT64_C(x) x##i64
#elif @HAVE_LONG_LONG_INT@
# define INT64_C(x) x##LL
#endif
#if ULONG_MAX >> 31 >> 31 >> 1 == 1
# define UINT64_C(x) x##UL
#elif defined _MSC_VER
# define UINT64_C(x) x##ui64
#elif @HAVE_UNSIGNED_LONG_LONG_INT@
# define UINT64_C(x) x##ULL
#endif
/* 7.18.4.2. Macros for greatest-width integer constants */
#ifndef INTMAX_C
# if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1
# define INTMAX_C(x) x##LL
# elif defined GL_INT64_T
# define INTMAX_C(x) INT64_C(x)
# else
# define INTMAX_C(x) x##L
# endif
#endif
#ifndef UINTMAX_C
# if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1
# define UINTMAX_C(x) x##ULL
# elif defined GL_UINT64_T
# define UINTMAX_C(x) UINT64_C(x)
# else
# define UINTMAX_C(x) x##UL
# endif
#endif
#endif /* _@GUARD_PREFIX@_STDINT_H */
#endif /* !(defined __ANDROID__ && ...) */
#endif /* !defined _@GUARD_PREFIX@_STDINT_H && !defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H */

463
Example/Pods/libidn/lib/gl/striconv.c generated Normal file
View File

@ -0,0 +1,463 @@
/* Charset conversion.
Copyright (C) 2001-2007, 2010-2015 Free Software Foundation, Inc.
Written by Bruno Haible and Simon Josefsson.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program; if not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
/* Specification. */
#include "striconv.h"
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#if HAVE_ICONV
# include <iconv.h>
/* Get MB_LEN_MAX, CHAR_BIT. */
# include <limits.h>
#endif
#include "c-strcase.h"
#ifndef SIZE_MAX
# define SIZE_MAX ((size_t) -1)
#endif
#if HAVE_ICONV
int
mem_cd_iconv (const char *src, size_t srclen, iconv_t cd,
char **resultp, size_t *lengthp)
{
# define tmpbufsize 4096
size_t length;
char *result;
/* Avoid glibc-2.1 bug and Solaris 2.7-2.9 bug. */
# if defined _LIBICONV_VERSION \
|| !(((__GLIBC__ == 2 && __GLIBC_MINOR__ <= 1) && !defined __UCLIBC__) \
|| defined __sun)
/* Set to the initial state. */
iconv (cd, NULL, NULL, NULL, NULL);
# endif
/* Determine the length we need. */
{
size_t count = 0;
/* The alignment is needed when converting e.g. to glibc's WCHAR_T or
libiconv's UCS-4-INTERNAL encoding. */
union { unsigned int align; char buf[tmpbufsize]; } tmp;
# define tmpbuf tmp.buf
const char *inptr = src;
size_t insize = srclen;
while (insize > 0)
{
char *outptr = tmpbuf;
size_t outsize = tmpbufsize;
size_t res = iconv (cd,
(ICONV_CONST char **) &inptr, &insize,
&outptr, &outsize);
if (res == (size_t)(-1))
{
if (errno == E2BIG)
;
else if (errno == EINVAL)
break;
else
return -1;
}
# if !defined _LIBICONV_VERSION && !(defined __GLIBC__ && !defined __UCLIBC__)
/* Irix iconv() inserts a NUL byte if it cannot convert.
NetBSD iconv() inserts a question mark if it cannot convert.
Only GNU libiconv and GNU libc are known to prefer to fail rather
than doing a lossy conversion. */
else if (res > 0)
{
errno = EILSEQ;
return -1;
}
# endif
count += outptr - tmpbuf;
}
/* Avoid glibc-2.1 bug and Solaris 2.7 bug. */
# if defined _LIBICONV_VERSION \
|| !(((__GLIBC__ == 2 && __GLIBC_MINOR__ <= 1) && !defined __UCLIBC__) \
|| defined __sun)
{
char *outptr = tmpbuf;
size_t outsize = tmpbufsize;
size_t res = iconv (cd, NULL, NULL, &outptr, &outsize);
if (res == (size_t)(-1))
return -1;
count += outptr - tmpbuf;
}
# endif
length = count;
# undef tmpbuf
}
if (length == 0)
{
*lengthp = 0;
return 0;
}
if (*resultp != NULL && *lengthp >= length)
result = *resultp;
else
{
result = (char *) malloc (length);
if (result == NULL)
{
errno = ENOMEM;
return -1;
}
}
/* Avoid glibc-2.1 bug and Solaris 2.7-2.9 bug. */
# if defined _LIBICONV_VERSION \
|| !(((__GLIBC__ == 2 && __GLIBC_MINOR__ <= 1) && !defined __UCLIBC__) \
|| defined __sun)
/* Return to the initial state. */
iconv (cd, NULL, NULL, NULL, NULL);
# endif
/* Do the conversion for real. */
{
const char *inptr = src;
size_t insize = srclen;
char *outptr = result;
size_t outsize = length;
while (insize > 0)
{
size_t res = iconv (cd,
(ICONV_CONST char **) &inptr, &insize,
&outptr, &outsize);
if (res == (size_t)(-1))
{
if (errno == EINVAL)
break;
else
goto fail;
}
# if !defined _LIBICONV_VERSION && !(defined __GLIBC__ && !defined __UCLIBC__)
/* Irix iconv() inserts a NUL byte if it cannot convert.
NetBSD iconv() inserts a question mark if it cannot convert.
Only GNU libiconv and GNU libc are known to prefer to fail rather
than doing a lossy conversion. */
else if (res > 0)
{
errno = EILSEQ;
goto fail;
}
# endif
}
/* Avoid glibc-2.1 bug and Solaris 2.7 bug. */
# if defined _LIBICONV_VERSION \
|| !(((__GLIBC__ == 2 && __GLIBC_MINOR__ <= 1) && !defined __UCLIBC__) \
|| defined __sun)
{
size_t res = iconv (cd, NULL, NULL, &outptr, &outsize);
if (res == (size_t)(-1))
goto fail;
}
# endif
if (outsize != 0)
abort ();
}
*resultp = result;
*lengthp = length;
return 0;
fail:
{
if (result != *resultp)
{
int saved_errno = errno;
free (result);
errno = saved_errno;
}
return -1;
}
# undef tmpbufsize
}
char *
str_cd_iconv (const char *src, iconv_t cd)
{
/* For most encodings, a trailing NUL byte in the input will be converted
to a trailing NUL byte in the output. But not for UTF-7. So that this
function is usable for UTF-7, we have to exclude the NUL byte from the
conversion and add it by hand afterwards. */
# if !defined _LIBICONV_VERSION && !(defined __GLIBC__ && !defined __UCLIBC__)
/* Irix iconv() inserts a NUL byte if it cannot convert.
NetBSD iconv() inserts a question mark if it cannot convert.
Only GNU libiconv and GNU libc are known to prefer to fail rather
than doing a lossy conversion. For other iconv() implementations,
we have to look at the number of irreversible conversions returned;
but this information is lost when iconv() returns for an E2BIG reason.
Therefore we cannot use the second, faster algorithm. */
char *result = NULL;
size_t length = 0;
int retval = mem_cd_iconv (src, strlen (src), cd, &result, &length);
char *final_result;
if (retval < 0)
{
if (result != NULL)
abort ();
return NULL;
}
/* Add the terminating NUL byte. */
final_result =
(result != NULL ? realloc (result, length + 1) : malloc (length + 1));
if (final_result == NULL)
{
free (result);
errno = ENOMEM;
return NULL;
}
final_result[length] = '\0';
return final_result;
# else
/* This algorithm is likely faster than the one above. But it may produce
iconv() returns for an E2BIG reason, when the output size guess is too
small. Therefore it can only be used when we don't need the number of
irreversible conversions performed. */
char *result;
size_t result_size;
size_t length;
const char *inptr = src;
size_t inbytes_remaining = strlen (src);
/* Make a guess for the worst-case output size, in order to avoid a
realloc. It's OK if the guess is wrong as long as it is not zero and
doesn't lead to an integer overflow. */
result_size = inbytes_remaining;
{
size_t approx_sqrt_SIZE_MAX = SIZE_MAX >> (sizeof (size_t) * CHAR_BIT / 2);
if (result_size <= approx_sqrt_SIZE_MAX / MB_LEN_MAX)
result_size *= MB_LEN_MAX;
}
result_size += 1; /* for the terminating NUL */
result = (char *) malloc (result_size);
if (result == NULL)
{
errno = ENOMEM;
return NULL;
}
/* Avoid glibc-2.1 bug and Solaris 2.7-2.9 bug. */
# if defined _LIBICONV_VERSION \
|| !(((__GLIBC__ == 2 && __GLIBC_MINOR__ <= 1) && !defined __UCLIBC__) \
|| defined __sun)
/* Set to the initial state. */
iconv (cd, NULL, NULL, NULL, NULL);
# endif
/* Do the conversion. */
{
char *outptr = result;
size_t outbytes_remaining = result_size - 1;
for (;;)
{
/* Here inptr + inbytes_remaining = src + strlen (src),
outptr + outbytes_remaining = result + result_size - 1. */
size_t res = iconv (cd,
(ICONV_CONST char **) &inptr, &inbytes_remaining,
&outptr, &outbytes_remaining);
if (res == (size_t)(-1))
{
if (errno == EINVAL)
break;
else if (errno == E2BIG)
{
size_t used = outptr - result;
size_t newsize = result_size * 2;
char *newresult;
if (!(newsize > result_size))
{
errno = ENOMEM;
goto failed;
}
newresult = (char *) realloc (result, newsize);
if (newresult == NULL)
{
errno = ENOMEM;
goto failed;
}
result = newresult;
result_size = newsize;
outptr = result + used;
outbytes_remaining = result_size - 1 - used;
}
else
goto failed;
}
else
break;
}
/* Avoid glibc-2.1 bug and Solaris 2.7 bug. */
# if defined _LIBICONV_VERSION \
|| !(((__GLIBC__ == 2 && __GLIBC_MINOR__ <= 1) && !defined __UCLIBC__) \
|| defined __sun)
for (;;)
{
/* Here outptr + outbytes_remaining = result + result_size - 1. */
size_t res = iconv (cd, NULL, NULL, &outptr, &outbytes_remaining);
if (res == (size_t)(-1))
{
if (errno == E2BIG)
{
size_t used = outptr - result;
size_t newsize = result_size * 2;
char *newresult;
if (!(newsize > result_size))
{
errno = ENOMEM;
goto failed;
}
newresult = (char *) realloc (result, newsize);
if (newresult == NULL)
{
errno = ENOMEM;
goto failed;
}
result = newresult;
result_size = newsize;
outptr = result + used;
outbytes_remaining = result_size - 1 - used;
}
else
goto failed;
}
else
break;
}
# endif
/* Add the terminating NUL byte. */
*outptr++ = '\0';
length = outptr - result;
}
/* Give away unused memory. */
if (length < result_size)
{
char *smaller_result = (char *) realloc (result, length);
if (smaller_result != NULL)
result = smaller_result;
}
return result;
failed:
{
int saved_errno = errno;
free (result);
errno = saved_errno;
return NULL;
}
# endif
}
#endif
char *
str_iconv (const char *src, const char *from_codeset, const char *to_codeset)
{
if (*src == '\0' || c_strcasecmp (from_codeset, to_codeset) == 0)
{
char *result = strdup (src);
if (result == NULL)
errno = ENOMEM;
return result;
}
else
{
#if HAVE_ICONV
iconv_t cd;
char *result;
/* Avoid glibc-2.1 bug with EUC-KR. */
# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ <= 1) && !defined __UCLIBC__) \
&& !defined _LIBICONV_VERSION
if (c_strcasecmp (from_codeset, "EUC-KR") == 0
|| c_strcasecmp (to_codeset, "EUC-KR") == 0)
{
errno = EINVAL;
return NULL;
}
# endif
cd = iconv_open (to_codeset, from_codeset);
if (cd == (iconv_t) -1)
return NULL;
result = str_cd_iconv (src, cd);
if (result == NULL)
{
/* Close cd, but preserve the errno from str_cd_iconv. */
int saved_errno = errno;
iconv_close (cd);
errno = saved_errno;
}
else
{
if (iconv_close (cd) < 0)
{
/* Return NULL, but free the allocated memory, and while doing
that, preserve the errno from iconv_close. */
int saved_errno = errno;
free (result);
errno = saved_errno;
return NULL;
}
}
return result;
#else
/* This is a different error code than if iconv_open existed but didn't
support from_codeset and to_codeset, so that the caller can emit
an error message such as
"iconv() is not supported. Installing GNU libiconv and
then reinstalling this package would fix this." */
errno = ENOSYS;
return NULL;
#endif
}
}

75
Example/Pods/libidn/lib/gl/striconv.h generated Normal file
View File

@ -0,0 +1,75 @@
/* Charset conversion.
Copyright (C) 2001-2004, 2006-2007, 2009-2015 Free Software Foundation, Inc.
Written by Bruno Haible and Simon Josefsson.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program; if not, see <http://www.gnu.org/licenses/>. */
#ifndef _STRICONV_H
#define _STRICONV_H
#include <stddef.h>
#if HAVE_ICONV
#include <iconv.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif
#if HAVE_ICONV
/* Convert an entire string from one encoding to another, using iconv.
The original string is at [SRC,...,SRC+SRCLEN-1].
The conversion descriptor is passed as CD.
*RESULTP and *LENGTH should initially be a scratch buffer and its size,
or *RESULTP can initially be NULL.
May erase the contents of the memory at *RESULTP.
Return value: 0 if successful, otherwise -1 and errno set.
If successful: The resulting string is stored in *RESULTP and its length
in *LENGTHP. *RESULTP is set to a freshly allocated memory block, or is
unchanged if no dynamic memory allocation was necessary. */
extern int mem_cd_iconv (const char *src, size_t srclen, iconv_t cd,
char **resultp, size_t *lengthp);
/* Convert an entire string from one encoding to another, using iconv.
The original string is the NUL-terminated string starting at SRC.
The conversion descriptor is passed as CD. Both the "from" and the "to"
encoding must use a single NUL byte at the end of the string (i.e. not
UCS-2, UCS-4, UTF-16, UTF-32).
Allocate a malloced memory block for the result.
Return value: the freshly allocated resulting NUL-terminated string if
successful, otherwise NULL and errno set. */
extern char * str_cd_iconv (const char *src, iconv_t cd);
#endif
/* Convert an entire string from one encoding to another, using iconv.
The original string is the NUL-terminated string starting at SRC.
Both the "from" and the "to" encoding must use a single NUL byte at the
end of the string (i.e. not UCS-2, UCS-4, UTF-16, UTF-32).
Allocate a malloced memory block for the result.
Return value: the freshly allocated resulting NUL-terminated string if
successful, otherwise NULL and errno set. */
extern char * str_iconv (const char *src,
const char *from_codeset, const char *to_codeset);
#ifdef __cplusplus
}
#endif
#endif /* _STRICONV_H */

2
Example/Pods/libidn/lib/gl/string.h generated Normal file
View File

@ -0,0 +1,2 @@
int strverscmp (const char *s1, const char *s2);
#include_next <string.h>

1046
Example/Pods/libidn/lib/gl/string.in.h generated Normal file

File diff suppressed because it is too large Load Diff

131
Example/Pods/libidn/lib/gl/strverscmp.c generated Normal file
View File

@ -0,0 +1,131 @@
/* Compare strings while treating digits characters numerically.
Copyright (C) 1997, 2000, 2002, 2004, 2006, 2009-2015 Free Software
Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jean-François Bignolles <bignolle@ecoledoc.ibp.fr>, 1997.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along
with this program; if not, see <http://www.gnu.org/licenses/>. */
#if !_LIBC
# include <config.h>
#endif
#include <string.h>
#include <ctype.h>
/* states: S_N: normal, S_I: comparing integral part, S_F: comparing
fractional parts, S_Z: idem but with leading Zeroes only */
#define S_N 0x0
#define S_I 0x4
#define S_F 0x8
#define S_Z 0xC
/* result_type: CMP: return diff; LEN: compare using len_diff/diff */
#define CMP 2
#define LEN 3
/* ISDIGIT differs from isdigit, as follows:
- Its arg may be any int or unsigned int; it need not be an unsigned char
or EOF.
- It's typically faster.
POSIX says that only '0' through '9' are digits. Prefer ISDIGIT to
isdigit unless it's important to use the locale's definition
of "digit" even when the host does not conform to POSIX. */
#define ISDIGIT(c) ((unsigned int) (c) - '0' <= 9)
#undef __strverscmp
#undef strverscmp
#ifndef weak_alias
# define __strverscmp strverscmp
#endif
/* Compare S1 and S2 as strings holding indices/version numbers,
returning less than, equal to or greater than zero if S1 is less than,
equal to or greater than S2 (for more info, see the texinfo doc).
*/
int
__strverscmp (const char *s1, const char *s2)
{
const unsigned char *p1 = (const unsigned char *) s1;
const unsigned char *p2 = (const unsigned char *) s2;
unsigned char c1, c2;
int state;
int diff;
/* Symbol(s) 0 [1-9] others (padding)
Transition (10) 0 (01) d (00) x (11) - */
static const unsigned int next_state[] =
{
/* state x d 0 - */
/* S_N */ S_N, S_I, S_Z, S_N,
/* S_I */ S_N, S_I, S_I, S_I,
/* S_F */ S_N, S_F, S_F, S_F,
/* S_Z */ S_N, S_F, S_Z, S_Z
};
static const int result_type[] =
{
/* state x/x x/d x/0 x/- d/x d/d d/0 d/-
0/x 0/d 0/0 0/- -/x -/d -/0 -/- */
/* S_N */ CMP, CMP, CMP, CMP, CMP, LEN, CMP, CMP,
CMP, CMP, CMP, CMP, CMP, CMP, CMP, CMP,
/* S_I */ CMP, -1, -1, CMP, 1, LEN, LEN, CMP,
1, LEN, LEN, CMP, CMP, CMP, CMP, CMP,
/* S_F */ CMP, CMP, CMP, CMP, CMP, LEN, CMP, CMP,
CMP, CMP, CMP, CMP, CMP, CMP, CMP, CMP,
/* S_Z */ CMP, 1, 1, CMP, -1, CMP, CMP, CMP,
-1, CMP, CMP, CMP
};
if (p1 == p2)
return 0;
c1 = *p1++;
c2 = *p2++;
/* Hint: '0' is a digit too. */
state = S_N | ((c1 == '0') + (ISDIGIT (c1) != 0));
while ((diff = c1 - c2) == 0 && c1 != '\0')
{
state = next_state[state];
c1 = *p1++;
c2 = *p2++;
state |= (c1 == '0') + (ISDIGIT (c1) != 0);
}
state = result_type[state << 2 | ((c2 == '0') + (ISDIGIT (c2) != 0))];
switch (state)
{
case CMP:
return diff;
case LEN:
while (ISDIGIT (*p1++))
if (!ISDIGIT (*p2++))
return 1;
return ISDIGIT (*p2) ? -1 : diff;
default:
return state;
}
}
#ifdef weak_alias
weak_alias (__strverscmp, strverscmp)
#endif

View File

@ -0,0 +1,53 @@
/* Provide a more complete sys/types.h.
Copyright (C) 2011-2015 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program; if not, see <http://www.gnu.org/licenses/>. */
#if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
#endif
@PRAGMA_COLUMNS@
#ifndef _@GUARD_PREFIX@_SYS_TYPES_H
/* The include_next requires a split double-inclusion guard. */
# define _GL_INCLUDING_SYS_TYPES_H
#@INCLUDE_NEXT@ @NEXT_SYS_TYPES_H@
# undef _GL_INCLUDING_SYS_TYPES_H
#ifndef _@GUARD_PREFIX@_SYS_TYPES_H
#define _@GUARD_PREFIX@_SYS_TYPES_H
/* Override off_t if Large File Support is requested on native Windows. */
#if @WINDOWS_64_BIT_OFF_T@
/* Same as int64_t in <stdint.h>. */
# if defined _MSC_VER
# define off_t __int64
# else
# define off_t long long int
# endif
/* Indicator, for gnulib internal purposes. */
# define _GL_WINDOWS_64_BIT_OFF_T 1
#endif
/* MSVC 9 defines size_t in <stddef.h>, not in <sys/types.h>. */
/* But avoid namespace pollution on glibc systems. */
#if ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__) \
&& ! defined __GLIBC__
# include <stddef.h>
#endif
#endif /* _@GUARD_PREFIX@_SYS_TYPES_H */
#endif /* _@GUARD_PREFIX@_SYS_TYPES_H */

750
Example/Pods/libidn/lib/gl/unistr.h generated Normal file
View File

@ -0,0 +1,750 @@
/* Elementary Unicode string functions.
Copyright (C) 2001-2002, 2005-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#ifndef _UNISTR_H
#define _UNISTR_H
#include "unitypes.h"
/* Get common macros for C. */
#include "unused-parameter.h"
/* Get bool. */
#include <stdbool.h>
/* Get size_t. */
#include <stddef.h>
#ifdef __cplusplus
extern "C" {
#endif
/* Conventions:
All functions prefixed with u8_ operate on UTF-8 encoded strings.
Their unit is an uint8_t (1 byte).
All functions prefixed with u16_ operate on UTF-16 encoded strings.
Their unit is an uint16_t (a 2-byte word).
All functions prefixed with u32_ operate on UCS-4 encoded strings.
Their unit is an uint32_t (a 4-byte word).
All argument pairs (s, n) denote a Unicode string s[0..n-1] with exactly
n units.
All arguments starting with "str" and the arguments of functions starting
with u8_str/u16_str/u32_str denote a NUL terminated string, i.e. a string
which terminates at the first NUL unit. This termination unit is
considered part of the string for all memory allocation purposes, but
is not considered part of the string for all other logical purposes.
Functions returning a string result take a (resultbuf, lengthp) argument
pair. If resultbuf is not NULL and the result fits into *lengthp units,
it is put in resultbuf, and resultbuf is returned. Otherwise, a freshly
allocated string is returned. In both cases, *lengthp is set to the
length (number of units) of the returned string. In case of error,
NULL is returned and errno is set. */
/* Elementary string checks. */
/* Check whether an UTF-8 string is well-formed.
Return NULL if valid, or a pointer to the first invalid unit otherwise. */
extern const uint8_t *
u8_check (const uint8_t *s, size_t n)
_UC_ATTRIBUTE_PURE;
/* Check whether an UTF-16 string is well-formed.
Return NULL if valid, or a pointer to the first invalid unit otherwise. */
extern const uint16_t *
u16_check (const uint16_t *s, size_t n)
_UC_ATTRIBUTE_PURE;
/* Check whether an UCS-4 string is well-formed.
Return NULL if valid, or a pointer to the first invalid unit otherwise. */
extern const uint32_t *
u32_check (const uint32_t *s, size_t n)
_UC_ATTRIBUTE_PURE;
/* Elementary string conversions. */
/* Convert an UTF-8 string to an UTF-16 string. */
extern uint16_t *
u8_to_u16 (const uint8_t *s, size_t n, uint16_t *resultbuf,
size_t *lengthp);
/* Convert an UTF-8 string to an UCS-4 string. */
extern uint32_t *
u8_to_u32 (const uint8_t *s, size_t n, uint32_t *resultbuf,
size_t *lengthp);
/* Convert an UTF-16 string to an UTF-8 string. */
extern uint8_t *
u16_to_u8 (const uint16_t *s, size_t n, uint8_t *resultbuf,
size_t *lengthp);
/* Convert an UTF-16 string to an UCS-4 string. */
extern uint32_t *
u16_to_u32 (const uint16_t *s, size_t n, uint32_t *resultbuf,
size_t *lengthp);
/* Convert an UCS-4 string to an UTF-8 string. */
extern uint8_t *
u32_to_u8 (const uint32_t *s, size_t n, uint8_t *resultbuf,
size_t *lengthp);
/* Convert an UCS-4 string to an UTF-16 string. */
extern uint16_t *
u32_to_u16 (const uint32_t *s, size_t n, uint16_t *resultbuf,
size_t *lengthp);
/* Elementary string functions. */
/* Return the length (number of units) of the first character in S, which is
no longer than N. Return 0 if it is the NUL character. Return -1 upon
failure. */
/* Similar to mblen(), except that s must not be NULL. */
extern int
u8_mblen (const uint8_t *s, size_t n)
_UC_ATTRIBUTE_PURE;
extern int
u16_mblen (const uint16_t *s, size_t n)
_UC_ATTRIBUTE_PURE;
extern int
u32_mblen (const uint32_t *s, size_t n)
_UC_ATTRIBUTE_PURE;
/* Return the length (number of units) of the first character in S, putting
its 'ucs4_t' representation in *PUC. Upon failure, *PUC is set to 0xfffd,
and an appropriate number of units is returned.
The number of available units, N, must be > 0. */
/* Similar to mbtowc(), except that puc and s must not be NULL, n must be > 0,
and the NUL character is not treated specially. */
/* The variants with _safe suffix are safe, even if the library is compiled
without --enable-safety. */
#if GNULIB_UNISTR_U8_MBTOUC_UNSAFE || HAVE_LIBUNISTRING
# if !HAVE_INLINE
extern int
u8_mbtouc_unsafe (ucs4_t *puc, const uint8_t *s, size_t n);
# else
extern int
u8_mbtouc_unsafe_aux (ucs4_t *puc, const uint8_t *s, size_t n);
static inline int
u8_mbtouc_unsafe (ucs4_t *puc, const uint8_t *s, size_t n)
{
uint8_t c = *s;
if (c < 0x80)
{
*puc = c;
return 1;
}
else
return u8_mbtouc_unsafe_aux (puc, s, n);
}
# endif
#endif
#if GNULIB_UNISTR_U16_MBTOUC_UNSAFE || HAVE_LIBUNISTRING
# if !HAVE_INLINE
extern int
u16_mbtouc_unsafe (ucs4_t *puc, const uint16_t *s, size_t n);
# else
extern int
u16_mbtouc_unsafe_aux (ucs4_t *puc, const uint16_t *s, size_t n);
static inline int
u16_mbtouc_unsafe (ucs4_t *puc, const uint16_t *s, size_t n)
{
uint16_t c = *s;
if (c < 0xd800 || c >= 0xe000)
{
*puc = c;
return 1;
}
else
return u16_mbtouc_unsafe_aux (puc, s, n);
}
# endif
#endif
#if GNULIB_UNISTR_U32_MBTOUC_UNSAFE || HAVE_LIBUNISTRING
# if !HAVE_INLINE
extern int
u32_mbtouc_unsafe (ucs4_t *puc, const uint32_t *s, size_t n);
# else
static inline int
u32_mbtouc_unsafe (ucs4_t *puc,
const uint32_t *s, size_t n _GL_UNUSED_PARAMETER)
{
uint32_t c = *s;
# if CONFIG_UNICODE_SAFETY
if (c < 0xd800 || (c >= 0xe000 && c < 0x110000))
# endif
*puc = c;
# if CONFIG_UNICODE_SAFETY
else
/* invalid multibyte character */
*puc = 0xfffd;
# endif
return 1;
}
# endif
#endif
#if GNULIB_UNISTR_U8_MBTOUC || HAVE_LIBUNISTRING
# if !HAVE_INLINE
extern int
u8_mbtouc (ucs4_t *puc, const uint8_t *s, size_t n);
# else
extern int
u8_mbtouc_aux (ucs4_t *puc, const uint8_t *s, size_t n);
static inline int
u8_mbtouc (ucs4_t *puc, const uint8_t *s, size_t n)
{
uint8_t c = *s;
if (c < 0x80)
{
*puc = c;
return 1;
}
else
return u8_mbtouc_aux (puc, s, n);
}
# endif
#endif
#if GNULIB_UNISTR_U16_MBTOUC || HAVE_LIBUNISTRING
# if !HAVE_INLINE
extern int
u16_mbtouc (ucs4_t *puc, const uint16_t *s, size_t n);
# else
extern int
u16_mbtouc_aux (ucs4_t *puc, const uint16_t *s, size_t n);
static inline int
u16_mbtouc (ucs4_t *puc, const uint16_t *s, size_t n)
{
uint16_t c = *s;
if (c < 0xd800 || c >= 0xe000)
{
*puc = c;
return 1;
}
else
return u16_mbtouc_aux (puc, s, n);
}
# endif
#endif
#if GNULIB_UNISTR_U32_MBTOUC || HAVE_LIBUNISTRING
# if !HAVE_INLINE
extern int
u32_mbtouc (ucs4_t *puc, const uint32_t *s, size_t n);
# else
static inline int
u32_mbtouc (ucs4_t *puc, const uint32_t *s, size_t n _GL_UNUSED_PARAMETER)
{
uint32_t c = *s;
if (c < 0xd800 || (c >= 0xe000 && c < 0x110000))
*puc = c;
else
/* invalid multibyte character */
*puc = 0xfffd;
return 1;
}
# endif
#endif
/* Return the length (number of units) of the first character in S, putting
its 'ucs4_t' representation in *PUC. Upon failure, *PUC is set to 0xfffd,
and -1 is returned for an invalid sequence of units, -2 is returned for an
incomplete sequence of units.
The number of available units, N, must be > 0. */
/* Similar to u*_mbtouc(), except that the return value gives more details
about the failure, similar to mbrtowc(). */
#if GNULIB_UNISTR_U8_MBTOUCR || HAVE_LIBUNISTRING
extern int
u8_mbtoucr (ucs4_t *puc, const uint8_t *s, size_t n);
#endif
#if GNULIB_UNISTR_U16_MBTOUCR || HAVE_LIBUNISTRING
extern int
u16_mbtoucr (ucs4_t *puc, const uint16_t *s, size_t n);
#endif
#if GNULIB_UNISTR_U32_MBTOUCR || HAVE_LIBUNISTRING
extern int
u32_mbtoucr (ucs4_t *puc, const uint32_t *s, size_t n);
#endif
/* Put the multibyte character represented by UC in S, returning its
length. Return -1 upon failure, -2 if the number of available units, N,
is too small. The latter case cannot occur if N >= 6/2/1, respectively. */
/* Similar to wctomb(), except that s must not be NULL, and the argument n
must be specified. */
#if GNULIB_UNISTR_U8_UCTOMB || HAVE_LIBUNISTRING
/* Auxiliary function, also used by u8_chr, u8_strchr, u8_strrchr. */
extern int
u8_uctomb_aux (uint8_t *s, ucs4_t uc, int n);
# if !HAVE_INLINE
extern int
u8_uctomb (uint8_t *s, ucs4_t uc, int n);
# else
static inline int
u8_uctomb (uint8_t *s, ucs4_t uc, int n)
{
if (uc < 0x80 && n > 0)
{
s[0] = uc;
return 1;
}
else
return u8_uctomb_aux (s, uc, n);
}
# endif
#endif
#if GNULIB_UNISTR_U16_UCTOMB || HAVE_LIBUNISTRING
/* Auxiliary function, also used by u16_chr, u16_strchr, u16_strrchr. */
extern int
u16_uctomb_aux (uint16_t *s, ucs4_t uc, int n);
# if !HAVE_INLINE
extern int
u16_uctomb (uint16_t *s, ucs4_t uc, int n);
# else
static inline int
u16_uctomb (uint16_t *s, ucs4_t uc, int n)
{
if (uc < 0xd800 && n > 0)
{
s[0] = uc;
return 1;
}
else
return u16_uctomb_aux (s, uc, n);
}
# endif
#endif
#if GNULIB_UNISTR_U32_UCTOMB || HAVE_LIBUNISTRING
# if !HAVE_INLINE
extern int
u32_uctomb (uint32_t *s, ucs4_t uc, int n);
# else
static inline int
u32_uctomb (uint32_t *s, ucs4_t uc, int n)
{
if (uc < 0xd800 || (uc >= 0xe000 && uc < 0x110000))
{
if (n > 0)
{
*s = uc;
return 1;
}
else
return -2;
}
else
return -1;
}
# endif
#endif
/* Copy N units from SRC to DEST. */
/* Similar to memcpy(). */
extern uint8_t *
u8_cpy (uint8_t *dest, const uint8_t *src, size_t n);
extern uint16_t *
u16_cpy (uint16_t *dest, const uint16_t *src, size_t n);
extern uint32_t *
u32_cpy (uint32_t *dest, const uint32_t *src, size_t n);
/* Copy N units from SRC to DEST, guaranteeing correct behavior for
overlapping memory areas. */
/* Similar to memmove(). */
extern uint8_t *
u8_move (uint8_t *dest, const uint8_t *src, size_t n);
extern uint16_t *
u16_move (uint16_t *dest, const uint16_t *src, size_t n);
extern uint32_t *
u32_move (uint32_t *dest, const uint32_t *src, size_t n);
/* Set the first N characters of S to UC. UC should be a character that
occupies only 1 unit. */
/* Similar to memset(). */
extern uint8_t *
u8_set (uint8_t *s, ucs4_t uc, size_t n);
extern uint16_t *
u16_set (uint16_t *s, ucs4_t uc, size_t n);
extern uint32_t *
u32_set (uint32_t *s, ucs4_t uc, size_t n);
/* Compare S1 and S2, each of length N. */
/* Similar to memcmp(). */
extern int
u8_cmp (const uint8_t *s1, const uint8_t *s2, size_t n)
_UC_ATTRIBUTE_PURE;
extern int
u16_cmp (const uint16_t *s1, const uint16_t *s2, size_t n)
_UC_ATTRIBUTE_PURE;
extern int
u32_cmp (const uint32_t *s1, const uint32_t *s2, size_t n)
_UC_ATTRIBUTE_PURE;
/* Compare S1 and S2. */
/* Similar to the gnulib function memcmp2(). */
extern int
u8_cmp2 (const uint8_t *s1, size_t n1, const uint8_t *s2, size_t n2)
_UC_ATTRIBUTE_PURE;
extern int
u16_cmp2 (const uint16_t *s1, size_t n1, const uint16_t *s2, size_t n2)
_UC_ATTRIBUTE_PURE;
extern int
u32_cmp2 (const uint32_t *s1, size_t n1, const uint32_t *s2, size_t n2)
_UC_ATTRIBUTE_PURE;
/* Search the string at S for UC. */
/* Similar to memchr(). */
extern uint8_t *
u8_chr (const uint8_t *s, size_t n, ucs4_t uc)
_UC_ATTRIBUTE_PURE;
extern uint16_t *
u16_chr (const uint16_t *s, size_t n, ucs4_t uc)
_UC_ATTRIBUTE_PURE;
extern uint32_t *
u32_chr (const uint32_t *s, size_t n, ucs4_t uc)
_UC_ATTRIBUTE_PURE;
/* Count the number of Unicode characters in the N units from S. */
/* Similar to mbsnlen(). */
extern size_t
u8_mbsnlen (const uint8_t *s, size_t n)
_UC_ATTRIBUTE_PURE;
extern size_t
u16_mbsnlen (const uint16_t *s, size_t n)
_UC_ATTRIBUTE_PURE;
extern size_t
u32_mbsnlen (const uint32_t *s, size_t n)
_UC_ATTRIBUTE_PURE;
/* Elementary string functions with memory allocation. */
/* Make a freshly allocated copy of S, of length N. */
extern uint8_t *
u8_cpy_alloc (const uint8_t *s, size_t n);
extern uint16_t *
u16_cpy_alloc (const uint16_t *s, size_t n);
extern uint32_t *
u32_cpy_alloc (const uint32_t *s, size_t n);
/* Elementary string functions on NUL terminated strings. */
/* Return the length (number of units) of the first character in S.
Return 0 if it is the NUL character. Return -1 upon failure. */
extern int
u8_strmblen (const uint8_t *s)
_UC_ATTRIBUTE_PURE;
extern int
u16_strmblen (const uint16_t *s)
_UC_ATTRIBUTE_PURE;
extern int
u32_strmblen (const uint32_t *s)
_UC_ATTRIBUTE_PURE;
/* Return the length (number of units) of the first character in S, putting
its 'ucs4_t' representation in *PUC. Return 0 if it is the NUL
character. Return -1 upon failure. */
extern int
u8_strmbtouc (ucs4_t *puc, const uint8_t *s);
extern int
u16_strmbtouc (ucs4_t *puc, const uint16_t *s);
extern int
u32_strmbtouc (ucs4_t *puc, const uint32_t *s);
/* Forward iteration step. Advances the pointer past the next character,
or returns NULL if the end of the string has been reached. Puts the
character's 'ucs4_t' representation in *PUC. */
extern const uint8_t *
u8_next (ucs4_t *puc, const uint8_t *s);
extern const uint16_t *
u16_next (ucs4_t *puc, const uint16_t *s);
extern const uint32_t *
u32_next (ucs4_t *puc, const uint32_t *s);
/* Backward iteration step. Advances the pointer to point to the previous
character, or returns NULL if the beginning of the string had been reached.
Puts the character's 'ucs4_t' representation in *PUC. */
extern const uint8_t *
u8_prev (ucs4_t *puc, const uint8_t *s, const uint8_t *start);
extern const uint16_t *
u16_prev (ucs4_t *puc, const uint16_t *s, const uint16_t *start);
extern const uint32_t *
u32_prev (ucs4_t *puc, const uint32_t *s, const uint32_t *start);
/* Return the number of units in S. */
/* Similar to strlen(), wcslen(). */
extern size_t
u8_strlen (const uint8_t *s)
_UC_ATTRIBUTE_PURE;
extern size_t
u16_strlen (const uint16_t *s)
_UC_ATTRIBUTE_PURE;
extern size_t
u32_strlen (const uint32_t *s)
_UC_ATTRIBUTE_PURE;
/* Return the number of units in S, but at most MAXLEN. */
/* Similar to strnlen(), wcsnlen(). */
extern size_t
u8_strnlen (const uint8_t *s, size_t maxlen)
_UC_ATTRIBUTE_PURE;
extern size_t
u16_strnlen (const uint16_t *s, size_t maxlen)
_UC_ATTRIBUTE_PURE;
extern size_t
u32_strnlen (const uint32_t *s, size_t maxlen)
_UC_ATTRIBUTE_PURE;
/* Copy SRC to DEST. */
/* Similar to strcpy(), wcscpy(). */
extern uint8_t *
u8_strcpy (uint8_t *dest, const uint8_t *src);
extern uint16_t *
u16_strcpy (uint16_t *dest, const uint16_t *src);
extern uint32_t *
u32_strcpy (uint32_t *dest, const uint32_t *src);
/* Copy SRC to DEST, returning the address of the terminating NUL in DEST. */
/* Similar to stpcpy(). */
extern uint8_t *
u8_stpcpy (uint8_t *dest, const uint8_t *src);
extern uint16_t *
u16_stpcpy (uint16_t *dest, const uint16_t *src);
extern uint32_t *
u32_stpcpy (uint32_t *dest, const uint32_t *src);
/* Copy no more than N units of SRC to DEST. */
/* Similar to strncpy(), wcsncpy(). */
extern uint8_t *
u8_strncpy (uint8_t *dest, const uint8_t *src, size_t n);
extern uint16_t *
u16_strncpy (uint16_t *dest, const uint16_t *src, size_t n);
extern uint32_t *
u32_strncpy (uint32_t *dest, const uint32_t *src, size_t n);
/* Copy no more than N units of SRC to DEST. Return a pointer past the last
non-NUL unit written into DEST. */
/* Similar to stpncpy(). */
extern uint8_t *
u8_stpncpy (uint8_t *dest, const uint8_t *src, size_t n);
extern uint16_t *
u16_stpncpy (uint16_t *dest, const uint16_t *src, size_t n);
extern uint32_t *
u32_stpncpy (uint32_t *dest, const uint32_t *src, size_t n);
/* Append SRC onto DEST. */
/* Similar to strcat(), wcscat(). */
extern uint8_t *
u8_strcat (uint8_t *dest, const uint8_t *src);
extern uint16_t *
u16_strcat (uint16_t *dest, const uint16_t *src);
extern uint32_t *
u32_strcat (uint32_t *dest, const uint32_t *src);
/* Append no more than N units of SRC onto DEST. */
/* Similar to strncat(), wcsncat(). */
extern uint8_t *
u8_strncat (uint8_t *dest, const uint8_t *src, size_t n);
extern uint16_t *
u16_strncat (uint16_t *dest, const uint16_t *src, size_t n);
extern uint32_t *
u32_strncat (uint32_t *dest, const uint32_t *src, size_t n);
/* Compare S1 and S2. */
/* Similar to strcmp(), wcscmp(). */
#ifdef __sun
/* Avoid a collision with the u8_strcmp() function in Solaris 11 libc. */
extern int
u8_strcmp_gnu (const uint8_t *s1, const uint8_t *s2)
_UC_ATTRIBUTE_PURE;
# define u8_strcmp u8_strcmp_gnu
#else
extern int
u8_strcmp (const uint8_t *s1, const uint8_t *s2)
_UC_ATTRIBUTE_PURE;
#endif
extern int
u16_strcmp (const uint16_t *s1, const uint16_t *s2)
_UC_ATTRIBUTE_PURE;
extern int
u32_strcmp (const uint32_t *s1, const uint32_t *s2)
_UC_ATTRIBUTE_PURE;
/* Compare S1 and S2 using the collation rules of the current locale.
Return -1 if S1 < S2, 0 if S1 = S2, 1 if S1 > S2.
Upon failure, set errno and return any value. */
/* Similar to strcoll(), wcscoll(). */
extern int
u8_strcoll (const uint8_t *s1, const uint8_t *s2);
extern int
u16_strcoll (const uint16_t *s1, const uint16_t *s2);
extern int
u32_strcoll (const uint32_t *s1, const uint32_t *s2);
/* Compare no more than N units of S1 and S2. */
/* Similar to strncmp(), wcsncmp(). */
extern int
u8_strncmp (const uint8_t *s1, const uint8_t *s2, size_t n)
_UC_ATTRIBUTE_PURE;
extern int
u16_strncmp (const uint16_t *s1, const uint16_t *s2, size_t n)
_UC_ATTRIBUTE_PURE;
extern int
u32_strncmp (const uint32_t *s1, const uint32_t *s2, size_t n)
_UC_ATTRIBUTE_PURE;
/* Duplicate S, returning an identical malloc'd string. */
/* Similar to strdup(), wcsdup(). */
extern uint8_t *
u8_strdup (const uint8_t *s);
extern uint16_t *
u16_strdup (const uint16_t *s);
extern uint32_t *
u32_strdup (const uint32_t *s);
/* Find the first occurrence of UC in STR. */
/* Similar to strchr(), wcschr(). */
extern uint8_t *
u8_strchr (const uint8_t *str, ucs4_t uc)
_UC_ATTRIBUTE_PURE;
extern uint16_t *
u16_strchr (const uint16_t *str, ucs4_t uc)
_UC_ATTRIBUTE_PURE;
extern uint32_t *
u32_strchr (const uint32_t *str, ucs4_t uc)
_UC_ATTRIBUTE_PURE;
/* Find the last occurrence of UC in STR. */
/* Similar to strrchr(), wcsrchr(). */
extern uint8_t *
u8_strrchr (const uint8_t *str, ucs4_t uc)
_UC_ATTRIBUTE_PURE;
extern uint16_t *
u16_strrchr (const uint16_t *str, ucs4_t uc)
_UC_ATTRIBUTE_PURE;
extern uint32_t *
u32_strrchr (const uint32_t *str, ucs4_t uc)
_UC_ATTRIBUTE_PURE;
/* Return the length of the initial segment of STR which consists entirely
of Unicode characters not in REJECT. */
/* Similar to strcspn(), wcscspn(). */
extern size_t
u8_strcspn (const uint8_t *str, const uint8_t *reject)
_UC_ATTRIBUTE_PURE;
extern size_t
u16_strcspn (const uint16_t *str, const uint16_t *reject)
_UC_ATTRIBUTE_PURE;
extern size_t
u32_strcspn (const uint32_t *str, const uint32_t *reject)
_UC_ATTRIBUTE_PURE;
/* Return the length of the initial segment of STR which consists entirely
of Unicode characters in ACCEPT. */
/* Similar to strspn(), wcsspn(). */
extern size_t
u8_strspn (const uint8_t *str, const uint8_t *accept)
_UC_ATTRIBUTE_PURE;
extern size_t
u16_strspn (const uint16_t *str, const uint16_t *accept)
_UC_ATTRIBUTE_PURE;
extern size_t
u32_strspn (const uint32_t *str, const uint32_t *accept)
_UC_ATTRIBUTE_PURE;
/* Find the first occurrence in STR of any character in ACCEPT. */
/* Similar to strpbrk(), wcspbrk(). */
extern uint8_t *
u8_strpbrk (const uint8_t *str, const uint8_t *accept)
_UC_ATTRIBUTE_PURE;
extern uint16_t *
u16_strpbrk (const uint16_t *str, const uint16_t *accept)
_UC_ATTRIBUTE_PURE;
extern uint32_t *
u32_strpbrk (const uint32_t *str, const uint32_t *accept)
_UC_ATTRIBUTE_PURE;
/* Find the first occurrence of NEEDLE in HAYSTACK. */
/* Similar to strstr(), wcsstr(). */
extern uint8_t *
u8_strstr (const uint8_t *haystack, const uint8_t *needle)
_UC_ATTRIBUTE_PURE;
extern uint16_t *
u16_strstr (const uint16_t *haystack, const uint16_t *needle)
_UC_ATTRIBUTE_PURE;
extern uint32_t *
u32_strstr (const uint32_t *haystack, const uint32_t *needle)
_UC_ATTRIBUTE_PURE;
/* Test whether STR starts with PREFIX. */
extern bool
u8_startswith (const uint8_t *str, const uint8_t *prefix)
_UC_ATTRIBUTE_PURE;
extern bool
u16_startswith (const uint16_t *str, const uint16_t *prefix)
_UC_ATTRIBUTE_PURE;
extern bool
u32_startswith (const uint32_t *str, const uint32_t *prefix)
_UC_ATTRIBUTE_PURE;
/* Test whether STR ends with SUFFIX. */
extern bool
u8_endswith (const uint8_t *str, const uint8_t *suffix)
_UC_ATTRIBUTE_PURE;
extern bool
u16_endswith (const uint16_t *str, const uint16_t *suffix)
_UC_ATTRIBUTE_PURE;
extern bool
u32_endswith (const uint32_t *str, const uint32_t *suffix)
_UC_ATTRIBUTE_PURE;
/* Divide STR into tokens separated by characters in DELIM.
This interface is actually more similar to wcstok than to strtok. */
/* Similar to strtok_r(), wcstok(). */
extern uint8_t *
u8_strtok (uint8_t *str, const uint8_t *delim, uint8_t **ptr);
extern uint16_t *
u16_strtok (uint16_t *str, const uint16_t *delim, uint16_t **ptr);
extern uint32_t *
u32_strtok (uint32_t *str, const uint32_t *delim, uint32_t **ptr);
#ifdef __cplusplus
}
#endif
#endif /* _UNISTR_H */

750
Example/Pods/libidn/lib/gl/unistr.in.h generated Normal file
View File

@ -0,0 +1,750 @@
/* Elementary Unicode string functions.
Copyright (C) 2001-2002, 2005-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#ifndef _UNISTR_H
#define _UNISTR_H
#include "unitypes.h"
/* Get common macros for C. */
#include "unused-parameter.h"
/* Get bool. */
#include <stdbool.h>
/* Get size_t. */
#include <stddef.h>
#ifdef __cplusplus
extern "C" {
#endif
/* Conventions:
All functions prefixed with u8_ operate on UTF-8 encoded strings.
Their unit is an uint8_t (1 byte).
All functions prefixed with u16_ operate on UTF-16 encoded strings.
Their unit is an uint16_t (a 2-byte word).
All functions prefixed with u32_ operate on UCS-4 encoded strings.
Their unit is an uint32_t (a 4-byte word).
All argument pairs (s, n) denote a Unicode string s[0..n-1] with exactly
n units.
All arguments starting with "str" and the arguments of functions starting
with u8_str/u16_str/u32_str denote a NUL terminated string, i.e. a string
which terminates at the first NUL unit. This termination unit is
considered part of the string for all memory allocation purposes, but
is not considered part of the string for all other logical purposes.
Functions returning a string result take a (resultbuf, lengthp) argument
pair. If resultbuf is not NULL and the result fits into *lengthp units,
it is put in resultbuf, and resultbuf is returned. Otherwise, a freshly
allocated string is returned. In both cases, *lengthp is set to the
length (number of units) of the returned string. In case of error,
NULL is returned and errno is set. */
/* Elementary string checks. */
/* Check whether an UTF-8 string is well-formed.
Return NULL if valid, or a pointer to the first invalid unit otherwise. */
extern const uint8_t *
u8_check (const uint8_t *s, size_t n)
_UC_ATTRIBUTE_PURE;
/* Check whether an UTF-16 string is well-formed.
Return NULL if valid, or a pointer to the first invalid unit otherwise. */
extern const uint16_t *
u16_check (const uint16_t *s, size_t n)
_UC_ATTRIBUTE_PURE;
/* Check whether an UCS-4 string is well-formed.
Return NULL if valid, or a pointer to the first invalid unit otherwise. */
extern const uint32_t *
u32_check (const uint32_t *s, size_t n)
_UC_ATTRIBUTE_PURE;
/* Elementary string conversions. */
/* Convert an UTF-8 string to an UTF-16 string. */
extern uint16_t *
u8_to_u16 (const uint8_t *s, size_t n, uint16_t *resultbuf,
size_t *lengthp);
/* Convert an UTF-8 string to an UCS-4 string. */
extern uint32_t *
u8_to_u32 (const uint8_t *s, size_t n, uint32_t *resultbuf,
size_t *lengthp);
/* Convert an UTF-16 string to an UTF-8 string. */
extern uint8_t *
u16_to_u8 (const uint16_t *s, size_t n, uint8_t *resultbuf,
size_t *lengthp);
/* Convert an UTF-16 string to an UCS-4 string. */
extern uint32_t *
u16_to_u32 (const uint16_t *s, size_t n, uint32_t *resultbuf,
size_t *lengthp);
/* Convert an UCS-4 string to an UTF-8 string. */
extern uint8_t *
u32_to_u8 (const uint32_t *s, size_t n, uint8_t *resultbuf,
size_t *lengthp);
/* Convert an UCS-4 string to an UTF-16 string. */
extern uint16_t *
u32_to_u16 (const uint32_t *s, size_t n, uint16_t *resultbuf,
size_t *lengthp);
/* Elementary string functions. */
/* Return the length (number of units) of the first character in S, which is
no longer than N. Return 0 if it is the NUL character. Return -1 upon
failure. */
/* Similar to mblen(), except that s must not be NULL. */
extern int
u8_mblen (const uint8_t *s, size_t n)
_UC_ATTRIBUTE_PURE;
extern int
u16_mblen (const uint16_t *s, size_t n)
_UC_ATTRIBUTE_PURE;
extern int
u32_mblen (const uint32_t *s, size_t n)
_UC_ATTRIBUTE_PURE;
/* Return the length (number of units) of the first character in S, putting
its 'ucs4_t' representation in *PUC. Upon failure, *PUC is set to 0xfffd,
and an appropriate number of units is returned.
The number of available units, N, must be > 0. */
/* Similar to mbtowc(), except that puc and s must not be NULL, n must be > 0,
and the NUL character is not treated specially. */
/* The variants with _safe suffix are safe, even if the library is compiled
without --enable-safety. */
#if GNULIB_UNISTR_U8_MBTOUC_UNSAFE || HAVE_LIBUNISTRING
# if !HAVE_INLINE
extern int
u8_mbtouc_unsafe (ucs4_t *puc, const uint8_t *s, size_t n);
# else
extern int
u8_mbtouc_unsafe_aux (ucs4_t *puc, const uint8_t *s, size_t n);
static inline int
u8_mbtouc_unsafe (ucs4_t *puc, const uint8_t *s, size_t n)
{
uint8_t c = *s;
if (c < 0x80)
{
*puc = c;
return 1;
}
else
return u8_mbtouc_unsafe_aux (puc, s, n);
}
# endif
#endif
#if GNULIB_UNISTR_U16_MBTOUC_UNSAFE || HAVE_LIBUNISTRING
# if !HAVE_INLINE
extern int
u16_mbtouc_unsafe (ucs4_t *puc, const uint16_t *s, size_t n);
# else
extern int
u16_mbtouc_unsafe_aux (ucs4_t *puc, const uint16_t *s, size_t n);
static inline int
u16_mbtouc_unsafe (ucs4_t *puc, const uint16_t *s, size_t n)
{
uint16_t c = *s;
if (c < 0xd800 || c >= 0xe000)
{
*puc = c;
return 1;
}
else
return u16_mbtouc_unsafe_aux (puc, s, n);
}
# endif
#endif
#if GNULIB_UNISTR_U32_MBTOUC_UNSAFE || HAVE_LIBUNISTRING
# if !HAVE_INLINE
extern int
u32_mbtouc_unsafe (ucs4_t *puc, const uint32_t *s, size_t n);
# else
static inline int
u32_mbtouc_unsafe (ucs4_t *puc,
const uint32_t *s, size_t n _GL_UNUSED_PARAMETER)
{
uint32_t c = *s;
# if CONFIG_UNICODE_SAFETY
if (c < 0xd800 || (c >= 0xe000 && c < 0x110000))
# endif
*puc = c;
# if CONFIG_UNICODE_SAFETY
else
/* invalid multibyte character */
*puc = 0xfffd;
# endif
return 1;
}
# endif
#endif
#if GNULIB_UNISTR_U8_MBTOUC || HAVE_LIBUNISTRING
# if !HAVE_INLINE
extern int
u8_mbtouc (ucs4_t *puc, const uint8_t *s, size_t n);
# else
extern int
u8_mbtouc_aux (ucs4_t *puc, const uint8_t *s, size_t n);
static inline int
u8_mbtouc (ucs4_t *puc, const uint8_t *s, size_t n)
{
uint8_t c = *s;
if (c < 0x80)
{
*puc = c;
return 1;
}
else
return u8_mbtouc_aux (puc, s, n);
}
# endif
#endif
#if GNULIB_UNISTR_U16_MBTOUC || HAVE_LIBUNISTRING
# if !HAVE_INLINE
extern int
u16_mbtouc (ucs4_t *puc, const uint16_t *s, size_t n);
# else
extern int
u16_mbtouc_aux (ucs4_t *puc, const uint16_t *s, size_t n);
static inline int
u16_mbtouc (ucs4_t *puc, const uint16_t *s, size_t n)
{
uint16_t c = *s;
if (c < 0xd800 || c >= 0xe000)
{
*puc = c;
return 1;
}
else
return u16_mbtouc_aux (puc, s, n);
}
# endif
#endif
#if GNULIB_UNISTR_U32_MBTOUC || HAVE_LIBUNISTRING
# if !HAVE_INLINE
extern int
u32_mbtouc (ucs4_t *puc, const uint32_t *s, size_t n);
# else
static inline int
u32_mbtouc (ucs4_t *puc, const uint32_t *s, size_t n _GL_UNUSED_PARAMETER)
{
uint32_t c = *s;
if (c < 0xd800 || (c >= 0xe000 && c < 0x110000))
*puc = c;
else
/* invalid multibyte character */
*puc = 0xfffd;
return 1;
}
# endif
#endif
/* Return the length (number of units) of the first character in S, putting
its 'ucs4_t' representation in *PUC. Upon failure, *PUC is set to 0xfffd,
and -1 is returned for an invalid sequence of units, -2 is returned for an
incomplete sequence of units.
The number of available units, N, must be > 0. */
/* Similar to u*_mbtouc(), except that the return value gives more details
about the failure, similar to mbrtowc(). */
#if GNULIB_UNISTR_U8_MBTOUCR || HAVE_LIBUNISTRING
extern int
u8_mbtoucr (ucs4_t *puc, const uint8_t *s, size_t n);
#endif
#if GNULIB_UNISTR_U16_MBTOUCR || HAVE_LIBUNISTRING
extern int
u16_mbtoucr (ucs4_t *puc, const uint16_t *s, size_t n);
#endif
#if GNULIB_UNISTR_U32_MBTOUCR || HAVE_LIBUNISTRING
extern int
u32_mbtoucr (ucs4_t *puc, const uint32_t *s, size_t n);
#endif
/* Put the multibyte character represented by UC in S, returning its
length. Return -1 upon failure, -2 if the number of available units, N,
is too small. The latter case cannot occur if N >= 6/2/1, respectively. */
/* Similar to wctomb(), except that s must not be NULL, and the argument n
must be specified. */
#if GNULIB_UNISTR_U8_UCTOMB || HAVE_LIBUNISTRING
/* Auxiliary function, also used by u8_chr, u8_strchr, u8_strrchr. */
extern int
u8_uctomb_aux (uint8_t *s, ucs4_t uc, int n);
# if !HAVE_INLINE
extern int
u8_uctomb (uint8_t *s, ucs4_t uc, int n);
# else
static inline int
u8_uctomb (uint8_t *s, ucs4_t uc, int n)
{
if (uc < 0x80 && n > 0)
{
s[0] = uc;
return 1;
}
else
return u8_uctomb_aux (s, uc, n);
}
# endif
#endif
#if GNULIB_UNISTR_U16_UCTOMB || HAVE_LIBUNISTRING
/* Auxiliary function, also used by u16_chr, u16_strchr, u16_strrchr. */
extern int
u16_uctomb_aux (uint16_t *s, ucs4_t uc, int n);
# if !HAVE_INLINE
extern int
u16_uctomb (uint16_t *s, ucs4_t uc, int n);
# else
static inline int
u16_uctomb (uint16_t *s, ucs4_t uc, int n)
{
if (uc < 0xd800 && n > 0)
{
s[0] = uc;
return 1;
}
else
return u16_uctomb_aux (s, uc, n);
}
# endif
#endif
#if GNULIB_UNISTR_U32_UCTOMB || HAVE_LIBUNISTRING
# if !HAVE_INLINE
extern int
u32_uctomb (uint32_t *s, ucs4_t uc, int n);
# else
static inline int
u32_uctomb (uint32_t *s, ucs4_t uc, int n)
{
if (uc < 0xd800 || (uc >= 0xe000 && uc < 0x110000))
{
if (n > 0)
{
*s = uc;
return 1;
}
else
return -2;
}
else
return -1;
}
# endif
#endif
/* Copy N units from SRC to DEST. */
/* Similar to memcpy(). */
extern uint8_t *
u8_cpy (uint8_t *dest, const uint8_t *src, size_t n);
extern uint16_t *
u16_cpy (uint16_t *dest, const uint16_t *src, size_t n);
extern uint32_t *
u32_cpy (uint32_t *dest, const uint32_t *src, size_t n);
/* Copy N units from SRC to DEST, guaranteeing correct behavior for
overlapping memory areas. */
/* Similar to memmove(). */
extern uint8_t *
u8_move (uint8_t *dest, const uint8_t *src, size_t n);
extern uint16_t *
u16_move (uint16_t *dest, const uint16_t *src, size_t n);
extern uint32_t *
u32_move (uint32_t *dest, const uint32_t *src, size_t n);
/* Set the first N characters of S to UC. UC should be a character that
occupies only 1 unit. */
/* Similar to memset(). */
extern uint8_t *
u8_set (uint8_t *s, ucs4_t uc, size_t n);
extern uint16_t *
u16_set (uint16_t *s, ucs4_t uc, size_t n);
extern uint32_t *
u32_set (uint32_t *s, ucs4_t uc, size_t n);
/* Compare S1 and S2, each of length N. */
/* Similar to memcmp(). */
extern int
u8_cmp (const uint8_t *s1, const uint8_t *s2, size_t n)
_UC_ATTRIBUTE_PURE;
extern int
u16_cmp (const uint16_t *s1, const uint16_t *s2, size_t n)
_UC_ATTRIBUTE_PURE;
extern int
u32_cmp (const uint32_t *s1, const uint32_t *s2, size_t n)
_UC_ATTRIBUTE_PURE;
/* Compare S1 and S2. */
/* Similar to the gnulib function memcmp2(). */
extern int
u8_cmp2 (const uint8_t *s1, size_t n1, const uint8_t *s2, size_t n2)
_UC_ATTRIBUTE_PURE;
extern int
u16_cmp2 (const uint16_t *s1, size_t n1, const uint16_t *s2, size_t n2)
_UC_ATTRIBUTE_PURE;
extern int
u32_cmp2 (const uint32_t *s1, size_t n1, const uint32_t *s2, size_t n2)
_UC_ATTRIBUTE_PURE;
/* Search the string at S for UC. */
/* Similar to memchr(). */
extern uint8_t *
u8_chr (const uint8_t *s, size_t n, ucs4_t uc)
_UC_ATTRIBUTE_PURE;
extern uint16_t *
u16_chr (const uint16_t *s, size_t n, ucs4_t uc)
_UC_ATTRIBUTE_PURE;
extern uint32_t *
u32_chr (const uint32_t *s, size_t n, ucs4_t uc)
_UC_ATTRIBUTE_PURE;
/* Count the number of Unicode characters in the N units from S. */
/* Similar to mbsnlen(). */
extern size_t
u8_mbsnlen (const uint8_t *s, size_t n)
_UC_ATTRIBUTE_PURE;
extern size_t
u16_mbsnlen (const uint16_t *s, size_t n)
_UC_ATTRIBUTE_PURE;
extern size_t
u32_mbsnlen (const uint32_t *s, size_t n)
_UC_ATTRIBUTE_PURE;
/* Elementary string functions with memory allocation. */
/* Make a freshly allocated copy of S, of length N. */
extern uint8_t *
u8_cpy_alloc (const uint8_t *s, size_t n);
extern uint16_t *
u16_cpy_alloc (const uint16_t *s, size_t n);
extern uint32_t *
u32_cpy_alloc (const uint32_t *s, size_t n);
/* Elementary string functions on NUL terminated strings. */
/* Return the length (number of units) of the first character in S.
Return 0 if it is the NUL character. Return -1 upon failure. */
extern int
u8_strmblen (const uint8_t *s)
_UC_ATTRIBUTE_PURE;
extern int
u16_strmblen (const uint16_t *s)
_UC_ATTRIBUTE_PURE;
extern int
u32_strmblen (const uint32_t *s)
_UC_ATTRIBUTE_PURE;
/* Return the length (number of units) of the first character in S, putting
its 'ucs4_t' representation in *PUC. Return 0 if it is the NUL
character. Return -1 upon failure. */
extern int
u8_strmbtouc (ucs4_t *puc, const uint8_t *s);
extern int
u16_strmbtouc (ucs4_t *puc, const uint16_t *s);
extern int
u32_strmbtouc (ucs4_t *puc, const uint32_t *s);
/* Forward iteration step. Advances the pointer past the next character,
or returns NULL if the end of the string has been reached. Puts the
character's 'ucs4_t' representation in *PUC. */
extern const uint8_t *
u8_next (ucs4_t *puc, const uint8_t *s);
extern const uint16_t *
u16_next (ucs4_t *puc, const uint16_t *s);
extern const uint32_t *
u32_next (ucs4_t *puc, const uint32_t *s);
/* Backward iteration step. Advances the pointer to point to the previous
character, or returns NULL if the beginning of the string had been reached.
Puts the character's 'ucs4_t' representation in *PUC. */
extern const uint8_t *
u8_prev (ucs4_t *puc, const uint8_t *s, const uint8_t *start);
extern const uint16_t *
u16_prev (ucs4_t *puc, const uint16_t *s, const uint16_t *start);
extern const uint32_t *
u32_prev (ucs4_t *puc, const uint32_t *s, const uint32_t *start);
/* Return the number of units in S. */
/* Similar to strlen(), wcslen(). */
extern size_t
u8_strlen (const uint8_t *s)
_UC_ATTRIBUTE_PURE;
extern size_t
u16_strlen (const uint16_t *s)
_UC_ATTRIBUTE_PURE;
extern size_t
u32_strlen (const uint32_t *s)
_UC_ATTRIBUTE_PURE;
/* Return the number of units in S, but at most MAXLEN. */
/* Similar to strnlen(), wcsnlen(). */
extern size_t
u8_strnlen (const uint8_t *s, size_t maxlen)
_UC_ATTRIBUTE_PURE;
extern size_t
u16_strnlen (const uint16_t *s, size_t maxlen)
_UC_ATTRIBUTE_PURE;
extern size_t
u32_strnlen (const uint32_t *s, size_t maxlen)
_UC_ATTRIBUTE_PURE;
/* Copy SRC to DEST. */
/* Similar to strcpy(), wcscpy(). */
extern uint8_t *
u8_strcpy (uint8_t *dest, const uint8_t *src);
extern uint16_t *
u16_strcpy (uint16_t *dest, const uint16_t *src);
extern uint32_t *
u32_strcpy (uint32_t *dest, const uint32_t *src);
/* Copy SRC to DEST, returning the address of the terminating NUL in DEST. */
/* Similar to stpcpy(). */
extern uint8_t *
u8_stpcpy (uint8_t *dest, const uint8_t *src);
extern uint16_t *
u16_stpcpy (uint16_t *dest, const uint16_t *src);
extern uint32_t *
u32_stpcpy (uint32_t *dest, const uint32_t *src);
/* Copy no more than N units of SRC to DEST. */
/* Similar to strncpy(), wcsncpy(). */
extern uint8_t *
u8_strncpy (uint8_t *dest, const uint8_t *src, size_t n);
extern uint16_t *
u16_strncpy (uint16_t *dest, const uint16_t *src, size_t n);
extern uint32_t *
u32_strncpy (uint32_t *dest, const uint32_t *src, size_t n);
/* Copy no more than N units of SRC to DEST. Return a pointer past the last
non-NUL unit written into DEST. */
/* Similar to stpncpy(). */
extern uint8_t *
u8_stpncpy (uint8_t *dest, const uint8_t *src, size_t n);
extern uint16_t *
u16_stpncpy (uint16_t *dest, const uint16_t *src, size_t n);
extern uint32_t *
u32_stpncpy (uint32_t *dest, const uint32_t *src, size_t n);
/* Append SRC onto DEST. */
/* Similar to strcat(), wcscat(). */
extern uint8_t *
u8_strcat (uint8_t *dest, const uint8_t *src);
extern uint16_t *
u16_strcat (uint16_t *dest, const uint16_t *src);
extern uint32_t *
u32_strcat (uint32_t *dest, const uint32_t *src);
/* Append no more than N units of SRC onto DEST. */
/* Similar to strncat(), wcsncat(). */
extern uint8_t *
u8_strncat (uint8_t *dest, const uint8_t *src, size_t n);
extern uint16_t *
u16_strncat (uint16_t *dest, const uint16_t *src, size_t n);
extern uint32_t *
u32_strncat (uint32_t *dest, const uint32_t *src, size_t n);
/* Compare S1 and S2. */
/* Similar to strcmp(), wcscmp(). */
#ifdef __sun
/* Avoid a collision with the u8_strcmp() function in Solaris 11 libc. */
extern int
u8_strcmp_gnu (const uint8_t *s1, const uint8_t *s2)
_UC_ATTRIBUTE_PURE;
# define u8_strcmp u8_strcmp_gnu
#else
extern int
u8_strcmp (const uint8_t *s1, const uint8_t *s2)
_UC_ATTRIBUTE_PURE;
#endif
extern int
u16_strcmp (const uint16_t *s1, const uint16_t *s2)
_UC_ATTRIBUTE_PURE;
extern int
u32_strcmp (const uint32_t *s1, const uint32_t *s2)
_UC_ATTRIBUTE_PURE;
/* Compare S1 and S2 using the collation rules of the current locale.
Return -1 if S1 < S2, 0 if S1 = S2, 1 if S1 > S2.
Upon failure, set errno and return any value. */
/* Similar to strcoll(), wcscoll(). */
extern int
u8_strcoll (const uint8_t *s1, const uint8_t *s2);
extern int
u16_strcoll (const uint16_t *s1, const uint16_t *s2);
extern int
u32_strcoll (const uint32_t *s1, const uint32_t *s2);
/* Compare no more than N units of S1 and S2. */
/* Similar to strncmp(), wcsncmp(). */
extern int
u8_strncmp (const uint8_t *s1, const uint8_t *s2, size_t n)
_UC_ATTRIBUTE_PURE;
extern int
u16_strncmp (const uint16_t *s1, const uint16_t *s2, size_t n)
_UC_ATTRIBUTE_PURE;
extern int
u32_strncmp (const uint32_t *s1, const uint32_t *s2, size_t n)
_UC_ATTRIBUTE_PURE;
/* Duplicate S, returning an identical malloc'd string. */
/* Similar to strdup(), wcsdup(). */
extern uint8_t *
u8_strdup (const uint8_t *s);
extern uint16_t *
u16_strdup (const uint16_t *s);
extern uint32_t *
u32_strdup (const uint32_t *s);
/* Find the first occurrence of UC in STR. */
/* Similar to strchr(), wcschr(). */
extern uint8_t *
u8_strchr (const uint8_t *str, ucs4_t uc)
_UC_ATTRIBUTE_PURE;
extern uint16_t *
u16_strchr (const uint16_t *str, ucs4_t uc)
_UC_ATTRIBUTE_PURE;
extern uint32_t *
u32_strchr (const uint32_t *str, ucs4_t uc)
_UC_ATTRIBUTE_PURE;
/* Find the last occurrence of UC in STR. */
/* Similar to strrchr(), wcsrchr(). */
extern uint8_t *
u8_strrchr (const uint8_t *str, ucs4_t uc)
_UC_ATTRIBUTE_PURE;
extern uint16_t *
u16_strrchr (const uint16_t *str, ucs4_t uc)
_UC_ATTRIBUTE_PURE;
extern uint32_t *
u32_strrchr (const uint32_t *str, ucs4_t uc)
_UC_ATTRIBUTE_PURE;
/* Return the length of the initial segment of STR which consists entirely
of Unicode characters not in REJECT. */
/* Similar to strcspn(), wcscspn(). */
extern size_t
u8_strcspn (const uint8_t *str, const uint8_t *reject)
_UC_ATTRIBUTE_PURE;
extern size_t
u16_strcspn (const uint16_t *str, const uint16_t *reject)
_UC_ATTRIBUTE_PURE;
extern size_t
u32_strcspn (const uint32_t *str, const uint32_t *reject)
_UC_ATTRIBUTE_PURE;
/* Return the length of the initial segment of STR which consists entirely
of Unicode characters in ACCEPT. */
/* Similar to strspn(), wcsspn(). */
extern size_t
u8_strspn (const uint8_t *str, const uint8_t *accept)
_UC_ATTRIBUTE_PURE;
extern size_t
u16_strspn (const uint16_t *str, const uint16_t *accept)
_UC_ATTRIBUTE_PURE;
extern size_t
u32_strspn (const uint32_t *str, const uint32_t *accept)
_UC_ATTRIBUTE_PURE;
/* Find the first occurrence in STR of any character in ACCEPT. */
/* Similar to strpbrk(), wcspbrk(). */
extern uint8_t *
u8_strpbrk (const uint8_t *str, const uint8_t *accept)
_UC_ATTRIBUTE_PURE;
extern uint16_t *
u16_strpbrk (const uint16_t *str, const uint16_t *accept)
_UC_ATTRIBUTE_PURE;
extern uint32_t *
u32_strpbrk (const uint32_t *str, const uint32_t *accept)
_UC_ATTRIBUTE_PURE;
/* Find the first occurrence of NEEDLE in HAYSTACK. */
/* Similar to strstr(), wcsstr(). */
extern uint8_t *
u8_strstr (const uint8_t *haystack, const uint8_t *needle)
_UC_ATTRIBUTE_PURE;
extern uint16_t *
u16_strstr (const uint16_t *haystack, const uint16_t *needle)
_UC_ATTRIBUTE_PURE;
extern uint32_t *
u32_strstr (const uint32_t *haystack, const uint32_t *needle)
_UC_ATTRIBUTE_PURE;
/* Test whether STR starts with PREFIX. */
extern bool
u8_startswith (const uint8_t *str, const uint8_t *prefix)
_UC_ATTRIBUTE_PURE;
extern bool
u16_startswith (const uint16_t *str, const uint16_t *prefix)
_UC_ATTRIBUTE_PURE;
extern bool
u32_startswith (const uint32_t *str, const uint32_t *prefix)
_UC_ATTRIBUTE_PURE;
/* Test whether STR ends with SUFFIX. */
extern bool
u8_endswith (const uint8_t *str, const uint8_t *suffix)
_UC_ATTRIBUTE_PURE;
extern bool
u16_endswith (const uint16_t *str, const uint16_t *suffix)
_UC_ATTRIBUTE_PURE;
extern bool
u32_endswith (const uint32_t *str, const uint32_t *suffix)
_UC_ATTRIBUTE_PURE;
/* Divide STR into tokens separated by characters in DELIM.
This interface is actually more similar to wcstok than to strtok. */
/* Similar to strtok_r(), wcstok(). */
extern uint8_t *
u8_strtok (uint8_t *str, const uint8_t *delim, uint8_t **ptr);
extern uint16_t *
u16_strtok (uint16_t *str, const uint16_t *delim, uint16_t **ptr);
extern uint32_t *
u32_strtok (uint32_t *str, const uint32_t *delim, uint32_t **ptr);
#ifdef __cplusplus
}
#endif
#endif /* _UNISTR_H */

View File

@ -0,0 +1,105 @@
/* Check UTF-8 string.
Copyright (C) 2002, 2006-2007, 2009-2015 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This program is free software: you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
/* Specification. */
#include "unistr.h"
const uint8_t *
u8_check (const uint8_t *s, size_t n)
{
const uint8_t *s_end = s + n;
while (s < s_end)
{
/* Keep in sync with unistr.h and u8-mbtouc-aux.c. */
uint8_t c = *s;
if (c < 0x80)
{
s++;
continue;
}
if (c >= 0xc2)
{
if (c < 0xe0)
{
if (s + 2 <= s_end
&& (s[1] ^ 0x80) < 0x40)
{
s += 2;
continue;
}
}
else if (c < 0xf0)
{
if (s + 3 <= s_end
&& (s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40
&& (c >= 0xe1 || s[1] >= 0xa0)
&& (c != 0xed || s[1] < 0xa0))
{
s += 3;
continue;
}
}
else if (c < 0xf8)
{
if (s + 4 <= s_end
&& (s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40
&& (s[3] ^ 0x80) < 0x40
&& (c >= 0xf1 || s[1] >= 0x90)
#if 1
&& (c < 0xf4 || (c == 0xf4 && s[1] < 0x90))
#endif
)
{
s += 4;
continue;
}
}
#if 0
else if (c < 0xfc)
{
if (s + 5 <= s_end
&& (s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40
&& (s[3] ^ 0x80) < 0x40 && (s[4] ^ 0x80) < 0x40
&& (c >= 0xf9 || s[1] >= 0x88))
{
s += 5;
continue;
}
}
else if (c < 0xfe)
{
if (s + 6 <= s_end
&& (s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40
&& (s[3] ^ 0x80) < 0x40 && (s[4] ^ 0x80) < 0x40
&& (s[5] ^ 0x80) < 0x40
&& (c >= 0xfd || s[1] >= 0x84))
{
s += 6;
continue;
}
}
#endif
}
/* invalid or incomplete multibyte character */
return s;
}
return NULL;
}

View File

@ -0,0 +1,285 @@
/* Look at first character in UTF-8 string, returning an error code.
Copyright (C) 1999-2002, 2006-2007, 2009-2015 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2001.
This program is free software: you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
/* Specification. */
#include "unistr.h"
int
u8_mbtoucr (ucs4_t *puc, const uint8_t *s, size_t n)
{
uint8_t c = *s;
if (c < 0x80)
{
*puc = c;
return 1;
}
else if (c >= 0xc2)
{
if (c < 0xe0)
{
if (n >= 2)
{
if ((s[1] ^ 0x80) < 0x40)
{
*puc = ((unsigned int) (c & 0x1f) << 6)
| (unsigned int) (s[1] ^ 0x80);
return 2;
}
/* invalid multibyte character */
}
else
{
/* incomplete multibyte character */
*puc = 0xfffd;
return -2;
}
}
else if (c < 0xf0)
{
if (n >= 2)
{
if ((s[1] ^ 0x80) < 0x40
&& (c >= 0xe1 || s[1] >= 0xa0)
&& (c != 0xed || s[1] < 0xa0))
{
if (n >= 3)
{
if ((s[2] ^ 0x80) < 0x40)
{
*puc = ((unsigned int) (c & 0x0f) << 12)
| ((unsigned int) (s[1] ^ 0x80) << 6)
| (unsigned int) (s[2] ^ 0x80);
return 3;
}
/* invalid multibyte character */
}
else
{
/* incomplete multibyte character */
*puc = 0xfffd;
return -2;
}
}
/* invalid multibyte character */
}
else
{
/* incomplete multibyte character */
*puc = 0xfffd;
return -2;
}
}
else if (c < 0xf8)
{
if (n >= 2)
{
if ((s[1] ^ 0x80) < 0x40
&& (c >= 0xf1 || s[1] >= 0x90)
#if 1
&& (c < 0xf4 || (c == 0xf4 && s[1] < 0x90))
#endif
)
{
if (n >= 3)
{
if ((s[2] ^ 0x80) < 0x40)
{
if (n >= 4)
{
if ((s[3] ^ 0x80) < 0x40)
{
*puc = ((unsigned int) (c & 0x07) << 18)
| ((unsigned int) (s[1] ^ 0x80) << 12)
| ((unsigned int) (s[2] ^ 0x80) << 6)
| (unsigned int) (s[3] ^ 0x80);
return 4;
}
/* invalid multibyte character */
}
else
{
/* incomplete multibyte character */
*puc = 0xfffd;
return -2;
}
}
/* invalid multibyte character */
}
else
{
/* incomplete multibyte character */
*puc = 0xfffd;
return -2;
}
}
/* invalid multibyte character */
}
else
{
/* incomplete multibyte character */
*puc = 0xfffd;
return -2;
}
}
#if 0
else if (c < 0xfc)
{
if (n >= 2)
{
if ((s[1] ^ 0x80) < 0x40
&& (c >= 0xf9 || s[1] >= 0x88))
{
if (n >= 3)
{
if ((s[2] ^ 0x80) < 0x40)
{
if (n >= 4)
{
if ((s[3] ^ 0x80) < 0x40)
{
if (n >= 5)
{
if ((s[4] ^ 0x80) < 0x40)
{
*puc = ((unsigned int) (c & 0x03) << 24)
| ((unsigned int) (s[1] ^ 0x80) << 18)
| ((unsigned int) (s[2] ^ 0x80) << 12)
| ((unsigned int) (s[3] ^ 0x80) << 6)
| (unsigned int) (s[4] ^ 0x80);
return 5;
}
/* invalid multibyte character */
}
else
{
/* incomplete multibyte character */
*puc = 0xfffd;
return -2;
}
}
/* invalid multibyte character */
}
else
{
/* incomplete multibyte character */
*puc = 0xfffd;
return -2;
}
}
/* invalid multibyte character */
}
else
{
/* incomplete multibyte character */
*puc = 0xfffd;
return -2;
}
}
/* invalid multibyte character */
}
else
{
/* incomplete multibyte character */
*puc = 0xfffd;
return -2;
}
}
else if (c < 0xfe)
{
if (n >= 2)
{
if ((s[1] ^ 0x80) < 0x40
&& (c >= 0xfd || s[1] >= 0x84))
{
if (n >= 3)
{
if ((s[2] ^ 0x80) < 0x40)
{
if (n >= 4)
{
if ((s[3] ^ 0x80) < 0x40)
{
if (n >= 5)
{
if ((s[4] ^ 0x80) < 0x40)
{
if (n >= 6)
{
if ((s[5] ^ 0x80) < 0x40)
{
*puc = ((unsigned int) (c & 0x01) << 30)
| ((unsigned int) (s[1] ^ 0x80) << 24)
| ((unsigned int) (s[2] ^ 0x80) << 18)
| ((unsigned int) (s[3] ^ 0x80) << 12)
| ((unsigned int) (s[4] ^ 0x80) << 6)
| (unsigned int) (s[5] ^ 0x80);
return 6;
}
/* invalid multibyte character */
}
else
{
/* incomplete multibyte character */
*puc = 0xfffd;
return -2;
}
}
/* invalid multibyte character */
}
else
{
/* incomplete multibyte character */
*puc = 0xfffd;
return -2;
}
}
/* invalid multibyte character */
}
else
{
/* incomplete multibyte character */
*puc = 0xfffd;
return -2;
}
}
/* invalid multibyte character */
}
else
{
/* incomplete multibyte character */
*puc = 0xfffd;
return -2;
}
}
/* invalid multibyte character */
}
else
{
/* incomplete multibyte character */
*puc = 0xfffd;
return -2;
}
}
#endif
}
/* invalid multibyte character */
*puc = 0xfffd;
return -1;
}

View File

@ -0,0 +1,69 @@
/* Conversion UCS-4 to UTF-8.
Copyright (C) 2002, 2006-2007, 2009-2015 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This program is free software: you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
/* Specification. */
#include "unistr.h"
int
u8_uctomb_aux (uint8_t *s, ucs4_t uc, int n)
{
int count;
if (uc < 0x80)
/* The case n >= 1 is already handled by the caller. */
return -2;
else if (uc < 0x800)
count = 2;
else if (uc < 0x10000)
{
if (uc < 0xd800 || uc >= 0xe000)
count = 3;
else
return -1;
}
#if 0
else if (uc < 0x200000)
count = 4;
else if (uc < 0x4000000)
count = 5;
else if (uc <= 0x7fffffff)
count = 6;
#else
else if (uc < 0x110000)
count = 4;
#endif
else
return -1;
if (n < count)
return -2;
switch (count) /* note: code falls through cases! */
{
#if 0
case 6: s[5] = 0x80 | (uc & 0x3f); uc = uc >> 6; uc |= 0x4000000;
case 5: s[4] = 0x80 | (uc & 0x3f); uc = uc >> 6; uc |= 0x200000;
#endif
case 4: s[3] = 0x80 | (uc & 0x3f); uc = uc >> 6; uc |= 0x10000;
case 3: s[2] = 0x80 | (uc & 0x3f); uc = uc >> 6; uc |= 0x800;
case 2: s[1] = 0x80 | (uc & 0x3f); uc = uc >> 6; uc |= 0xc0;
/*case 1:*/ s[0] = uc;
}
return count;
}

View File

@ -0,0 +1,88 @@
/* Store a character in UTF-8 string.
Copyright (C) 2002, 2005-2006, 2009-2015 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This program is free software: you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
#if defined IN_LIBUNISTRING
/* Tell unistr.h to declare u8_uctomb as 'extern', not 'static inline'. */
# include "unistring-notinline.h"
#endif
/* Specification. */
#include "unistr.h"
#if !HAVE_INLINE
int
u8_uctomb (uint8_t *s, ucs4_t uc, int n)
{
if (uc < 0x80)
{
if (n > 0)
{
s[0] = uc;
return 1;
}
/* else return -2, below. */
}
else
{
int count;
if (uc < 0x800)
count = 2;
else if (uc < 0x10000)
{
if (uc < 0xd800 || uc >= 0xe000)
count = 3;
else
return -1;
}
#if 0
else if (uc < 0x200000)
count = 4;
else if (uc < 0x4000000)
count = 5;
else if (uc <= 0x7fffffff)
count = 6;
#else
else if (uc < 0x110000)
count = 4;
#endif
else
return -1;
if (n >= count)
{
switch (count) /* note: code falls through cases! */
{
#if 0
case 6: s[5] = 0x80 | (uc & 0x3f); uc = uc >> 6; uc |= 0x4000000;
case 5: s[4] = 0x80 | (uc & 0x3f); uc = uc >> 6; uc |= 0x200000;
#endif
case 4: s[3] = 0x80 | (uc & 0x3f); uc = uc >> 6; uc |= 0x10000;
case 3: s[2] = 0x80 | (uc & 0x3f); uc = uc >> 6; uc |= 0x800;
case 2: s[1] = 0x80 | (uc & 0x3f); uc = uc >> 6; uc |= 0xc0;
/*case 1:*/ s[0] = uc;
}
return count;
}
}
return -2;
}
#endif

46
Example/Pods/libidn/lib/gl/unitypes.h generated Normal file
View File

@ -0,0 +1,46 @@
/* Elementary types and macros for the GNU UniString library.
Copyright (C) 2002, 2005-2006, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#ifndef _UNITYPES_H
#define _UNITYPES_H
/* Get uint8_t, uint16_t, uint32_t. */
#include <stdint.h>
/* Type representing a Unicode character. */
typedef uint32_t ucs4_t;
/* Attribute of a function whose result depends only on the arguments
(not pointers!) and which has no side effects. */
#ifndef _UC_ATTRIBUTE_CONST
# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)
# define _UC_ATTRIBUTE_CONST __attribute__ ((__const__))
# else
# define _UC_ATTRIBUTE_CONST
# endif
#endif
/* Attribute of a function whose result depends only on the arguments
(possibly pointers) and global memory, and which has no side effects. */
#ifndef _UC_ATTRIBUTE_PURE
# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
# define _UC_ATTRIBUTE_PURE __attribute__ ((__pure__))
# else
# define _UC_ATTRIBUTE_PURE
# endif
#endif
#endif /* _UNITYPES_H */

46
Example/Pods/libidn/lib/gl/unitypes.in.h generated Normal file
View File

@ -0,0 +1,46 @@
/* Elementary types and macros for the GNU UniString library.
Copyright (C) 2002, 2005-2006, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#ifndef _UNITYPES_H
#define _UNITYPES_H
/* Get uint8_t, uint16_t, uint32_t. */
#include <stdint.h>
/* Type representing a Unicode character. */
typedef uint32_t ucs4_t;
/* Attribute of a function whose result depends only on the arguments
(not pointers!) and which has no side effects. */
#ifndef _UC_ATTRIBUTE_CONST
# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)
# define _UC_ATTRIBUTE_CONST __attribute__ ((__const__))
# else
# define _UC_ATTRIBUTE_CONST
# endif
#endif
/* Attribute of a function whose result depends only on the arguments
(possibly pointers) and global memory, and which has no side effects. */
#ifndef _UC_ATTRIBUTE_PURE
# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
# define _UC_ATTRIBUTE_PURE __attribute__ ((__pure__))
# else
# define _UC_ATTRIBUTE_PURE
# endif
#endif
#endif /* _UNITYPES_H */

9354
Example/Pods/libidn/lib/gunibreak.h generated Normal file

File diff suppressed because it is too large Load Diff

662
Example/Pods/libidn/lib/gunicomp.h generated Normal file
View File

@ -0,0 +1,662 @@
/* This file is automatically generated. DO NOT EDIT!
Instead, edit gen-unicode-tables.pl and re-run.
Note that gen-unicode-tables.pl doesn't work with Perl 5.10 or later.. */
#define COMPOSE_FIRST_START 1
#define COMPOSE_FIRST_SINGLE_START 147
#define COMPOSE_SECOND_START 357
#define COMPOSE_SECOND_SINGLE_START 388
#define COMPOSE_TABLE_LAST 48
static const guint16 compose_data[][256] = {
{ /* page 0, index 0 */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 147, 148, 149, 0, 0, 1, 2, 3, 4, 5,
150, 6, 7, 8, 151, 9, 10, 11, 12, 13, 14, 0, 15, 16, 17, 18, 19, 20, 21,
22, 23, 0, 0, 0, 0, 0, 0, 24, 25, 26, 27, 28, 152, 29, 30, 31, 32, 33,
34, 35, 36, 37, 38, 0, 39, 40, 41, 42, 43, 44, 45, 46, 47, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 48, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 49, 0, 153, 154,
50, 155, 0, 0, 51, 0, 0, 0, 0, 156, 0, 0, 0, 0, 52, 53, 157, 0, 158, 0,
0, 0, 54, 0, 0, 0, 0, 0, 55, 0, 159, 160, 56, 161, 0, 0, 57, 0, 0, 0, 0,
162, 0, 0, 0, 0, 58,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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 106, 107, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 232, 233, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 234, 235, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
},
{ /* page 31, index 12 */
108, 109, 236, 237, 238, 239, 240, 241, 110, 111, 242, 243, 244, 245,
246, 247, 112, 113, 0, 0, 0, 0, 0, 0, 114, 115, 0, 0, 0, 0, 0, 0, 116,
117, 248, 249, 250, 251, 252, 253, 118, 119, 254, 255, 256, 257, 258,
259, 120, 121, 0, 0, 0, 0, 0, 0, 122, 123, 0, 0, 0, 0, 0, 0, 124, 125, 0,
0, 0, 0, 0, 0, 126, 127, 0, 0, 0, 0, 0, 0, 128, 129, 0, 0, 0, 0, 0, 0, 0,
130, 0, 0, 0, 0, 0, 0, 131, 132, 260, 261, 262, 263, 264, 265, 133, 134,
266, 267, 268, 269, 270, 271, 272, 0, 0, 0, 273, 0, 0, 0, 0, 0, 0, 0,
274, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 275, 0, 0,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, 325, 0, 326, 0, 327, 0,
328, 0, 329, 0, 330, 0, 331, 0, 0, 332, 0, 333, 0, 334, 0, 0, 0, 0, 0, 0,
137, 0, 0, 138, 0, 0, 139, 0, 0, 140, 0, 0, 141, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 386, 387,
0, 0, 335, 0, 0, 0, 0, 0, 0, 0, 0, 336, 0, 0, 0, 0, 337, 0, 338, 0, 339,
0, 340, 0, 341, 0, 342, 0, 343, 0, 344, 0, 345, 0, 346, 0, 347, 0, 348,
0, 0, 349, 0, 350, 0, 351, 0, 0, 0, 0, 0, 0, 142, 0, 0, 143, 0, 0, 144,
0, 0, 145, 0, 0, 146, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 352, 353, 354, 355, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 356, 0, 0
}
};
static const gint16 compose_table[COMPOSE_TABLE_LAST + 1] = {
0 /* page 0 */,
1 /* page 1 */,
2 /* page 2 */,
3 /* page 3 */,
4 /* page 4 */,
0 + G_UNICODE_MAX_TABLE_INDEX,
5 /* page 6 */,
0 + G_UNICODE_MAX_TABLE_INDEX,
0 + G_UNICODE_MAX_TABLE_INDEX,
6 /* page 9 */,
0 + G_UNICODE_MAX_TABLE_INDEX,
7 /* page 11 */,
8 /* page 12 */,
9 /* page 13 */,
0 + G_UNICODE_MAX_TABLE_INDEX,
0 + G_UNICODE_MAX_TABLE_INDEX,
10 /* page 16 */,
0 + G_UNICODE_MAX_TABLE_INDEX,
0 + G_UNICODE_MAX_TABLE_INDEX,
0 + G_UNICODE_MAX_TABLE_INDEX,
0 + G_UNICODE_MAX_TABLE_INDEX,
0 + G_UNICODE_MAX_TABLE_INDEX,
0 + G_UNICODE_MAX_TABLE_INDEX,
0 + G_UNICODE_MAX_TABLE_INDEX,
0 + G_UNICODE_MAX_TABLE_INDEX,
0 + G_UNICODE_MAX_TABLE_INDEX,
0 + G_UNICODE_MAX_TABLE_INDEX,
0 + G_UNICODE_MAX_TABLE_INDEX,
0 + G_UNICODE_MAX_TABLE_INDEX,
0 + G_UNICODE_MAX_TABLE_INDEX,
11 /* page 30 */,
12 /* page 31 */,
0 + G_UNICODE_MAX_TABLE_INDEX,
13 /* page 33 */,
14 /* page 34 */,
0 + G_UNICODE_MAX_TABLE_INDEX,
0 + G_UNICODE_MAX_TABLE_INDEX,
0 + G_UNICODE_MAX_TABLE_INDEX,
0 + G_UNICODE_MAX_TABLE_INDEX,
0 + G_UNICODE_MAX_TABLE_INDEX,
0 + G_UNICODE_MAX_TABLE_INDEX,
0 + G_UNICODE_MAX_TABLE_INDEX,
0 + G_UNICODE_MAX_TABLE_INDEX,
0 + G_UNICODE_MAX_TABLE_INDEX,
0 + G_UNICODE_MAX_TABLE_INDEX,
0 + G_UNICODE_MAX_TABLE_INDEX,
0 + G_UNICODE_MAX_TABLE_INDEX,
0 + G_UNICODE_MAX_TABLE_INDEX,
15 /* page 48 */
};
static const guint16 compose_first_single[][2] = {
{ 0x0338, 0x226e },
{ 0x0338, 0x2260 },
{ 0x0338, 0x226f },
{ 0x0307, 0x1e1e },
{ 0x0302, 0x0134 },
{ 0x0307, 0x1e1f },
{ 0x0304, 0x01de },
{ 0x0301, 0x01fa },
{ 0x0301, 0x1e08 },
{ 0x0301, 0x1e2e },
{ 0x0304, 0x022a },
{ 0x0301, 0x01fe },
{ 0x0304, 0x01df },
{ 0x0301, 0x01fb },
{ 0x0301, 0x1e09 },
{ 0x0301, 0x1e2f },
{ 0x0304, 0x022b },
{ 0x0301, 0x01ff },
{ 0x0307, 0x1e64 },
{ 0x0307, 0x1e65 },
{ 0x0307, 0x1e66 },
{ 0x0307, 0x1e67 },
{ 0x0301, 0x1e78 },
{ 0x0301, 0x1e79 },
{ 0x0308, 0x1e7a },
{ 0x0308, 0x1e7b },
{ 0x0307, 0x1e9b },
{ 0x030c, 0x01ee },
{ 0x0304, 0x01ec },
{ 0x0304, 0x01ed },
{ 0x0304, 0x01e0 },
{ 0x0304, 0x01e1 },
{ 0x0306, 0x1e1c },
{ 0x0306, 0x1e1d },
{ 0x0304, 0x0230 },
{ 0x0304, 0x0231 },
{ 0x030c, 0x01ef },
{ 0x0314, 0x1fec },
{ 0x0345, 0x1fb4 },
{ 0x0345, 0x1fc4 },
{ 0x0345, 0x1ff4 },
{ 0x0308, 0x0407 },
{ 0x0301, 0x0403 },
{ 0x0308, 0x04de },
{ 0x0301, 0x040c },
{ 0x0308, 0x04e6 },
{ 0x0308, 0x04f4 },
{ 0x0308, 0x04f8 },
{ 0x0308, 0x04ec },
{ 0x0301, 0x0453 },
{ 0x0308, 0x04df },
{ 0x0301, 0x045c },
{ 0x0308, 0x04e7 },
{ 0x0308, 0x04f5 },
{ 0x0308, 0x04f9 },
{ 0x0308, 0x04ed },
{ 0x0308, 0x0457 },
{ 0x030f, 0x0476 },
{ 0x030f, 0x0477 },
{ 0x0308, 0x04da },
{ 0x0308, 0x04db },
{ 0x0308, 0x04ea },
{ 0x0308, 0x04eb },
{ 0x0654, 0x0624 },
{ 0x0654, 0x0626 },
{ 0x0654, 0x06c2 },
{ 0x0654, 0x06d3 },
{ 0x0654, 0x06c0 },
{ 0x093c, 0x0929 },
{ 0x093c, 0x0931 },
{ 0x093c, 0x0934 },
{ 0x0bd7, 0x0b94 },
{ 0x0bbe, 0x0bcb },
{ 0x0c56, 0x0c48 },
{ 0x0cd5, 0x0cc0 },
{ 0x0cd5, 0x0ccb },
{ 0x0d3e, 0x0d4b },
{ 0x0dca, 0x0ddd },
{ 0x102e, 0x1026 },
{ 0x0304, 0x1e38 },
{ 0x0304, 0x1e39 },
{ 0x0304, 0x1e5c },
{ 0x0304, 0x1e5d },
{ 0x0307, 0x1e68 },
{ 0x0307, 0x1e69 },
{ 0x0302, 0x1ec6 },
{ 0x0302, 0x1ec7 },
{ 0x0302, 0x1ed8 },
{ 0x0302, 0x1ed9 },
{ 0x0345, 0x1f82 },
{ 0x0345, 0x1f83 },
{ 0x0345, 0x1f84 },
{ 0x0345, 0x1f85 },
{ 0x0345, 0x1f86 },
{ 0x0345, 0x1f87 },
{ 0x0345, 0x1f8a },
{ 0x0345, 0x1f8b },
{ 0x0345, 0x1f8c },
{ 0x0345, 0x1f8d },
{ 0x0345, 0x1f8e },
{ 0x0345, 0x1f8f },
{ 0x0345, 0x1f92 },
{ 0x0345, 0x1f93 },
{ 0x0345, 0x1f94 },
{ 0x0345, 0x1f95 },
{ 0x0345, 0x1f96 },
{ 0x0345, 0x1f97 },
{ 0x0345, 0x1f9a },
{ 0x0345, 0x1f9b },
{ 0x0345, 0x1f9c },
{ 0x0345, 0x1f9d },
{ 0x0345, 0x1f9e },
{ 0x0345, 0x1f9f },
{ 0x0345, 0x1fa2 },
{ 0x0345, 0x1fa3 },
{ 0x0345, 0x1fa4 },
{ 0x0345, 0x1fa5 },
{ 0x0345, 0x1fa6 },
{ 0x0345, 0x1fa7 },
{ 0x0345, 0x1faa },
{ 0x0345, 0x1fab },
{ 0x0345, 0x1fac },
{ 0x0345, 0x1fad },
{ 0x0345, 0x1fae },
{ 0x0345, 0x1faf },
{ 0x0345, 0x1fb2 },
{ 0x0345, 0x1fc2 },
{ 0x0345, 0x1ff2 },
{ 0x0345, 0x1fb7 },
{ 0x0345, 0x1fc7 },
{ 0x0345, 0x1ff7 },
{ 0x0338, 0x219a },
{ 0x0338, 0x219b },
{ 0x0338, 0x21ae },
{ 0x0338, 0x21cd },
{ 0x0338, 0x21cf },
{ 0x0338, 0x21ce },
{ 0x0338, 0x2204 },
{ 0x0338, 0x2209 },
{ 0x0338, 0x220c },
{ 0x0338, 0x2224 },
{ 0x0338, 0x2226 },
{ 0x0338, 0x2241 },
{ 0x0338, 0x2244 },
{ 0x0338, 0x2247 },
{ 0x0338, 0x2249 },
{ 0x0338, 0x226d },
{ 0x0338, 0x2262 },
{ 0x0338, 0x2270 },
{ 0x0338, 0x2271 },
{ 0x0338, 0x2274 },
{ 0x0338, 0x2275 },
{ 0x0338, 0x2278 },
{ 0x0338, 0x2279 },
{ 0x0338, 0x2280 },
{ 0x0338, 0x2281 },
{ 0x0338, 0x22e0 },
{ 0x0338, 0x22e1 },
{ 0x0338, 0x2284 },
{ 0x0338, 0x2285 },
{ 0x0338, 0x2288 },
{ 0x0338, 0x2289 },
{ 0x0338, 0x22e2 },
{ 0x0338, 0x22e3 },
{ 0x0338, 0x22ac },
{ 0x0338, 0x22ad },
{ 0x0338, 0x22ae },
{ 0x0338, 0x22af },
{ 0x0338, 0x22ea },
{ 0x0338, 0x22eb },
{ 0x0338, 0x22ec },
{ 0x0338, 0x22ed },
{ 0x3099, 0x3094 },
{ 0x3099, 0x304c },
{ 0x3099, 0x304e },
{ 0x3099, 0x3050 },
{ 0x3099, 0x3052 },
{ 0x3099, 0x3054 },
{ 0x3099, 0x3056 },
{ 0x3099, 0x3058 },
{ 0x3099, 0x305a },
{ 0x3099, 0x305c },
{ 0x3099, 0x305e },
{ 0x3099, 0x3060 },
{ 0x3099, 0x3062 },
{ 0x3099, 0x3065 },
{ 0x3099, 0x3067 },
{ 0x3099, 0x3069 },
{ 0x3099, 0x309e },
{ 0x3099, 0x30f4 },
{ 0x3099, 0x30ac },
{ 0x3099, 0x30ae },
{ 0x3099, 0x30b0 },
{ 0x3099, 0x30b2 },
{ 0x3099, 0x30b4 },
{ 0x3099, 0x30b6 },
{ 0x3099, 0x30b8 },
{ 0x3099, 0x30ba },
{ 0x3099, 0x30bc },
{ 0x3099, 0x30be },
{ 0x3099, 0x30c0 },
{ 0x3099, 0x30c2 },
{ 0x3099, 0x30c5 },
{ 0x3099, 0x30c7 },
{ 0x3099, 0x30c9 },
{ 0x3099, 0x30f7 },
{ 0x3099, 0x30f8 },
{ 0x3099, 0x30f9 },
{ 0x3099, 0x30fa },
{ 0x3099, 0x30fe }
};
static const guint16 compose_second_single[][2] = {
{ 0x0627, 0x0622 },
{ 0x0627, 0x0623 },
{ 0x0627, 0x0625 },
{ 0x09c7, 0x09cb },
{ 0x09c7, 0x09cc },
{ 0x0b47, 0x0b4b },
{ 0x0b47, 0x0b48 },
{ 0x0b47, 0x0b4c },
{ 0x0bc6, 0x0bca },
{ 0x0bc6, 0x0bcc },
{ 0x0cc6, 0x0cca },
{ 0x0cc6, 0x0cc7 },
{ 0x0cc6, 0x0cc8 },
{ 0x0d46, 0x0d4a },
{ 0x0d46, 0x0d4c },
{ 0x0dd9, 0x0dda },
{ 0x0dd9, 0x0ddc },
{ 0x0dd9, 0x0dde }
};
static const guint16 compose_array[146][31] = {
{ 0x00c0, 0x00c1, 0x00c2, 0x00c3, 0x0100, 0x0102, 0x0226, 0x00c4, 0x1ea2, 0x00c5, 0, 0x01cd, 0x0200, 0x0202, 0, 0, 0, 0x1ea0, 0, 0x1e00, 0, 0, 0x0104, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, 0x1e02, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x1e04, 0, 0, 0, 0, 0, 0, 0, 0, 0x1e06, 0, 0, 0, 0 },
{ 0, 0x0106, 0x0108, 0, 0, 0, 0x010a, 0, 0, 0, 0, 0x010c, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x00c7, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, 0x1e0a, 0, 0, 0, 0, 0x010e, 0, 0, 0, 0, 0, 0x1e0c, 0, 0, 0, 0x1e10, 0, 0x1e12, 0, 0, 0x1e0e, 0, 0, 0, 0 },
{ 0x00c8, 0x00c9, 0x00ca, 0x1ebc, 0x0112, 0x0114, 0x0116, 0x00cb, 0x1eba, 0, 0, 0x011a, 0x0204, 0x0206, 0, 0, 0, 0x1eb8, 0, 0, 0, 0x0228, 0x0118, 0x1e18, 0, 0x1e1a, 0, 0, 0, 0, 0 },
{ 0, 0x01f4, 0x011c, 0, 0x1e20, 0x011e, 0x0120, 0, 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 0, 0, 0, 0, 0x3073, 0x3074 },
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x3076, 0x3077 },
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x3079, 0x307a },
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x307c, 0x307d },
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x30d0, 0x30d1 },
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x30d3, 0x30d4 },
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x30d6, 0x30d7 },
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x30d9, 0x30da },
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x30dc, 0x30dd }
};

10364
Example/Pods/libidn/lib/gunidecomp.h generated Normal file

File diff suppressed because it is too large Load Diff

1
Example/Pods/libidn/lib/idn-int.h generated Normal file
View File

@ -0,0 +1 @@
#include <stdint.h>

873
Example/Pods/libidn/lib/idna.c generated Normal file
View File

@ -0,0 +1,873 @@
/* idna.c --- Prototypes for Internationalized Domain Name library.
Copyright (C) 2002-2015 Simon Josefsson
This file is part of GNU Libidn.
GNU Libidn is free software: you can redistribute it and/or
modify it under the terms of either:
* the GNU Lesser General Public License as published by the Free
Software Foundation; either version 3 of the License, or (at
your option) any later version.
or
* the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at
your option) any later version.
or both in parallel, as here.
GNU Libidn is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received copies of the GNU General Public License and
the GNU Lesser General Public License along with this program. If
not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <stdlib.h>
#include <string.h>
#include <stringprep.h>
#include <punycode.h>
#include "idna.h"
/* Get c_strcasecmp. */
#include <c-strcase.h>
#define DOTP(c) ((c) == 0x002E || (c) == 0x3002 || \
(c) == 0xFF0E || (c) == 0xFF61)
/* Core functions */
/**
* idna_to_ascii_4i:
* @in: input array with unicode code points.
* @inlen: length of input array with unicode code points.
* @out: output zero terminated string that must have room for at
* least 63 characters plus the terminating zero.
* @flags: an #Idna_flags value, e.g., %IDNA_ALLOW_UNASSIGNED or
* %IDNA_USE_STD3_ASCII_RULES.
*
* The ToASCII operation takes a sequence of Unicode code points that
* make up one domain label and transforms it into a sequence of code
* points in the ASCII range (0..7F). If ToASCII succeeds, the
* original sequence and the resulting sequence are equivalent labels.
*
* It is important to note that the ToASCII operation can fail. ToASCII
* fails if any step of it fails. If any step of the ToASCII operation
* fails on any label in a domain name, that domain name MUST NOT be used
* as an internationalized domain name. The method for deadling with this
* failure is application-specific.
*
* The inputs to ToASCII are a sequence of code points, the AllowUnassigned
* flag, and the UseSTD3ASCIIRules flag. The output of ToASCII is either a
* sequence of ASCII code points or a failure condition.
*
* ToASCII never alters a sequence of code points that are all in the ASCII
* range to begin with (although it could fail). Applying the ToASCII
* operation multiple times has exactly the same effect as applying it just
* once.
*
* Return value: Returns 0 on success, or an #Idna_rc error code.
*/
int
idna_to_ascii_4i (const uint32_t * in, size_t inlen, char *out, int flags)
{
size_t len, outlen;
uint32_t *src; /* XXX don't need to copy data? */
int rc;
/*
* ToASCII consists of the following steps:
*
* 1. If all code points in the sequence are in the ASCII range (0..7F)
* then skip to step 3.
*/
{
size_t i;
int inasciirange;
inasciirange = 1;
for (i = 0; i < inlen; i++)
if (in[i] > 0x7F)
inasciirange = 0;
if (inasciirange)
{
src = malloc (sizeof (in[0]) * (inlen + 1));
if (src == NULL)
return IDNA_MALLOC_ERROR;
memcpy (src, in, sizeof (in[0]) * inlen);
src[inlen] = 0;
goto step3;
}
}
/*
* 2. Perform the steps specified in [NAMEPREP] and fail if there is
* an error. The AllowUnassigned flag is used in [NAMEPREP].
*/
{
char *p;
p = stringprep_ucs4_to_utf8 (in, (ssize_t) inlen, NULL, NULL);
if (p == NULL)
return IDNA_MALLOC_ERROR;
len = strlen (p);
do
{
char *newp;
len = 2 * len + 10; /* XXX better guess? */
newp = realloc (p, len);
if (newp == NULL)
{
free (p);
return IDNA_MALLOC_ERROR;
}
p = newp;
if (flags & IDNA_ALLOW_UNASSIGNED)
rc = stringprep_nameprep (p, len);
else
rc = stringprep_nameprep_no_unassigned (p, len);
}
while (rc == STRINGPREP_TOO_SMALL_BUFFER);
if (rc != STRINGPREP_OK)
{
free (p);
return IDNA_STRINGPREP_ERROR;
}
src = stringprep_utf8_to_ucs4 (p, -1, NULL);
free (p);
if (!src)
return IDNA_MALLOC_ERROR;
}
step3:
/*
* 3. If the UseSTD3ASCIIRules flag is set, then perform these checks:
*
* (a) Verify the absence of non-LDH ASCII code points; that is,
* the absence of 0..2C, 2E..2F, 3A..40, 5B..60, and 7B..7F.
*
* (b) Verify the absence of leading and trailing hyphen-minus;
* that is, the absence of U+002D at the beginning and end of
* the sequence.
*/
if (flags & IDNA_USE_STD3_ASCII_RULES)
{
size_t i;
for (i = 0; src[i]; i++)
if (src[i] <= 0x2C || src[i] == 0x2E || src[i] == 0x2F ||
(src[i] >= 0x3A && src[i] <= 0x40) ||
(src[i] >= 0x5B && src[i] <= 0x60) ||
(src[i] >= 0x7B && src[i] <= 0x7F))
{
free (src);
return IDNA_CONTAINS_NON_LDH;
}
if (src[0] == 0x002D || (i > 0 && src[i - 1] == 0x002D))
{
free (src);
return IDNA_CONTAINS_MINUS;
}
}
/*
* 4. If all code points in the sequence are in the ASCII range
* (0..7F), then skip to step 8.
*/
{
size_t i;
int inasciirange;
inasciirange = 1;
for (i = 0; src[i]; i++)
{
if (src[i] > 0x7F)
inasciirange = 0;
/* copy string to output buffer if we are about to skip to step8 */
if (i < 64)
out[i] = src[i];
}
if (i < 64)
out[i] = '\0';
if (inasciirange)
goto step8;
}
/*
* 5. Verify that the sequence does NOT begin with the ACE prefix.
*
*/
{
size_t i;
int match;
match = 1;
for (i = 0; match && i < strlen (IDNA_ACE_PREFIX); i++)
if (((uint32_t) IDNA_ACE_PREFIX[i] & 0xFF) != src[i])
match = 0;
if (match)
{
free (src);
return IDNA_CONTAINS_ACE_PREFIX;
}
}
/*
* 6. Encode the sequence using the encoding algorithm in [PUNYCODE]
* and fail if there is an error.
*/
for (len = 0; src[len]; len++)
;
src[len] = '\0';
outlen = 63 - strlen (IDNA_ACE_PREFIX);
rc = punycode_encode (len, src, NULL,
&outlen, &out[strlen (IDNA_ACE_PREFIX)]);
if (rc != PUNYCODE_SUCCESS)
{
free (src);
return IDNA_PUNYCODE_ERROR;
}
out[strlen (IDNA_ACE_PREFIX) + outlen] = '\0';
/*
* 7. Prepend the ACE prefix.
*/
memcpy (out, IDNA_ACE_PREFIX, strlen (IDNA_ACE_PREFIX));
/*
* 8. Verify that the number of code points is in the range 1 to 63
* inclusive (0 is excluded).
*/
step8:
free (src);
if (strlen (out) < 1 || strlen (out) > 63)
return IDNA_INVALID_LENGTH;
return IDNA_SUCCESS;
}
/* ToUnicode(). May realloc() utf8in. Will free utf8in unconditionally. */
static int
idna_to_unicode_internal (char *utf8in,
uint32_t * out, size_t * outlen, int flags)
{
int rc;
char tmpout[64];
size_t utf8len = strlen (utf8in) + 1;
size_t addlen = 0;
/*
* ToUnicode consists of the following steps:
*
* 1. If the sequence contains any code points outside the ASCII range
* (0..7F) then proceed to step 2, otherwise skip to step 3.
*/
{
size_t i;
int inasciirange;
inasciirange = 1;
for (i = 0; utf8in[i]; i++)
if (utf8in[i] & ~0x7F)
inasciirange = 0;
if (inasciirange)
goto step3;
}
/*
* 2. Perform the steps specified in [NAMEPREP] and fail if there is an
* error. (If step 3 of ToASCII is also performed here, it will not
* affect the overall behavior of ToUnicode, but it is not
* necessary.) The AllowUnassigned flag is used in [NAMEPREP].
*/
do
{
char *newp = realloc (utf8in, utf8len + addlen);
if (newp == NULL)
{
free (utf8in);
return IDNA_MALLOC_ERROR;
}
utf8in = newp;
if (flags & IDNA_ALLOW_UNASSIGNED)
rc = stringprep_nameprep (utf8in, utf8len + addlen);
else
rc = stringprep_nameprep_no_unassigned (utf8in, utf8len + addlen);
addlen += 1;
}
while (rc == STRINGPREP_TOO_SMALL_BUFFER);
if (rc != STRINGPREP_OK)
{
free (utf8in);
return IDNA_STRINGPREP_ERROR;
}
/* 3. Verify that the sequence begins with the ACE prefix, and save a
* copy of the sequence.
* ... The ToASCII and ToUnicode operations MUST recognize the ACE
prefix in a case-insensitive manner.
*/
step3:
if (c_strncasecmp (utf8in, IDNA_ACE_PREFIX, strlen (IDNA_ACE_PREFIX)) != 0)
{
free (utf8in);
return IDNA_NO_ACE_PREFIX;
}
/* 4. Remove the ACE prefix.
*/
memmove (utf8in, &utf8in[strlen (IDNA_ACE_PREFIX)],
strlen (utf8in) - strlen (IDNA_ACE_PREFIX) + 1);
/* 5. Decode the sequence using the decoding algorithm in [PUNYCODE]
* and fail if there is an error. Save a copy of the result of
* this step.
*/
(*outlen)--; /* reserve one for the zero */
rc = punycode_decode (strlen (utf8in), utf8in, outlen, out, NULL);
if (rc != PUNYCODE_SUCCESS)
{
free (utf8in);
return IDNA_PUNYCODE_ERROR;
}
out[*outlen] = 0; /* add zero */
/* 6. Apply ToASCII.
*/
rc = idna_to_ascii_4i (out, *outlen, tmpout, flags);
if (rc != IDNA_SUCCESS)
{
free (utf8in);
return rc;
}
/* 7. Verify that the result of step 6 matches the saved copy from
* step 3, using a case-insensitive ASCII comparison.
*/
if (c_strcasecmp (utf8in, tmpout + strlen (IDNA_ACE_PREFIX)) != 0)
{
free (utf8in);
return IDNA_ROUNDTRIP_VERIFY_ERROR;
}
/* 8. Return the saved copy from step 5.
*/
free (utf8in);
return IDNA_SUCCESS;
}
/**
* idna_to_unicode_44i:
* @in: input array with unicode code points.
* @inlen: length of input array with unicode code points.
* @out: output array with unicode code points.
* @outlen: on input, maximum size of output array with unicode code points,
* on exit, actual size of output array with unicode code points.
* @flags: an #Idna_flags value, e.g., %IDNA_ALLOW_UNASSIGNED or
* %IDNA_USE_STD3_ASCII_RULES.
*
* The ToUnicode operation takes a sequence of Unicode code points
* that make up one domain label and returns a sequence of Unicode
* code points. If the input sequence is a label in ACE form, then the
* result is an equivalent internationalized label that is not in ACE
* form, otherwise the original sequence is returned unaltered.
*
* ToUnicode never fails. If any step fails, then the original input
* sequence is returned immediately in that step.
*
* The Punycode decoder can never output more code points than it
* inputs, but Nameprep can, and therefore ToUnicode can. Note that
* the number of octets needed to represent a sequence of code points
* depends on the particular character encoding used.
*
* The inputs to ToUnicode are a sequence of code points, the
* AllowUnassigned flag, and the UseSTD3ASCIIRules flag. The output of
* ToUnicode is always a sequence of Unicode code points.
*
* Return value: Returns #Idna_rc error condition, but it must only be
* used for debugging purposes. The output buffer is always
* guaranteed to contain the correct data according to the
* specification (sans malloc induced errors). NB! This means that
* you normally ignore the return code from this function, as
* checking it means breaking the standard.
*/
int
idna_to_unicode_44i (const uint32_t * in, size_t inlen,
uint32_t * out, size_t * outlen, int flags)
{
int rc;
size_t outlensave = *outlen;
char *p;
p = stringprep_ucs4_to_utf8 (in, (ssize_t) inlen, NULL, NULL);
if (p == NULL)
return IDNA_MALLOC_ERROR;
rc = idna_to_unicode_internal (p, out, outlen, flags);
if (rc != IDNA_SUCCESS)
{
memcpy (out, in, sizeof (in[0]) * (inlen < outlensave ?
inlen : outlensave));
*outlen = inlen;
}
/* p is freed in idna_to_unicode_internal. */
return rc;
}
/* Wrappers that handle several labels */
/**
* idna_to_ascii_4z:
* @input: zero terminated input Unicode string.
* @output: pointer to newly allocated output string.
* @flags: an #Idna_flags value, e.g., %IDNA_ALLOW_UNASSIGNED or
* %IDNA_USE_STD3_ASCII_RULES.
*
* Convert UCS-4 domain name to ASCII string. The domain name may
* contain several labels, separated by dots. The output buffer must
* be deallocated by the caller.
*
* Return value: Returns %IDNA_SUCCESS on success, or error code.
**/
int
idna_to_ascii_4z (const uint32_t * input, char **output, int flags)
{
const uint32_t *start = input;
const uint32_t *end;
char buf[64];
char *out = NULL;
int rc;
/* 1) Whenever dots are used as label separators, the following
characters MUST be recognized as dots: U+002E (full stop),
U+3002 (ideographic full stop), U+FF0E (fullwidth full stop),
U+FF61 (halfwidth ideographic full stop). */
if (input[0] == 0)
{
/* Handle implicit zero-length root label. */
*output = malloc (1);
if (!*output)
return IDNA_MALLOC_ERROR;
strcpy (*output, "");
return IDNA_SUCCESS;
}
if (DOTP (input[0]) && input[1] == 0)
{
/* Handle explicit zero-length root label. */
*output = malloc (2);
if (!*output)
return IDNA_MALLOC_ERROR;
strcpy (*output, ".");
return IDNA_SUCCESS;
}
*output = NULL;
do
{
end = start;
for (; *end && !DOTP (*end); end++)
;
if (*end == '\0' && start == end)
{
/* Handle explicit zero-length root label. */
buf[0] = '\0';
}
else
{
rc = idna_to_ascii_4i (start, (size_t) (end - start), buf, flags);
if (rc != IDNA_SUCCESS)
{
free (out);
return rc;
}
}
if (out)
{
size_t l = strlen (out) + 1 + strlen (buf) + 1;
char *newp = realloc (out, l);
if (!newp)
{
free (out);
return IDNA_MALLOC_ERROR;
}
out = newp;
strcat (out, ".");
strcat (out, buf);
}
else
{
out = strdup (buf);
if (!out)
return IDNA_MALLOC_ERROR;
}
start = end + 1;
}
while (*end);
*output = out;
return IDNA_SUCCESS;
}
/**
* idna_to_ascii_8z:
* @input: zero terminated input UTF-8 string.
* @output: pointer to newly allocated output string.
* @flags: an #Idna_flags value, e.g., %IDNA_ALLOW_UNASSIGNED or
* %IDNA_USE_STD3_ASCII_RULES.
*
* Convert UTF-8 domain name to ASCII string. The domain name may
* contain several labels, separated by dots. The output buffer must
* be deallocated by the caller.
*
* Return value: Returns %IDNA_SUCCESS on success, or error code.
**/
int
idna_to_ascii_8z (const char *input, char **output, int flags)
{
uint32_t *ucs4;
size_t ucs4len;
int rc;
ucs4 = stringprep_utf8_to_ucs4 (input, -1, &ucs4len);
if (!ucs4)
return IDNA_ICONV_ERROR;
rc = idna_to_ascii_4z (ucs4, output, flags);
free (ucs4);
return rc;
}
/**
* idna_to_ascii_lz:
* @input: zero terminated input string encoded in the current locale's
* character set.
* @output: pointer to newly allocated output string.
* @flags: an #Idna_flags value, e.g., %IDNA_ALLOW_UNASSIGNED or
* %IDNA_USE_STD3_ASCII_RULES.
*
* Convert domain name in the locale's encoding to ASCII string. The
* domain name may contain several labels, separated by dots. The
* output buffer must be deallocated by the caller.
*
* Return value: Returns %IDNA_SUCCESS on success, or error code.
**/
int
idna_to_ascii_lz (const char *input, char **output, int flags)
{
char *utf8;
int rc;
utf8 = stringprep_locale_to_utf8 (input);
if (!utf8)
return IDNA_ICONV_ERROR;
rc = idna_to_ascii_8z (utf8, output, flags);
free (utf8);
return rc;
}
/**
* idna_to_unicode_4z4z:
* @input: zero-terminated Unicode string.
* @output: pointer to newly allocated output Unicode string.
* @flags: an #Idna_flags value, e.g., %IDNA_ALLOW_UNASSIGNED or
* %IDNA_USE_STD3_ASCII_RULES.
*
* Convert possibly ACE encoded domain name in UCS-4 format into a
* UCS-4 string. The domain name may contain several labels,
* separated by dots. The output buffer must be deallocated by the
* caller.
*
* Return value: Returns %IDNA_SUCCESS on success, or error code.
**/
int
idna_to_unicode_4z4z (const uint32_t * input, uint32_t ** output, int flags)
{
const uint32_t *start = input;
const uint32_t *end;
uint32_t *buf;
size_t buflen;
uint32_t *out = NULL;
size_t outlen = 0;
*output = NULL;
do
{
end = start;
for (; *end && !DOTP (*end); end++)
;
buflen = (size_t) (end - start);
buf = malloc (sizeof (buf[0]) * (buflen + 1));
if (!buf)
return IDNA_MALLOC_ERROR;
/* don't check return code as per specification! */
idna_to_unicode_44i (start, (size_t) (end - start),
buf, &buflen, flags);
if (out)
{
uint32_t *newp = realloc (out,
sizeof (out[0])
* (outlen + 1 + buflen + 1));
if (!newp)
{
free (buf);
free (out);
return IDNA_MALLOC_ERROR;
}
out = newp;
out[outlen++] = 0x002E; /* '.' (full stop) */
memcpy (out + outlen, buf, sizeof (buf[0]) * buflen);
outlen += buflen;
out[outlen] = 0x0;
free (buf);
}
else
{
out = buf;
outlen = buflen;
out[outlen] = 0x0;
}
start = end + 1;
}
while (*end);
*output = out;
return IDNA_SUCCESS;
}
/**
* idna_to_unicode_8z4z:
* @input: zero-terminated UTF-8 string.
* @output: pointer to newly allocated output Unicode string.
* @flags: an #Idna_flags value, e.g., %IDNA_ALLOW_UNASSIGNED or
* %IDNA_USE_STD3_ASCII_RULES.
*
* Convert possibly ACE encoded domain name in UTF-8 format into a
* UCS-4 string. The domain name may contain several labels,
* separated by dots. The output buffer must be deallocated by the
* caller.
*
* Return value: Returns %IDNA_SUCCESS on success, or error code.
**/
int
idna_to_unicode_8z4z (const char *input, uint32_t ** output, int flags)
{
uint32_t *ucs4;
size_t ucs4len;
int rc;
ucs4 = stringprep_utf8_to_ucs4 (input, -1, &ucs4len);
if (!ucs4)
return IDNA_ICONV_ERROR;
rc = idna_to_unicode_4z4z (ucs4, output, flags);
free (ucs4);
return rc;
}
/**
* idna_to_unicode_8z8z:
* @input: zero-terminated UTF-8 string.
* @output: pointer to newly allocated output UTF-8 string.
* @flags: an #Idna_flags value, e.g., %IDNA_ALLOW_UNASSIGNED or
* %IDNA_USE_STD3_ASCII_RULES.
*
* Convert possibly ACE encoded domain name in UTF-8 format into a
* UTF-8 string. The domain name may contain several labels,
* separated by dots. The output buffer must be deallocated by the
* caller.
*
* Return value: Returns %IDNA_SUCCESS on success, or error code.
**/
int
idna_to_unicode_8z8z (const char *input, char **output, int flags)
{
uint32_t *ucs4;
int rc;
rc = idna_to_unicode_8z4z (input, &ucs4, flags);
if (rc != IDNA_SUCCESS)
return rc;
*output = stringprep_ucs4_to_utf8 (ucs4, -1, NULL, NULL);
free (ucs4);
if (!*output)
return IDNA_ICONV_ERROR;
return IDNA_SUCCESS;
}
/**
* idna_to_unicode_8zlz:
* @input: zero-terminated UTF-8 string.
* @output: pointer to newly allocated output string encoded in the
* current locale's character set.
* @flags: an #Idna_flags value, e.g., %IDNA_ALLOW_UNASSIGNED or
* %IDNA_USE_STD3_ASCII_RULES.
*
* Convert possibly ACE encoded domain name in UTF-8 format into a
* string encoded in the current locale's character set. The domain
* name may contain several labels, separated by dots. The output
* buffer must be deallocated by the caller.
*
* Return value: Returns %IDNA_SUCCESS on success, or error code.
**/
int
idna_to_unicode_8zlz (const char *input, char **output, int flags)
{
char *utf8;
int rc;
rc = idna_to_unicode_8z8z (input, &utf8, flags);
if (rc != IDNA_SUCCESS)
return rc;
*output = stringprep_utf8_to_locale (utf8);
free (utf8);
if (!*output)
return IDNA_ICONV_ERROR;
return IDNA_SUCCESS;
}
/**
* idna_to_unicode_lzlz:
* @input: zero-terminated string encoded in the current locale's
* character set.
* @output: pointer to newly allocated output string encoded in the
* current locale's character set.
* @flags: an #Idna_flags value, e.g., %IDNA_ALLOW_UNASSIGNED or
* %IDNA_USE_STD3_ASCII_RULES.
*
* Convert possibly ACE encoded domain name in the locale's character
* set into a string encoded in the current locale's character set.
* The domain name may contain several labels, separated by dots. The
* output buffer must be deallocated by the caller.
*
* Return value: Returns %IDNA_SUCCESS on success, or error code.
**/
int
idna_to_unicode_lzlz (const char *input, char **output, int flags)
{
char *utf8;
int rc;
utf8 = stringprep_locale_to_utf8 (input);
if (!utf8)
return IDNA_ICONV_ERROR;
rc = idna_to_unicode_8zlz (utf8, output, flags);
free (utf8);
return rc;
}
/**
* IDNA_ACE_PREFIX
*
* The IANA allocated prefix to use for IDNA. "xn--"
*/
/**
* Idna_rc:
* @IDNA_SUCCESS: Successful operation. This value is guaranteed to
* always be zero, the remaining ones are only guaranteed to hold
* non-zero values, for logical comparison purposes.
* @IDNA_STRINGPREP_ERROR: Error during string preparation.
* @IDNA_PUNYCODE_ERROR: Error during punycode operation.
* @IDNA_CONTAINS_NON_LDH: For IDNA_USE_STD3_ASCII_RULES, indicate that
* the string contains non-LDH ASCII characters.
* @IDNA_CONTAINS_LDH: Same as @IDNA_CONTAINS_NON_LDH, for compatibility
* with typo in earlier versions.
* @IDNA_CONTAINS_MINUS: For IDNA_USE_STD3_ASCII_RULES, indicate that
* the string contains a leading or trailing hyphen-minus (U+002D).
* @IDNA_INVALID_LENGTH: The final output string is not within the
* (inclusive) range 1 to 63 characters.
* @IDNA_NO_ACE_PREFIX: The string does not contain the ACE prefix
* (for ToUnicode).
* @IDNA_ROUNDTRIP_VERIFY_ERROR: The ToASCII operation on output
* string does not equal the input.
* @IDNA_CONTAINS_ACE_PREFIX: The input contains the ACE prefix (for
* ToASCII).
* @IDNA_ICONV_ERROR: Could not convert string in locale encoding.
* @IDNA_MALLOC_ERROR: Could not allocate buffer (this is typically a
* fatal error).
* @IDNA_DLOPEN_ERROR: Could not dlopen the libcidn DSO (only used
* internally in libc).
*
* Enumerated return codes of idna_to_ascii_4i(),
* idna_to_unicode_44i() functions (and functions derived from those
* functions). The value 0 is guaranteed to always correspond to
* success.
*/
/**
* Idna_flags:
* @IDNA_ALLOW_UNASSIGNED: Don't reject strings containing unassigned
* Unicode code points.
* @IDNA_USE_STD3_ASCII_RULES: Validate strings according to STD3
* rules (i.e., normal host name rules).
*
* Flags to pass to idna_to_ascii_4i(), idna_to_unicode_44i() etc.
*/

123
Example/Pods/libidn/lib/idna.h generated Normal file
View File

@ -0,0 +1,123 @@
/* idna.h --- Prototypes for Internationalized Domain Name library.
Copyright (C) 2002-2015 Simon Josefsson
This file is part of GNU Libidn.
GNU Libidn is free software: you can redistribute it and/or
modify it under the terms of either:
* the GNU Lesser General Public License as published by the Free
Software Foundation; either version 3 of the License, or (at
your option) any later version.
or
* the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at
your option) any later version.
or both in parallel, as here.
GNU Libidn is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received copies of the GNU General Public License and
the GNU Lesser General Public License along with this program. If
not, see <http://www.gnu.org/licenses/>. */
#ifndef IDNA_H
# define IDNA_H
# ifndef IDNAPI
# if defined LIBIDN_BUILDING && defined HAVE_VISIBILITY && HAVE_VISIBILITY
# define IDNAPI __attribute__((__visibility__("default")))
# elif defined LIBIDN_BUILDING && defined _MSC_VER && ! defined LIBIDN_STATIC
# define IDNAPI __declspec(dllexport)
# elif defined _MSC_VER && ! defined LIBIDN_STATIC
# define IDNAPI __declspec(dllimport)
# else
# define IDNAPI
# endif
# endif
# include <stddef.h> /* size_t */
# include "idn-int.h" /* uint32_t */
# ifdef __cplusplus
extern "C"
{
# endif
/* Error codes. */
typedef enum
{
IDNA_SUCCESS = 0,
IDNA_STRINGPREP_ERROR = 1,
IDNA_PUNYCODE_ERROR = 2,
IDNA_CONTAINS_NON_LDH = 3,
/* Workaround typo in earlier versions. */
IDNA_CONTAINS_LDH = IDNA_CONTAINS_NON_LDH,
IDNA_CONTAINS_MINUS = 4,
IDNA_INVALID_LENGTH = 5,
IDNA_NO_ACE_PREFIX = 6,
IDNA_ROUNDTRIP_VERIFY_ERROR = 7,
IDNA_CONTAINS_ACE_PREFIX = 8,
IDNA_ICONV_ERROR = 9,
/* Internal errors. */
IDNA_MALLOC_ERROR = 201,
IDNA_DLOPEN_ERROR = 202
} Idna_rc;
/* IDNA flags */
typedef enum
{
IDNA_ALLOW_UNASSIGNED = 0x0001,
IDNA_USE_STD3_ASCII_RULES = 0x0002
} Idna_flags;
# ifndef IDNA_ACE_PREFIX
# define IDNA_ACE_PREFIX "xn--"
# endif
extern IDNAPI const char *idna_strerror (Idna_rc rc);
/* Core functions */
extern IDNAPI int idna_to_ascii_4i (const uint32_t * in, size_t inlen,
char *out, int flags);
extern IDNAPI int idna_to_unicode_44i (const uint32_t * in, size_t inlen,
uint32_t * out, size_t * outlen,
int flags);
/* Wrappers that handle several labels */
extern IDNAPI int idna_to_ascii_4z (const uint32_t * input,
char **output, int flags);
extern IDNAPI int idna_to_ascii_8z (const char *input, char **output,
int flags);
extern IDNAPI int idna_to_ascii_lz (const char *input, char **output,
int flags);
extern IDNAPI int idna_to_unicode_4z4z (const uint32_t * input,
uint32_t ** output, int flags);
extern IDNAPI int idna_to_unicode_8z4z (const char *input,
uint32_t ** output, int flags);
extern IDNAPI int idna_to_unicode_8z8z (const char *input,
char **output, int flags);
extern IDNAPI int idna_to_unicode_8zlz (const char *input,
char **output, int flags);
extern IDNAPI int idna_to_unicode_lzlz (const char *input,
char **output, int flags);
# ifdef __cplusplus
}
# endif
#endif /* IDNA_H */

1114
Example/Pods/libidn/lib/nfkc.c generated Normal file

File diff suppressed because it is too large Load Diff

1340
Example/Pods/libidn/lib/pr29.c generated Normal file

File diff suppressed because it is too large Load Diff

73
Example/Pods/libidn/lib/pr29.h generated Normal file
View File

@ -0,0 +1,73 @@
/* pr29.h --- Detect strings which are non-idempotent under NFKC.
Copyright (C) 2004-2015 Simon Josefsson
This file is part of GNU Libidn.
GNU Libidn is free software: you can redistribute it and/or
modify it under the terms of either:
* the GNU Lesser General Public License as published by the Free
Software Foundation; either version 3 of the License, or (at
your option) any later version.
or
* the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at
your option) any later version.
or both in parallel, as here.
GNU Libidn is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received copies of the GNU General Public License and
the GNU Lesser General Public License along with this program. If
not, see <http://www.gnu.org/licenses/>. */
#ifndef PR29_H
# define PR29_H
# ifndef IDNAPI
# if defined LIBIDN_BUILDING && defined HAVE_VISIBILITY && HAVE_VISIBILITY
# define IDNAPI __attribute__((__visibility__("default")))
# elif defined LIBIDN_BUILDING && defined _MSC_VER && ! defined LIBIDN_STATIC
# define IDNAPI __declspec(dllexport)
# elif defined _MSC_VER && ! defined LIBIDN_STATIC
# define IDNAPI __declspec(dllimport)
# else
# define IDNAPI
# endif
# endif
# ifdef __cplusplus
extern "C"
{
# endif
/* Get size_t. */
# include <stdlib.h>
/* Get uint32_t. */
# include "idn-int.h"
/* Error codes. */
typedef enum
{
PR29_SUCCESS = 0,
PR29_PROBLEM = 1, /* String is a problem sequence. */
PR29_STRINGPREP_ERROR = 2 /* Charset conversion failed (p29_8*). */
} Pr29_rc;
extern IDNAPI const char *pr29_strerror (Pr29_rc rc);
extern IDNAPI int pr29_4 (const uint32_t * in, size_t len);
extern IDNAPI int pr29_4z (const uint32_t * in);
extern IDNAPI int pr29_8z (const char *in);
# ifdef __cplusplus
}
# endif
#endif /* PR29_H */

322
Example/Pods/libidn/lib/profiles.c generated Normal file
View File

@ -0,0 +1,322 @@
/* profiles.c --- Definitions of stringprep profiles.
Copyright (C) 2002-2015 Simon Josefsson
This file is part of GNU Libidn.
GNU Libidn is free software: you can redistribute it and/or
modify it under the terms of either:
* the GNU Lesser General Public License as published by the Free
Software Foundation; either version 3 of the License, or (at
your option) any later version.
or
* the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at
your option) any later version.
or both in parallel, as here.
GNU Libidn is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received copies of the GNU General Public License and
the GNU Lesser General Public License along with this program. If
not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
#include "stringprep.h"
const Stringprep_profiles stringprep_profiles[] = {
{"Nameprep", stringprep_nameprep},
{"KRBprep", stringprep_kerberos5}, /* Deprecate? */
{"Nodeprep", stringprep_xmpp_nodeprep},
{"Resourceprep", stringprep_xmpp_resourceprep},
{"plain", stringprep_plain}, /* sasl-anon-00. */
{"trace", stringprep_trace}, /* sasl-anon-01,02,03. */
{"SASLprep", stringprep_saslprep},
{"ISCSIprep", stringprep_iscsi}, /* Obsolete. */
{"iSCSI", stringprep_iscsi}, /* IANA. */
{NULL, NULL}
};
const Stringprep_profile stringprep_nameprep[] = {
{STRINGPREP_MAP_TABLE, 0, stringprep_rfc3454_B_1},
{STRINGPREP_MAP_TABLE, 0, stringprep_rfc3454_B_2},
{STRINGPREP_NFKC, 0, 0},
{STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_1_2},
{STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_2_2},
{STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_3},
{STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_4},
{STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_5},
{STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_6},
{STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_7},
{STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_8},
{STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_9},
{STRINGPREP_BIDI, 0, 0},
{STRINGPREP_BIDI_PROHIBIT_TABLE, ~STRINGPREP_NO_BIDI,
stringprep_rfc3454_C_8},
{STRINGPREP_BIDI_RAL_TABLE, 0, stringprep_rfc3454_D_1},
{STRINGPREP_BIDI_L_TABLE, 0, stringprep_rfc3454_D_2},
{STRINGPREP_UNASSIGNED_TABLE, ~STRINGPREP_NO_UNASSIGNED,
stringprep_rfc3454_A_1},
{0}
};
const Stringprep_profile stringprep_kerberos5[] = {
/* XXX this is likely to be wrong as the specification is
a rough draft. */
{STRINGPREP_MAP_TABLE, 0, stringprep_rfc3454_B_1},
{STRINGPREP_MAP_TABLE, 0, stringprep_rfc3454_B_3},
{STRINGPREP_NFKC, 0, 0},
{STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_1_2},
{STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_2_2},
{STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_3},
{STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_4},
{STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_5},
{STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_6},
{STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_7},
{STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_8},
{STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_9},
{STRINGPREP_BIDI, 0, 0},
{STRINGPREP_BIDI_PROHIBIT_TABLE, ~STRINGPREP_NO_BIDI,
stringprep_rfc3454_C_8},
{STRINGPREP_BIDI_RAL_TABLE, 0, stringprep_rfc3454_D_1},
{STRINGPREP_BIDI_L_TABLE, 0, stringprep_rfc3454_D_2},
{STRINGPREP_UNASSIGNED_TABLE, ~STRINGPREP_NO_UNASSIGNED,
stringprep_rfc3454_A_1},
{0}
};
const Stringprep_table_element stringprep_xmpp_nodeprep_prohibit[] = {
{0x000022}, /* #x22 (") */
{0x000026}, /* #x26 (&) */
{0x000027}, /* #x27 (') */
{0x00002F}, /* #x2F (/) */
{0x00003A}, /* #x3A (:) */
{0x00003C}, /* #x3C (<) */
{0x00003E}, /* #x3E (>) */
{0x000040}, /* #x40 (@) */
{0}
};
const Stringprep_profile stringprep_xmpp_nodeprep[] = {
{STRINGPREP_MAP_TABLE, 0, stringprep_rfc3454_B_1},
{STRINGPREP_MAP_TABLE, 0, stringprep_rfc3454_B_2},
{STRINGPREP_NFKC, 0, 0},
{STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_1_1},
{STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_1_2},
{STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_2_1},
{STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_2_2},
{STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_3},
{STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_4},
{STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_5},
{STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_6},
{STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_7},
{STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_8},
{STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_9},
{STRINGPREP_PROHIBIT_TABLE, 0, stringprep_xmpp_nodeprep_prohibit},
{STRINGPREP_BIDI, 0, 0},
{STRINGPREP_BIDI_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_8},
{STRINGPREP_BIDI_RAL_TABLE, 0, stringprep_rfc3454_D_1},
{STRINGPREP_BIDI_L_TABLE, 0, stringprep_rfc3454_D_2},
{STRINGPREP_UNASSIGNED_TABLE, ~STRINGPREP_NO_UNASSIGNED,
stringprep_rfc3454_A_1},
{0}
};
const Stringprep_profile stringprep_xmpp_resourceprep[] = {
{STRINGPREP_MAP_TABLE, 0, stringprep_rfc3454_B_1},
{STRINGPREP_NFKC, 0, 0},
{STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_1_2},
{STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_2_1},
{STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_2_2},
{STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_3},
{STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_4},
{STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_5},
{STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_6},
{STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_7},
{STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_8},
{STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_9},
{STRINGPREP_BIDI, 0, 0},
{STRINGPREP_BIDI_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_8},
{STRINGPREP_BIDI_RAL_TABLE, ~STRINGPREP_NO_BIDI, stringprep_rfc3454_D_1},
{STRINGPREP_BIDI_L_TABLE, ~STRINGPREP_NO_BIDI, stringprep_rfc3454_D_2},
{STRINGPREP_UNASSIGNED_TABLE, ~STRINGPREP_NO_UNASSIGNED,
stringprep_rfc3454_A_1},
{0}
};
const Stringprep_profile stringprep_plain[] = {
{STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_2_1},
{STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_2_2},
{STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_3},
{STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_4},
{STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_5},
{STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_6},
{STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_8},
{STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_9},
{STRINGPREP_BIDI, 0, 0},
{STRINGPREP_BIDI_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_8},
{STRINGPREP_BIDI_RAL_TABLE, ~STRINGPREP_NO_BIDI, stringprep_rfc3454_D_1},
{STRINGPREP_BIDI_L_TABLE, ~STRINGPREP_NO_BIDI, stringprep_rfc3454_D_2},
{0}
};
const Stringprep_profile stringprep_trace[] = {
{STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_2_1},
{STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_2_2},
{STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_3},
{STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_4},
{STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_5},
{STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_6},
{STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_8},
{STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_9},
{STRINGPREP_BIDI, 0, 0},
{STRINGPREP_BIDI_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_8},
{STRINGPREP_BIDI_RAL_TABLE, ~STRINGPREP_NO_BIDI, stringprep_rfc3454_D_1},
{STRINGPREP_BIDI_L_TABLE, ~STRINGPREP_NO_BIDI, stringprep_rfc3454_D_2},
{0}
};
const Stringprep_table_element stringprep_iscsi_prohibit[] = {
/* NB, since start == 0, we must have that end != 0 for the
end-of-table logic to work. */
{0x0000, 1}, /* [ASCII CONTROL CHARACTERS and SPACE through ,] */
{0x0001},
{0x0002},
{0x0003},
{0x0004},
{0x0005},
{0x0006},
{0x0007},
{0x0008},
{0x0009},
{0x000A},
{0x000B},
{0x000C},
{0x000D},
{0x000E},
{0x000F},
{0x0010},
{0x0011},
{0x0012},
{0x0013},
{0x0014},
{0x0015},
{0x0016},
{0x0017},
{0x0018},
{0x0019},
{0x001A},
{0x001B},
{0x001C},
{0x001D},
{0x001E},
{0x001F},
{0x0020},
{0x0021},
{0x0022},
{0x0023},
{0x0024},
{0x0025},
{0x0026},
{0x0027},
{0x0028},
{0x0029},
{0x002A},
{0x002B},
{0x002C},
{0x002F}, /* [ASCII /] */
{0x003B}, /* [ASCII ; through @] */
{0x003C},
{0x003D},
{0x003E},
{0x003F},
{0x0040},
{0x005B}, /* [ASCII [ through `] */
{0x005C},
{0x005D},
{0x005E},
{0x005F},
{0x0060},
{0x007B}, /* [ASCII { through DEL] */
{0x007C},
{0x007D},
{0x007E},
{0x007F},
{0x3002}, /* ideographic full stop */
{0}
};
const Stringprep_profile stringprep_iscsi[] = {
{STRINGPREP_MAP_TABLE, 0, stringprep_rfc3454_B_1},
{STRINGPREP_MAP_TABLE, 0, stringprep_rfc3454_B_2},
{STRINGPREP_NFKC, 0, 0},
{STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_1_1},
{STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_1_2},
{STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_2_1},
{STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_2_2},
{STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_3},
{STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_4},
{STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_5},
{STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_6},
{STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_7},
{STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_8},
{STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_9},
{STRINGPREP_PROHIBIT_TABLE, 0, stringprep_iscsi_prohibit},
{STRINGPREP_BIDI, 0, 0},
{STRINGPREP_BIDI_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_8},
{STRINGPREP_BIDI_RAL_TABLE, ~STRINGPREP_NO_BIDI, stringprep_rfc3454_D_1},
{STRINGPREP_BIDI_L_TABLE, ~STRINGPREP_NO_BIDI, stringprep_rfc3454_D_2},
{STRINGPREP_UNASSIGNED_TABLE, ~STRINGPREP_NO_UNASSIGNED,
stringprep_rfc3454_A_1},
{0}
};
const Stringprep_table_element stringprep_saslprep_space_map[] = {
{0x0000A0, 0, {0x0020}}, /* 00A0; NO-BREAK SPACE */
{0x001680, 0, {0x0020}}, /* 1680; OGHAM SPACE MARK */
{0x002000, 0, {0x0020}}, /* 2000; EN QUAD */
{0x002001, 0, {0x0020}}, /* 2001; EM QUAD */
{0x002002, 0, {0x0020}}, /* 2002; EN SPACE */
{0x002003, 0, {0x0020}}, /* 2003; EM SPACE */
{0x002004, 0, {0x0020}}, /* 2004; THREE-PER-EM SPACE */
{0x002005, 0, {0x0020}}, /* 2005; FOUR-PER-EM SPACE */
{0x002006, 0, {0x0020}}, /* 2006; SIX-PER-EM SPACE */
{0x002007, 0, {0x0020}}, /* 2007; FIGURE SPACE */
{0x002008, 0, {0x0020}}, /* 2008; PUNCTUATION SPACE */
{0x002009, 0, {0x0020}}, /* 2009; THIN SPACE */
{0x00200A, 0, {0x0020}}, /* 200A; HAIR SPACE */
{0x00200B, 0, {0x0020}}, /* 200B; ZERO WIDTH SPACE */
{0x00202F, 0, {0x0020}}, /* 202F; NARROW NO-BREAK SPACE */
{0x00205F, 0, {0x0020}}, /* 205F; MEDIUM MATHEMATICAL SPACE */
{0x003000, 0, {0x0020}}, /* 3000; IDEOGRAPHIC SPACE */
{0}
};
const Stringprep_profile stringprep_saslprep[] = {
{STRINGPREP_MAP_TABLE, 0, stringprep_saslprep_space_map},
{STRINGPREP_MAP_TABLE, 0, stringprep_rfc3454_B_1},
{STRINGPREP_NFKC, 0, 0},
{STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_1_2},
{STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_2_1},
{STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_2_2},
{STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_3},
{STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_4},
{STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_5},
{STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_6},
{STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_7},
{STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_8},
{STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_9},
{STRINGPREP_BIDI, 0, 0},
{STRINGPREP_BIDI_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_8},
{STRINGPREP_BIDI_RAL_TABLE, ~STRINGPREP_NO_BIDI, stringprep_rfc3454_D_1},
{STRINGPREP_BIDI_L_TABLE, ~STRINGPREP_NO_BIDI, stringprep_rfc3454_D_2},
{STRINGPREP_UNASSIGNED_TABLE, ~STRINGPREP_NO_UNASSIGNED,
stringprep_rfc3454_A_1},
{0}
};

464
Example/Pods/libidn/lib/punycode.c generated Normal file
View File

@ -0,0 +1,464 @@
/* punycode.c --- Implementation of punycode used to ASCII encode IDN's.
Copyright (C) 2002-2015 Simon Josefsson
This file is part of GNU Libidn.
GNU Libidn is free software: you can redistribute it and/or
modify it under the terms of either:
* the GNU Lesser General Public License as published by the Free
Software Foundation; either version 3 of the License, or (at
your option) any later version.
or
* the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at
your option) any later version.
or both in parallel, as here.
GNU Libidn is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received copies of the GNU General Public License and
the GNU Lesser General Public License along with this program. If
not, see <http://www.gnu.org/licenses/>. */
/*
* This file is derived from RFC 3492bis written by Adam M. Costello,
* downloaded from http://www.nicemice.net/idn/punycode-spec.gz on
* 2015-03-02 with SHA1 a966a8017f6be579d74a50a226accc7607c40133, a
* copy of which is stored in the GNU Libidn version controlled
* repository under doc/specification/punycode-spec.gz.
*
* The changes compared to Adam's file include: re-indentation, adding
* the license boilerplate and this comment, #include of config.h and
* punycode.h, adding GTK-DOC comments, changing the return code of
* punycode_encode and punycode_decode from enum to int, renaming the
* input_length_orig function input variable to input_length (and
* renaming the internal input_length variable to input_len) in
* punycode_encode.
*
* Adam's file contains the following:
*
* punycode-sample.c 2.0.0 (2004-Mar-21-Sun)
* http://www.nicemice.net/idn/
* Adam M. Costello
* http://www.nicemice.net/amc/
*
* This is ANSI C code (C89) implementing Punycode 1.0.x.
*
* Disclaimer and license: Regarding this entire document or any
* portion of it (including the pseudocode and C code), the author
* makes no guarantees and is not responsible for any damage resulting
* from its use. The author grants irrevocable permission to anyone
* to use, modify, and distribute it in any way that does not diminish
* the rights of anyone else to use, modify, and distribute it,
* provided that redistributed derivative works do not contain
* misleading author or version information. Derivative works need
* not be licensed under similar terms.
*/
#include <config.h>
/**********************************************************/
/* Implementation (would normally go in its own .c file): */
#include <string.h>
#include "punycode.h"
/*** Bootstring parameters for Punycode ***/
enum
{ base = 36, tmin = 1, tmax = 26, skew = 38, damp = 700,
initial_bias = 72, initial_n = 0x80, delimiter = 0x2D
};
/* basic(cp) tests whether cp is a basic code point: */
#define basic(cp) ((punycode_uint)(cp) < 0x80)
/* delim(cp) tests whether cp is a delimiter: */
#define delim(cp) ((cp) == delimiter)
/* decode_digit(cp) returns the numeric value of a basic code */
/* point (for use in representing integers) in the range 0 to */
/* base-1, or base if cp does not represent a value. */
static punycode_uint
decode_digit (punycode_uint cp)
{
return cp - 48 < 10 ? cp - 22 : cp - 65 < 26 ? cp - 65 :
cp - 97 < 26 ? cp - 97 : base;
}
/* encode_digit(d,flag) returns the basic code point whose value */
/* (when used for representing integers) is d, which needs to be in */
/* the range 0 to base-1. The lowercase form is used unless flag is */
/* nonzero, in which case the uppercase form is used. The behavior */
/* is undefined if flag is nonzero and digit d has no uppercase form. */
static char
encode_digit (punycode_uint d, int flag)
{
return d + 22 + 75 * (d < 26) - ((flag != 0) << 5);
/* 0..25 map to ASCII a..z or A..Z */
/* 26..35 map to ASCII 0..9 */
}
/* flagged(bcp) tests whether a basic code point is flagged */
/* (uppercase). The behavior is undefined if bcp is not a */
/* basic code point. */
#define flagged(bcp) ((punycode_uint)(bcp) - 65 < 26)
/* encode_basic(bcp,flag) forces a basic code point to lowercase */
/* if flag is zero, uppercase if flag is nonzero, and returns */
/* the resulting code point. The code point is unchanged if it */
/* is caseless. The behavior is undefined if bcp is not a basic */
/* code point. */
static char
encode_basic (punycode_uint bcp, int flag)
{
bcp -= (bcp - 97 < 26) << 5;
return bcp + ((!flag && (bcp - 65 < 26)) << 5);
}
/*** Platform-specific constants ***/
/* maxint is the maximum value of a punycode_uint variable: */
static const punycode_uint maxint = -1;
/* Because maxint is unsigned, -1 becomes the maximum value. */
/*** Bias adaptation function ***/
static punycode_uint
adapt (punycode_uint delta, punycode_uint numpoints, int firsttime)
{
punycode_uint k;
delta = firsttime ? delta / damp : delta >> 1;
/* delta >> 1 is a faster way of doing delta / 2 */
delta += delta / numpoints;
for (k = 0; delta > ((base - tmin) * tmax) / 2; k += base)
{
delta /= base - tmin;
}
return k + (base - tmin + 1) * delta / (delta + skew);
}
/*** Main encode function ***/
/**
* punycode_encode:
* @input_length: The number of code points in the @input array and
* the number of flags in the @case_flags array.
* @input: An array of code points. They are presumed to be Unicode
* code points, but that is not strictly REQUIRED. The array
* contains code points, not code units. UTF-16 uses code units
* D800 through DFFF to refer to code points 10000..10FFFF. The
* code points D800..DFFF do not occur in any valid Unicode string.
* The code points that can occur in Unicode strings (0..D7FF and
* E000..10FFFF) are also called Unicode scalar values.
* @case_flags: A %NULL pointer or an array of boolean values parallel
* to the @input array. Nonzero (true, flagged) suggests that the
* corresponding Unicode character be forced to uppercase after
* being decoded (if possible), and zero (false, unflagged) suggests
* that it be forced to lowercase (if possible). ASCII code points
* (0..7F) are encoded literally, except that ASCII letters are
* forced to uppercase or lowercase according to the corresponding
* case flags. If @case_flags is a %NULL pointer then ASCII letters
* are left as they are, and other code points are treated as
* unflagged.
* @output_length: The caller passes in the maximum number of ASCII
* code points that it can receive. On successful return it will
* contain the number of ASCII code points actually output.
* @output: An array of ASCII code points. It is *not*
* null-terminated; it will contain zeros if and only if the @input
* contains zeros. (Of course the caller can leave room for a
* terminator and add one if needed.)
*
* Converts a sequence of code points (presumed to be Unicode code
* points) to Punycode.
*
* Return value: The return value can be any of the #Punycode_status
* values defined above except %PUNYCODE_BAD_INPUT. If not
* %PUNYCODE_SUCCESS, then @output_size and @output might contain
* garbage.
**/
int
punycode_encode (size_t input_length,
const punycode_uint input[],
const unsigned char case_flags[],
size_t * output_length, char output[])
{
punycode_uint input_len, n, delta, h, b, bias, j, m, q, k, t;
size_t out, max_out;
/* The Punycode spec assumes that the input length is the same type */
/* of integer as a code point, so we need to convert the size_t to */
/* a punycode_uint, which could overflow. */
if (input_length > maxint)
return punycode_overflow;
input_len = (punycode_uint) input_length;
/* Initialize the state: */
n = initial_n;
delta = 0;
out = 0;
max_out = *output_length;
bias = initial_bias;
/* Handle the basic code points: */
for (j = 0; j < input_len; ++j)
{
if (basic (input[j]))
{
if (max_out - out < 2)
return punycode_big_output;
output[out++] = case_flags ?
encode_basic (input[j], case_flags[j]) : (char) input[j];
}
/* else if (input[j] < n) return punycode_bad_input; */
/* (not needed for Punycode with unsigned code points) */
}
h = b = (punycode_uint) out;
/* cannot overflow because out <= input_len <= maxint */
/* h is the number of code points that have been handled, b is the */
/* number of basic code points, and out is the number of ASCII code */
/* points that have been output. */
if (b > 0)
output[out++] = delimiter;
/* Main encoding loop: */
while (h < input_len)
{
/* All non-basic code points < n have been */
/* handled already. Find the next larger one: */
for (m = maxint, j = 0; j < input_len; ++j)
{
/* if (basic(input[j])) continue; */
/* (not needed for Punycode) */
if (input[j] >= n && input[j] < m)
m = input[j];
}
/* Increase delta enough to advance the decoder's */
/* <n,i> state to <m,0>, but guard against overflow: */
if (m - n > (maxint - delta) / (h + 1))
return punycode_overflow;
delta += (m - n) * (h + 1);
n = m;
for (j = 0; j < input_len; ++j)
{
/* Punycode does not need to check whether input[j] is basic: */
if (input[j] < n /* || basic(input[j]) */ )
{
if (++delta == 0)
return punycode_overflow;
}
if (input[j] == n)
{
/* Represent delta as a generalized variable-length integer: */
for (q = delta, k = base;; k += base)
{
if (out >= max_out)
return punycode_big_output;
t = k <= bias /* + tmin */ ? tmin : /* +tmin not needed */
k >= bias + tmax ? tmax : k - bias;
if (q < t)
break;
output[out++] = encode_digit (t + (q - t) % (base - t), 0);
q = (q - t) / (base - t);
}
output[out++] = encode_digit (q, case_flags && case_flags[j]);
bias = adapt (delta, h + 1, h == b);
delta = 0;
++h;
}
}
++delta, ++n;
}
*output_length = out;
return punycode_success;
}
/*** Main decode function ***/
/**
* punycode_decode:
* @input_length: The number of ASCII code points in the @input array.
* @input: An array of ASCII code points (0..7F).
* @output_length: The caller passes in the maximum number of code
* points that it can receive into the @output array (which is also
* the maximum number of flags that it can receive into the
* @case_flags array, if @case_flags is not a %NULL pointer). On
* successful return it will contain the number of code points
* actually output (which is also the number of flags actually
* output, if case_flags is not a null pointer). The decoder will
* never need to output more code points than the number of ASCII
* code points in the input, because of the way the encoding is
* defined. The number of code points output cannot exceed the
* maximum possible value of a punycode_uint, even if the supplied
* @output_length is greater than that.
* @output: An array of code points like the input argument of
* punycode_encode() (see above).
* @case_flags: A %NULL pointer (if the flags are not needed by the
* caller) or an array of boolean values parallel to the @output
* array. Nonzero (true, flagged) suggests that the corresponding
* Unicode character be forced to uppercase by the caller (if
* possible), and zero (false, unflagged) suggests that it be forced
* to lowercase (if possible). ASCII code points (0..7F) are output
* already in the proper case, but their flags will be set
* appropriately so that applying the flags would be harmless.
*
* Converts Punycode to a sequence of code points (presumed to be
* Unicode code points).
*
* Return value: The return value can be any of the #Punycode_status
* values defined above. If not %PUNYCODE_SUCCESS, then
* @output_length, @output, and @case_flags might contain garbage.
*
**/
int
punycode_decode (size_t input_length,
const char input[],
size_t * output_length,
punycode_uint output[], unsigned char case_flags[])
{
punycode_uint n, out, i, max_out, bias, oldi, w, k, digit, t;
size_t b, j, in;
/* Initialize the state: */
n = initial_n;
out = i = 0;
max_out = *output_length > maxint ? maxint
: (punycode_uint) * output_length;
bias = initial_bias;
/* Handle the basic code points: Let b be the number of input code */
/* points before the last delimiter, or 0 if there is none, then */
/* copy the first b code points to the output. */
for (b = j = 0; j < input_length; ++j)
if (delim (input[j]))
b = j;
if (b > max_out)
return punycode_big_output;
for (j = 0; j < b; ++j)
{
if (case_flags)
case_flags[out] = flagged (input[j]);
if (!basic (input[j]))
return punycode_bad_input;
output[out++] = input[j];
}
/* Main decoding loop: Start just after the last delimiter if any */
/* basic code points were copied; start at the beginning otherwise. */
for (in = b > 0 ? b + 1 : 0; in < input_length; ++out)
{
/* in is the index of the next ASCII code point to be consumed, */
/* and out is the number of code points in the output array. */
/* Decode a generalized variable-length integer into delta, */
/* which gets added to i. The overflow checking is easier */
/* if we increase i as we go, then subtract off its starting */
/* value at the end to obtain delta. */
for (oldi = i, w = 1, k = base;; k += base)
{
if (in >= input_length)
return punycode_bad_input;
digit = decode_digit (input[in++]);
if (digit >= base)
return punycode_bad_input;
if (digit > (maxint - i) / w)
return punycode_overflow;
i += digit * w;
t = k <= bias /* + tmin */ ? tmin : /* +tmin not needed */
k >= bias + tmax ? tmax : k - bias;
if (digit < t)
break;
if (w > maxint / (base - t))
return punycode_overflow;
w *= (base - t);
}
bias = adapt (i - oldi, out + 1, oldi == 0);
/* i was supposed to wrap around from out+1 to 0, */
/* incrementing n each time, so we'll fix that now: */
if (i / (out + 1) > maxint - n)
return punycode_overflow;
n += i / (out + 1);
i %= (out + 1);
/* Insert n at position i of the output: */
/* not needed for Punycode: */
/* if (basic(n)) return punycode_bad_input; */
if (out >= max_out)
return punycode_big_output;
if (case_flags)
{
memmove (case_flags + i + 1, case_flags + i, out - i);
/* Case of last ASCII code point determines case flag: */
case_flags[i] = flagged (input[in - 1]);
}
memmove (output + i + 1, output + i, (out - i) * sizeof *output);
output[i++] = n;
}
*output_length = (size_t) out;
/* cannot overflow because out <= old value of *output_length */
return punycode_success;
}
/**
* punycode_uint
*
* Unicode code point data type, this is always a 32 bit unsigned
* integer.
*/
/**
* Punycode_status
* @PUNYCODE_SUCCESS: Successful operation. This value is guaranteed
* to always be zero, the remaining ones are only guaranteed to hold
* non-zero values, for logical comparison purposes.
* @PUNYCODE_BAD_INPUT: Input is invalid.
* @PUNYCODE_BIG_OUTPUT: Output would exceed the space provided.
* @PUNYCODE_OVERFLOW: Input needs wider integers to process.
*
* Enumerated return codes of punycode_encode() and punycode_decode().
* The value 0 is guaranteed to always correspond to success.
*/

239
Example/Pods/libidn/lib/punycode.h generated Normal file
View File

@ -0,0 +1,239 @@
/* punycode.h --- Declarations for punycode functions.
Copyright (C) 2002-2015 Simon Josefsson
This file is part of GNU Libidn.
GNU Libidn is free software: you can redistribute it and/or
modify it under the terms of either:
* the GNU Lesser General Public License as published by the Free
Software Foundation; either version 3 of the License, or (at
your option) any later version.
or
* the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at
your option) any later version.
or both in parallel, as here.
GNU Libidn is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received copies of the GNU General Public License and
the GNU Lesser General Public License along with this program. If
not, see <http://www.gnu.org/licenses/>. */
/*
* This file is derived from RFC 3492bis written by Adam M. Costello,
* downloaded from http://www.nicemice.net/idn/punycode-spec.gz on
* 2015-03-02 with SHA1 a966a8017f6be579d74a50a226accc7607c40133, a
* copy of which is stored in the GNU Libidn version controlled
* repository under doc/specification/punycode-spec.gz.
*
* The changes compared to Adam's file include: re-indentation, adding
* the license boilerplate and this comment, adding the #ifndef
* PUNYCODE_H and IDNAPI blocks, changing the return code of
* punycode_encode and punycode_decode from enum to int, simplifying
* the definition of punycode_uint by #include'ing idn-int.h and using
* uint32_t instead of limit.h-based code, adding Punycode_status and
* punycode_strerror, adding 'extern IDNAPI' declarations to function
* prototypes, and mentioning variable names in function prototypes.
*
* Adam's file contains the following:
*
* punycode-sample.c 2.0.0 (2004-Mar-21-Sun)
* http://www.nicemice.net/idn/
* Adam M. Costello
* http://www.nicemice.net/amc/
*
* This is ANSI C code (C89) implementing Punycode 1.0.x.
*
* Disclaimer and license: Regarding this entire document or any
* portion of it (including the pseudocode and C code), the author
* makes no guarantees and is not responsible for any damage resulting
* from its use. The author grants irrevocable permission to anyone
* to use, modify, and distribute it in any way that does not diminish
* the rights of anyone else to use, modify, and distribute it,
* provided that redistributed derivative works do not contain
* misleading author or version information. Derivative works need
* not be licensed under similar terms.
*/
#ifndef PUNYCODE_H
# define PUNYCODE_H
# ifndef IDNAPI
# if defined LIBIDN_BUILDING && defined HAVE_VISIBILITY && HAVE_VISIBILITY
# define IDNAPI __attribute__((__visibility__("default")))
# elif defined LIBIDN_BUILDING && defined _MSC_VER && ! defined LIBIDN_STATIC
# define IDNAPI __declspec(dllexport)
# elif defined _MSC_VER && ! defined LIBIDN_STATIC
# define IDNAPI __declspec(dllimport)
# else
# define IDNAPI
# endif
# endif
#ifdef __cplusplus
extern "C"
{
#endif
/************************************************************/
/* Public interface (would normally go in its own .h file): */
#include <stddef.h> /* size_t */
#include "idn-int.h" /* uint32_t */
enum punycode_status
{
punycode_success = 0,
punycode_bad_input = 1, /* Input is invalid. */
punycode_big_output = 2, /* Output would exceed the space provided. */
punycode_overflow = 3 /* Wider integers needed to process input. */
};
typedef enum
{
PUNYCODE_SUCCESS = punycode_success,
PUNYCODE_BAD_INPUT = punycode_bad_input,
PUNYCODE_BIG_OUTPUT = punycode_big_output,
PUNYCODE_OVERFLOW = punycode_overflow
} Punycode_status;
extern IDNAPI const char *punycode_strerror (Punycode_status rc);
/* punycode_uint needs to be unsigned and needs to be */
/* at least 26 bits wide. The particular type can be */
/* specified by defining PUNYCODE_UINT, otherwise a */
/* suitable type will be chosen automatically. */
typedef uint32_t punycode_uint;
extern IDNAPI int punycode_encode (size_t input_length,
const punycode_uint input[],
const unsigned char case_flags[],
size_t * output_length, char output[]);
/*
punycode_encode() converts a sequence of code points (presumed to be
Unicode code points) to Punycode.
Input arguments (to be supplied by the caller):
input_length
The number of code points in the input array and the number
of flags in the case_flags array.
input
An array of code points. They are presumed to be Unicode
code points, but that is not strictly necessary. The
array contains code points, not code units. UTF-16 uses
code units D800 through DFFF to refer to code points
10000..10FFFF. The code points D800..DFFF do not occur in
any valid Unicode string. The code points that can occur in
Unicode strings (0..D7FF and E000..10FFFF) are also called
Unicode scalar values.
case_flags
A null pointer or an array of boolean values parallel to
the input array. Nonzero (true, flagged) suggests that the
corresponding Unicode character be forced to uppercase after
being decoded (if possible), and zero (false, unflagged)
suggests that it be forced to lowercase (if possible).
ASCII code points (0..7F) are encoded literally, except that
ASCII letters are forced to uppercase or lowercase according
to the corresponding case flags. If case_flags is a null
pointer then ASCII letters are left as they are, and other
code points are treated as unflagged.
Output arguments (to be filled in by the function):
output
An array of ASCII code points. It is *not* null-terminated;
it will contain zeros if and only if the input contains
zeros. (Of course the caller can leave room for a
terminator and add one if needed.)
Input/output arguments (to be supplied by the caller and overwritten
by the function):
output_length
The caller passes in the maximum number of ASCII code points
that it can receive. On successful return it will contain
the number of ASCII code points actually output.
Return value:
Can be any of the punycode_status values defined above except
punycode_bad_input. If not punycode_success, then output_size
and output might contain garbage.
*/
extern IDNAPI int punycode_decode (size_t input_length,
const char input[],
size_t * output_length,
punycode_uint output[],
unsigned char case_flags[]);
/*
punycode_decode() converts Punycode to a sequence of code points
(presumed to be Unicode code points).
Input arguments (to be supplied by the caller):
input_length
The number of ASCII code points in the input array.
input
An array of ASCII code points (0..7F).
Output arguments (to be filled in by the function):
output
An array of code points like the input argument of
punycode_encode() (see above).
case_flags
A null pointer (if the flags are not needed by the caller)
or an array of boolean values parallel to the output array.
Nonzero (true, flagged) suggests that the corresponding
Unicode character be forced to uppercase by the caller (if
possible), and zero (false, unflagged) suggests that it
be forced to lowercase (if possible). ASCII code points
(0..7F) are output already in the proper case, but their
flags will be set appropriately so that applying the flags
would be harmless.
Input/output arguments (to be supplied by the caller and overwritten
by the function):
output_length
The caller passes in the maximum number of code points
that it can receive into the output array (which is also
the maximum number of flags that it can receive into the
case_flags array, if case_flags is not a null pointer). On
successful return it will contain the number of code points
actually output (which is also the number of flags actually
output, if case_flags is not a null pointer). The decoder
will never need to output more code points than the number
of ASCII code points in the input, because of the way the
encoding is defined. The number of code points output
cannot exceed the maximum possible value of a punycode_uint,
even if the supplied output_length is greater than that.
Return value:
Can be any of the punycode_status values defined above. If not
punycode_success, then output_length, output, and case_flags
might contain garbage.
*/
#ifdef __cplusplus
}
#endif
#endif /* PUNYCODE_H */

4253
Example/Pods/libidn/lib/rfc3454.c generated Normal file

File diff suppressed because it is too large Load Diff

135
Example/Pods/libidn/lib/strerror-idna.c generated Normal file
View File

@ -0,0 +1,135 @@
/* strerror-idna.c --- Convert IDNA errors into text.
Copyright (C) 2004-2015 Simon Josefsson
This file is part of GNU Libidn.
GNU Libidn is free software: you can redistribute it and/or
modify it under the terms of either:
* the GNU Lesser General Public License as published by the Free
Software Foundation; either version 3 of the License, or (at
your option) any later version.
or
* the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at
your option) any later version.
or both in parallel, as here.
GNU Libidn is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received copies of the GNU General Public License and
the GNU Lesser General Public License along with this program. If
not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include "idna.h"
#include "gettext.h"
#define _(String) dgettext (PACKAGE, String)
/**
* idna_strerror:
* @rc: an #Idna_rc return code.
*
* Convert a return code integer to a text string. This string can be
* used to output a diagnostic message to the user.
*
* IDNA_SUCCESS: Successful operation. This value is guaranteed to
* always be zero, the remaining ones are only guaranteed to hold
* non-zero values, for logical comparison purposes.
* IDNA_STRINGPREP_ERROR: Error during string preparation.
* IDNA_PUNYCODE_ERROR: Error during punycode operation.
* IDNA_CONTAINS_NON_LDH: For IDNA_USE_STD3_ASCII_RULES, indicate that
* the string contains non-LDH ASCII characters.
* IDNA_CONTAINS_MINUS: For IDNA_USE_STD3_ASCII_RULES, indicate that
* the string contains a leading or trailing hyphen-minus (U+002D).
* IDNA_INVALID_LENGTH: The final output string is not within the
* (inclusive) range 1 to 63 characters.
* IDNA_NO_ACE_PREFIX: The string does not contain the ACE prefix
* (for ToUnicode).
* IDNA_ROUNDTRIP_VERIFY_ERROR: The ToASCII operation on output
* string does not equal the input.
* IDNA_CONTAINS_ACE_PREFIX: The input contains the ACE prefix (for
* ToASCII).
* IDNA_ICONV_ERROR: Could not convert string in locale encoding.
* IDNA_MALLOC_ERROR: Could not allocate buffer (this is typically a
* fatal error).
* IDNA_DLOPEN_ERROR: Could not dlopen the libcidn DSO (only used
* internally in libc).
*
* Return value: Returns a pointer to a statically allocated string
* containing a description of the error with the return code @rc.
**/
const char *
idna_strerror (Idna_rc rc)
{
const char *p;
bindtextdomain (PACKAGE, LOCALEDIR);
switch (rc)
{
case IDNA_SUCCESS:
p = _("Success");
break;
case IDNA_STRINGPREP_ERROR:
p = _("String preparation failed");
break;
case IDNA_PUNYCODE_ERROR:
p = _("Punycode failed");
break;
case IDNA_CONTAINS_NON_LDH:
p = _("Non-digit/letter/hyphen in input");
break;
case IDNA_CONTAINS_MINUS:
p = _("Forbidden leading or trailing minus sign (`-')");
break;
case IDNA_INVALID_LENGTH:
p = _("Output would be too large or too small");
break;
case IDNA_NO_ACE_PREFIX:
p = _("Input does not start with ACE prefix (`xn--')");
break;
case IDNA_ROUNDTRIP_VERIFY_ERROR:
p = _("String not idempotent under ToASCII");
break;
case IDNA_CONTAINS_ACE_PREFIX:
p = _("Input already contain ACE prefix (`xn--')");
break;
case IDNA_ICONV_ERROR:
p = _("Could not convert string in locale encoding");
break;
case IDNA_MALLOC_ERROR:
p = _("Cannot allocate memory");
break;
case IDNA_DLOPEN_ERROR:
p = _("System dlopen failed");
break;
default:
p = _("Unknown error");
break;
}
return p;
}

83
Example/Pods/libidn/lib/strerror-pr29.c generated Normal file
View File

@ -0,0 +1,83 @@
/* strerror-pr29.c --- Convert PR29 errors into text.
Copyright (C) 2004-2015 Simon Josefsson
This file is part of GNU Libidn.
GNU Libidn is free software: you can redistribute it and/or
modify it under the terms of either:
* the GNU Lesser General Public License as published by the Free
Software Foundation; either version 3 of the License, or (at
your option) any later version.
or
* the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at
your option) any later version.
or both in parallel, as here.
GNU Libidn is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received copies of the GNU General Public License and
the GNU Lesser General Public License along with this program. If
not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include "pr29.h"
#include "gettext.h"
#define _(String) dgettext (PACKAGE, String)
/**
* pr29_strerror:
* @rc: an #Pr29_rc return code.
*
* Convert a return code integer to a text string. This string can be
* used to output a diagnostic message to the user.
*
* PR29_SUCCESS: Successful operation. This value is guaranteed to
* always be zero, the remaining ones are only guaranteed to hold
* non-zero values, for logical comparison purposes.
* PR29_PROBLEM: A problem sequence was encountered.
* PR29_STRINGPREP_ERROR: The character set conversion failed (only
* for pr29_8z()).
*
* Return value: Returns a pointer to a statically allocated string
* containing a description of the error with the return code @rc.
**/
const char *
pr29_strerror (Pr29_rc rc)
{
const char *p;
bindtextdomain (PACKAGE, LOCALEDIR);
switch (rc)
{
case PR29_SUCCESS:
p = _("Success");
break;
case PR29_PROBLEM:
p = _("String not idempotent under Unicode NFKC normalization");
break;
case PR29_STRINGPREP_ERROR:
p = _("String preparation failed");
break;
default:
p = _("Unknown error");
break;
}
return p;
}

View File

@ -0,0 +1,87 @@
/* strerror-punycode.c --- Convert punycode errors into text.
Copyright (C) 2004-2015 Simon Josefsson
This file is part of GNU Libidn.
GNU Libidn is free software: you can redistribute it and/or
modify it under the terms of either:
* the GNU Lesser General Public License as published by the Free
Software Foundation; either version 3 of the License, or (at
your option) any later version.
or
* the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at
your option) any later version.
or both in parallel, as here.
GNU Libidn is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received copies of the GNU General Public License and
the GNU Lesser General Public License along with this program. If
not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include "punycode.h"
#include "gettext.h"
#define _(String) dgettext (PACKAGE, String)
/**
* punycode_strerror:
* @rc: an #Punycode_status return code.
*
* Convert a return code integer to a text string. This string can be
* used to output a diagnostic message to the user.
*
* PUNYCODE_SUCCESS: Successful operation. This value is guaranteed
* to always be zero, the remaining ones are only guaranteed to hold
* non-zero values, for logical comparison purposes.
* PUNYCODE_BAD_INPUT: Input is invalid.
* PUNYCODE_BIG_OUTPUT: Output would exceed the space provided.
* PUNYCODE_OVERFLOW: Input needs wider integers to process.
*
* Return value: Returns a pointer to a statically allocated string
* containing a description of the error with the return code @rc.
**/
const char *
punycode_strerror (Punycode_status rc)
{
const char *p;
bindtextdomain (PACKAGE, LOCALEDIR);
switch (rc)
{
case PUNYCODE_SUCCESS:
p = _("Success");
break;
case PUNYCODE_BAD_INPUT:
p = _("Invalid input");
break;
case PUNYCODE_BIG_OUTPUT:
p = _("Output would exceed the buffer space provided");
break;
case PUNYCODE_OVERFLOW:
p = _("String size limit exceeded");
break;
default:
p = _("Unknown error");
break;
}
return p;
}

View File

@ -0,0 +1,143 @@
/* strerror-stringprep.c --- Convert stringprep errors into text.
Copyright (C) 2004-2015 Simon Josefsson
This file is part of GNU Libidn.
GNU Libidn is free software: you can redistribute it and/or
modify it under the terms of either:
* the GNU Lesser General Public License as published by the Free
Software Foundation; either version 3 of the License, or (at
your option) any later version.
or
* the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at
your option) any later version.
or both in parallel, as here.
GNU Libidn is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received copies of the GNU General Public License and
the GNU Lesser General Public License along with this program. If
not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include "stringprep.h"
#include "gettext.h"
#define _(String) dgettext (PACKAGE, String)
/**
* stringprep_strerror:
* @rc: a #Stringprep_rc return code.
*
* Convert a return code integer to a text string. This string can be
* used to output a diagnostic message to the user.
*
* STRINGPREP_OK: Successful operation. This value is guaranteed to
* always be zero, the remaining ones are only guaranteed to hold
* non-zero values, for logical comparison purposes.
* STRINGPREP_CONTAINS_UNASSIGNED: String contain unassigned Unicode
* code points, which is forbidden by the profile.
* STRINGPREP_CONTAINS_PROHIBITED: String contain code points
* prohibited by the profile.
* STRINGPREP_BIDI_BOTH_L_AND_RAL: String contain code points with
* conflicting bidirection category.
* STRINGPREP_BIDI_LEADTRAIL_NOT_RAL: Leading and trailing character
* in string not of proper bidirectional category.
* STRINGPREP_BIDI_CONTAINS_PROHIBITED: Contains prohibited code
* points detected by bidirectional code.
* STRINGPREP_TOO_SMALL_BUFFER: Buffer handed to function was too
* small. This usually indicate a problem in the calling
* application.
* STRINGPREP_PROFILE_ERROR: The stringprep profile was inconsistent.
* This usually indicate an internal error in the library.
* STRINGPREP_FLAG_ERROR: The supplied flag conflicted with profile.
* This usually indicate a problem in the calling application.
* STRINGPREP_UNKNOWN_PROFILE: The supplied profile name was not
* known to the library.
* STRINGPREP_ICONV_ERROR: Could not convert string in locale encoding.
* STRINGPREP_NFKC_FAILED: The Unicode NFKC operation failed. This
* usually indicate an internal error in the library.
* STRINGPREP_MALLOC_ERROR: The malloc() was out of memory. This is
* usually a fatal error.
*
* Return value: Returns a pointer to a statically allocated string
* containing a description of the error with the return code @rc.
**/
const char *
stringprep_strerror (Stringprep_rc rc)
{
const char *p;
bindtextdomain (PACKAGE, LOCALEDIR);
switch (rc)
{
case STRINGPREP_OK:
p = _("Success");
break;
case STRINGPREP_CONTAINS_UNASSIGNED:
p = _("Forbidden unassigned code points in input");
break;
case STRINGPREP_CONTAINS_PROHIBITED:
p = _("Prohibited code points in input");
break;
case STRINGPREP_BIDI_BOTH_L_AND_RAL:
p = _("Conflicting bidirectional properties in input");
break;
case STRINGPREP_BIDI_LEADTRAIL_NOT_RAL:
p = _("Malformed bidirectional string");
break;
case STRINGPREP_BIDI_CONTAINS_PROHIBITED:
p = _("Prohibited bidirectional code points in input");
break;
case STRINGPREP_TOO_SMALL_BUFFER:
p = _("Output would exceed the buffer space provided");
break;
case STRINGPREP_PROFILE_ERROR:
p = _("Error in stringprep profile definition");
break;
case STRINGPREP_FLAG_ERROR:
p = _("Flag conflict with profile");
break;
case STRINGPREP_UNKNOWN_PROFILE:
p = _("Unknown profile");
break;
case STRINGPREP_ICONV_ERROR:
p = _("Could not convert string in locale encoding.");
break;
case STRINGPREP_NFKC_FAILED:
p = _("Unicode normalization failed (internal error)");
break;
case STRINGPREP_MALLOC_ERROR:
p = _("Cannot allocate memory");
break;
default:
p = _("Unknown error");
break;
}
return p;
}

97
Example/Pods/libidn/lib/strerror-tld.c generated Normal file
View File

@ -0,0 +1,97 @@
/* strerror-tld.c --- Convert TLD errors into text.
Copyright (C) 2004-2015 Simon Josefsson
This file is part of GNU Libidn.
GNU Libidn is free software: you can redistribute it and/or
modify it under the terms of either:
* the GNU Lesser General Public License as published by the Free
Software Foundation; either version 3 of the License, or (at
your option) any later version.
or
* the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at
your option) any later version.
or both in parallel, as here.
GNU Libidn is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received copies of the GNU General Public License and
the GNU Lesser General Public License along with this program. If
not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include "tld.h"
#include "gettext.h"
#define _(String) dgettext (PACKAGE, String)
/**
* tld_strerror:
* @rc: tld return code
*
* Convert a return code integer to a text string. This string can be
* used to output a diagnostic message to the user.
*
* TLD_SUCCESS: Successful operation. This value is guaranteed to
* always be zero, the remaining ones are only guaranteed to hold
* non-zero values, for logical comparison purposes.
* TLD_INVALID: Invalid character found.
* TLD_NODATA: No input data was provided.
* TLD_MALLOC_ERROR: Error during memory allocation.
* TLD_ICONV_ERROR: Error during iconv string conversion.
* TLD_NO_TLD: No top-level domain found in domain string.
*
* Return value: Returns a pointer to a statically allocated string
* containing a description of the error with the return code @rc.
**/
const char *
tld_strerror (Tld_rc rc)
{
const char *p;
bindtextdomain (PACKAGE, LOCALEDIR);
switch (rc)
{
case TLD_SUCCESS:
p = _("Success");
break;
case TLD_INVALID:
p = _("Code points prohibited by top-level domain");
break;
case TLD_NODATA:
p = _("Missing input");
break;
case TLD_MALLOC_ERROR:
p = _("Cannot allocate memory");
break;
case TLD_ICONV_ERROR:
p = _("System iconv failed");
break;
case TLD_NO_TLD:
p = _("No top-level domain found in input");
break;
default:
p = _("Unknown error");
break;
}
return p;
}

692
Example/Pods/libidn/lib/stringprep.c generated Normal file
View File

@ -0,0 +1,692 @@
/* stringprep.c --- Core stringprep implementation.
Copyright (C) 2002-2015 Simon Josefsson
This file is part of GNU Libidn.
GNU Libidn is free software: you can redistribute it and/or
modify it under the terms of either:
* the GNU Lesser General Public License as published by the Free
Software Foundation; either version 3 of the License, or (at
your option) any later version.
or
* the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at
your option) any later version.
or both in parallel, as here.
GNU Libidn is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received copies of the GNU General Public License and
the GNU Lesser General Public License along with this program. If
not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <stdlib.h>
#include <string.h>
#include "stringprep.h"
static ssize_t
stringprep_find_character_in_table (uint32_t ucs4,
const Stringprep_table_element * table)
{
ssize_t i;
/* This is where typical uses of Libidn spends very close to all CPU
time and causes most cache misses. One could easily do a binary
search instead. Before rewriting this, I want hard evidence this
slowness is at all relevant in typical applications. (I don't
dispute optimization may improve matters significantly, I'm
mostly interested in having someone give real-world benchmark on
the impact of libidn.) */
for (i = 0; table[i].start || table[i].end; i++)
if (ucs4 >= table[i].start &&
ucs4 <= (table[i].end ? table[i].end : table[i].start))
return i;
return -1;
}
static ssize_t
stringprep_find_string_in_table (uint32_t * ucs4,
size_t ucs4len,
size_t * tablepos,
const Stringprep_table_element * table)
{
size_t j;
ssize_t pos;
for (j = 0; j < ucs4len; j++)
if ((pos = stringprep_find_character_in_table (ucs4[j], table)) != -1)
{
if (tablepos)
*tablepos = pos;
return j;
}
return -1;
}
static int
stringprep_apply_table_to_string (uint32_t * ucs4,
size_t * ucs4len,
size_t maxucs4len,
const Stringprep_table_element * table)
{
ssize_t pos;
size_t i, maplen;
while ((pos = stringprep_find_string_in_table (ucs4, *ucs4len,
&i, table)) != -1)
{
for (maplen = STRINGPREP_MAX_MAP_CHARS;
maplen > 0 && table[i].map[maplen - 1] == 0; maplen--)
;
if (*ucs4len - 1 + maplen >= maxucs4len)
return STRINGPREP_TOO_SMALL_BUFFER;
memmove (&ucs4[pos + maplen], &ucs4[pos + 1],
sizeof (uint32_t) * (*ucs4len - pos - 1));
memcpy (&ucs4[pos], table[i].map, sizeof (uint32_t) * maplen);
*ucs4len = *ucs4len - 1 + maplen;
}
return STRINGPREP_OK;
}
#define INVERTED(x) ((x) & ((~0UL) >> 1))
#define UNAPPLICAPLEFLAGS(flags, profileflags) \
((!INVERTED(profileflags) && !(profileflags & flags) && profileflags) || \
( INVERTED(profileflags) && (profileflags & flags)))
/**
* stringprep_4i:
* @ucs4: input/output array with string to prepare.
* @len: on input, length of input array with Unicode code points,
* on exit, length of output array with Unicode code points.
* @maxucs4len: maximum length of input/output array.
* @flags: a #Stringprep_profile_flags value, or 0.
* @profile: pointer to #Stringprep_profile to use.
*
* Prepare the input UCS-4 string according to the stringprep profile,
* and write back the result to the input string.
*
* The input is not required to be zero terminated (@ucs4[@len] = 0).
* The output will not be zero terminated unless @ucs4[@len] = 0.
* Instead, see stringprep_4zi() if your input is zero terminated or
* if you want the output to be.
*
* Since the stringprep operation can expand the string, @maxucs4len
* indicate how large the buffer holding the string is. This function
* will not read or write to code points outside that size.
*
* The @flags are one of #Stringprep_profile_flags values, or 0.
*
* The @profile contain the #Stringprep_profile instructions to
* perform. Your application can define new profiles, possibly
* re-using the generic stringprep tables that always will be part of
* the library, or use one of the currently supported profiles.
*
* Return value: Returns %STRINGPREP_OK iff successful, or an
* #Stringprep_rc error code.
**/
int
stringprep_4i (uint32_t * ucs4, size_t * len, size_t maxucs4len,
Stringprep_profile_flags flags,
const Stringprep_profile * profile)
{
size_t i, j;
ssize_t k;
size_t ucs4len = *len;
int rc;
for (i = 0; profile[i].operation; i++)
{
switch (profile[i].operation)
{
case STRINGPREP_NFKC:
{
uint32_t *q = 0;
if (UNAPPLICAPLEFLAGS (flags, profile[i].flags))
break;
if (flags & STRINGPREP_NO_NFKC && !profile[i].flags)
/* Profile requires NFKC, but callee asked for no NFKC. */
return STRINGPREP_FLAG_ERROR;
q = stringprep_ucs4_nfkc_normalize (ucs4, ucs4len);
if (!q)
return STRINGPREP_NFKC_FAILED;
for (ucs4len = 0; q[ucs4len]; ucs4len++)
;
if (ucs4len >= maxucs4len)
{
free (q);
return STRINGPREP_TOO_SMALL_BUFFER;
}
memcpy (ucs4, q, ucs4len * sizeof (ucs4[0]));
free (q);
}
break;
case STRINGPREP_PROHIBIT_TABLE:
k = stringprep_find_string_in_table (ucs4, ucs4len,
NULL, profile[i].table);
if (k != -1)
return STRINGPREP_CONTAINS_PROHIBITED;
break;
case STRINGPREP_UNASSIGNED_TABLE:
if (UNAPPLICAPLEFLAGS (flags, profile[i].flags))
break;
if (flags & STRINGPREP_NO_UNASSIGNED)
{
k = stringprep_find_string_in_table
(ucs4, ucs4len, NULL, profile[i].table);
if (k != -1)
return STRINGPREP_CONTAINS_UNASSIGNED;
}
break;
case STRINGPREP_MAP_TABLE:
if (UNAPPLICAPLEFLAGS (flags, profile[i].flags))
break;
rc = stringprep_apply_table_to_string
(ucs4, &ucs4len, maxucs4len, profile[i].table);
if (rc != STRINGPREP_OK)
return rc;
break;
case STRINGPREP_BIDI_PROHIBIT_TABLE:
case STRINGPREP_BIDI_RAL_TABLE:
case STRINGPREP_BIDI_L_TABLE:
break;
case STRINGPREP_BIDI:
{
int done_prohibited = 0;
int done_ral = 0;
int done_l = 0;
size_t contains_ral = SIZE_MAX;
size_t contains_l = SIZE_MAX;
for (j = 0; profile[j].operation; j++)
if (profile[j].operation == STRINGPREP_BIDI_PROHIBIT_TABLE)
{
done_prohibited = 1;
k = stringprep_find_string_in_table (ucs4, ucs4len,
NULL,
profile[j].table);
if (k != -1)
return STRINGPREP_BIDI_CONTAINS_PROHIBITED;
}
else if (profile[j].operation == STRINGPREP_BIDI_RAL_TABLE)
{
done_ral = 1;
if (stringprep_find_string_in_table
(ucs4, ucs4len, NULL, profile[j].table) != -1)
contains_ral = j;
}
else if (profile[j].operation == STRINGPREP_BIDI_L_TABLE)
{
done_l = 1;
if (stringprep_find_string_in_table
(ucs4, ucs4len, NULL, profile[j].table) != -1)
contains_l = j;
}
if (!done_prohibited || !done_ral || !done_l)
return STRINGPREP_PROFILE_ERROR;
if (contains_ral != SIZE_MAX && contains_l != SIZE_MAX)
return STRINGPREP_BIDI_BOTH_L_AND_RAL;
if (contains_ral != SIZE_MAX)
{
if (!(stringprep_find_character_in_table
(ucs4[0], profile[contains_ral].table) != -1 &&
stringprep_find_character_in_table
(ucs4[ucs4len - 1], profile[contains_ral].table) != -1))
return STRINGPREP_BIDI_LEADTRAIL_NOT_RAL;
}
}
break;
default:
return STRINGPREP_PROFILE_ERROR;
break;
}
}
*len = ucs4len;
return STRINGPREP_OK;
}
static int
stringprep_4zi_1 (uint32_t * ucs4, size_t ucs4len, size_t maxucs4len,
Stringprep_profile_flags flags,
const Stringprep_profile * profile)
{
int rc;
rc = stringprep_4i (ucs4, &ucs4len, maxucs4len, flags, profile);
if (rc != STRINGPREP_OK)
return rc;
if (ucs4len >= maxucs4len)
return STRINGPREP_TOO_SMALL_BUFFER;
ucs4[ucs4len] = 0;
return STRINGPREP_OK;
}
/**
* stringprep_4zi:
* @ucs4: input/output array with zero terminated string to prepare.
* @maxucs4len: maximum length of input/output array.
* @flags: a #Stringprep_profile_flags value, or 0.
* @profile: pointer to #Stringprep_profile to use.
*
* Prepare the input zero terminated UCS-4 string according to the
* stringprep profile, and write back the result to the input string.
*
* Since the stringprep operation can expand the string, @maxucs4len
* indicate how large the buffer holding the string is. This function
* will not read or write to code points outside that size.
*
* The @flags are one of #Stringprep_profile_flags values, or 0.
*
* The @profile contain the #Stringprep_profile instructions to
* perform. Your application can define new profiles, possibly
* re-using the generic stringprep tables that always will be part of
* the library, or use one of the currently supported profiles.
*
* Return value: Returns %STRINGPREP_OK iff successful, or an
* #Stringprep_rc error code.
**/
int
stringprep_4zi (uint32_t * ucs4, size_t maxucs4len,
Stringprep_profile_flags flags,
const Stringprep_profile * profile)
{
size_t ucs4len;
for (ucs4len = 0; ucs4len < maxucs4len && ucs4[ucs4len] != 0; ucs4len++)
;
return stringprep_4zi_1 (ucs4, ucs4len, maxucs4len, flags, profile);
}
/**
* stringprep:
* @in: input/ouput array with string to prepare.
* @maxlen: maximum length of input/output array.
* @flags: a #Stringprep_profile_flags value, or 0.
* @profile: pointer to #Stringprep_profile to use.
*
* Prepare the input zero terminated UTF-8 string according to the
* stringprep profile, and write back the result to the input string.
*
* Note that you must convert strings entered in the systems locale
* into UTF-8 before using this function, see
* stringprep_locale_to_utf8().
*
* Since the stringprep operation can expand the string, @maxlen
* indicate how large the buffer holding the string is. This function
* will not read or write to characters outside that size.
*
* The @flags are one of #Stringprep_profile_flags values, or 0.
*
* The @profile contain the #Stringprep_profile instructions to
* perform. Your application can define new profiles, possibly
* re-using the generic stringprep tables that always will be part of
* the library, or use one of the currently supported profiles.
*
* Return value: Returns %STRINGPREP_OK iff successful, or an error code.
**/
int
stringprep (char *in,
size_t maxlen,
Stringprep_profile_flags flags,
const Stringprep_profile * profile)
{
int rc;
char *utf8 = NULL;
uint32_t *ucs4 = NULL;
size_t ucs4len, maxucs4len, adducs4len = 50;
do
{
uint32_t *newp;
free (ucs4);
ucs4 = stringprep_utf8_to_ucs4 (in, -1, &ucs4len);
if (ucs4 == NULL)
return STRINGPREP_ICONV_ERROR;
maxucs4len = ucs4len + adducs4len;
newp = realloc (ucs4, maxucs4len * sizeof (uint32_t));
if (!newp)
{
free (ucs4);
return STRINGPREP_MALLOC_ERROR;
}
ucs4 = newp;
rc = stringprep_4i (ucs4, &ucs4len, maxucs4len, flags, profile);
adducs4len += 50;
}
while (rc == STRINGPREP_TOO_SMALL_BUFFER);
if (rc != STRINGPREP_OK)
{
free (ucs4);
return rc;
}
utf8 = stringprep_ucs4_to_utf8 (ucs4, ucs4len, 0, 0);
free (ucs4);
if (!utf8)
return STRINGPREP_ICONV_ERROR;
if (strlen (utf8) >= maxlen)
{
free (utf8);
return STRINGPREP_TOO_SMALL_BUFFER;
}
strcpy (in, utf8); /* flawfinder: ignore */
free (utf8);
return STRINGPREP_OK;
}
/**
* stringprep_profile:
* @in: input array with UTF-8 string to prepare.
* @out: output variable with pointer to newly allocate string.
* @profile: name of stringprep profile to use.
* @flags: a #Stringprep_profile_flags value, or 0.
*
* Prepare the input zero terminated UTF-8 string according to the
* stringprep profile, and return the result in a newly allocated
* variable.
*
* Note that you must convert strings entered in the systems locale
* into UTF-8 before using this function, see
* stringprep_locale_to_utf8().
*
* The output @out variable must be deallocated by the caller.
*
* The @flags are one of #Stringprep_profile_flags values, or 0.
*
* The @profile specifies the name of the stringprep profile to use.
* It must be one of the internally supported stringprep profiles.
*
* Return value: Returns %STRINGPREP_OK iff successful, or an error code.
**/
int
stringprep_profile (const char *in,
char **out,
const char *profile, Stringprep_profile_flags flags)
{
const Stringprep_profiles *p;
char *str = NULL;
size_t len = strlen (in) + 1;
int rc;
for (p = &stringprep_profiles[0]; p->name; p++)
if (strcmp (p->name, profile) == 0)
break;
if (!p || !p->name || !p->tables)
return STRINGPREP_UNKNOWN_PROFILE;
do
{
free (str);
str = (char *) malloc (len);
if (str == NULL)
return STRINGPREP_MALLOC_ERROR;
strcpy (str, in);
rc = stringprep (str, len, flags, p->tables);
len += 50;
}
while (rc == STRINGPREP_TOO_SMALL_BUFFER);
if (rc == STRINGPREP_OK)
*out = str;
else
free (str);
return rc;
}
/*! \mainpage GNU Internationalized Domain Name Library
*
* \section intro Introduction
*
* GNU Libidn is an implementation of the Stringprep, Punycode and IDNA
* specifications defined by the IETF Internationalized Domain Names
* (IDN) working group, used for internationalized domain names. The
* package is available under the GNU Lesser General Public License.
*
* The library contains a generic Stringprep implementation that does
* Unicode 3.2 NFKC normalization, mapping and prohibitation of
* characters, and bidirectional character handling. Profiles for
* Nameprep, iSCSI, SASL and XMPP are included. Punycode and ASCII
* Compatible Encoding (ACE) via IDNA are supported. A mechanism to
* define Top-Level Domain (TLD) specific validation tables, and to
* compare strings against those tables, is included. Default tables
* for some TLDs are also included.
*
* The Stringprep API consists of two main functions, one for
* converting data from the system's native representation into UTF-8,
* and one function to perform the Stringprep processing. Adding a
* new Stringprep profile for your application within the API is
* straightforward. The Punycode API consists of one encoding
* function and one decoding function. The IDNA API consists of the
* ToASCII and ToUnicode functions, as well as an high-level interface
* for converting entire domain names to and from the ACE encoded
* form. The TLD API consists of one set of functions to extract the
* TLD name from a domain string, one set of functions to locate the
* proper TLD table to use based on the TLD name, and core functions
* to validate a string against a TLD table, and some utility wrappers
* to perform all the steps in one call.
*
* The library is used by, e.g., GNU SASL and Shishi to process user
* names and passwords. Libidn can be built into GNU Libc to enable a
* new system-wide getaddrinfo() flag for IDN processing.
*
* Libidn is developed for the GNU/Linux system, but runs on over 20 Unix
* platforms (including Solaris, IRIX, AIX, and Tru64) and Windows.
* Libidn is written in C and (parts of) the API is accessible from C,
* C++, Emacs Lisp, Python and Java.
*
* The project web page:\n
* http://www.gnu.org/software/libidn/
*
* The software archive:\n
* ftp://alpha.gnu.org/pub/gnu/libidn/
*
* For more information see:\n
* http://www.ietf.org/html.charters/idn-charter.html\n
* http://www.ietf.org/rfc/rfc3454.txt (stringprep specification)\n
* http://www.ietf.org/rfc/rfc3490.txt (idna specification)\n
* http://www.ietf.org/rfc/rfc3491.txt (nameprep specification)\n
* http://www.ietf.org/rfc/rfc3492.txt (punycode specification)\n
* http://www.ietf.org/internet-drafts/draft-ietf-ips-iscsi-string-prep-04.txt\n
* http://www.ietf.org/internet-drafts/draft-ietf-krb-wg-utf8-profile-01.txt\n
* http://www.ietf.org/internet-drafts/draft-ietf-sasl-anon-00.txt\n
* http://www.ietf.org/internet-drafts/draft-ietf-sasl-saslprep-00.txt\n
* http://www.ietf.org/internet-drafts/draft-ietf-xmpp-nodeprep-01.txt\n
* http://www.ietf.org/internet-drafts/draft-ietf-xmpp-resourceprep-01.txt\n
*
* Further information and paid contract development:\n
* Simon Josefsson <simon@josefsson.org>
*
* \section examples Examples
*
* \include example.c
* \include example3.c
* \include example4.c
* \include example5.c
*/
/**
* STRINGPREP_VERSION
*
* String defined via CPP denoting the header file version number.
* Used together with stringprep_check_version() to verify header file
* and run-time library consistency.
*/
/**
* STRINGPREP_MAX_MAP_CHARS
*
* Maximum number of code points that can replace a single code point,
* during stringprep mapping.
*/
/**
* Stringprep_rc:
* @STRINGPREP_OK: Successful operation. This value is guaranteed to
* always be zero, the remaining ones are only guaranteed to hold
* non-zero values, for logical comparison purposes.
* @STRINGPREP_CONTAINS_UNASSIGNED: String contain unassigned Unicode
* code points, which is forbidden by the profile.
* @STRINGPREP_CONTAINS_PROHIBITED: String contain code points
* prohibited by the profile.
* @STRINGPREP_BIDI_BOTH_L_AND_RAL: String contain code points with
* conflicting bidirection category.
* @STRINGPREP_BIDI_LEADTRAIL_NOT_RAL: Leading and trailing character
* in string not of proper bidirectional category.
* @STRINGPREP_BIDI_CONTAINS_PROHIBITED: Contains prohibited code
* points detected by bidirectional code.
* @STRINGPREP_TOO_SMALL_BUFFER: Buffer handed to function was too
* small. This usually indicate a problem in the calling
* application.
* @STRINGPREP_PROFILE_ERROR: The stringprep profile was inconsistent.
* This usually indicate an internal error in the library.
* @STRINGPREP_FLAG_ERROR: The supplied flag conflicted with profile.
* This usually indicate a problem in the calling application.
* @STRINGPREP_UNKNOWN_PROFILE: The supplied profile name was not
* known to the library.
* @STRINGPREP_ICONV_ERROR: Could not convert string in locale encoding.
* @STRINGPREP_NFKC_FAILED: The Unicode NFKC operation failed. This
* usually indicate an internal error in the library.
* @STRINGPREP_MALLOC_ERROR: The malloc() was out of memory. This is
* usually a fatal error.
*
* Enumerated return codes of stringprep(), stringprep_profile()
* functions (and macros using those functions). The value 0 is
* guaranteed to always correspond to success.
*/
/**
* Stringprep_profile_flags:
* @STRINGPREP_NO_NFKC: Disable the NFKC normalization, as well as
* selecting the non-NFKC case folding tables. Usually the profile
* specifies BIDI and NFKC settings, and applications should not
* override it unless in special situations.
* @STRINGPREP_NO_BIDI: Disable the BIDI step. Usually the profile
* specifies BIDI and NFKC settings, and applications should not
* override it unless in special situations.
* @STRINGPREP_NO_UNASSIGNED: Make the library return with an error if
* string contains unassigned characters according to profile.
*
* Stringprep profile flags.
*/
/**
* Stringprep_profile_steps:
* @STRINGPREP_NFKC: The NFKC step.
* @STRINGPREP_BIDI: The BIDI step.
* @STRINGPREP_MAP_TABLE: The MAP step.
* @STRINGPREP_UNASSIGNED_TABLE: The Unassigned step.
* @STRINGPREP_PROHIBIT_TABLE: The Prohibited step.
* @STRINGPREP_BIDI_PROHIBIT_TABLE: The BIDI-Prohibited step.
* @STRINGPREP_BIDI_RAL_TABLE: The BIDI-RAL step.
* @STRINGPREP_BIDI_L_TABLE: The BIDI-L step.
*
* Various steps in the stringprep algorithm. You really want to
* study the source code to understand this one. Only useful if you
* want to add another profile.
*/
/**
* stringprep_nameprep:
* @in: input/ouput array with string to prepare.
* @maxlen: maximum length of input/output array.
*
* Prepare the input UTF-8 string according to the nameprep profile.
* The AllowUnassigned flag is true, use
* stringprep_nameprep_no_unassigned() if you want a false
* AllowUnassigned. Returns 0 iff successful, or an error code.
**/
/**
* stringprep_nameprep_no_unassigned:
* @in: input/ouput array with string to prepare.
* @maxlen: maximum length of input/output array.
*
* Prepare the input UTF-8 string according to the nameprep profile.
* The AllowUnassigned flag is false, use stringprep_nameprep() for
* true AllowUnassigned. Returns 0 iff successful, or an error code.
**/
/**
* stringprep_iscsi:
* @in: input/ouput array with string to prepare.
* @maxlen: maximum length of input/output array.
*
* Prepare the input UTF-8 string according to the draft iSCSI
* stringprep profile. Returns 0 iff successful, or an error code.
**/
/**
* stringprep_plain:
* @in: input/ouput array with string to prepare.
* @maxlen: maximum length of input/output array.
*
* Prepare the input UTF-8 string according to the draft SASL
* ANONYMOUS profile. Returns 0 iff successful, or an error code.
**/
/**
* stringprep_xmpp_nodeprep:
* @in: input/ouput array with string to prepare.
* @maxlen: maximum length of input/output array.
*
* Prepare the input UTF-8 string according to the draft XMPP node
* identifier profile. Returns 0 iff successful, or an error code.
**/
/**
* stringprep_xmpp_resourceprep:
* @in: input/ouput array with string to prepare.
* @maxlen: maximum length of input/output array.
*
* Prepare the input UTF-8 string according to the draft XMPP resource
* identifier profile. Returns 0 iff successful, or an error code.
**/

242
Example/Pods/libidn/lib/stringprep.h generated Normal file
View File

@ -0,0 +1,242 @@
/* stringprep.h --- Header file for stringprep functions.
Copyright (C) 2002-2015 Simon Josefsson
This file is part of GNU Libidn.
GNU Libidn is free software: you can redistribute it and/or
modify it under the terms of either:
* the GNU Lesser General Public License as published by the Free
Software Foundation; either version 3 of the License, or (at
your option) any later version.
or
* the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at
your option) any later version.
or both in parallel, as here.
GNU Libidn is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received copies of the GNU General Public License and
the GNU Lesser General Public License along with this program. If
not, see <http://www.gnu.org/licenses/>. */
#ifndef STRINGPREP_H
# define STRINGPREP_H
# ifndef IDNAPI
# if defined LIBIDN_BUILDING && defined HAVE_VISIBILITY && HAVE_VISIBILITY
# define IDNAPI __attribute__((__visibility__("default")))
# elif defined LIBIDN_BUILDING && defined _MSC_VER && ! defined LIBIDN_STATIC
# define IDNAPI __declspec(dllexport)
# elif defined _MSC_VER && ! defined LIBIDN_STATIC
# define IDNAPI __declspec(dllimport)
# else
# define IDNAPI
# endif
# endif
# include <stddef.h> /* size_t */
# include <sys/types.h> /* ssize_t */
# include "idn-int.h" /* uint32_t */
# ifdef __cplusplus
extern "C"
{
# endif
# define STRINGPREP_VERSION "1.32"
/* Error codes. */
typedef enum
{
STRINGPREP_OK = 0,
/* Stringprep errors. */
STRINGPREP_CONTAINS_UNASSIGNED = 1,
STRINGPREP_CONTAINS_PROHIBITED = 2,
STRINGPREP_BIDI_BOTH_L_AND_RAL = 3,
STRINGPREP_BIDI_LEADTRAIL_NOT_RAL = 4,
STRINGPREP_BIDI_CONTAINS_PROHIBITED = 5,
/* Error in calling application. */
STRINGPREP_TOO_SMALL_BUFFER = 100,
STRINGPREP_PROFILE_ERROR = 101,
STRINGPREP_FLAG_ERROR = 102,
STRINGPREP_UNKNOWN_PROFILE = 103,
STRINGPREP_ICONV_ERROR = 104,
/* Internal errors. */
STRINGPREP_NFKC_FAILED = 200,
STRINGPREP_MALLOC_ERROR = 201
} Stringprep_rc;
/* Flags used when calling stringprep(). */
typedef enum
{
STRINGPREP_NO_NFKC = 1,
STRINGPREP_NO_BIDI = 2,
STRINGPREP_NO_UNASSIGNED = 4
} Stringprep_profile_flags;
/* Steps in a stringprep profile. */
typedef enum
{
STRINGPREP_NFKC = 1,
STRINGPREP_BIDI = 2,
STRINGPREP_MAP_TABLE = 3,
STRINGPREP_UNASSIGNED_TABLE = 4,
STRINGPREP_PROHIBIT_TABLE = 5,
STRINGPREP_BIDI_PROHIBIT_TABLE = 6,
STRINGPREP_BIDI_RAL_TABLE = 7,
STRINGPREP_BIDI_L_TABLE = 8
} Stringprep_profile_steps;
# define STRINGPREP_MAX_MAP_CHARS 4
struct Stringprep_table_element
{
uint32_t start;
uint32_t end; /* 0 if only one character */
uint32_t map[STRINGPREP_MAX_MAP_CHARS]; /* NULL if end is not 0 */
};
typedef struct Stringprep_table_element Stringprep_table_element;
struct Stringprep_table
{
Stringprep_profile_steps operation;
Stringprep_profile_flags flags;
const Stringprep_table_element *table;
};
typedef struct Stringprep_table Stringprep_profile;
struct Stringprep_profiles
{
const char *name;
const Stringprep_profile *tables;
};
typedef struct Stringprep_profiles Stringprep_profiles;
extern IDNAPI const Stringprep_profiles stringprep_profiles[];
/* Profiles */
extern IDNAPI const Stringprep_table_element stringprep_rfc3454_A_1[];
extern IDNAPI const Stringprep_table_element stringprep_rfc3454_B_1[];
extern IDNAPI const Stringprep_table_element stringprep_rfc3454_B_2[];
extern IDNAPI const Stringprep_table_element stringprep_rfc3454_B_3[];
extern IDNAPI const Stringprep_table_element stringprep_rfc3454_C_1_1[];
extern IDNAPI const Stringprep_table_element stringprep_rfc3454_C_1_2[];
extern IDNAPI const Stringprep_table_element stringprep_rfc3454_C_2_1[];
extern IDNAPI const Stringprep_table_element stringprep_rfc3454_C_2_2[];
extern IDNAPI const Stringprep_table_element stringprep_rfc3454_C_3[];
extern IDNAPI const Stringprep_table_element stringprep_rfc3454_C_4[];
extern IDNAPI const Stringprep_table_element stringprep_rfc3454_C_5[];
extern IDNAPI const Stringprep_table_element stringprep_rfc3454_C_6[];
extern IDNAPI const Stringprep_table_element stringprep_rfc3454_C_7[];
extern IDNAPI const Stringprep_table_element stringprep_rfc3454_C_8[];
extern IDNAPI const Stringprep_table_element stringprep_rfc3454_C_9[];
extern IDNAPI const Stringprep_table_element stringprep_rfc3454_D_1[];
extern IDNAPI const Stringprep_table_element stringprep_rfc3454_D_2[];
/* Nameprep */
extern IDNAPI const Stringprep_profile stringprep_nameprep[];
# define stringprep_nameprep(in, maxlen) \
stringprep(in, maxlen, 0, stringprep_nameprep)
# define stringprep_nameprep_no_unassigned(in, maxlen) \
stringprep(in, maxlen, STRINGPREP_NO_UNASSIGNED, stringprep_nameprep)
/* SASL */
extern IDNAPI const Stringprep_profile stringprep_saslprep[];
extern IDNAPI const Stringprep_table_element stringprep_saslprep_space_map[];
extern IDNAPI const Stringprep_profile stringprep_plain[];
extern IDNAPI const Stringprep_profile stringprep_trace[];
# define stringprep_plain(in, maxlen) \
stringprep(in, maxlen, 0, stringprep_plain)
/* Kerberos */
extern IDNAPI const Stringprep_profile stringprep_kerberos5[];
# define stringprep_kerberos5(in, maxlen) \
stringprep(in, maxlen, 0, stringprep_kerberos5)
/* XMPP */
extern IDNAPI const Stringprep_profile stringprep_xmpp_nodeprep[];
extern IDNAPI const Stringprep_profile stringprep_xmpp_resourceprep[];
extern IDNAPI const Stringprep_table_element stringprep_xmpp_nodeprep_prohibit[];
# define stringprep_xmpp_nodeprep(in, maxlen) \
stringprep(in, maxlen, 0, stringprep_xmpp_nodeprep)
# define stringprep_xmpp_resourceprep(in, maxlen) \
stringprep(in, maxlen, 0, stringprep_xmpp_resourceprep)
/* iSCSI */
extern IDNAPI const Stringprep_profile stringprep_iscsi[];
extern IDNAPI const Stringprep_table_element stringprep_iscsi_prohibit[];
# define stringprep_iscsi(in, maxlen) \
stringprep(in, maxlen, 0, stringprep_iscsi)
/* API */
extern IDNAPI int stringprep_4i (uint32_t * ucs4, size_t * len,
size_t maxucs4len,
Stringprep_profile_flags flags,
const Stringprep_profile * profile);
extern IDNAPI int stringprep_4zi (uint32_t * ucs4, size_t maxucs4len,
Stringprep_profile_flags flags,
const Stringprep_profile * profile);
extern IDNAPI int stringprep (char *in, size_t maxlen,
Stringprep_profile_flags flags,
const Stringprep_profile * profile);
extern IDNAPI int stringprep_profile (const char *in,
char **out,
const char *profile,
Stringprep_profile_flags flags);
extern IDNAPI const char *stringprep_strerror (Stringprep_rc rc);
extern IDNAPI const char *stringprep_check_version (const char
*req_version);
/* Utility */
extern IDNAPI int stringprep_unichar_to_utf8 (uint32_t c, char *outbuf);
extern IDNAPI uint32_t stringprep_utf8_to_unichar (const char *p);
extern IDNAPI uint32_t *stringprep_utf8_to_ucs4 (const char *str,
ssize_t len,
size_t * items_written);
extern IDNAPI char *stringprep_ucs4_to_utf8 (const uint32_t * str,
ssize_t len,
size_t * items_read,
size_t * items_written);
extern IDNAPI char *stringprep_utf8_nfkc_normalize (const char *str,
ssize_t len);
extern IDNAPI uint32_t *stringprep_ucs4_nfkc_normalize (const uint32_t * str,
ssize_t len);
extern IDNAPI const char *stringprep_locale_charset (void);
extern IDNAPI char *stringprep_convert (const char *str,
const char *to_codeset,
const char *from_codeset);
extern IDNAPI char *stringprep_locale_to_utf8 (const char *str);
extern IDNAPI char *stringprep_utf8_to_locale (const char *str);
# ifdef __cplusplus
}
# endif
#endif /* STRINGPREP_H */

527
Example/Pods/libidn/lib/tld.c generated Normal file
View File

@ -0,0 +1,527 @@
/* tld.c --- Declarations for TLD restriction checking.
Copyright (C) 2004-2015 Simon Josefsson.
Copyright (C) 2003-2014 Free Software Foundation, Inc.
Author: Thomas Jacob, Internet24.de
This file is part of GNU Libidn.
GNU Libidn is free software: you can redistribute it and/or
modify it under the terms of either:
* the GNU Lesser General Public License as published by the Free
Software Foundation; either version 3 of the License, or (at
your option) any later version.
or
* the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at
your option) any later version.
or both in parallel, as here.
GNU Libidn is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received copies of the GNU General Public License and
the GNU Lesser General Public License along with this program. If
not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
/* Get stringprep_utf8_to_ucs4, stringprep_locale_to_utf8. */
#include <stringprep.h>
/* Get strcmp(). */
#include <string.h>
/* Get specifications. */
#include <tld.h>
/* Array of built-in domain restriction structures. See tlds.c. */
extern const Tld_table *_tld_tables[];
/**
* tld_get_table:
* @tld: TLD name (e.g. "com") as zero terminated ASCII byte string.
* @tables: Zero terminated array of #Tld_table info-structures for
* TLDs.
*
* Get the TLD table for a named TLD by searching through the given
* TLD table array.
*
* Return value: Return structure corresponding to TLD @tld by going
* thru @tables, or return %NULL if no such structure is found.
*/
const Tld_table *
tld_get_table (const char *tld, const Tld_table ** tables)
{
const Tld_table **tldtable = NULL;
if (!tld || !tables)
return NULL;
for (tldtable = tables; *tldtable; tldtable++)
if (!strcmp ((*tldtable)->name, tld))
return *tldtable;
return NULL;
}
/**
* tld_default_table:
* @tld: TLD name (e.g. "com") as zero terminated ASCII byte string.
* @overrides: Additional zero terminated array of #Tld_table
* info-structures for TLDs, or %NULL to only use library deault
* tables.
*
* Get the TLD table for a named TLD, using the internal defaults,
* possibly overrided by the (optional) supplied tables.
*
* Return value: Return structure corresponding to TLD @tld_str, first
* looking through @overrides then thru built-in list, or %NULL if
* no such structure found.
*/
const Tld_table *
tld_default_table (const char *tld, const Tld_table ** overrides)
{
const Tld_table *tldtable = NULL;
if (!tld)
return NULL;
if (overrides)
tldtable = tld_get_table (tld, overrides);
if (!tldtable)
tldtable = tld_get_table (tld, _tld_tables);
return tldtable;
}
#define DOTP(c) ((c) == 0x002E || (c) == 0x3002 || \
(c) == 0xFF0E || (c) == 0xFF61)
/**
* tld_get_4:
* @in: Array of unicode code points to process. Does not need to be
* zero terminated.
* @inlen: Number of unicode code points.
* @out: Zero terminated ascii result string pointer.
*
* Isolate the top-level domain of @in and return it as an ASCII
* string in @out.
*
* Return value: Return %TLD_SUCCESS on success, or the corresponding
* #Tld_rc error code otherwise.
*/
int
tld_get_4 (const uint32_t * in, size_t inlen, char **out)
{
const uint32_t *ipos;
size_t olen;
*out = NULL;
if (!in || inlen == 0)
return TLD_NODATA;
ipos = &in[inlen - 1];
olen = 0;
/* Scan backwards for non(latin)letters. */
while (ipos >= in && ((*ipos >= 0x41 && *ipos <= 0x5A) ||
(*ipos >= 0x61 && *ipos <= 0x7A)))
ipos--, olen++;
if (olen > 0 && ipos >= in && DOTP (*ipos))
{
/* Found something that appears a TLD. */
char *out_s = malloc (sizeof (char) * (olen + 1));
char *opos = out_s;
if (!opos)
return TLD_MALLOC_ERROR;
ipos++;
/* Transcribe to lowercase ascii string. */
for (; ipos < &in[inlen]; ipos++, opos++)
*opos = *ipos > 0x5A ? *ipos : *ipos + 0x20;
*opos = 0;
*out = out_s;
return TLD_SUCCESS;
}
return TLD_NO_TLD;
}
/**
* tld_get_4z:
* @in: Zero terminated array of unicode code points to process.
* @out: Zero terminated ascii result string pointer.
*
* Isolate the top-level domain of @in and return it as an ASCII
* string in @out.
*
* Return value: Return %TLD_SUCCESS on success, or the corresponding
* #Tld_rc error code otherwise.
*/
int
tld_get_4z (const uint32_t * in, char **out)
{
const uint32_t *ipos = in;
if (!in)
return TLD_NODATA;
while (*ipos)
ipos++;
return tld_get_4 (in, ipos - in, out);
}
/**
* tld_get_z:
* @in: Zero terminated character array to process.
* @out: Zero terminated ascii result string pointer.
*
* Isolate the top-level domain of @in and return it as an ASCII
* string in @out. The input string @in may be UTF-8, ISO-8859-1 or
* any ASCII compatible character encoding.
*
* Return value: Return %TLD_SUCCESS on success, or the corresponding
* #Tld_rc error code otherwise.
*/
int
tld_get_z (const char *in, char **out)
{
uint32_t *iucs;
size_t i, ilen;
int rc;
ilen = strlen (in);
iucs = calloc (ilen, sizeof (*iucs));
if (!iucs)
return TLD_MALLOC_ERROR;
for (i = 0; i < ilen; i++)
iucs[i] = in[i];
rc = tld_get_4 (iucs, ilen, out);
free (iucs);
return rc;
}
/*
* tld_checkchar - verify that character is permitted
* @ch: 32 bit unicode character to check.
* @tld: A #Tld_table data structure to check @ch against.
*
* Verify if @ch is either in [a-z0-9-.] or mentioned as a valid
* character in @tld.
*
* Return value: Return the #Tld_rc value %TLD_SUCCESS if @ch is a
* valid character for the TLD @tld or if @tld is %NULL,
* %TLD_INVALID if @ch is invalid as defined by @tld.
*/
static int
_tld_checkchar (uint32_t ch, const Tld_table * tld)
{
const Tld_table_element *s, *e, *m;
if (!tld)
return TLD_SUCCESS;
/* Check for [-a-z0-9.]. */
if ((ch >= 0x61 && ch <= 0x7A) ||
(ch >= 0x30 && ch <= 0x39) || ch == 0x2D || DOTP (ch))
return TLD_SUCCESS;
s = tld->valid;
e = s + tld->nvalid;
while (s < e)
{
m = s + ((e - s) >> 1);
if (ch < m->start)
e = m;
else if (ch > m->end)
s = m + 1;
else
return TLD_SUCCESS;
}
return TLD_INVALID;
}
/**
* tld_check_4t:
* @in: Array of unicode code points to process. Does not need to be
* zero terminated.
* @inlen: Number of unicode code points.
* @errpos: Position of offending character is returned here.
* @tld: A #Tld_table data structure representing the restrictions for
* which the input should be tested.
*
* Test each of the code points in @in for whether or not
* they are allowed by the data structure in @tld, return
* the position of the first character for which this is not
* the case in @errpos.
*
* Return value: Returns the #Tld_rc value %TLD_SUCCESS if all code
* points are valid or when @tld is null, %TLD_INVALID if a
* character is not allowed, or additional error codes on general
* failure conditions.
*/
int
tld_check_4t (const uint32_t * in, size_t inlen, size_t * errpos,
const Tld_table * tld)
{
const uint32_t *ipos;
int rc;
if (!tld) /* No data for TLD so everything is valid. */
return TLD_SUCCESS;
ipos = in;
while (ipos < &in[inlen])
{
rc = _tld_checkchar (*ipos, tld);
if (rc != TLD_SUCCESS)
{
if (errpos)
*errpos = ipos - in;
return rc;
}
ipos++;
}
return TLD_SUCCESS;
}
/**
* tld_check_4tz:
* @in: Zero terminated array of unicode code points to process.
* @errpos: Position of offending character is returned here.
* @tld: A #Tld_table data structure representing the restrictions for
* which the input should be tested.
*
* Test each of the code points in @in for whether or not
* they are allowed by the data structure in @tld, return
* the position of the first character for which this is not
* the case in @errpos.
*
* Return value: Returns the #Tld_rc value %TLD_SUCCESS if all code
* points are valid or when @tld is null, %TLD_INVALID if a
* character is not allowed, or additional error codes on general
* failure conditions.
*/
int
tld_check_4tz (const uint32_t * in, size_t * errpos, const Tld_table * tld)
{
const uint32_t *ipos = in;
if (!ipos)
return TLD_NODATA;
while (*ipos)
ipos++;
return tld_check_4t (in, ipos - in, errpos, tld);
}
/**
* tld_check_4:
* @in: Array of unicode code points to process. Does not need to be
* zero terminated.
* @inlen: Number of unicode code points.
* @errpos: Position of offending character is returned here.
* @overrides: A #Tld_table array of additional domain restriction
* structures that complement and supersede the built-in information.
*
* Test each of the code points in @in for whether or not they are
* allowed by the information in @overrides or by the built-in TLD
* restriction data. When data for the same TLD is available both
* internally and in @overrides, the information in @overrides takes
* precedence. If several entries for a specific TLD are found, the
* first one is used. If @overrides is %NULL, only the built-in
* information is used. The position of the first offending character
* is returned in @errpos.
*
* Return value: Returns the #Tld_rc value %TLD_SUCCESS if all code
* points are valid or when @tld is null, %TLD_INVALID if a
* character is not allowed, or additional error codes on general
* failure conditions.
*/
int
tld_check_4 (const uint32_t * in, size_t inlen, size_t * errpos,
const Tld_table ** overrides)
{
const Tld_table *tld;
char *domain;
int rc;
if (errpos)
*errpos = 0;
/* Get TLD name. */
rc = tld_get_4 (in, inlen, &domain);
if (rc != TLD_SUCCESS)
{
if (rc == TLD_NO_TLD) /* No TLD, say OK */
return TLD_SUCCESS;
else
return rc;
}
/* Retrieve appropriate data structure. */
tld = tld_default_table (domain, overrides);
free (domain);
return tld_check_4t (in, inlen, errpos, tld);
}
/**
* tld_check_4z:
* @in: Zero-terminated array of unicode code points to process.
* @errpos: Position of offending character is returned here.
* @overrides: A #Tld_table array of additional domain restriction
* structures that complement and supersede the built-in information.
*
* Test each of the code points in @in for whether or not they are
* allowed by the information in @overrides or by the built-in TLD
* restriction data. When data for the same TLD is available both
* internally and in @overrides, the information in @overrides takes
* precedence. If several entries for a specific TLD are found, the
* first one is used. If @overrides is %NULL, only the built-in
* information is used. The position of the first offending character
* is returned in @errpos.
*
* Return value: Returns the #Tld_rc value %TLD_SUCCESS if all code
* points are valid or when @tld is null, %TLD_INVALID if a
* character is not allowed, or additional error codes on general
* failure conditions.
*/
int
tld_check_4z (const uint32_t * in, size_t * errpos,
const Tld_table ** overrides)
{
const uint32_t *ipos = in;
if (!ipos)
return TLD_NODATA;
while (*ipos)
ipos++;
return tld_check_4 (in, ipos - in, errpos, overrides);
}
/**
* tld_check_8z:
* @in: Zero-terminated UTF8 string to process.
* @errpos: Position of offending character is returned here.
* @overrides: A #Tld_table array of additional domain restriction
* structures that complement and supersede the built-in information.
*
* Test each of the characters in @in for whether or not they are
* allowed by the information in @overrides or by the built-in TLD
* restriction data. When data for the same TLD is available both
* internally and in @overrides, the information in @overrides takes
* precedence. If several entries for a specific TLD are found, the
* first one is used. If @overrides is %NULL, only the built-in
* information is used. The position of the first offending character
* is returned in @errpos. Note that the error position refers to the
* decoded character offset rather than the byte position in the
* string.
*
* Return value: Returns the #Tld_rc value %TLD_SUCCESS if all
* characters are valid or when @tld is null, %TLD_INVALID if a
* character is not allowed, or additional error codes on general
* failure conditions.
*/
int
tld_check_8z (const char *in, size_t * errpos, const Tld_table ** overrides)
{
uint32_t *iucs;
size_t ilen;
int rc;
if (!in)
return TLD_NODATA;
iucs = stringprep_utf8_to_ucs4 (in, -1, &ilen);
if (!iucs)
return TLD_MALLOC_ERROR;
rc = tld_check_4 (iucs, ilen, errpos, overrides);
free (iucs);
return rc;
}
/**
* tld_check_lz:
* @in: Zero-terminated string in the current locales encoding to process.
* @errpos: Position of offending character is returned here.
* @overrides: A #Tld_table array of additional domain restriction
* structures that complement and supersede the built-in information.
*
* Test each of the characters in @in for whether or not they are
* allowed by the information in @overrides or by the built-in TLD
* restriction data. When data for the same TLD is available both
* internally and in @overrides, the information in @overrides takes
* precedence. If several entries for a specific TLD are found, the
* first one is used. If @overrides is %NULL, only the built-in
* information is used. The position of the first offending character
* is returned in @errpos. Note that the error position refers to the
* decoded character offset rather than the byte position in the
* string.
*
* Return value: Returns the #Tld_rc value %TLD_SUCCESS if all
* characters are valid or when @tld is null, %TLD_INVALID if a
* character is not allowed, or additional error codes on general
* failure conditions.
*/
int
tld_check_lz (const char *in, size_t * errpos, const Tld_table ** overrides)
{
char *utf8;
int rc;
if (!in)
return TLD_NODATA;
utf8 = stringprep_locale_to_utf8 (in);
if (!utf8)
return TLD_ICONV_ERROR;
rc = tld_check_8z (utf8, errpos, overrides);
free (utf8);
return rc;
}
/**
* Tld_rc:
* @TLD_SUCCESS: Successful operation. This value is guaranteed to
* always be zero, the remaining ones are only guaranteed to hold
* non-zero values, for logical comparison purposes.
* @TLD_INVALID: Invalid character found.
* @TLD_NODATA: No input data was provided.
* @TLD_MALLOC_ERROR: Error during memory allocation.
* @TLD_ICONV_ERROR: Error during iconv string conversion.
* @TLD_NO_TLD: No top-level domain found in domain string.
* @TLD_NOTLD: Same as @TLD_NO_TLD, for compatibility
* with typo in earlier versions.
*
* Enumerated return codes of the TLD checking functions.
* The value 0 is guaranteed to always correspond to success.
*/

135
Example/Pods/libidn/lib/tld.h generated Normal file
View File

@ -0,0 +1,135 @@
/* tld.h --- Declarations for TLD restriction checking.
Copyright (C) 2004-2015 Simon Josefsson.
Copyright (C) 2003-2014 Free Software Foundation, Inc.
Author: Thomas Jacob, Internet24.de
This file is part of GNU Libidn.
GNU Libidn is free software: you can redistribute it and/or
modify it under the terms of either:
* the GNU Lesser General Public License as published by the Free
Software Foundation; either version 3 of the License, or (at
your option) any later version.
or
* the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at
your option) any later version.
or both in parallel, as here.
GNU Libidn is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received copies of the GNU General Public License and
the GNU Lesser General Public License along with this program. If
not, see <http://www.gnu.org/licenses/>. */
#ifndef TLD_H
# define TLD_H
# ifndef IDNAPI
# if defined LIBIDN_BUILDING && defined HAVE_VISIBILITY && HAVE_VISIBILITY
# define IDNAPI __attribute__((__visibility__("default")))
# elif defined LIBIDN_BUILDING && defined _MSC_VER && ! defined LIBIDN_STATIC
# define IDNAPI __declspec(dllexport)
# elif defined _MSC_VER && ! defined LIBIDN_STATIC
# define IDNAPI __declspec(dllimport)
# else
# define IDNAPI
# endif
# endif
# ifdef __cplusplus
extern "C"
{
# endif
/* Get size_t. */
# include <stdlib.h>
/* Get uint32_t. */
# include "idn-int.h"
/* Interval of valid code points in the TLD. */
struct Tld_table_element
{
uint32_t start; /* Start of range. */
uint32_t end; /* End of range, end == start if single. */
};
typedef struct Tld_table_element Tld_table_element;
/* List valid code points in a TLD. */
struct Tld_table
{
const char *name; /* TLD name, e.g., "no". */
const char *version; /* Version string from TLD file. */
size_t nvalid; /* Number of entries in data. */
const Tld_table_element *valid; /* Sorted array of valid code points. */
};
typedef struct Tld_table Tld_table;
/* Error codes. */
typedef enum
{
TLD_SUCCESS = 0,
TLD_INVALID = 1, /* Invalid character found. */
TLD_NODATA = 2, /* Char, domain or inlen = 0. */
TLD_MALLOC_ERROR = 3,
TLD_ICONV_ERROR = 4,
TLD_NO_TLD = 5,
/* Workaround typo in earlier versions. */
TLD_NOTLD = TLD_NO_TLD
} Tld_rc;
extern IDNAPI const char *tld_strerror (Tld_rc rc);
/* Extract TLD, as ASCII string, of UCS4 domain name into "out". */
extern IDNAPI int tld_get_4 (const uint32_t * in, size_t inlen,
char **out);
extern IDNAPI int tld_get_4z (const uint32_t * in, char **out);
extern IDNAPI int tld_get_z (const char *in, char **out);
/* Return structure corresponding to the named TLD from specified
* list of TLD tables, or return NULL if no matching TLD can be
* found. */
extern IDNAPI const Tld_table *tld_get_table (const char *tld,
const Tld_table ** tables);
/* Return structure corresponding to the named TLD, first looking
* thru overrides then thru built-in list, or return NULL if no
* matching TLD can be found. */
extern IDNAPI const Tld_table * tld_default_table (const char *tld,
const Tld_table ** overrides);
/* Check NAMEPREPPED domain name for valid characters as defined by
* the relevant registering body (plus [a-z0-9.-]). If error is
* TLD_INVALID, set errpos to position of offending character. */
extern IDNAPI int tld_check_4t (const uint32_t * in, size_t inlen,
size_t * errpos, const Tld_table * tld);
extern IDNAPI int tld_check_4tz (const uint32_t * in, size_t * errpos,
const Tld_table * tld);
/* Utility interfaces that uses tld_get_4* to find TLD of string,
then tld_default_table (with overrides) to find proper TLD table
for the string, and then hands over to tld_check_4t*. */
extern IDNAPI int tld_check_4 (const uint32_t * in, size_t inlen,
size_t * errpos,
const Tld_table ** overrides);
extern IDNAPI int tld_check_4z (const uint32_t * in, size_t * errpos,
const Tld_table ** overrides);
extern IDNAPI int tld_check_8z (const char *in, size_t * errpos,
const Tld_table ** overrides);
extern IDNAPI int tld_check_lz (const char *in, size_t * errpos,
const Tld_table ** overrides);
# ifdef __cplusplus
}
# endif
#endif /* TLD_H */

63
Example/Pods/libidn/lib/tlds.c generated Normal file
View File

@ -0,0 +1,63 @@
/* This file is automatically generated. DO NOT EDIT!
Instead, edit gen-tld-tables.pl and re-run. */
#include "tld.h"
/* TLD fr */
static const Tld_table_element _tld_fr_valid[] =
{
{ 0x2d, 0x2d },
{ 0x30, 0x39 },
{ 0x61, 0x7a },
{ 0xe0, 0xe0 },
{ 0xe2, 0xe2 },
{ 0xe6, 0xeb },
{ 0xee, 0xef },
{ 0xf4, 0xf4 },
{ 0xf9, 0xf9 },
{ 0xfb, 0xfc },
{ 0xff, 0xff },
{ 0x153, 0x153 }
};
static const Tld_table _tld_fr =
{
"fr",
"1.0",
12,
&_tld_fr_valid[0]
};
/* TLD no */
static const Tld_table_element _tld_no_valid[] =
{
{ 0xe0, 0xe1 },
{ 0xe4, 0xea },
{ 0xf1, 0xf4 },
{ 0xf6, 0xf6 },
{ 0xf8, 0xf8 },
{ 0xfc, 0xfc },
{ 0x10d, 0x10d },
{ 0x111, 0x111 },
{ 0x144, 0x144 },
{ 0x14b, 0x14b },
{ 0x161, 0x161 },
{ 0x167, 0x167 },
{ 0x17e, 0x17e }
};
static const Tld_table _tld_no =
{
"no",
"1.0",
13,
&_tld_no_valid[0]
};
/* Main array */
const Tld_table * _tld_tables[] =
{
&_tld_fr,
&_tld_no,
NULL
};

162
Example/Pods/libidn/lib/toutf8.c generated Normal file
View File

@ -0,0 +1,162 @@
/* toutf8.c --- Convert strings from system locale into UTF-8.
Copyright (C) 2002-2015 Simon Josefsson
This file is part of GNU Libidn.
GNU Libidn is free software: you can redistribute it and/or
modify it under the terms of either:
* the GNU Lesser General Public License as published by the Free
Software Foundation; either version 3 of the License, or (at
your option) any later version.
or
* the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at
your option) any later version.
or both in parallel, as here.
GNU Libidn is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received copies of the GNU General Public License and
the GNU Lesser General Public License along with this program. If
not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
/* Get prototypes. */
#include "stringprep.h"
/* Get fprintf. */
#include <stdio.h>
/* Get getenv. */
#include <stdlib.h>
/* Get strlen. */
#include <string.h>
/* Get iconv_string. */
#include "striconv.h"
#ifdef _LIBC
# define HAVE_ICONV 1
# define HAVE_LOCALE_H 1
# define HAVE_LANGINFO_CODESET 1
#endif
#include <locale.h>
#ifdef HAVE_LANGINFO_CODESET
# include <langinfo.h>
#endif
#ifdef _LIBC
# define stringprep_locale_charset() nl_langinfo (CODESET)
#else
/**
* stringprep_locale_charset:
*
* Find out current locale charset. The function respect the CHARSET
* environment variable, but typically uses nl_langinfo(CODESET) when
* it is supported. It fall back on "ASCII" if CHARSET isn't set and
* nl_langinfo isn't supported or return anything.
*
* Note that this function return the application's locale's preferred
* charset (or thread's locale's preffered charset, if your system
* support thread-specific locales). It does not return what the
* system may be using. Thus, if you receive data from external
* sources you cannot in general use this function to guess what
* charset it is encoded in. Use stringprep_convert from the external
* representation into the charset returned by this function, to have
* data in the locale encoding.
*
* Return value: Return the character set used by the current locale.
* It will never return NULL, but use "ASCII" as a fallback.
**/
const char *
stringprep_locale_charset (void)
{
const char *charset = getenv ("CHARSET"); /* flawfinder: ignore */
if (charset && *charset)
return charset;
# ifdef HAVE_LANGINFO_CODESET
charset = nl_langinfo (CODESET);
if (charset && *charset)
return charset;
# endif
return "ASCII";
}
#endif
/**
* stringprep_convert:
* @str: input zero-terminated string.
* @to_codeset: name of destination character set.
* @from_codeset: name of origin character set, as used by @str.
*
* Convert the string from one character set to another using the
* system's iconv() function.
*
* Return value: Returns newly allocated zero-terminated string which
* is @str transcoded into to_codeset.
**/
char *
stringprep_convert (const char *str,
const char *to_codeset, const char *from_codeset)
{
#if HAVE_ICONV
return str_iconv (str, from_codeset, to_codeset);
#else
char *p;
fprintf (stderr, "libidn: warning: libiconv not installed, cannot "
"convert data to UTF-8\n");
p = malloc (strlen (str) + 1);
if (!p)
return NULL;
return strcpy (p, str);
#endif
}
/**
* stringprep_locale_to_utf8:
* @str: input zero terminated string.
*
* Convert string encoded in the locale's character set into UTF-8 by
* using stringprep_convert().
*
* Return value: Returns newly allocated zero-terminated string which
* is @str transcoded into UTF-8.
**/
char *
stringprep_locale_to_utf8 (const char *str)
{
return stringprep_convert (str, "UTF-8", stringprep_locale_charset ());
}
/**
* stringprep_utf8_to_locale:
* @str: input zero terminated string.
*
* Convert string encoded in UTF-8 into the locale's character set by
* using stringprep_convert().
*
* Return value: Returns newly allocated zero-terminated string which
* is @str transcoded into the locale's character set.
**/
char *
stringprep_utf8_to_locale (const char *str)
{
return stringprep_convert (str, stringprep_locale_charset (), "UTF-8");
}

59
Example/Pods/libidn/lib/version.c generated Normal file
View File

@ -0,0 +1,59 @@
/* version.c --- Version handling.
Copyright (C) 2002-2015 Simon Josefsson
This file is part of GNU Libidn.
GNU Libidn is free software: you can redistribute it and/or
modify it under the terms of either:
* the GNU Lesser General Public License as published by the Free
Software Foundation; either version 3 of the License, or (at
your option) any later version.
or
* the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at
your option) any later version.
or both in parallel, as here.
GNU Libidn is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received copies of the GNU General Public License and
the GNU Lesser General Public License along with this program. If
not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include "stringprep.h"
#include <string.h> /* for strverscmp */
/**
* stringprep_check_version:
* @req_version: Required version number, or NULL.
*
* Check that the version of the library is at minimum the requested one
* and return the version string; return NULL if the condition is not
* satisfied. If a NULL is passed to this function, no check is done,
* but the version string is simply returned.
*
* See %STRINGPREP_VERSION for a suitable @req_version string.
*
* Return value: Version string of run-time library, or NULL if the
* run-time library does not meet the required version number.
*/
const char *
stringprep_check_version (const char *req_version)
{
if (!req_version || strverscmp (req_version, STRINGPREP_VERSION) <= 0)
return STRINGPREP_VERSION;
return NULL;
}

View File

@ -35,6 +35,7 @@ Pod::Spec.new do |s|
}
# s.public_header_files = 'Pod/Classes/**/*.h'
s.preserve_paths = "PNXMPPFramework/Vendor/libidn/"
# s.frameworks = 'UIKit', 'MapKit'
# s.dependency 'AFNetworking', '~> 2.3'
@ -43,14 +44,14 @@ s.preserve_path = 'PNXMPPFramework/module/module.modulemap'
#s.module_map = 'module/module.modulemap'
s.subspec 'Core' do |core|
core.source_files = ['XMPPFramework.h', 'Core/**/*.{h,m}', 'Vendor/libidn/*.h', 'Authentication/**/*.{h,m}', 'Categories/**/*.{h,m}', 'Utilities/**/*.{h,m}']
core.vendored_libraries = 'Vendor/libidn/libidn.a'
core.source_files = ['XMPPFramework.h', 'Core/**/*.{h,m}', 'Authentication/**/*.{h,m}', 'Categories/**/*.{h,m}', 'Utilities/**/*.{h,m}']
core.libraries = 'xml2', 'resolv'
core.xcconfig = { 'HEADER_SEARCH_PATHS' => '$(inherited) $(SDKROOT)/usr/include/libxml2 $(PODS_ROOT)/XMPPFramework/module $(SDKROOT)/usr/include/libresolv', 'LIBRARY_SEARCH_PATHS' => '"$(PODS_ROOT)/Vendor/libidn"', 'CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES' => 'YES', 'OTHER_LDFLAGS' => '"-lxml2"', 'ENABLE_BITCODE' => 'NO'
core.xcconfig = { 'HEADER_SEARCH_PATHS' => '$(inherited) $(SDKROOT)/usr/include/libxml2 $(PODS_ROOT)/XMPPFramework/module $(SDKROOT)/usr/include/libresolv', 'CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES' => 'YES', 'OTHER_LDFLAGS' => '"-lxml2"', 'ENABLE_BITCODE' => 'NO'
}
core.dependency 'CocoaLumberjack','~>1.9'
core.dependency 'CocoaAsyncSocket'
core.dependency 'KissXML'
core.dependency 'libidn'
end
s.subspec 'Authentication' do |ss|

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,41 +0,0 @@
#import <Foundation/Foundation.h>
#import <asl.h>
#import "DDLog.h"
/**
* Welcome to Cocoa Lumberjack!
*
* The project page has a wealth of documentation if you have any questions.
* https://github.com/CocoaLumberjack/CocoaLumberjack
*
* If you're new to the project you may wish to read the "Getting Started" wiki.
* https://github.com/CocoaLumberjack/CocoaLumberjack/wiki/GettingStarted
*
*
* This class provides a logger for the Apple System Log facility.
*
* As described in the "Getting Started" page,
* the traditional NSLog() function directs it's output to two places:
*
* - Apple System Log
* - StdErr (if stderr is a TTY) so log statements show up in Xcode console
*
* To duplicate NSLog() functionality you can simply add this logger and a tty logger.
* However, if you instead choose to use file logging (for faster performance),
* you may choose to use a file logger and a tty logger.
**/
@interface DDASLLogger : DDAbstractLogger <DDLogger>
{
aslclient client;
}
+ (instancetype)sharedInstance;
// Inherited from DDAbstractLogger
// - (id <DDLogFormatter>)logFormatter;
// - (void)setLogFormatter:(id <DDLogFormatter>)formatter;
@end

View File

@ -1,100 +0,0 @@
#import "DDASLLogger.h"
#import <libkern/OSAtomic.h>
/**
* Welcome to Cocoa Lumberjack!
*
* The project page has a wealth of documentation if you have any questions.
* https://github.com/CocoaLumberjack/CocoaLumberjack
*
* If you're new to the project you may wish to read the "Getting Started" wiki.
* https://github.com/CocoaLumberjack/CocoaLumberjack/wiki/GettingStarted
**/
#if ! __has_feature(objc_arc)
#warning This file must be compiled with ARC. Use -fobjc-arc flag (or convert project to ARC).
#endif
@implementation DDASLLogger
static DDASLLogger *sharedInstance;
/**
* The runtime sends initialize to each class in a program exactly one time just before the class,
* or any class that inherits from it, is sent its first message from within the program. (Thus the
* method may never be invoked if the class is not used.) The runtime sends the initialize message to
* classes in a thread-safe manner. Superclasses receive this message before their subclasses.
*
* This method may also be called directly (assumably by accident), hence the safety mechanism.
**/
+ (void)initialize
{
static BOOL initialized = NO;
if (!initialized)
{
initialized = YES;
sharedInstance = [[[self class] alloc] init];
}
}
+ (instancetype)sharedInstance
{
return sharedInstance;
}
- (id)init
{
if (sharedInstance != nil)
{
return nil;
}
if ((self = [super init]))
{
// A default asl client is provided for the main thread,
// but background threads need to create their own client.
client = asl_open(NULL, "com.apple.console", 0);
}
return self;
}
- (void)logMessage:(DDLogMessage *)logMessage
{
NSString *logMsg = logMessage->logMsg;
if (formatter)
{
logMsg = [formatter formatLogMessage:logMessage];
}
if (logMsg)
{
const char *msg = [logMsg UTF8String];
int aslLogLevel;
switch (logMessage->logFlag)
{
// Note: By default ASL will filter anything above level 5 (Notice).
// So our mappings shouldn't go above that level.
case LOG_FLAG_ERROR : aslLogLevel = ASL_LEVEL_ALERT; break;
case LOG_FLAG_WARN : aslLogLevel = ASL_LEVEL_CRIT; break;
case LOG_FLAG_INFO : aslLogLevel = ASL_LEVEL_ERR; break;
case LOG_FLAG_DEBUG : aslLogLevel = ASL_LEVEL_WARNING; break;
default : aslLogLevel = ASL_LEVEL_NOTICE; break;
}
asl_log(client, NULL, aslLogLevel, "%s", msg);
}
}
- (NSString *)loggerName
{
return @"cocoa.lumberjack.aslLogger";
}
@end

View File

@ -1,102 +0,0 @@
#import <Foundation/Foundation.h>
#import "DDLog.h"
/**
* Welcome to Cocoa Lumberjack!
*
* The project page has a wealth of documentation if you have any questions.
* https://github.com/CocoaLumberjack/CocoaLumberjack
*
* If you're new to the project you may wish to read the "Getting Started" wiki.
* https://github.com/CocoaLumberjack/CocoaLumberjack/wiki/GettingStarted
*
*
* This class provides an abstract implementation of a database logger.
*
* That is, it provides the base implementation for a database logger to build atop of.
* All that is needed for a concrete database logger is to extend this class
* and override the methods in the implementation file that are prefixed with "db_".
**/
@interface DDAbstractDatabaseLogger : DDAbstractLogger {
@protected
NSUInteger saveThreshold;
NSTimeInterval saveInterval;
NSTimeInterval maxAge;
NSTimeInterval deleteInterval;
BOOL deleteOnEverySave;
BOOL saveTimerSuspended;
NSUInteger unsavedCount;
dispatch_time_t unsavedTime;
dispatch_source_t saveTimer;
dispatch_time_t lastDeleteTime;
dispatch_source_t deleteTimer;
}
/**
* Specifies how often to save the data to disk.
* Since saving is an expensive operation (disk io) it is not done after every log statement.
* These properties allow you to configure how/when the logger saves to disk.
*
* A save is done when either (whichever happens first):
*
* - The number of unsaved log entries reaches saveThreshold
* - The amount of time since the oldest unsaved log entry was created reaches saveInterval
*
* You can optionally disable the saveThreshold by setting it to zero.
* If you disable the saveThreshold you are entirely dependent on the saveInterval.
*
* You can optionally disable the saveInterval by setting it to zero (or a negative value).
* If you disable the saveInterval you are entirely dependent on the saveThreshold.
*
* It's not wise to disable both saveThreshold and saveInterval.
*
* The default saveThreshold is 500.
* The default saveInterval is 60 seconds.
**/
@property (assign, readwrite) NSUInteger saveThreshold;
@property (assign, readwrite) NSTimeInterval saveInterval;
/**
* It is likely you don't want the log entries to persist forever.
* Doing so would allow the database to grow infinitely large over time.
*
* The maxAge property provides a way to specify how old a log statement can get
* before it should get deleted from the database.
*
* The deleteInterval specifies how often to sweep for old log entries.
* Since deleting is an expensive operation (disk io) is is done on a fixed interval.
*
* An alternative to the deleteInterval is the deleteOnEverySave option.
* This specifies that old log entries should be deleted during every save operation.
*
* You can optionally disable the maxAge by setting it to zero (or a negative value).
* If you disable the maxAge then old log statements are not deleted.
*
* You can optionally disable the deleteInterval by setting it to zero (or a negative value).
*
* If you disable both deleteInterval and deleteOnEverySave then old log statements are not deleted.
*
* It's not wise to enable both deleteInterval and deleteOnEverySave.
*
* The default maxAge is 7 days.
* The default deleteInterval is 5 minutes.
* The default deleteOnEverySave is NO.
**/
@property (assign, readwrite) NSTimeInterval maxAge;
@property (assign, readwrite) NSTimeInterval deleteInterval;
@property (assign, readwrite) BOOL deleteOnEverySave;
/**
* Forces a save of any pending log entries (flushes log entries to disk).
**/
- (void)savePendingLogEntries;
/**
* Removes any log entries that are older than maxAge.
**/
- (void)deleteOldLogEntries;
@end

View File

@ -1,727 +0,0 @@
#import "DDAbstractDatabaseLogger.h"
#import <math.h>
/**
* Welcome to Cocoa Lumberjack!
*
* The project page has a wealth of documentation if you have any questions.
* https://github.com/CocoaLumberjack/CocoaLumberjack
*
* If you're new to the project you may wish to read the "Getting Started" wiki.
* https://github.com/CocoaLumberjack/CocoaLumberjack/wiki/GettingStarted
**/
#if ! __has_feature(objc_arc)
#warning This file must be compiled with ARC. Use -fobjc-arc flag (or convert project to ARC).
#endif
@interface DDAbstractDatabaseLogger ()
- (void)destroySaveTimer;
- (void)destroyDeleteTimer;
@end
#pragma mark -
@implementation DDAbstractDatabaseLogger
- (id)init
{
if ((self = [super init]))
{
saveThreshold = 500;
saveInterval = 60; // 60 seconds
maxAge = (60 * 60 * 24 * 7); // 7 days
deleteInterval = (60 * 5); // 5 minutes
}
return self;
}
- (void)dealloc
{
[self destroySaveTimer];
[self destroyDeleteTimer];
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#pragma mark Override Me
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- (BOOL)db_log:(DDLogMessage *)logMessage
{
// Override me and add your implementation.
//
// Return YES if an item was added to the buffer.
// Return NO if the logMessage was ignored.
return NO;
}
- (void)db_save
{
// Override me and add your implementation.
}
- (void)db_delete
{
// Override me and add your implementation.
}
- (void)db_saveAndDelete
{
// Override me and add your implementation.
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#pragma mark Private API
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- (void)performSaveAndSuspendSaveTimer
{
if (unsavedCount > 0)
{
if (deleteOnEverySave)
[self db_saveAndDelete];
else
[self db_save];
}
unsavedCount = 0;
unsavedTime = 0;
if (saveTimer && !saveTimerSuspended)
{
dispatch_suspend(saveTimer);
saveTimerSuspended = YES;
}
}
- (void)performDelete
{
if (maxAge > 0.0)
{
[self db_delete];
lastDeleteTime = dispatch_time(DISPATCH_TIME_NOW, 0);
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#pragma mark Timers
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- (void)destroySaveTimer
{
if (saveTimer)
{
dispatch_source_cancel(saveTimer);
if (saveTimerSuspended)
{
// Must resume a timer before releasing it (or it will crash)
dispatch_resume(saveTimer);
saveTimerSuspended = NO;
}
#if !OS_OBJECT_USE_OBJC
dispatch_release(saveTimer);
#endif
saveTimer = NULL;
}
}
- (void)updateAndResumeSaveTimer
{
if ((saveTimer != NULL) && (saveInterval > 0.0) && (unsavedTime > 0.0))
{
uint64_t interval = (uint64_t)(saveInterval * NSEC_PER_SEC);
dispatch_time_t startTime = dispatch_time(unsavedTime, interval);
dispatch_source_set_timer(saveTimer, startTime, interval, 1.0);
if (saveTimerSuspended)
{
dispatch_resume(saveTimer);
saveTimerSuspended = NO;
}
}
}
- (void)createSuspendedSaveTimer
{
if ((saveTimer == NULL) && (saveInterval > 0.0))
{
saveTimer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, loggerQueue);
dispatch_source_set_event_handler(saveTimer, ^{ @autoreleasepool {
[self performSaveAndSuspendSaveTimer];
}});
saveTimerSuspended = YES;
}
}
- (void)destroyDeleteTimer
{
if (deleteTimer)
{
dispatch_source_cancel(deleteTimer);
#if !OS_OBJECT_USE_OBJC
dispatch_release(deleteTimer);
#endif
deleteTimer = NULL;
}
}
- (void)updateDeleteTimer
{
if ((deleteTimer != NULL) && (deleteInterval > 0.0) && (maxAge > 0.0))
{
uint64_t interval = (uint64_t)(deleteInterval * NSEC_PER_SEC);
dispatch_time_t startTime;
if (lastDeleteTime > 0)
startTime = dispatch_time(lastDeleteTime, interval);
else
startTime = dispatch_time(DISPATCH_TIME_NOW, interval);
dispatch_source_set_timer(deleteTimer, startTime, interval, 1.0);
}
}
- (void)createAndStartDeleteTimer
{
if ((deleteTimer == NULL) && (deleteInterval > 0.0) && (maxAge > 0.0))
{
deleteTimer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, loggerQueue);
if (deleteTimer != NULL) {
dispatch_source_set_event_handler(deleteTimer, ^{ @autoreleasepool {
[self performDelete];
}});
[self updateDeleteTimer];
if (deleteTimer != NULL) dispatch_resume(deleteTimer);
}
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#pragma mark Configuration
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- (NSUInteger)saveThreshold
{
// The design of this method is taken from the DDAbstractLogger implementation.
// For extensive documentation please refer to the DDAbstractLogger implementation.
// Note: The internal implementation MUST access the colorsEnabled variable directly,
// This method is designed explicitly for external access.
//
// Using "self." syntax to go through this method will cause immediate deadlock.
// This is the intended result. Fix it by accessing the ivar directly.
// Great strides have been take to ensure this is safe to do. Plus it's MUCH faster.
NSAssert(![self isOnGlobalLoggingQueue], @"Core architecture requirement failure");
NSAssert(![self isOnInternalLoggerQueue], @"MUST access ivar directly, NOT via self.* syntax.");
dispatch_queue_t globalLoggingQueue = [DDLog loggingQueue];
__block NSUInteger result;
dispatch_sync(globalLoggingQueue, ^{
dispatch_sync(loggerQueue, ^{
result = saveThreshold;
});
});
return result;
}
- (void)setSaveThreshold:(NSUInteger)threshold
{
dispatch_block_t block = ^{ @autoreleasepool {
if (saveThreshold != threshold)
{
saveThreshold = threshold;
// Since the saveThreshold has changed,
// we check to see if the current unsavedCount has surpassed the new threshold.
//
// If it has, we immediately save the log.
if ((unsavedCount >= saveThreshold) && (saveThreshold > 0))
{
[self performSaveAndSuspendSaveTimer];
}
}
}};
// The design of the setter logic below is taken from the DDAbstractLogger implementation.
// For documentation please refer to the DDAbstractLogger implementation.
if ([self isOnInternalLoggerQueue])
{
block();
}
else
{
dispatch_queue_t globalLoggingQueue = [DDLog loggingQueue];
NSAssert(![self isOnGlobalLoggingQueue], @"Core architecture requirement failure");
dispatch_async(globalLoggingQueue, ^{
dispatch_async(loggerQueue, block);
});
}
}
- (NSTimeInterval)saveInterval
{
// The design of this method is taken from the DDAbstractLogger implementation.
// For extensive documentation please refer to the DDAbstractLogger implementation.
// Note: The internal implementation MUST access the colorsEnabled variable directly,
// This method is designed explicitly for external access.
//
// Using "self." syntax to go through this method will cause immediate deadlock.
// This is the intended result. Fix it by accessing the ivar directly.
// Great strides have been take to ensure this is safe to do. Plus it's MUCH faster.
NSAssert(![self isOnGlobalLoggingQueue], @"Core architecture requirement failure");
NSAssert(![self isOnInternalLoggerQueue], @"MUST access ivar directly, NOT via self.* syntax.");
dispatch_queue_t globalLoggingQueue = [DDLog loggingQueue];
__block NSTimeInterval result;
dispatch_sync(globalLoggingQueue, ^{
dispatch_sync(loggerQueue, ^{
result = saveInterval;
});
});
return result;
}
- (void)setSaveInterval:(NSTimeInterval)interval
{
dispatch_block_t block = ^{ @autoreleasepool {
// C99 recommended floating point comparison macro
// Read: isLessThanOrGreaterThan(floatA, floatB)
if (/* saveInterval != interval */ islessgreater(saveInterval, interval))
{
saveInterval = interval;
// There are several cases we need to handle here.
//
// 1. If the saveInterval was previously enabled and it just got disabled,
// then we need to stop the saveTimer. (And we might as well release it.)
//
// 2. If the saveInterval was previously disabled and it just got enabled,
// then we need to setup the saveTimer. (Plus we might need to do an immediate save.)
//
// 3. If the saveInterval increased, then we need to reset the timer so that it fires at the later date.
//
// 4. If the saveInterval decreased, then we need to reset the timer so that it fires at an earlier date.
// (Plus we might need to do an immediate save.)
if (saveInterval > 0.0)
{
if (saveTimer == NULL)
{
// Handles #2
//
// Since the saveTimer uses the unsavedTime to calculate it's first fireDate,
// if a save is needed the timer will fire immediately.
[self createSuspendedSaveTimer];
[self updateAndResumeSaveTimer];
}
else
{
// Handles #3
// Handles #4
//
// Since the saveTimer uses the unsavedTime to calculate it's first fireDate,
// if a save is needed the timer will fire immediately.
[self updateAndResumeSaveTimer];
}
}
else if (saveTimer)
{
// Handles #1
[self destroySaveTimer];
}
}
}};
// The design of the setter logic below is taken from the DDAbstractLogger implementation.
// For documentation please refer to the DDAbstractLogger implementation.
if ([self isOnInternalLoggerQueue])
{
block();
}
else
{
dispatch_queue_t globalLoggingQueue = [DDLog loggingQueue];
NSAssert(![self isOnGlobalLoggingQueue], @"Core architecture requirement failure");
dispatch_async(globalLoggingQueue, ^{
dispatch_async(loggerQueue, block);
});
}
}
- (NSTimeInterval)maxAge
{
// The design of this method is taken from the DDAbstractLogger implementation.
// For extensive documentation please refer to the DDAbstractLogger implementation.
// Note: The internal implementation MUST access the colorsEnabled variable directly,
// This method is designed explicitly for external access.
//
// Using "self." syntax to go through this method will cause immediate deadlock.
// This is the intended result. Fix it by accessing the ivar directly.
// Great strides have been take to ensure this is safe to do. Plus it's MUCH faster.
NSAssert(![self isOnGlobalLoggingQueue], @"Core architecture requirement failure");
NSAssert(![self isOnInternalLoggerQueue], @"MUST access ivar directly, NOT via self.* syntax.");
dispatch_queue_t globalLoggingQueue = [DDLog loggingQueue];
__block NSTimeInterval result;
dispatch_sync(globalLoggingQueue, ^{
dispatch_sync(loggerQueue, ^{
result = maxAge;
});
});
return result;
}
- (void)setMaxAge:(NSTimeInterval)interval
{
dispatch_block_t block = ^{ @autoreleasepool {
// C99 recommended floating point comparison macro
// Read: isLessThanOrGreaterThan(floatA, floatB)
if (/* maxAge != interval */ islessgreater(maxAge, interval))
{
NSTimeInterval oldMaxAge = maxAge;
NSTimeInterval newMaxAge = interval;
maxAge = interval;
// There are several cases we need to handle here.
//
// 1. If the maxAge was previously enabled and it just got disabled,
// then we need to stop the deleteTimer. (And we might as well release it.)
//
// 2. If the maxAge was previously disabled and it just got enabled,
// then we need to setup the deleteTimer. (Plus we might need to do an immediate delete.)
//
// 3. If the maxAge was increased,
// then we don't need to do anything.
//
// 4. If the maxAge was decreased,
// then we should do an immediate delete.
BOOL shouldDeleteNow = NO;
if (oldMaxAge > 0.0)
{
if (newMaxAge <= 0.0)
{
// Handles #1
[self destroyDeleteTimer];
}
else if (oldMaxAge > newMaxAge)
{
// Handles #4
shouldDeleteNow = YES;
}
}
else if (newMaxAge > 0.0)
{
// Handles #2
shouldDeleteNow = YES;
}
if (shouldDeleteNow)
{
[self performDelete];
if (deleteTimer)
[self updateDeleteTimer];
else
[self createAndStartDeleteTimer];
}
}
}};
// The design of the setter logic below is taken from the DDAbstractLogger implementation.
// For documentation please refer to the DDAbstractLogger implementation.
if ([self isOnInternalLoggerQueue])
{
block();
}
else
{
dispatch_queue_t globalLoggingQueue = [DDLog loggingQueue];
NSAssert(![self isOnGlobalLoggingQueue], @"Core architecture requirement failure");
dispatch_async(globalLoggingQueue, ^{
dispatch_async(loggerQueue, block);
});
}
}
- (NSTimeInterval)deleteInterval
{
// The design of this method is taken from the DDAbstractLogger implementation.
// For extensive documentation please refer to the DDAbstractLogger implementation.
// Note: The internal implementation MUST access the colorsEnabled variable directly,
// This method is designed explicitly for external access.
//
// Using "self." syntax to go through this method will cause immediate deadlock.
// This is the intended result. Fix it by accessing the ivar directly.
// Great strides have been take to ensure this is safe to do. Plus it's MUCH faster.
NSAssert(![self isOnGlobalLoggingQueue], @"Core architecture requirement failure");
NSAssert(![self isOnInternalLoggerQueue], @"MUST access ivar directly, NOT via self.* syntax.");
dispatch_queue_t globalLoggingQueue = [DDLog loggingQueue];
__block NSTimeInterval result;
dispatch_sync(globalLoggingQueue, ^{
dispatch_sync(loggerQueue, ^{
result = deleteInterval;
});
});
return result;
}
- (void)setDeleteInterval:(NSTimeInterval)interval
{
dispatch_block_t block = ^{ @autoreleasepool {
// C99 recommended floating point comparison macro
// Read: isLessThanOrGreaterThan(floatA, floatB)
if (/* deleteInterval != interval */ islessgreater(deleteInterval, interval))
{
deleteInterval = interval;
// There are several cases we need to handle here.
//
// 1. If the deleteInterval was previously enabled and it just got disabled,
// then we need to stop the deleteTimer. (And we might as well release it.)
//
// 2. If the deleteInterval was previously disabled and it just got enabled,
// then we need to setup the deleteTimer. (Plus we might need to do an immediate delete.)
//
// 3. If the deleteInterval increased, then we need to reset the timer so that it fires at the later date.
//
// 4. If the deleteInterval decreased, then we need to reset the timer so that it fires at an earlier date.
// (Plus we might need to do an immediate delete.)
if (deleteInterval > 0.0)
{
if (deleteTimer == NULL)
{
// Handles #2
//
// Since the deleteTimer uses the lastDeleteTime to calculate it's first fireDate,
// if a delete is needed the timer will fire immediately.
[self createAndStartDeleteTimer];
}
else
{
// Handles #3
// Handles #4
//
// Since the deleteTimer uses the lastDeleteTime to calculate it's first fireDate,
// if a save is needed the timer will fire immediately.
[self updateDeleteTimer];
}
}
else if (deleteTimer)
{
// Handles #1
[self destroyDeleteTimer];
}
}
}};
// The design of the setter logic below is taken from the DDAbstractLogger implementation.
// For documentation please refer to the DDAbstractLogger implementation.
if ([self isOnInternalLoggerQueue])
{
block();
}
else
{
dispatch_queue_t globalLoggingQueue = [DDLog loggingQueue];
NSAssert(![self isOnGlobalLoggingQueue], @"Core architecture requirement failure");
dispatch_async(globalLoggingQueue, ^{
dispatch_async(loggerQueue, block);
});
}
}
- (BOOL)deleteOnEverySave
{
// The design of this method is taken from the DDAbstractLogger implementation.
// For extensive documentation please refer to the DDAbstractLogger implementation.
// Note: The internal implementation MUST access the colorsEnabled variable directly,
// This method is designed explicitly for external access.
//
// Using "self." syntax to go through this method will cause immediate deadlock.
// This is the intended result. Fix it by accessing the ivar directly.
// Great strides have been take to ensure this is safe to do. Plus it's MUCH faster.
NSAssert(![self isOnGlobalLoggingQueue], @"Core architecture requirement failure");
NSAssert(![self isOnInternalLoggerQueue], @"MUST access ivar directly, NOT via self.* syntax.");
dispatch_queue_t globalLoggingQueue = [DDLog loggingQueue];
__block BOOL result;
dispatch_sync(globalLoggingQueue, ^{
dispatch_sync(loggerQueue, ^{
result = deleteOnEverySave;
});
});
return result;
}
- (void)setDeleteOnEverySave:(BOOL)flag
{
dispatch_block_t block = ^{
deleteOnEverySave = flag;
};
// The design of the setter logic below is taken from the DDAbstractLogger implementation.
// For documentation please refer to the DDAbstractLogger implementation.
if ([self isOnInternalLoggerQueue])
{
block();
}
else
{
dispatch_queue_t globalLoggingQueue = [DDLog loggingQueue];
NSAssert(![self isOnGlobalLoggingQueue], @"Core architecture requirement failure");
dispatch_async(globalLoggingQueue, ^{
dispatch_async(loggerQueue, block);
});
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#pragma mark Public API
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- (void)savePendingLogEntries
{
dispatch_block_t block = ^{ @autoreleasepool {
[self performSaveAndSuspendSaveTimer];
}};
if ([self isOnInternalLoggerQueue])
block();
else
dispatch_async(loggerQueue, block);
}
- (void)deleteOldLogEntries
{
dispatch_block_t block = ^{ @autoreleasepool {
[self performDelete];
}};
if ([self isOnInternalLoggerQueue])
block();
else
dispatch_async(loggerQueue, block);
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#pragma mark DDLogger
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- (void)didAddLogger
{
// If you override me be sure to invoke [super didAddLogger];
[self createSuspendedSaveTimer];
[self createAndStartDeleteTimer];
}
- (void)willRemoveLogger
{
// If you override me be sure to invoke [super willRemoveLogger];
[self performSaveAndSuspendSaveTimer];
[self destroySaveTimer];
[self destroyDeleteTimer];
}
- (void)logMessage:(DDLogMessage *)logMessage
{
if ([self db_log:logMessage])
{
BOOL firstUnsavedEntry = (++unsavedCount == 1);
if ((unsavedCount >= saveThreshold) && (saveThreshold > 0))
{
[self performSaveAndSuspendSaveTimer];
}
else if (firstUnsavedEntry)
{
unsavedTime = dispatch_time(DISPATCH_TIME_NOW, 0);
[self updateAndResumeSaveTimer];
}
}
}
- (void)flush
{
// This method is invoked by DDLog's flushLog method.
//
// It is called automatically when the application quits,
// or if the developer invokes DDLog's flushLog method prior to crashing or something.
[self performSaveAndSuspendSaveTimer];
}
@end

View File

@ -1,369 +0,0 @@
#import <Foundation/Foundation.h>
#import "DDLog.h"
@class DDLogFileInfo;
/**
* Welcome to Cocoa Lumberjack!
*
* The project page has a wealth of documentation if you have any questions.
* https://github.com/CocoaLumberjack/CocoaLumberjack
*
* If you're new to the project you may wish to read the "Getting Started" wiki.
* https://github.com/CocoaLumberjack/CocoaLumberjack/wiki/GettingStarted
*
*
* This class provides a logger to write log statements to a file.
**/
// Default configuration and safety/sanity values.
//
// maximumFileSize -> DEFAULT_LOG_MAX_FILE_SIZE
// rollingFrequency -> DEFAULT_LOG_ROLLING_FREQUENCY
// maximumNumberOfLogFiles -> DEFAULT_LOG_MAX_NUM_LOG_FILES
//
// You should carefully consider the proper configuration values for your application.
#define DEFAULT_LOG_MAX_FILE_SIZE (1024 * 1024) // 1 MB
#define DEFAULT_LOG_ROLLING_FREQUENCY (60 * 60 * 24) // 24 Hours
#define DEFAULT_LOG_MAX_NUM_LOG_FILES (5) // 5 Files
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#pragma mark -
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// The LogFileManager protocol is designed to allow you to control all aspects of your log files.
//
// The primary purpose of this is to allow you to do something with the log files after they have been rolled.
// Perhaps you want to compress them to save disk space.
// Perhaps you want to upload them to an FTP server.
// Perhaps you want to run some analytics on the file.
//
// A default LogFileManager is, of course, provided.
// The default LogFileManager simply deletes old log files according to the maximumNumberOfLogFiles property.
//
// This protocol provides various methods to fetch the list of log files.
//
// There are two variants: sorted and unsorted.
// If sorting is not necessary, the unsorted variant is obviously faster.
// The sorted variant will return an array sorted by when the log files were created,
// with the most recently created log file at index 0, and the oldest log file at the end of the array.
//
// You can fetch only the log file paths (full path including name), log file names (name only),
// or an array of DDLogFileInfo objects.
// The DDLogFileInfo class is documented below, and provides a handy wrapper that
// gives you easy access to various file attributes such as the creation date or the file size.
@protocol DDLogFileManager <NSObject>
@required
// Public properties
/**
* The maximum number of archived log files to keep on disk.
* For example, if this property is set to 3,
* then the LogFileManager will only keep 3 archived log files (plus the current active log file) on disk.
* Once the active log file is rolled/archived, then the oldest of the existing 3 rolled/archived log files is deleted.
*
* You may optionally disable deleting old/rolled/archived log files by setting this property to zero.
**/
@property (readwrite, assign) NSUInteger maximumNumberOfLogFiles;
// Public methods
- (NSString *)logsDirectory;
- (NSArray *)unsortedLogFilePaths;
- (NSArray *)unsortedLogFileNames;
- (NSArray *)unsortedLogFileInfos;
- (NSArray *)sortedLogFilePaths;
- (NSArray *)sortedLogFileNames;
- (NSArray *)sortedLogFileInfos;
// Private methods (only to be used by DDFileLogger)
- (NSString *)createNewLogFile;
@optional
// Notifications from DDFileLogger
- (void)didArchiveLogFile:(NSString *)logFilePath;
- (void)didRollAndArchiveLogFile:(NSString *)logFilePath;
@end
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#pragma mark -
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
* Default log file manager.
*
* All log files are placed inside the logsDirectory.
* If a specific logsDirectory isn't specified, the default directory is used.
* On Mac, this is in ~/Library/Logs/<Application Name>.
* On iPhone, this is in ~/Library/Caches/Logs.
*
* Log files are named "<bundle identifier> <date> <time>.log"
* Example: com.organization.myapp 2013-12-03 17-14.log
*
* Archived log files are automatically deleted according to the maximumNumberOfLogFiles property.
**/
@interface DDLogFileManagerDefault : NSObject <DDLogFileManager>
{
NSUInteger maximumNumberOfLogFiles;
NSString *_logsDirectory;
}
- (id)init;
- (instancetype)initWithLogsDirectory:(NSString *)logsDirectory;
/*
* Methods to override.
*
* Log files are named "<bundle identifier> <date> <time>.log"
* Example: com.organization.myapp 2013-12-03 17-14.log
*
* If you wish to change default filename, you can override following two methods.
* - newLogFileName method would be called on new logfile creation.
* - isLogFile: method would be called to filter logfiles from all other files in logsDirectory.
* You have to parse given filename and return YES if it is logFile.
*
* **NOTE**
* newLogFileName returns filename. If appropriate file already exists, number would be added
* to filename before extension. You have to handle this case in isLogFile: method.
*
* Example:
* - newLogFileName returns "com.organization.myapp 2013-12-03.log",
* file "com.organization.myapp 2013-12-03.log" would be created.
* - after some time "com.organization.myapp 2013-12-03.log" is archived
* - newLogFileName again returns "com.organization.myapp 2013-12-03.log",
* file "com.organization.myapp 2013-12-03 2.log" would be created.
* - after some time "com.organization.myapp 2013-12-03 1.log" is archived
* - newLogFileName again returns "com.organization.myapp 2013-12-03.log",
* file "com.organization.myapp 2013-12-03 3.log" would be created.
**/
- (NSString *)newLogFileName;
- (BOOL)isLogFile:(NSString *)fileName;
/* Inherited from DDLogFileManager protocol:
@property (readwrite, assign) NSUInteger maximumNumberOfLogFiles;
- (NSString *)logsDirectory;
- (NSArray *)unsortedLogFilePaths;
- (NSArray *)unsortedLogFileNames;
- (NSArray *)unsortedLogFileInfos;
- (NSArray *)sortedLogFilePaths;
- (NSArray *)sortedLogFileNames;
- (NSArray *)sortedLogFileInfos;
*/
@end
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#pragma mark -
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
* Most users will want file log messages to be prepended with the date and time.
* Rather than forcing the majority of users to write their own formatter,
* we will supply a logical default formatter.
* Users can easily replace this formatter with their own by invoking the setLogFormatter method.
* It can also be removed by calling setLogFormatter, and passing a nil parameter.
*
* In addition to the convenience of having a logical default formatter,
* it will also provide a template that makes it easy for developers to copy and change.
**/
@interface DDLogFileFormatterDefault : NSObject <DDLogFormatter>
{
NSDateFormatter *dateFormatter;
}
- (id)init;
- (instancetype)initWithDateFormatter:(NSDateFormatter *)dateFormatter;
@end
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#pragma mark -
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@interface DDFileLogger : DDAbstractLogger <DDLogger>
{
__strong id <DDLogFileManager> logFileManager;
DDLogFileInfo *currentLogFileInfo;
NSFileHandle *currentLogFileHandle;
dispatch_source_t currentLogFileVnode;
dispatch_source_t rollingTimer;
unsigned long long maximumFileSize;
NSTimeInterval rollingFrequency;
}
- (id)init;
- (instancetype)initWithLogFileManager:(id <DDLogFileManager>)logFileManager;
/**
* Log File Rolling:
*
* maximumFileSize:
* The approximate maximum size to allow log files to grow.
* If a log file is larger than this value after a log statement is appended,
* then the log file is rolled.
*
* rollingFrequency
* How often to roll the log file.
* The frequency is given as an NSTimeInterval, which is a double that specifies the interval in seconds.
* Once the log file gets to be this old, it is rolled.
*
* Both the maximumFileSize and the rollingFrequency are used to manage rolling.
* Whichever occurs first will cause the log file to be rolled.
*
* For example:
* The rollingFrequency is 24 hours,
* but the log file surpasses the maximumFileSize after only 20 hours.
* The log file will be rolled at that 20 hour mark.
* A new log file will be created, and the 24 hour timer will be restarted.
*
* You may optionally disable rolling due to filesize by setting maximumFileSize to zero.
* If you do so, rolling is based solely on rollingFrequency.
*
* You may optionally disable rolling due to time by setting rollingFrequency to zero (or any non-positive number).
* If you do so, rolling is based solely on maximumFileSize.
*
* If you disable both maximumFileSize and rollingFrequency, then the log file won't ever be rolled.
* This is strongly discouraged.
**/
@property (readwrite, assign) unsigned long long maximumFileSize;
@property (readwrite, assign) NSTimeInterval rollingFrequency;
/**
* The DDLogFileManager instance can be used to retrieve the list of log files,
* and configure the maximum number of archived log files to keep.
*
* @see DDLogFileManager.maximumNumberOfLogFiles
**/
@property (strong, nonatomic, readonly) id <DDLogFileManager> logFileManager;
// You can optionally force the current log file to be rolled with this method.
// CompletionBlock will be called on main queue.
- (void)rollLogFileWithCompletionBlock:(void (^)())completionBlock;
// Method is deprecated. Use rollLogFileWithCompletionBlock: method instead.
- (void)rollLogFile __attribute((deprecated));
// Inherited from DDAbstractLogger
// - (id <DDLogFormatter>)logFormatter;
// - (void)setLogFormatter:(id <DDLogFormatter>)formatter;
@end
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#pragma mark -
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
* DDLogFileInfo is a simple class that provides access to various file attributes.
* It provides good performance as it only fetches the information if requested,
* and it caches the information to prevent duplicate fetches.
*
* It was designed to provide quick snapshots of the current state of log files,
* and to help sort log files in an array.
*
* This class does not monitor the files, or update it's cached attribute values if the file changes on disk.
* This is not what the class was designed for.
*
* If you absolutely must get updated values,
* you can invoke the reset method which will clear the cache.
**/
@interface DDLogFileInfo : NSObject
{
__strong NSString *filePath;
__strong NSString *fileName;
__strong NSDictionary *fileAttributes;
__strong NSDate *creationDate;
__strong NSDate *modificationDate;
unsigned long long fileSize;
}
@property (strong, nonatomic, readonly) NSString *filePath;
@property (strong, nonatomic, readonly) NSString *fileName;
@property (strong, nonatomic, readonly) NSDictionary *fileAttributes;
@property (strong, nonatomic, readonly) NSDate *creationDate;
@property (strong, nonatomic, readonly) NSDate *modificationDate;
@property (nonatomic, readonly) unsigned long long fileSize;
@property (nonatomic, readonly) NSTimeInterval age;
@property (nonatomic, readwrite) BOOL isArchived;
+ (instancetype)logFileWithPath:(NSString *)filePath;
- (instancetype)initWithFilePath:(NSString *)filePath;
- (void)reset;
- (void)renameFile:(NSString *)newFileName;
#if TARGET_IPHONE_SIMULATOR
// So here's the situation.
// Extended attributes are perfect for what we're trying to do here (marking files as archived).
// This is exactly what extended attributes were designed for.
//
// But Apple screws us over on the simulator.
// Everytime you build-and-go, they copy the application into a new folder on the hard drive,
// and as part of the process they strip extended attributes from our log files.
// Normally, a copy of a file preserves extended attributes.
// So obviously Apple has gone to great lengths to piss us off.
//
// Thus we use a slightly different tactic for marking log files as archived in the simulator.
// That way it "just works" and there's no confusion when testing.
//
// The difference in method names is indicative of the difference in functionality.
// On the simulator we add an attribute by appending a filename extension.
//
// For example:
// "mylog.txt" -> "mylog.archived.txt"
// "mylog" -> "mylog.archived"
- (BOOL)hasExtensionAttributeWithName:(NSString *)attrName;
- (void)addExtensionAttributeWithName:(NSString *)attrName;
- (void)removeExtensionAttributeWithName:(NSString *)attrName;
#else
// Normal use of extended attributes used everywhere else,
// such as on Macs and on iPhone devices.
- (BOOL)hasExtendedAttributeWithName:(NSString *)attrName;
- (void)addExtendedAttributeWithName:(NSString *)attrName;
- (void)removeExtendedAttributeWithName:(NSString *)attrName;
#endif
- (NSComparisonResult)reverseCompareByCreationDate:(DDLogFileInfo *)another;
- (NSComparisonResult)reverseCompareByModificationDate:(DDLogFileInfo *)another;
@end

File diff suppressed because it is too large Load Diff

View File

@ -1,99 +0,0 @@
//
// DDLog+LOGV.h
// Lumberjack
//
// Created by Mike Pontillo on 11/20/12.
//
//
#ifndef Lumberjack_DDLog_LOGV_h
#define Lumberjack_DDLog_LOGV_h
#import "DDLog.h"
#define LOGV_MACRO(isAsynchronous, lvl, flg, ctx, atag, fnct, frmt, avalist) \
[DDLog log:isAsynchronous \
level:lvl \
flag:flg \
context:ctx \
file:__FILE__ \
function:fnct \
line:__LINE__ \
tag:atag \
format:frmt \
args:avalist]
#define LOGV_OBJC_MACRO(async, lvl, flg, ctx, frmt, avalist) \
LOGV_MACRO(async, lvl, flg, ctx, nil, sel_getName(_cmd), frmt, avalist)
#define LOGV_C_MACRO(async, lvl, flg, ctx, frmt, avalist) \
LOGV_MACRO(async, lvl, flg, ctx, nil, __FUNCTION__, frmt, avalist)
#define SYNC_LOGV_OBJC_MACRO(lvl, flg, ctx, frmt, avalist) \
LOGV_OBJC_MACRO( NO, lvl, flg, ctx, frmt, avalist)
#define ASYNC_LOGV_OBJC_MACRO(lvl, flg, ctx, frmt, avalist) \
LOGV_OBJC_MACRO(YES, lvl, flg, ctx, frmt, avalist)
#define SYNC_LOGV_C_MACRO(lvl, flg, ctx, frmt, avalist) \
LOGV_C_MACRO( NO, lvl, flg, ctx, frmt, avalist)
#define ASYNC_LOGV_C_MACRO(lvl, flg, ctx, frmt, avalist) \
LOGV_C_MACRO(YES, lvl, flg, ctx, frmt, avalist)
#define LOGV_MAYBE(async, lvl, flg, ctx, fnct, frmt, avalist) \
do { if(lvl & flg) LOGV_MACRO(async, lvl, flg, ctx, nil, fnct, frmt, avalist); } while(0)
#define LOGV_OBJC_MAYBE(async, lvl, flg, ctx, frmt, avalist) \
LOGV_MAYBE(async, lvl, flg, ctx, sel_getName(_cmd), frmt, avalist)
#define LOGV_C_MAYBE(async, lvl, flg, ctx, frmt, avalist) \
LOGV_MAYBE(async, lvl, flg, ctx, __FUNCTION__, frmt, avalist)
#define SYNC_LOGV_OBJC_MAYBE(lvl, flg, ctx, frmt, avalist) \
LOGV_OBJC_MAYBE( NO, lvl, flg, ctx, frmt, avalist)
#define ASYNC_LOGV_OBJC_MAYBE(lvl, flg, ctx, frmt, avalist) \
LOGV_OBJC_MAYBE(YES, lvl, flg, ctx, frmt, avalist)
#define SYNC_LOGV_C_MAYBE(lvl, flg, ctx, frmt, avalist) \
LOGV_C_MAYBE( NO, lvl, flg, ctx, frmt, avalist)
#define ASYNC_LOGV_C_MAYBE(lvl, flg, ctx, frmt, avalist) \
LOGV_C_MAYBE(YES, lvl, flg, ctx, frmt, avalist)
#define LOGV_OBJC_TAG_MACRO(async, lvl, flg, ctx, tag, frmt, avalist) \
LOGV_MACRO(async, lvl, flg, ctx, tag, sel_getName(_cmd), frmt, avalist)
#define LOGV_C_TAG_MACRO(async, lvl, flg, ctx, tag, frmt, avalist) \
LOGV_MACRO(async, lvl, flg, ctx, tag, __FUNCTION__, frmt, avalist)
#define LOGV_TAG_MAYBE(async, lvl, flg, ctx, tag, fnct, frmt, avalist) \
do { if(lvl & flg) LOGV_MACRO(async, lvl, flg, ctx, tag, fnct, frmt, avalist); } while(0)
#define LOGV_OBJC_TAG_MAYBE(async, lvl, flg, ctx, tag, frmt, avalist) \
LOGV_TAG_MAYBE(async, lvl, flg, ctx, tag, sel_getName(_cmd), frmt, avalist)
#define LOGV_C_TAG_MAYBE(async, lvl, flg, ctx, tag, frmt, avalist) \
LOGV_TAG_MAYBE(async, lvl, flg, ctx, tag, __FUNCTION__, frmt, avalist)
#define DDLogvError(frmt, avalist) LOGV_OBJC_MAYBE(LOG_ASYNC_ERROR, ddLogLevel, LOG_FLAG_ERROR, 0, frmt, avalist)
#define DDLogvWarn(frmt, avalist) LOGV_OBJC_MAYBE(LOG_ASYNC_WARN, ddLogLevel, LOG_FLAG_WARN, 0, frmt, avalist)
#define DDLogvInfo(frmt, avalist) LOGV_OBJC_MAYBE(LOG_ASYNC_INFO, ddLogLevel, LOG_FLAG_INFO, 0, frmt, avalist)
#define DDLogvVerbose(frmt, avalist) LOGV_OBJC_MAYBE(LOG_ASYNC_VERBOSE, ddLogLevel, LOG_FLAG_VERBOSE, 0, frmt, avalist)
#define DDLogvCError(frmt, avalist) LOGV_C_MAYBE(LOG_ASYNC_ERROR, ddLogLevel, LOG_FLAG_ERROR, 0, frmt, avalist)
#define DDLogvCWarn(frmt, avalist) LOGV_C_MAYBE(LOG_ASYNC_WARN, ddLogLevel, LOG_FLAG_WARN, 0, frmt, avalist)
#define DDLogvCInfo(frmt, avalist) LOGV_C_MAYBE(LOG_ASYNC_INFO, ddLogLevel, LOG_FLAG_INFO, 0, frmt, avalist)
#define DDLogvCVerbose(frmt, avalist) LOGV_C_MAYBE(LOG_ASYNC_VERBOSE, ddLogLevel, LOG_FLAG_VERBOSE, 0, frmt, avalist)
#endif

Some files were not shown because too many files have changed in this diff Show More