Azure IoT common library
Dependents: STM32F746_iothub_client_sample_mqtt f767zi_mqtt iothub_client_sample_amqp iothub_client_sample_http ... more
urlencode.c@1:9190c0f4d23a, 2016-04-24 (annotated)
- Committer:
- AzureIoTClient
- Date:
- Sun Apr 24 16:41:14 2016 -0700
- Revision:
- 1:9190c0f4d23a
- Parent:
- 0:fa2de1b79154
- Child:
- 6:c55b013dfc2a
1.0.5
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Azure.IoT Build | 0:fa2de1b79154 | 1 | // Copyright (c) Microsoft. All rights reserved. |
Azure.IoT Build | 0:fa2de1b79154 | 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. |
Azure.IoT Build | 0:fa2de1b79154 | 3 | |
Azure.IoT Build | 0:fa2de1b79154 | 4 | // |
Azure.IoT Build | 0:fa2de1b79154 | 5 | // PUT NO INCLUDES BEFORE HERE !!!! |
Azure.IoT Build | 0:fa2de1b79154 | 6 | // |
Azure.IoT Build | 0:fa2de1b79154 | 7 | #include <stdlib.h> |
Azure.IoT Build | 0:fa2de1b79154 | 8 | #ifdef _CRTDBG_MAP_ALLOC |
Azure.IoT Build | 0:fa2de1b79154 | 9 | #include <crtdbg.h> |
Azure.IoT Build | 0:fa2de1b79154 | 10 | #endif |
Azure.IoT Build | 0:fa2de1b79154 | 11 | #include "azure_c_shared_utility/gballoc.h" |
Azure.IoT Build | 0:fa2de1b79154 | 12 | |
Azure.IoT Build | 0:fa2de1b79154 | 13 | #include <stddef.h> |
Azure.IoT Build | 0:fa2de1b79154 | 14 | #include <string.h> |
Azure.IoT Build | 0:fa2de1b79154 | 15 | // |
Azure.IoT Build | 0:fa2de1b79154 | 16 | // PUT NO CLIENT LIBRARY INCLUDES BEFORE HERE !!!! |
Azure.IoT Build | 0:fa2de1b79154 | 17 | // |
Azure.IoT Build | 0:fa2de1b79154 | 18 | #include "azure_c_shared_utility/urlencode.h" |
Azure.IoT Build | 0:fa2de1b79154 | 19 | #include "azure_c_shared_utility/iot_logging.h" |
Azure.IoT Build | 0:fa2de1b79154 | 20 | #include "azure_c_shared_utility/strings.h" |
Azure.IoT Build | 0:fa2de1b79154 | 21 | |
Azure.IoT Build | 0:fa2de1b79154 | 22 | static const struct { |
Azure.IoT Build | 0:fa2de1b79154 | 23 | size_t numberOfChars; |
Azure.IoT Build | 0:fa2de1b79154 | 24 | const char* encoding; |
Azure.IoT Build | 0:fa2de1b79154 | 25 | } urlEncoding[] = { |
Azure.IoT Build | 0:fa2de1b79154 | 26 | { 1, "\0" }, |
Azure.IoT Build | 0:fa2de1b79154 | 27 | { 3, "%01" }, |
Azure.IoT Build | 0:fa2de1b79154 | 28 | { 3, "%02" }, |
Azure.IoT Build | 0:fa2de1b79154 | 29 | { 3, "%03" }, |
Azure.IoT Build | 0:fa2de1b79154 | 30 | { 3, "%04" }, |
Azure.IoT Build | 0:fa2de1b79154 | 31 | { 3, "%05" }, |
Azure.IoT Build | 0:fa2de1b79154 | 32 | { 3, "%06" }, |
Azure.IoT Build | 0:fa2de1b79154 | 33 | { 3, "%07" }, |
Azure.IoT Build | 0:fa2de1b79154 | 34 | { 3, "%08" }, |
Azure.IoT Build | 0:fa2de1b79154 | 35 | { 3, "%09" }, |
Azure.IoT Build | 0:fa2de1b79154 | 36 | { 3, "%0a" }, |
Azure.IoT Build | 0:fa2de1b79154 | 37 | { 3, "%0b" }, |
Azure.IoT Build | 0:fa2de1b79154 | 38 | { 3, "%0c" }, |
Azure.IoT Build | 0:fa2de1b79154 | 39 | { 3, "%0d" }, |
Azure.IoT Build | 0:fa2de1b79154 | 40 | { 3, "%0e" }, |
Azure.IoT Build | 0:fa2de1b79154 | 41 | { 3, "%0f" }, |
Azure.IoT Build | 0:fa2de1b79154 | 42 | { 3, "%10" }, |
Azure.IoT Build | 0:fa2de1b79154 | 43 | { 3, "%11" }, |
Azure.IoT Build | 0:fa2de1b79154 | 44 | { 3, "%12" }, |
Azure.IoT Build | 0:fa2de1b79154 | 45 | { 3, "%13" }, |
Azure.IoT Build | 0:fa2de1b79154 | 46 | { 3, "%14" }, |
Azure.IoT Build | 0:fa2de1b79154 | 47 | { 3, "%15" }, |
Azure.IoT Build | 0:fa2de1b79154 | 48 | { 3, "%16" }, |
Azure.IoT Build | 0:fa2de1b79154 | 49 | { 3, "%17" }, |
Azure.IoT Build | 0:fa2de1b79154 | 50 | { 3, "%18" }, |
Azure.IoT Build | 0:fa2de1b79154 | 51 | { 3, "%19" }, |
Azure.IoT Build | 0:fa2de1b79154 | 52 | { 3, "%1a" }, |
Azure.IoT Build | 0:fa2de1b79154 | 53 | { 3, "%1b" }, |
Azure.IoT Build | 0:fa2de1b79154 | 54 | { 3, "%1c" }, |
Azure.IoT Build | 0:fa2de1b79154 | 55 | { 3, "%1d" }, |
Azure.IoT Build | 0:fa2de1b79154 | 56 | { 3, "%1e" }, |
Azure.IoT Build | 0:fa2de1b79154 | 57 | { 3, "%1f" }, |
Azure.IoT Build | 0:fa2de1b79154 | 58 | { 3, "%20" }, |
Azure.IoT Build | 0:fa2de1b79154 | 59 | { 1, "!" }, |
Azure.IoT Build | 0:fa2de1b79154 | 60 | { 3, "%22" }, |
Azure.IoT Build | 0:fa2de1b79154 | 61 | { 3, "%23" }, |
Azure.IoT Build | 0:fa2de1b79154 | 62 | { 3, "%24" }, |
Azure.IoT Build | 0:fa2de1b79154 | 63 | { 3, "%25" }, |
Azure.IoT Build | 0:fa2de1b79154 | 64 | { 3, "%26" }, |
Azure.IoT Build | 0:fa2de1b79154 | 65 | { 3, "%27" }, |
Azure.IoT Build | 0:fa2de1b79154 | 66 | { 1, "(" }, |
Azure.IoT Build | 0:fa2de1b79154 | 67 | { 1, ")" }, |
Azure.IoT Build | 0:fa2de1b79154 | 68 | { 1, "*" }, |
Azure.IoT Build | 0:fa2de1b79154 | 69 | { 3, "%2b" }, |
Azure.IoT Build | 0:fa2de1b79154 | 70 | { 3, "%2c" }, |
Azure.IoT Build | 0:fa2de1b79154 | 71 | { 1, "-" }, |
Azure.IoT Build | 0:fa2de1b79154 | 72 | { 1, "." }, |
Azure.IoT Build | 0:fa2de1b79154 | 73 | { 3, "%2f" }, |
Azure.IoT Build | 0:fa2de1b79154 | 74 | { 1, "0" }, |
Azure.IoT Build | 0:fa2de1b79154 | 75 | { 1, "1" }, |
Azure.IoT Build | 0:fa2de1b79154 | 76 | { 1, "2" }, |
Azure.IoT Build | 0:fa2de1b79154 | 77 | { 1, "3" }, |
Azure.IoT Build | 0:fa2de1b79154 | 78 | { 1, "4" }, |
Azure.IoT Build | 0:fa2de1b79154 | 79 | { 1, "5" }, |
Azure.IoT Build | 0:fa2de1b79154 | 80 | { 1, "6" }, |
Azure.IoT Build | 0:fa2de1b79154 | 81 | { 1, "7" }, |
Azure.IoT Build | 0:fa2de1b79154 | 82 | { 1, "8" }, |
Azure.IoT Build | 0:fa2de1b79154 | 83 | { 1, "9" }, |
Azure.IoT Build | 0:fa2de1b79154 | 84 | { 3, "%3a" }, |
Azure.IoT Build | 0:fa2de1b79154 | 85 | { 3, "%3b" }, |
Azure.IoT Build | 0:fa2de1b79154 | 86 | { 3, "%3c" }, |
Azure.IoT Build | 0:fa2de1b79154 | 87 | { 3, "%3d" }, |
Azure.IoT Build | 0:fa2de1b79154 | 88 | { 3, "%3e" }, |
Azure.IoT Build | 0:fa2de1b79154 | 89 | { 3, "%3f" }, |
Azure.IoT Build | 0:fa2de1b79154 | 90 | { 3, "%40" }, |
Azure.IoT Build | 0:fa2de1b79154 | 91 | { 1, "A" }, |
Azure.IoT Build | 0:fa2de1b79154 | 92 | { 1, "B" }, |
Azure.IoT Build | 0:fa2de1b79154 | 93 | { 1, "C" }, |
Azure.IoT Build | 0:fa2de1b79154 | 94 | { 1, "D" }, |
Azure.IoT Build | 0:fa2de1b79154 | 95 | { 1, "E" }, |
Azure.IoT Build | 0:fa2de1b79154 | 96 | { 1, "F" }, |
Azure.IoT Build | 0:fa2de1b79154 | 97 | { 1, "G" }, |
Azure.IoT Build | 0:fa2de1b79154 | 98 | { 1, "H" }, |
Azure.IoT Build | 0:fa2de1b79154 | 99 | { 1, "I" }, |
Azure.IoT Build | 0:fa2de1b79154 | 100 | { 1, "J" }, |
Azure.IoT Build | 0:fa2de1b79154 | 101 | { 1, "K" }, |
Azure.IoT Build | 0:fa2de1b79154 | 102 | { 1, "L" }, |
Azure.IoT Build | 0:fa2de1b79154 | 103 | { 1, "M" }, |
Azure.IoT Build | 0:fa2de1b79154 | 104 | { 1, "N" }, |
Azure.IoT Build | 0:fa2de1b79154 | 105 | { 1, "O" }, |
Azure.IoT Build | 0:fa2de1b79154 | 106 | { 1, "P" }, |
Azure.IoT Build | 0:fa2de1b79154 | 107 | { 1, "Q" }, |
Azure.IoT Build | 0:fa2de1b79154 | 108 | { 1, "R" }, |
Azure.IoT Build | 0:fa2de1b79154 | 109 | { 1, "S" }, |
Azure.IoT Build | 0:fa2de1b79154 | 110 | { 1, "T" }, |
Azure.IoT Build | 0:fa2de1b79154 | 111 | { 1, "U" }, |
Azure.IoT Build | 0:fa2de1b79154 | 112 | { 1, "V" }, |
Azure.IoT Build | 0:fa2de1b79154 | 113 | { 1, "W" }, |
Azure.IoT Build | 0:fa2de1b79154 | 114 | { 1, "X" }, |
Azure.IoT Build | 0:fa2de1b79154 | 115 | { 1, "Y" }, |
Azure.IoT Build | 0:fa2de1b79154 | 116 | { 1, "Z" }, |
Azure.IoT Build | 0:fa2de1b79154 | 117 | { 3, "%5b" }, |
Azure.IoT Build | 0:fa2de1b79154 | 118 | { 3, "%5c" }, |
Azure.IoT Build | 0:fa2de1b79154 | 119 | { 3, "%5d" }, |
Azure.IoT Build | 0:fa2de1b79154 | 120 | { 3, "%5e" }, |
Azure.IoT Build | 0:fa2de1b79154 | 121 | { 1, "_" }, |
Azure.IoT Build | 0:fa2de1b79154 | 122 | { 3, "%60" }, |
Azure.IoT Build | 0:fa2de1b79154 | 123 | { 1, "a" }, |
Azure.IoT Build | 0:fa2de1b79154 | 124 | { 1, "b" }, |
Azure.IoT Build | 0:fa2de1b79154 | 125 | { 1, "c" }, |
Azure.IoT Build | 0:fa2de1b79154 | 126 | { 1, "d" }, |
Azure.IoT Build | 0:fa2de1b79154 | 127 | { 1, "e" }, |
Azure.IoT Build | 0:fa2de1b79154 | 128 | { 1, "f" }, |
Azure.IoT Build | 0:fa2de1b79154 | 129 | { 1, "g" }, |
Azure.IoT Build | 0:fa2de1b79154 | 130 | { 1, "h" }, |
Azure.IoT Build | 0:fa2de1b79154 | 131 | { 1, "i" }, |
Azure.IoT Build | 0:fa2de1b79154 | 132 | { 1, "j" }, |
Azure.IoT Build | 0:fa2de1b79154 | 133 | { 1, "k" }, |
Azure.IoT Build | 0:fa2de1b79154 | 134 | { 1, "l" }, |
Azure.IoT Build | 0:fa2de1b79154 | 135 | { 1, "m" }, |
Azure.IoT Build | 0:fa2de1b79154 | 136 | { 1, "n" }, |
Azure.IoT Build | 0:fa2de1b79154 | 137 | { 1, "o" }, |
Azure.IoT Build | 0:fa2de1b79154 | 138 | { 1, "p" }, |
Azure.IoT Build | 0:fa2de1b79154 | 139 | { 1, "q" }, |
Azure.IoT Build | 0:fa2de1b79154 | 140 | { 1, "r" }, |
Azure.IoT Build | 0:fa2de1b79154 | 141 | { 1, "s" }, |
Azure.IoT Build | 0:fa2de1b79154 | 142 | { 1, "t" }, |
Azure.IoT Build | 0:fa2de1b79154 | 143 | { 1, "u" }, |
Azure.IoT Build | 0:fa2de1b79154 | 144 | { 1, "v" }, |
Azure.IoT Build | 0:fa2de1b79154 | 145 | { 1, "w" }, |
Azure.IoT Build | 0:fa2de1b79154 | 146 | { 1, "x" }, |
Azure.IoT Build | 0:fa2de1b79154 | 147 | { 1, "y" }, |
Azure.IoT Build | 0:fa2de1b79154 | 148 | { 1, "z" }, |
Azure.IoT Build | 0:fa2de1b79154 | 149 | { 3, "%7b" }, |
Azure.IoT Build | 0:fa2de1b79154 | 150 | { 3, "%7c" }, |
Azure.IoT Build | 0:fa2de1b79154 | 151 | { 3, "%7d" }, |
Azure.IoT Build | 0:fa2de1b79154 | 152 | { 3, "%7e" }, |
Azure.IoT Build | 0:fa2de1b79154 | 153 | { 3, "%7f" }, |
Azure.IoT Build | 0:fa2de1b79154 | 154 | { 6, "%c2%80" }, |
Azure.IoT Build | 0:fa2de1b79154 | 155 | { 6, "%c2%81" }, |
Azure.IoT Build | 0:fa2de1b79154 | 156 | { 6, "%c2%82" }, |
Azure.IoT Build | 0:fa2de1b79154 | 157 | { 6, "%c2%83" }, |
Azure.IoT Build | 0:fa2de1b79154 | 158 | { 6, "%c2%84" }, |
Azure.IoT Build | 0:fa2de1b79154 | 159 | { 6, "%c2%85" }, |
Azure.IoT Build | 0:fa2de1b79154 | 160 | { 6, "%c2%86" }, |
Azure.IoT Build | 0:fa2de1b79154 | 161 | { 6, "%c2%87" }, |
Azure.IoT Build | 0:fa2de1b79154 | 162 | { 6, "%c2%88" }, |
Azure.IoT Build | 0:fa2de1b79154 | 163 | { 6, "%c2%89" }, |
Azure.IoT Build | 0:fa2de1b79154 | 164 | { 6, "%c2%8a" }, |
Azure.IoT Build | 0:fa2de1b79154 | 165 | { 6, "%c2%8b" }, |
Azure.IoT Build | 0:fa2de1b79154 | 166 | { 6, "%c2%8c" }, |
Azure.IoT Build | 0:fa2de1b79154 | 167 | { 6, "%c2%8d" }, |
Azure.IoT Build | 0:fa2de1b79154 | 168 | { 6, "%c2%8e" }, |
Azure.IoT Build | 0:fa2de1b79154 | 169 | { 6, "%c2%8f" }, |
Azure.IoT Build | 0:fa2de1b79154 | 170 | { 6, "%c2%90" }, |
Azure.IoT Build | 0:fa2de1b79154 | 171 | { 6, "%c2%91" }, |
Azure.IoT Build | 0:fa2de1b79154 | 172 | { 6, "%c2%92" }, |
Azure.IoT Build | 0:fa2de1b79154 | 173 | { 6, "%c2%93" }, |
Azure.IoT Build | 0:fa2de1b79154 | 174 | { 6, "%c2%94" }, |
Azure.IoT Build | 0:fa2de1b79154 | 175 | { 6, "%c2%95" }, |
Azure.IoT Build | 0:fa2de1b79154 | 176 | { 6, "%c2%96" }, |
Azure.IoT Build | 0:fa2de1b79154 | 177 | { 6, "%c2%97" }, |
Azure.IoT Build | 0:fa2de1b79154 | 178 | { 6, "%c2%98" }, |
Azure.IoT Build | 0:fa2de1b79154 | 179 | { 6, "%c2%99" }, |
Azure.IoT Build | 0:fa2de1b79154 | 180 | { 6, "%c2%9a" }, |
Azure.IoT Build | 0:fa2de1b79154 | 181 | { 6, "%c2%9b" }, |
Azure.IoT Build | 0:fa2de1b79154 | 182 | { 6, "%c2%9c" }, |
Azure.IoT Build | 0:fa2de1b79154 | 183 | { 6, "%c2%9d" }, |
Azure.IoT Build | 0:fa2de1b79154 | 184 | { 6, "%c2%9e" }, |
Azure.IoT Build | 0:fa2de1b79154 | 185 | { 6, "%c2%9f" }, |
Azure.IoT Build | 0:fa2de1b79154 | 186 | { 6, "%c2%a0" }, |
Azure.IoT Build | 0:fa2de1b79154 | 187 | { 6, "%c2%a1" }, |
Azure.IoT Build | 0:fa2de1b79154 | 188 | { 6, "%c2%a2" }, |
Azure.IoT Build | 0:fa2de1b79154 | 189 | { 6, "%c2%a3" }, |
Azure.IoT Build | 0:fa2de1b79154 | 190 | { 6, "%c2%a4" }, |
Azure.IoT Build | 0:fa2de1b79154 | 191 | { 6, "%c2%a5" }, |
Azure.IoT Build | 0:fa2de1b79154 | 192 | { 6, "%c2%a6" }, |
Azure.IoT Build | 0:fa2de1b79154 | 193 | { 6, "%c2%a7" }, |
Azure.IoT Build | 0:fa2de1b79154 | 194 | { 6, "%c2%a8" }, |
Azure.IoT Build | 0:fa2de1b79154 | 195 | { 6, "%c2%a9" }, |
Azure.IoT Build | 0:fa2de1b79154 | 196 | { 6, "%c2%aa" }, |
Azure.IoT Build | 0:fa2de1b79154 | 197 | { 6, "%c2%ab" }, |
Azure.IoT Build | 0:fa2de1b79154 | 198 | { 6, "%c2%ac" }, |
Azure.IoT Build | 0:fa2de1b79154 | 199 | { 6, "%c2%ad" }, |
Azure.IoT Build | 0:fa2de1b79154 | 200 | { 6, "%c2%ae" }, |
Azure.IoT Build | 0:fa2de1b79154 | 201 | { 6, "%c2%af" }, |
Azure.IoT Build | 0:fa2de1b79154 | 202 | { 6, "%c2%b0" }, |
Azure.IoT Build | 0:fa2de1b79154 | 203 | { 6, "%c2%b1" }, |
Azure.IoT Build | 0:fa2de1b79154 | 204 | { 6, "%c2%b2" }, |
Azure.IoT Build | 0:fa2de1b79154 | 205 | { 6, "%c2%b3" }, |
Azure.IoT Build | 0:fa2de1b79154 | 206 | { 6, "%c2%b4" }, |
Azure.IoT Build | 0:fa2de1b79154 | 207 | { 6, "%c2%b5" }, |
Azure.IoT Build | 0:fa2de1b79154 | 208 | { 6, "%c2%b6" }, |
Azure.IoT Build | 0:fa2de1b79154 | 209 | { 6, "%c2%b7" }, |
Azure.IoT Build | 0:fa2de1b79154 | 210 | { 6, "%c2%b8" }, |
Azure.IoT Build | 0:fa2de1b79154 | 211 | { 6, "%c2%b9" }, |
Azure.IoT Build | 0:fa2de1b79154 | 212 | { 6, "%c2%ba" }, |
Azure.IoT Build | 0:fa2de1b79154 | 213 | { 6, "%c2%bb" }, |
Azure.IoT Build | 0:fa2de1b79154 | 214 | { 6, "%c2%bc" }, |
Azure.IoT Build | 0:fa2de1b79154 | 215 | { 6, "%c2%bd" }, |
Azure.IoT Build | 0:fa2de1b79154 | 216 | { 6, "%c2%be" }, |
Azure.IoT Build | 0:fa2de1b79154 | 217 | { 6, "%c2%bf" }, |
Azure.IoT Build | 0:fa2de1b79154 | 218 | { 6, "%c3%80" }, |
Azure.IoT Build | 0:fa2de1b79154 | 219 | { 6, "%c3%81" }, |
Azure.IoT Build | 0:fa2de1b79154 | 220 | { 6, "%c3%82" }, |
Azure.IoT Build | 0:fa2de1b79154 | 221 | { 6, "%c3%83" }, |
Azure.IoT Build | 0:fa2de1b79154 | 222 | { 6, "%c3%84" }, |
Azure.IoT Build | 0:fa2de1b79154 | 223 | { 6, "%c3%85" }, |
Azure.IoT Build | 0:fa2de1b79154 | 224 | { 6, "%c3%86" }, |
Azure.IoT Build | 0:fa2de1b79154 | 225 | { 6, "%c3%87" }, |
Azure.IoT Build | 0:fa2de1b79154 | 226 | { 6, "%c3%88" }, |
Azure.IoT Build | 0:fa2de1b79154 | 227 | { 6, "%c3%89" }, |
Azure.IoT Build | 0:fa2de1b79154 | 228 | { 6, "%c3%8a" }, |
Azure.IoT Build | 0:fa2de1b79154 | 229 | { 6, "%c3%8b" }, |
Azure.IoT Build | 0:fa2de1b79154 | 230 | { 6, "%c3%8c" }, |
Azure.IoT Build | 0:fa2de1b79154 | 231 | { 6, "%c3%8d" }, |
Azure.IoT Build | 0:fa2de1b79154 | 232 | { 6, "%c3%8e" }, |
Azure.IoT Build | 0:fa2de1b79154 | 233 | { 6, "%c3%8f" }, |
Azure.IoT Build | 0:fa2de1b79154 | 234 | { 6, "%c3%90" }, |
Azure.IoT Build | 0:fa2de1b79154 | 235 | { 6, "%c3%91" }, |
Azure.IoT Build | 0:fa2de1b79154 | 236 | { 6, "%c3%92" }, |
Azure.IoT Build | 0:fa2de1b79154 | 237 | { 6, "%c3%93" }, |
Azure.IoT Build | 0:fa2de1b79154 | 238 | { 6, "%c3%94" }, |
Azure.IoT Build | 0:fa2de1b79154 | 239 | { 6, "%c3%95" }, |
Azure.IoT Build | 0:fa2de1b79154 | 240 | { 6, "%c3%96" }, |
Azure.IoT Build | 0:fa2de1b79154 | 241 | { 6, "%c3%97" }, |
Azure.IoT Build | 0:fa2de1b79154 | 242 | { 6, "%c3%98" }, |
Azure.IoT Build | 0:fa2de1b79154 | 243 | { 6, "%c3%99" }, |
Azure.IoT Build | 0:fa2de1b79154 | 244 | { 6, "%c3%9a" }, |
Azure.IoT Build | 0:fa2de1b79154 | 245 | { 6, "%c3%9b" }, |
Azure.IoT Build | 0:fa2de1b79154 | 246 | { 6, "%c3%9c" }, |
Azure.IoT Build | 0:fa2de1b79154 | 247 | { 6, "%c3%9d" }, |
Azure.IoT Build | 0:fa2de1b79154 | 248 | { 6, "%c3%9e" }, |
Azure.IoT Build | 0:fa2de1b79154 | 249 | { 6, "%c3%9f" }, |
Azure.IoT Build | 0:fa2de1b79154 | 250 | { 6, "%c3%a0" }, |
Azure.IoT Build | 0:fa2de1b79154 | 251 | { 6, "%c3%a1" }, |
Azure.IoT Build | 0:fa2de1b79154 | 252 | { 6, "%c3%a2" }, |
Azure.IoT Build | 0:fa2de1b79154 | 253 | { 6, "%c3%a3" }, |
Azure.IoT Build | 0:fa2de1b79154 | 254 | { 6, "%c3%a4" }, |
Azure.IoT Build | 0:fa2de1b79154 | 255 | { 6, "%c3%a5" }, |
Azure.IoT Build | 0:fa2de1b79154 | 256 | { 6, "%c3%a6" }, |
Azure.IoT Build | 0:fa2de1b79154 | 257 | { 6, "%c3%a7" }, |
Azure.IoT Build | 0:fa2de1b79154 | 258 | { 6, "%c3%a8" }, |
Azure.IoT Build | 0:fa2de1b79154 | 259 | { 6, "%c3%a9" }, |
Azure.IoT Build | 0:fa2de1b79154 | 260 | { 6, "%c3%aa" }, |
Azure.IoT Build | 0:fa2de1b79154 | 261 | { 6, "%c3%ab" }, |
Azure.IoT Build | 0:fa2de1b79154 | 262 | { 6, "%c3%ac" }, |
Azure.IoT Build | 0:fa2de1b79154 | 263 | { 6, "%c3%ad" }, |
Azure.IoT Build | 0:fa2de1b79154 | 264 | { 6, "%c3%ae" }, |
Azure.IoT Build | 0:fa2de1b79154 | 265 | { 6, "%c3%af" }, |
Azure.IoT Build | 0:fa2de1b79154 | 266 | { 6, "%c3%b0" }, |
Azure.IoT Build | 0:fa2de1b79154 | 267 | { 6, "%c3%b1" }, |
Azure.IoT Build | 0:fa2de1b79154 | 268 | { 6, "%c3%b2" }, |
Azure.IoT Build | 0:fa2de1b79154 | 269 | { 6, "%c3%b3" }, |
Azure.IoT Build | 0:fa2de1b79154 | 270 | { 6, "%c3%b4" }, |
Azure.IoT Build | 0:fa2de1b79154 | 271 | { 6, "%c3%b5" }, |
Azure.IoT Build | 0:fa2de1b79154 | 272 | { 6, "%c3%b6" }, |
Azure.IoT Build | 0:fa2de1b79154 | 273 | { 6, "%c3%b7" }, |
Azure.IoT Build | 0:fa2de1b79154 | 274 | { 6, "%c3%b8" }, |
Azure.IoT Build | 0:fa2de1b79154 | 275 | { 6, "%c3%b9" }, |
Azure.IoT Build | 0:fa2de1b79154 | 276 | { 6, "%c3%ba" }, |
Azure.IoT Build | 0:fa2de1b79154 | 277 | { 6, "%c3%bb" }, |
Azure.IoT Build | 0:fa2de1b79154 | 278 | { 6, "%c3%bc" }, |
Azure.IoT Build | 0:fa2de1b79154 | 279 | { 6, "%c3%bd" }, |
Azure.IoT Build | 0:fa2de1b79154 | 280 | { 6, "%c3%be" }, |
Azure.IoT Build | 0:fa2de1b79154 | 281 | { 6, "%c3%bf" } |
Azure.IoT Build | 0:fa2de1b79154 | 282 | }; |
Azure.IoT Build | 0:fa2de1b79154 | 283 | |
Azure.IoT Build | 0:fa2de1b79154 | 284 | STRING_HANDLE URL_EncodeString(const char* textEncode) |
Azure.IoT Build | 0:fa2de1b79154 | 285 | { |
Azure.IoT Build | 0:fa2de1b79154 | 286 | STRING_HANDLE result; |
Azure.IoT Build | 0:fa2de1b79154 | 287 | if (textEncode == NULL) |
Azure.IoT Build | 0:fa2de1b79154 | 288 | { |
Azure.IoT Build | 0:fa2de1b79154 | 289 | result = NULL; |
Azure.IoT Build | 0:fa2de1b79154 | 290 | } |
Azure.IoT Build | 0:fa2de1b79154 | 291 | else |
Azure.IoT Build | 0:fa2de1b79154 | 292 | { |
Azure.IoT Build | 0:fa2de1b79154 | 293 | STRING_HANDLE tempString = STRING_construct(textEncode); |
Azure.IoT Build | 0:fa2de1b79154 | 294 | if (tempString == NULL) |
Azure.IoT Build | 0:fa2de1b79154 | 295 | { |
Azure.IoT Build | 0:fa2de1b79154 | 296 | result = NULL; |
Azure.IoT Build | 0:fa2de1b79154 | 297 | } |
Azure.IoT Build | 0:fa2de1b79154 | 298 | else |
Azure.IoT Build | 0:fa2de1b79154 | 299 | { |
Azure.IoT Build | 0:fa2de1b79154 | 300 | result = URL_Encode(tempString); |
Azure.IoT Build | 0:fa2de1b79154 | 301 | STRING_delete(tempString); |
Azure.IoT Build | 0:fa2de1b79154 | 302 | } |
Azure.IoT Build | 0:fa2de1b79154 | 303 | } |
Azure.IoT Build | 0:fa2de1b79154 | 304 | return result; |
Azure.IoT Build | 0:fa2de1b79154 | 305 | } |
Azure.IoT Build | 0:fa2de1b79154 | 306 | |
Azure.IoT Build | 0:fa2de1b79154 | 307 | STRING_HANDLE URL_Encode(STRING_HANDLE input) |
Azure.IoT Build | 0:fa2de1b79154 | 308 | { |
Azure.IoT Build | 0:fa2de1b79154 | 309 | STRING_HANDLE result; |
Azure.IoT Build | 0:fa2de1b79154 | 310 | if (input == NULL) |
Azure.IoT Build | 0:fa2de1b79154 | 311 | { |
Azure.IoT Build | 0:fa2de1b79154 | 312 | /*Codes_SRS_URL_ENCODE_06_001: [If input is NULL then URL_Encode will return NULL.]*/ |
Azure.IoT Build | 0:fa2de1b79154 | 313 | result = NULL; |
AzureIoTClient | 1:9190c0f4d23a | 314 | LogError("URL_Encode:: NULL input"); |
Azure.IoT Build | 0:fa2de1b79154 | 315 | } |
Azure.IoT Build | 0:fa2de1b79154 | 316 | else |
Azure.IoT Build | 0:fa2de1b79154 | 317 | { |
Azure.IoT Build | 0:fa2de1b79154 | 318 | size_t lengthOfResult = 0; |
Azure.IoT Build | 0:fa2de1b79154 | 319 | char* encodedURL; |
Azure.IoT Build | 0:fa2de1b79154 | 320 | const char* currentInput; |
Azure.IoT Build | 0:fa2de1b79154 | 321 | unsigned char currentUnsignedChar; |
Azure.IoT Build | 0:fa2de1b79154 | 322 | currentInput = STRING_c_str(input); |
Azure.IoT Build | 0:fa2de1b79154 | 323 | /*Codes_SRS_URL_ENCODE_06_003: [If input is a zero length string then URL_Encode will return a zero length string.]*/ |
Azure.IoT Build | 0:fa2de1b79154 | 324 | do |
Azure.IoT Build | 0:fa2de1b79154 | 325 | { |
Azure.IoT Build | 0:fa2de1b79154 | 326 | currentUnsignedChar = (unsigned char)(*currentInput++); |
Azure.IoT Build | 0:fa2de1b79154 | 327 | lengthOfResult += urlEncoding[currentUnsignedChar].numberOfChars; |
Azure.IoT Build | 0:fa2de1b79154 | 328 | } while (currentUnsignedChar != 0); |
Azure.IoT Build | 0:fa2de1b79154 | 329 | if ((encodedURL = malloc(lengthOfResult)) == NULL) |
Azure.IoT Build | 0:fa2de1b79154 | 330 | { |
Azure.IoT Build | 0:fa2de1b79154 | 331 | /*Codes_SRS_URL_ENCODE_06_002: [If an error occurs during the encoding of input then URL_Encode will return NULL.]*/ |
Azure.IoT Build | 0:fa2de1b79154 | 332 | result = NULL; |
AzureIoTClient | 1:9190c0f4d23a | 333 | LogError("URL_Encode:: MALLOC failure on encode."); |
Azure.IoT Build | 0:fa2de1b79154 | 334 | } |
Azure.IoT Build | 0:fa2de1b79154 | 335 | else |
Azure.IoT Build | 0:fa2de1b79154 | 336 | { |
Azure.IoT Build | 0:fa2de1b79154 | 337 | size_t currentEncodePosition = 0; |
Azure.IoT Build | 0:fa2de1b79154 | 338 | currentInput = STRING_c_str(input); |
Azure.IoT Build | 0:fa2de1b79154 | 339 | do |
Azure.IoT Build | 0:fa2de1b79154 | 340 | { |
Azure.IoT Build | 0:fa2de1b79154 | 341 | currentUnsignedChar = (unsigned char)(*currentInput++); |
Azure.IoT Build | 0:fa2de1b79154 | 342 | if (urlEncoding[currentUnsignedChar].numberOfChars == 1) |
Azure.IoT Build | 0:fa2de1b79154 | 343 | { |
Azure.IoT Build | 0:fa2de1b79154 | 344 | encodedURL[currentEncodePosition++] = *(urlEncoding[currentUnsignedChar].encoding); |
Azure.IoT Build | 0:fa2de1b79154 | 345 | } |
Azure.IoT Build | 0:fa2de1b79154 | 346 | else |
Azure.IoT Build | 0:fa2de1b79154 | 347 | { |
Azure.IoT Build | 0:fa2de1b79154 | 348 | memcpy(encodedURL + currentEncodePosition, urlEncoding[currentUnsignedChar].encoding, urlEncoding[currentUnsignedChar].numberOfChars); |
Azure.IoT Build | 0:fa2de1b79154 | 349 | currentEncodePosition += urlEncoding[currentUnsignedChar].numberOfChars; |
Azure.IoT Build | 0:fa2de1b79154 | 350 | } |
Azure.IoT Build | 0:fa2de1b79154 | 351 | } while (currentUnsignedChar != 0); |
Azure.IoT Build | 0:fa2de1b79154 | 352 | result = STRING_new_with_memory(encodedURL); |
Azure.IoT Build | 0:fa2de1b79154 | 353 | } |
Azure.IoT Build | 0:fa2de1b79154 | 354 | } |
Azure.IoT Build | 0:fa2de1b79154 | 355 | return result; |
Azure.IoT Build | 0:fa2de1b79154 | 356 | } |