开源 企业版 高校版 私有云 模力方舟 AI 队友
代码拉取完成,页面将自动刷新
捐赠
捐赠前请先登录
扫描微信二维码支付
取消
支付完成
支付提示
将跳转至支付宝完成支付
确定
取消
1 Star 0 Fork 0

api-go/php-src

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
已有帐号? 立即登录
文件
master
分支 (321)
标签 (1019)
master
PHP-7.4
PHP-7.3
PHP-7.2
PHP-7.4.1
PHP-7.2.26
PHP-7.3.13
PHP-7.1
PHP-7.4.0
PHP-7.2.25
PHP-7.3.12
PHP-7.2.24
PHP-7.3.11
PHP-7.2.23
PHP-7.3.10
PHP-7.2.22
PHP-7.3.9
PHP-7.2.21
PHP-7.3.8
PHP-7.3.7
php-7.4.1
php-7.2.26
php-7.3.13
php-7.4.1RC1
php-7.3.13RC1
php-7.2.26RC1
php-7.4.0
php-7.2.25
php-7.3.12
php-7.4.0RC6
php-7.3.12RC1
php-7.2.25RC1
php-7.4.0RC5
php-7.1.33
php-7.2.24
php-7.3.11
php-7.4.0RC4
php-7.3.11RC1
php-7.2.24RC1
php-7.4.0RC3
master
分支 (321)
标签 (1019)
master
PHP-7.4
PHP-7.3
PHP-7.2
PHP-7.4.1
PHP-7.2.26
PHP-7.3.13
PHP-7.1
PHP-7.4.0
PHP-7.2.25
PHP-7.3.12
PHP-7.2.24
PHP-7.3.11
PHP-7.2.23
PHP-7.3.10
PHP-7.2.22
PHP-7.3.9
PHP-7.2.21
PHP-7.3.8
PHP-7.3.7
php-7.4.1
php-7.2.26
php-7.3.13
php-7.4.1RC1
php-7.3.13RC1
php-7.2.26RC1
php-7.4.0
php-7.2.25
php-7.3.12
php-7.4.0RC6
php-7.3.12RC1
php-7.2.25RC1
php-7.4.0RC5
php-7.1.33
php-7.2.24
php-7.3.11
php-7.4.0RC4
php-7.3.11RC1
php-7.2.24RC1
php-7.4.0RC3
克隆/下载
克隆/下载
提示
下载代码请复制以下命令到终端执行
为确保你提交的代码身份被 Gitee 正确识别,请执行以下命令完成配置
初次使用 SSH 协议进行代码克隆、推送等操作时,需按下述提示完成 SSH 配置
1 生成 RSA 密钥
2 获取 RSA 公钥内容,并配置到 SSH公钥
在 Gitee 上使用 SVN,请访问 使用指南
使用 HTTPS 协议时,命令行会出现如下账号密码验证步骤。基于安全考虑,Gitee 建议 配置并使用私人令牌 替代登录密码进行克隆、推送等操作
Username for 'https://gitee.com': userName
Password for 'https://userName@gitee.com': # 私人令牌
master
分支 (321)
标签 (1019)
master
PHP-7.4
PHP-7.3
PHP-7.2
PHP-7.4.1
PHP-7.2.26
PHP-7.3.13
PHP-7.1
PHP-7.4.0
PHP-7.2.25
PHP-7.3.12
PHP-7.2.24
PHP-7.3.11
PHP-7.2.23
PHP-7.3.10
PHP-7.2.22
PHP-7.3.9
PHP-7.2.21
PHP-7.3.8
PHP-7.3.7
php-7.4.1
php-7.2.26
php-7.3.13
php-7.4.1RC1
php-7.3.13RC1
php-7.2.26RC1
php-7.4.0
php-7.2.25
php-7.3.12
php-7.4.0RC6
php-7.3.12RC1
php-7.2.25RC1
php-7.4.0RC5
php-7.1.33
php-7.2.24
php-7.3.11
php-7.4.0RC4
php-7.3.11RC1
php-7.2.24RC1
php-7.4.0RC3
php-src
/
ext
/
standard
/
uuencode.c
php-src
/
ext
/
standard
/
uuencode.c
uuencode.c 6.45 KB
一键复制 编辑 原始数据 按行查看 历史
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231
/*
+----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Author: Ilia Alshanetsky <ilia@php.net> |
+----------------------------------------------------------------------+
*/
/*
* Portions of this code are based on Berkeley's uuencode/uudecode
* implementation.
*
* Copyright (c) 1983, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <math.h>
#include "php.h"
#include "php_uuencode.h"
#define PHP_UU_ENC(c) ((c) ? ((c) & 077) + ' ' : '`')
#define PHP_UU_ENC_C2(c) PHP_UU_ENC(((*(c) << 4) & 060) | ((*((c) + 1) >> 4) & 017))
#define PHP_UU_ENC_C3(c) PHP_UU_ENC(((*(c + 1) << 2) & 074) | ((*((c) + 2) >> 6) & 03))
#define PHP_UU_DEC(c) (((c) - ' ') & 077)
PHPAPI zend_string *php_uuencode(char *src, size_t src_len) /* {{{ */
{
size_t len = 45;
unsigned char *p, *s, *e, *ee;
zend_string *dest;
/* encoded length is ~ 38% greater than the original
Use 1.5 for easier calculation.
*/
dest = zend_string_safe_alloc(src_len/2, 3, 46, 0);
p = (unsigned char *) ZSTR_VAL(dest);
s = (unsigned char *) src;
e = s + src_len;
while ((s + 3) < e) {
ee = s + len;
if (ee > e) {
ee = e;
len = ee - s;
if (len % 3) {
ee = s + (int) (floor((double)len / 3) * 3);
}
}
*p++ = PHP_UU_ENC(len);
while (s < ee) {
*p++ = PHP_UU_ENC(*s >> 2);
*p++ = PHP_UU_ENC_C2(s);
*p++ = PHP_UU_ENC_C3(s);
*p++ = PHP_UU_ENC(*(s + 2) & 077);
s += 3;
}
if (len == 45) {
*p++ = '\n';
}
}
if (s < e) {
if (len == 45) {
*p++ = PHP_UU_ENC(e - s);
len = 0;
}
*p++ = PHP_UU_ENC(*s >> 2);
*p++ = PHP_UU_ENC_C2(s);
*p++ = ((e - s) > 1) ? PHP_UU_ENC_C3(s) : PHP_UU_ENC('0円');
*p++ = ((e - s) > 2) ? PHP_UU_ENC(*(s + 2) & 077) : PHP_UU_ENC('0円');
}
if (len < 45) {
*p++ = '\n';
}
*p++ = PHP_UU_ENC('0円');
*p++ = '\n';
*p = '0円';
dest = zend_string_truncate(dest, (char *) p - ZSTR_VAL(dest), 0);
return dest;
}
/* }}} */
PHPAPI zend_string *php_uudecode(char *src, size_t src_len) /* {{{ */
{
size_t len, total_len=0;
char *s, *e, *p, *ee;
zend_string *dest;
dest = zend_string_alloc((size_t) ceil(src_len * 0.75), 0);
p = ZSTR_VAL(dest);
s = src;
e = src + src_len;
while (s < e) {
if ((len = PHP_UU_DEC(*s++)) == 0) {
break;
}
/* sanity check */
if (len > src_len) {
goto err;
}
total_len += len;
ee = s + (len == 45 ? 60 : (int) floor(len * 1.33));
/* sanity check */
if (ee > e) {
goto err;
}
while (s < ee) {
if(s+4 > e) {
goto err;
}
*p++ = PHP_UU_DEC(*s) << 2 | PHP_UU_DEC(*(s + 1)) >> 4;
*p++ = PHP_UU_DEC(*(s + 1)) << 4 | PHP_UU_DEC(*(s + 2)) >> 2;
*p++ = PHP_UU_DEC(*(s + 2)) << 6 | PHP_UU_DEC(*(s + 3));
s += 4;
}
if (len < 45) {
break;
}
/* skip \n */
s++;
}
assert(p >= ZSTR_VAL(dest));
if ((len = total_len) > (size_t)(p - ZSTR_VAL(dest))) {
*p++ = PHP_UU_DEC(*s) << 2 | PHP_UU_DEC(*(s + 1)) >> 4;
if (len > 1) {
*p++ = PHP_UU_DEC(*(s + 1)) << 4 | PHP_UU_DEC(*(s + 2)) >> 2;
if (len > 2) {
*p++ = PHP_UU_DEC(*(s + 2)) << 6 | PHP_UU_DEC(*(s + 3));
}
}
}
ZSTR_LEN(dest) = total_len;
ZSTR_VAL(dest)[ZSTR_LEN(dest)] = '0円';
return dest;
err:
zend_string_efree(dest);
return NULL;
}
/* }}} */
/* {{{ proto string|false convert_uuencode(string data)
uuencode a string */
PHP_FUNCTION(convert_uuencode)
{
zend_string *src;
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_STR(src)
ZEND_PARSE_PARAMETERS_END();
if (ZSTR_LEN(src) < 1) { RETURN_FALSE; }
RETURN_STR(php_uuencode(ZSTR_VAL(src), ZSTR_LEN(src)));
}
/* }}} */
/* {{{ proto string|false convert_uudecode(string data)
decode a uuencoded string */
PHP_FUNCTION(convert_uudecode)
{
zend_string *src;
zend_string *dest;
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_STR(src)
ZEND_PARSE_PARAMETERS_END();
if (ZSTR_LEN(src) < 1) { RETURN_FALSE; }
if ((dest = php_uudecode(ZSTR_VAL(src), ZSTR_LEN(src))) == NULL) {
php_error_docref(NULL, E_WARNING, "The given parameter is not a valid uuencoded string");
RETURN_FALSE;
}
RETURN_STR(dest);
}
/* }}} */
Loading...
举报
举报成功
我们将于2个工作日内通过站内信反馈结果给你!
请认真填写举报原因,尽可能描述详细。
请选择举报类型
取消
发送
误判申诉

此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。

如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。

取消
提交

简介

php-src 镜像库
暂无标签
未知许可证
查看未知开源许可协议
取消

发行版

暂无发行版

贡献者

全部

近期动态

不能加载更多了
编辑仓库简介
简介内容
主页
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/netscript/php-src.git
git@gitee.com:netscript/php-src.git
netscript
php-src
php-src
master
点此查找更多帮助

搜索帮助

评论
仓库举报
回到顶部
登录提示
该操作需登录 Gitee 帐号,请先登录后再操作。
立即登录
没有帐号,去注册

AltStyle によって変換されたページ (->オリジナル) /