在代码中,开关用于将字母转换为连续值。优化编译器通常不会像切换前的简单连续数字条件那样完成这项工作。如何检测使用了哪个执行字符集和/或得出结论认为字母是连续的以用简单的条件替换它?
static long digit_value(char c)
{
if (c >= '0' && c <= '9')
return (c-'0');
switch(c) {
case 'a':
case 'A':
return 10;
case 'b':
case 'B':
return 11;
case 'c':
case 'C':
return 12;
case 'd':
case 'D':
return 13;
case 'e':
case 'E':
return 14;
case 'f':
case 'F':
return 15;
case 'g':
case 'G':
return 16;
case 'h':
case 'H':
return 17;
case 'i':
case 'I':
return 18;
case 'j':
case 'J':
return 19;
case 'k': …Run Code Online (Sandbox Code Playgroud) 我有用Vorbis格式编码的音乐,并且还将我的一些专辑编码为新的Opus格式.有没有办法可以将它们复制并播放到我的iPhone上?xiph.org wiki页面说明了vorbis支持,在自由软件方面,它是"正在进行中",虽然它引用了支持Vorbis的无线电流和视频应用程序,但音频支持呢?
总结要求:
[编辑:需要必要的媒体播放器功能]
我的android应用程序依赖于SNI来访问正确的服务器,因此它需要TLS并且不能与SSLv3一起使用.我正在使用okhttp和改造,服务器日志表明突然TLS握手切换到SSLv3并可能保持这种状态一段时间,导致由于缺少服务器名称指示支持而导致重复的主机名验证失败.
我知道在某些情况下(哪些?)okhttp停止使用TLS并切换到SSL作为后备.但是,这在SNI的情况下是不可接受的,有没有办法禁用回退?
示例apache日志:
[Wed May 07 18:00:12.799511 2014] [ssl:debug] [pid 20369:tid 140532403599104] ssl_engine_kernel.c(1891): [client <removed>:51431] AH02041: Protocol: TLSv1, Cipher: RC4-SHA (128/128 bits)
[Wed May 07 18:00:28.563170 2014] [ssl:debug] [pid 20455:tid 140532646553344] ssl_engine_kernel.c(1891): [client <removed>:51432] AH02041: Protocol: TLSv1, Cipher: RC4-SHA (128/128 bits)
[Wed May 07 18:00:45.884075 2014] [ssl:debug] [pid 20371:tid 140532445562624] ssl_engine_kernel.c(1891): [client <removed>:51433] AH02041: Protocol: TLSv1, Cipher: RC4-SHA (128/128 bits)
[Wed May 07 18:01:01.322657 2014] [ssl:debug] [pid 20455:tid 140532395206400] ssl_engine_kernel.c(1891): [client <removed>:51434] AH02041: Protocol: TLSv1, Cipher: RC4-SHA (128/128 bits)
[Wed …Run Code Online (Sandbox Code Playgroud) use std::ptr::{addr_of_mut, null_mut};
use libc::{CLOCK_MONOTONIC, timer_create, timer_delete, timer_t};
fn main() {
let mut timer1: timer_t = null_mut();
unsafe {
let r = timer_create(CLOCK_MONOTONIC, null_mut(), addr_of_mut!(timer1));
if r == 0 {
timer_delete(timer1);
}
}
}
Run Code Online (Sandbox Code Playgroud)
调用时timer_create(),生成的定时器 ID 存储在变量中timer1。我将它作为可变指针传递,因此这就是输出变量。
我怎样才能避免像上面的代码中timer1那样初始化null_mut(),因为知道 API 保证它是安全的?