Remove base.h includes from runtime/, fix up indirect dependencies
This probably just pushes a bit of it down to runtime/base/types.h, but at least a few decent-sized includes are out of every TU now (lexical_cast.hpp, iostream, boost/foreach, and filesystem.hpp). Haven't measured impact on build times if any. Reviewed By: @edwinsmith Differential Revision: D1115343
Esse commit está contido em:
+897
-896
Diferenças do arquivo suprimidas por serem muito extensas
Carregar Diff
@@ -16,7 +16,6 @@
|
||||
#ifndef incl_HPHP_HHVM_PROCESS_INIT_H_
|
||||
#define incl_HPHP_HHVM_PROCESS_INIT_H_
|
||||
|
||||
#include "hphp/util/base.h"
|
||||
#include "hphp/runtime/base/thread-init-fini.h"
|
||||
#include "hphp/runtime/vm/runtime.h"
|
||||
#include "hphp/compiler/analysis/emitter.h"
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#else
|
||||
#include "hphp/compiler/parser/parser.h"
|
||||
#endif
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include "hphp/util/util.h"
|
||||
#include "hphp/util/logger.h"
|
||||
|
||||
|
||||
@@ -20,8 +20,6 @@
|
||||
#include <cstring>
|
||||
#include <memory>
|
||||
|
||||
#include "hphp/util/base.h"
|
||||
|
||||
namespace HPHP {
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
|
||||
#include "parser.h"
|
||||
#include "hphp/util/hash.h"
|
||||
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include <boost/algorithm/string/predicate.hpp>
|
||||
|
||||
namespace HPHP {
|
||||
@@ -58,7 +60,7 @@ ParserBase::~ParserBase() {
|
||||
}
|
||||
|
||||
std::string ParserBase::getMessage(bool filename /* = false */) const {
|
||||
string ret = m_scanner.getError();
|
||||
std::string ret = m_scanner.getError();
|
||||
if (!ret.empty()) {
|
||||
ret += " ";
|
||||
}
|
||||
@@ -70,12 +72,12 @@ std::string ParserBase::getMessage(Location *loc,
|
||||
bool filename /* = false */) const {
|
||||
int line = loc->line1;
|
||||
int column = loc->char1;
|
||||
string ret = "(";
|
||||
std::string ret = "(";
|
||||
if (filename) {
|
||||
ret += string("File: ") + file() + ", ";
|
||||
ret += std::string("File: ") + file() + ", ";
|
||||
}
|
||||
ret += string("Line: ") + boost::lexical_cast<string>(line);
|
||||
ret += ", Char: " + boost::lexical_cast<string>(column) + ")";
|
||||
ret += std::string("Line: ") + boost::lexical_cast<std::string>(line);
|
||||
ret += ", Char: " + boost::lexical_cast<std::string>(column) + ")";
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -13,8 +13,10 @@
|
||||
| license@php.net so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
#include "hphp/parser/scanner.h"
|
||||
|
||||
#include <fstream>
|
||||
|
||||
#include "hphp/util/util.h"
|
||||
#include "hphp/util/logger.h"
|
||||
#include "hphp/zend/zend-string.h"
|
||||
@@ -44,7 +46,7 @@ bool ScannerToken::htmlTrim() {
|
||||
return false;
|
||||
}
|
||||
while (isspace(*p1) && p1 > p0) --p1;
|
||||
string text;
|
||||
std::string text;
|
||||
text.reserve(m_text.length());
|
||||
if (p0 != p00) {
|
||||
text = " ";
|
||||
@@ -76,7 +78,7 @@ void ScannerToken::xhpDecode() {
|
||||
// Pretty sure it is universally available!
|
||||
// (Do assertion anyway.)
|
||||
assert(ret);
|
||||
m_text = string(ret, len);
|
||||
m_text = std::string(ret, len);
|
||||
free(ret);
|
||||
}
|
||||
|
||||
@@ -119,7 +121,7 @@ Scanner::Scanner(const char *source, int len, int type,
|
||||
assert(m_source);
|
||||
m_streamOwner = false;
|
||||
if (md5) {
|
||||
m_stream = new std::istringstream(string(source, len));
|
||||
m_stream = new std::istringstream(std::string(source, len));
|
||||
m_streamOwner = true;
|
||||
computeMd5();
|
||||
}
|
||||
@@ -623,7 +625,7 @@ void Scanner::error(const char* fmt, ...) {
|
||||
void Scanner::warn(const char* fmt, ...) {
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
string msg;
|
||||
std::string msg;
|
||||
Util::string_vsnprintf(msg, fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
@@ -669,8 +671,8 @@ void Scanner::incLoc(const char *rawText, int rawLeng, int type) {
|
||||
}
|
||||
}
|
||||
|
||||
string Scanner::escape(const char *str, int len, char quote_type) const {
|
||||
string output;
|
||||
std::string Scanner::escape(const char *str, int len, char quote_type) const {
|
||||
std::string output;
|
||||
output.reserve(len);
|
||||
|
||||
if (quote_type == '\'') {
|
||||
@@ -717,7 +719,7 @@ string Scanner::escape(const char *str, int len, char quote_type) const {
|
||||
case 'x':
|
||||
case 'X': {
|
||||
if (isxdigit(str[i+1])) {
|
||||
string shex;
|
||||
std::string shex;
|
||||
shex += str[++i]; // 0th hex digit
|
||||
if (isxdigit(str[i+1])) {
|
||||
shex += str[++i]; // 1st hex digit
|
||||
@@ -732,7 +734,7 @@ string Scanner::escape(const char *str, int len, char quote_type) const {
|
||||
default: {
|
||||
// check for an octal
|
||||
if ('0' <= str[i] && str[i] <= '7') {
|
||||
string soct;
|
||||
std::string soct;
|
||||
soct += str[i]; // 0th octal digit
|
||||
if ('0' <= str[i+1] && str[i+1] <= '7') {
|
||||
soct += str[++i]; // 1st octal digit
|
||||
|
||||
@@ -18,6 +18,12 @@
|
||||
#define incl_HPHP_PARSER_SCANNER_H_
|
||||
|
||||
#include <sstream>
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
#include <limits>
|
||||
#include <cstdlib>
|
||||
#include <limits.h>
|
||||
|
||||
#include "hphp/util/exception.h"
|
||||
#include "hphp/parser/location.h"
|
||||
#include "hphp/parser/hphp.tab.hpp"
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
#include <iostream>
|
||||
#include <cstdlib>
|
||||
#include <fstream>
|
||||
#include <string.h>
|
||||
|
||||
#include "folly/String.h"
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
#include "hphp/runtime/base/array-data.h"
|
||||
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include <tbb/concurrent_hash_map.h>
|
||||
|
||||
#include "hphp/util/exception.h"
|
||||
@@ -713,16 +714,16 @@ const char* ArrayData::kindToString(ArrayKind kind) {
|
||||
}
|
||||
|
||||
void ArrayData::dump() {
|
||||
string out; dump(out); fwrite(out.c_str(), out.size(), 1, stdout);
|
||||
std::string out; dump(out); fwrite(out.c_str(), out.size(), 1, stdout);
|
||||
}
|
||||
|
||||
void ArrayData::dump(std::string &out) {
|
||||
VariableSerializer vs(VariableSerializer::Type::VarDump);
|
||||
String ret(vs.serialize(Array(this), true));
|
||||
out += "ArrayData(";
|
||||
out += boost::lexical_cast<string>(m_count);
|
||||
out += boost::lexical_cast<std::string>(m_count);
|
||||
out += "): ";
|
||||
out += string(ret.data(), ret.size());
|
||||
out += std::string(ret.data(), ret.size());
|
||||
}
|
||||
|
||||
void ArrayData::dump(std::ostream &out) {
|
||||
|
||||
@@ -13,8 +13,10 @@
|
||||
| license@php.net so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
#include "hphp/runtime/base/array-util.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "hphp/runtime/base/array-iterator.h"
|
||||
#include "hphp/runtime/base/string-util.h"
|
||||
#include "hphp/runtime/base/builtin-functions.h"
|
||||
@@ -592,10 +594,10 @@ Variant ArrayUtil::RegularSortUnique(CArrRef input) {
|
||||
if (input.size() <= 1) return input;
|
||||
|
||||
Array::SortData opaque;
|
||||
vector<int> indices;
|
||||
std::vector<int> indices;
|
||||
Array::SortImpl(indices, input, opaque, Array::SortRegularAscending, false);
|
||||
|
||||
vector<bool> duplicates(indices.size(), false);
|
||||
std::vector<bool> duplicates(indices.size(), false);
|
||||
int lastIdx = indices[0];
|
||||
Variant last = input->getValue(opaque.positions[lastIdx]);
|
||||
for (unsigned int i = 1; i < indices.size(); ++i) {
|
||||
|
||||
@@ -48,6 +48,9 @@
|
||||
using namespace HPHP::MethodLookup;
|
||||
|
||||
namespace HPHP {
|
||||
|
||||
using std::string;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// static strings
|
||||
|
||||
|
||||
@@ -31,6 +31,8 @@ namespace HPHP {
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// statics
|
||||
|
||||
using std::string;
|
||||
|
||||
bool ClassInfo::s_loaded = false;
|
||||
ClassInfo *ClassInfo::s_systemFuncs = nullptr;
|
||||
ClassInfo::ClassMap ClassInfo::s_class_like;
|
||||
@@ -235,7 +237,7 @@ Variant ClassInfo::ConstantInfo::getValue() const {
|
||||
void ClassInfo::ConstantInfo::setValue(CVarRef value) {
|
||||
VariableSerializer vs(VariableSerializer::Type::Serialize);
|
||||
String s = vs.serialize(value, true);
|
||||
svalue = string(s.data(), s.size());
|
||||
svalue = std::string(s.data(), s.size());
|
||||
deferred = false;
|
||||
}
|
||||
|
||||
@@ -775,16 +777,14 @@ ClassInfo::ParameterInfo::~ParameterInfo() {
|
||||
|
||||
ClassInfo::MethodInfo::~MethodInfo() {
|
||||
if (attribute & ClassInfo::IsRedeclared) {
|
||||
for (vector<const ParameterInfo *>::iterator it = parameters.begin();
|
||||
it != parameters.end(); ++it) {
|
||||
for (auto it = parameters.begin(); it != parameters.end(); ++it) {
|
||||
delete (MethodInfo*)(void*)*it;
|
||||
}
|
||||
} else {
|
||||
for (vector<const ParameterInfo *>::iterator it = parameters.begin();
|
||||
it != parameters.end(); ++it) {
|
||||
for (auto it = parameters.begin(); it != parameters.end(); ++it) {
|
||||
delete *it;
|
||||
}
|
||||
for (vector<const ConstantInfo *>::iterator it = staticVariables.begin();
|
||||
for (auto it = staticVariables.begin();
|
||||
it != staticVariables.end(); ++it) {
|
||||
delete *it;
|
||||
}
|
||||
|
||||
@@ -13,8 +13,11 @@
|
||||
| license@php.net so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
#include "hphp/runtime/base/code-coverage.h"
|
||||
|
||||
#include <fstream>
|
||||
#include <vector>
|
||||
|
||||
#include "hphp/runtime/base/complex-types.h"
|
||||
#include "hphp/runtime/base/execution-context.h"
|
||||
#include "hphp/util/logger.h"
|
||||
@@ -87,13 +90,13 @@ void CodeCoverage::Record(const char *filename, int line0, int line1) {
|
||||
|
||||
CodeCoverageMap::iterator iter = m_hits.find(filename);
|
||||
if (iter == m_hits.end()) {
|
||||
vector<int> &lines = m_hits[filename];
|
||||
std::vector<int> &lines = m_hits[filename];
|
||||
lines.resize(line1 + 1);
|
||||
for (int i = line0; i <= line0 /* should be line1 one day */; i++) {
|
||||
lines[i] = 1;
|
||||
}
|
||||
} else {
|
||||
vector<int> &lines = iter->second;
|
||||
std::vector<int> &lines = iter->second;
|
||||
if ((int)lines.size() < line1 + 1) {
|
||||
lines.resize(line1 + 1);
|
||||
}
|
||||
@@ -107,7 +110,7 @@ Array CodeCoverage::Report() {
|
||||
Array ret = Array::Create();
|
||||
for (CodeCoverageMap::const_iterator iter = m_hits.begin();
|
||||
iter != m_hits.end(); ++iter) {
|
||||
const vector<int> &lines = iter->second;
|
||||
const std::vector<int> &lines = iter->second;
|
||||
Array tmp = Array::Create();
|
||||
for (int i = 1; i < (int)lines.size(); i++) {
|
||||
if (lines[i]) {
|
||||
@@ -130,7 +133,7 @@ void CodeCoverage::Report(const std::string &filename) {
|
||||
f << "{\n";
|
||||
for (CodeCoverageMap::const_iterator iter = m_hits.begin();
|
||||
iter != m_hits.end();) {
|
||||
const vector<int> &lines = iter->second;
|
||||
const std::vector<int> &lines = iter->second;
|
||||
f << "\"" << iter->first << "\": [";
|
||||
int count = lines.size();
|
||||
for (int i = 0 /* not 1 */; i < count; i++) {
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace HPHP {
|
||||
|
||||
// helpers
|
||||
|
||||
static void log_apc(const string& name) {
|
||||
static void log_apc(const std::string& name) {
|
||||
if (RuntimeOption::EnableStats && RuntimeOption::EnableAPCStats) {
|
||||
ServerStats::Log(name, 1);
|
||||
}
|
||||
@@ -268,11 +268,11 @@ bool ConcurrentTableSharedStore::handlePromoteObj(const String& key,
|
||||
return false;
|
||||
}
|
||||
|
||||
static string std_apc_miss = "apc.miss";
|
||||
static string std_apc_hit = "apc.hit";
|
||||
static string std_apc_cas = "apc.cas";
|
||||
static string std_apc_update = "apc.update";
|
||||
static string std_apc_new = "apc.new";
|
||||
static std::string std_apc_miss = "apc.miss";
|
||||
static std::string std_apc_hit = "apc.hit";
|
||||
static std::string std_apc_cas = "apc.cas";
|
||||
static std::string std_apc_update = "apc.update";
|
||||
static std::string std_apc_new = "apc.new";
|
||||
|
||||
APCHandle* ConcurrentTableSharedStore::unserialize(const String& key,
|
||||
const StoreValue* sval) {
|
||||
@@ -510,7 +510,7 @@ bool ConcurrentTableSharedStore::store(const String& key, CVarRef value,
|
||||
} else {
|
||||
log_apc(std_apc_new);
|
||||
if (RuntimeOption::EnableStats && RuntimeOption::EnableAPCKeyStats) {
|
||||
string prefix = "apc.new." + GetSkeleton(key);
|
||||
std::string prefix = "apc.new." + GetSkeleton(key);
|
||||
ServerStats::Log(prefix, 1);
|
||||
}
|
||||
}
|
||||
@@ -596,8 +596,7 @@ void ConcurrentTableSharedStore::primeDone() {
|
||||
apcExtension::FileStorageAdviseOutPeriod);
|
||||
}
|
||||
|
||||
for (set<string>::const_iterator iter =
|
||||
apcExtension::CompletionKeys.begin();
|
||||
for (auto iter = apcExtension::CompletionKeys.begin();
|
||||
iter != apcExtension::CompletionKeys.end(); ++iter) {
|
||||
Map::accessor acc;
|
||||
const char *copy = strdup(iter->c_str());
|
||||
|
||||
@@ -17,8 +17,14 @@
|
||||
#ifndef incl_HPHP_COUNTABLE_H_
|
||||
#define incl_HPHP_COUNTABLE_H_
|
||||
|
||||
#include "hphp/util/base.h"
|
||||
#include <cstdlib>
|
||||
#include <cstdint>
|
||||
#include <cassert>
|
||||
#include <atomic>
|
||||
|
||||
#include "hphp/util/util.h"
|
||||
#include "hphp/util/compilation-flags.h"
|
||||
#include "hphp/util/compatibility.h"
|
||||
#include "hphp/util/trace.h"
|
||||
#include "hphp/util/atomic.h"
|
||||
|
||||
|
||||
@@ -16,7 +16,10 @@
|
||||
#ifndef incl_HPHP_DEBUGGABLE_H_
|
||||
#define incl_HPHP_DEBUGGABLE_H_
|
||||
|
||||
#include "hphp/util/base.h"
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
#include "hphp/runtime/base/string-buffer.h"
|
||||
#include "hphp/runtime/base/complex-types.h"
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ bool check_option(const char *option) {
|
||||
}
|
||||
|
||||
int emulate_zend(int argc, char** argv){
|
||||
vector<string> newargv;
|
||||
std::vector<std::string> newargv;
|
||||
|
||||
newargv.push_back(argv[0]);
|
||||
#ifdef PHP_DEFAULT_HDF
|
||||
@@ -140,8 +140,8 @@ int emulate_zend(int argc, char** argv){
|
||||
if (program == nullptr) {
|
||||
// If the program wasn't specified on the command-line, ala' -r,
|
||||
// is no command-line parameter, read the PHP file from stdin.
|
||||
string line;
|
||||
while (getline(std::cin, line)) {
|
||||
std::string line;
|
||||
while (std::getline(std::cin, line)) {
|
||||
write(tmp_fd, line.c_str(), line.length());
|
||||
write(tmp_fd, "\n", 1);
|
||||
}
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
#ifndef incl_HPHP_EMULATE_ZEND_H_
|
||||
#define incl_HPHP_EMULATE_ZEND_H_
|
||||
|
||||
#include "hphp/util/base.h"
|
||||
#include "hphp/runtime/base/types.h"
|
||||
|
||||
namespace HPHP {
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
#include "hphp/runtime/base/hphp-array.h"
|
||||
#include "hphp/runtime/vm/func.h"
|
||||
#include "hphp/runtime/vm/bytecode.h"
|
||||
#include "hphp/util/base.h"
|
||||
#include "hphp/util/lock.h"
|
||||
#include "hphp/util/thread-local.h"
|
||||
#include <setjmp.h>
|
||||
|
||||
@@ -13,8 +13,18 @@
|
||||
| license@php.net so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
#include "hphp/runtime/base/file-repository.h"
|
||||
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include "folly/ScopeGuard.h"
|
||||
|
||||
#include "hphp/util/assertions.h"
|
||||
#include "hphp/runtime/base/runtime-option.h"
|
||||
#include "hphp/runtime/base/zend-string.h"
|
||||
#include "hphp/util/process.h"
|
||||
@@ -33,8 +43,6 @@
|
||||
#include "hphp/runtime/vm/runtime.h"
|
||||
#include "hphp/runtime/vm/treadmill.h"
|
||||
|
||||
#include "folly/ScopeGuard.h"
|
||||
|
||||
using std::endl;
|
||||
|
||||
namespace HPHP {
|
||||
@@ -45,13 +53,15 @@ extern bool (*file_dump)(const char *filename);
|
||||
namespace Eval {
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
std::set<string> FileRepository::s_names;
|
||||
std::set<std::string> FileRepository::s_names;
|
||||
|
||||
PhpFile::PhpFile(const string &fileName, const string &srcRoot,
|
||||
const string &relPath, const string &md5,
|
||||
PhpFile::PhpFile(const std::string &fileName,
|
||||
const std::string &srcRoot,
|
||||
const std::string &relPath,
|
||||
const std::string &md5,
|
||||
HPHP::Unit* unit)
|
||||
: m_refCount(0), m_id(0),
|
||||
m_profName(string("run_init::") + string(fileName)),
|
||||
m_profName(std::string("run_init::") + std::string(fileName)),
|
||||
m_fileName(fileName), m_srcRoot(srcRoot), m_relPath(relPath), m_md5(md5),
|
||||
m_unit(unit) {
|
||||
}
|
||||
@@ -306,10 +316,10 @@ bool FileRepository::findFile(const StringData *path, struct stat *s) {
|
||||
String FileRepository::translateFileName(StringData *file) {
|
||||
ParsedFilesMap::const_accessor acc;
|
||||
if (!s_files.find(acc, file)) return file;
|
||||
string srcRoot(SourceRootInfo::GetCurrentSourceRoot());
|
||||
std::string srcRoot(SourceRootInfo::GetCurrentSourceRoot());
|
||||
if (srcRoot.empty()) return file;
|
||||
PhpFile *f = acc->second->getPhpFile();
|
||||
const string &parsedSrcRoot = f->getSrcRoot();
|
||||
const std::string &parsedSrcRoot = f->getSrcRoot();
|
||||
if (srcRoot == parsedSrcRoot) return file;
|
||||
int len = parsedSrcRoot.size();
|
||||
if (len > 0 && file->size() > len &&
|
||||
@@ -319,10 +329,10 @@ String FileRepository::translateFileName(StringData *file) {
|
||||
return file;
|
||||
}
|
||||
|
||||
string FileRepository::unitMd5(const string& fileMd5) {
|
||||
std::string FileRepository::unitMd5(const std::string& fileMd5) {
|
||||
// Incorporate relevant options into the unit md5 (there will be more)
|
||||
std::ostringstream opts;
|
||||
string t = fileMd5 + '\0'
|
||||
std::string t = fileMd5 + '\0'
|
||||
+ (RuntimeOption::EnableHipHopSyntax ? '1' : '0')
|
||||
+ (RuntimeOption::EnableEmitSwitch ? '1' : '0')
|
||||
+ (RuntimeOption::EvalJitEnableRenameFunction ? '1' : '0')
|
||||
@@ -331,14 +341,14 @@ string FileRepository::unitMd5(const string& fileMd5) {
|
||||
}
|
||||
|
||||
void FileRepository::setFileInfo(const StringData *name,
|
||||
const string& md5,
|
||||
const std::string& md5,
|
||||
FileInfo &fileInfo,
|
||||
bool fromRepo) {
|
||||
// Incorporate the path into the md5 that is used as the key for file
|
||||
// repository lookups. This assures that even if two PHP files have
|
||||
// identical content, separate units exist for them (so that
|
||||
// Unit::filepath() and Unit::dirpath() work correctly).
|
||||
string s = md5 + '\0' + name->data();
|
||||
std::string s = md5 + '\0' + name->data();
|
||||
fileInfo.m_md5 = string_md5(s.c_str(), s.size());
|
||||
|
||||
if (fromRepo) {
|
||||
@@ -351,12 +361,12 @@ void FileRepository::setFileInfo(const StringData *name,
|
||||
int srcRootLen = fileInfo.m_srcRoot.size();
|
||||
if (srcRootLen) {
|
||||
if (!strncmp(name->data(), fileInfo.m_srcRoot.c_str(), srcRootLen)) {
|
||||
fileInfo.m_relPath = string(name->data() + srcRootLen);
|
||||
fileInfo.m_relPath = std::string(name->data() + srcRootLen);
|
||||
}
|
||||
}
|
||||
|
||||
ReadLock lock(s_md5Lock);
|
||||
Md5FileMap::iterator it = s_md5Files.find(fileInfo.m_md5);
|
||||
auto it = s_md5Files.find(fileInfo.m_md5);
|
||||
if (it != s_md5Files.end()) {
|
||||
PhpFile *f = it->second;
|
||||
if (!fileInfo.m_relPath.empty() &&
|
||||
@@ -392,7 +402,7 @@ bool FileRepository::readActualFile(const StringData *name,
|
||||
void FileRepository::computeMd5(const StringData *name, FileInfo& fileInfo) {
|
||||
if (md5Enabled()) {
|
||||
auto& input = fileInfo.m_inputString;
|
||||
string md5 = string_md5(input.data(), input.size());
|
||||
std::string md5 = string_md5(input.data(), input.size());
|
||||
setFileInfo(name, md5, fileInfo, false);
|
||||
}
|
||||
}
|
||||
@@ -471,7 +481,7 @@ PhpFile *FileRepository::parseFile(const std::string &name,
|
||||
return p;
|
||||
}
|
||||
|
||||
bool FileRepository::fileStat(const string &name, struct stat *s) {
|
||||
bool FileRepository::fileStat(const std::string &name, struct stat *s) {
|
||||
return StatCache::stat(name, s) == 0;
|
||||
}
|
||||
|
||||
@@ -532,9 +542,9 @@ static bool findFileWrapper(const String& file, void* ctx) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
string server_root(SourceRootInfo::GetCurrentSourceRoot());
|
||||
std::string server_root(SourceRootInfo::GetCurrentSourceRoot());
|
||||
if (server_root.empty()) {
|
||||
server_root = string(g_vmContext->getCwd()->data());
|
||||
server_root = std::string(g_vmContext->getCwd()->data());
|
||||
if (server_root.empty() || server_root[server_root.size() - 1] != '/') {
|
||||
server_root += "/";
|
||||
}
|
||||
|
||||
@@ -17,6 +17,10 @@
|
||||
#ifndef HPHP_FILE_STREAM_WRAPPER_H
|
||||
#define HPHP_FILE_STREAM_WRAPPER_H
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "hphp/runtime/base/types.h"
|
||||
#include "hphp/runtime/base/file.h"
|
||||
#include "hphp/runtime/base/mem-file.h"
|
||||
|
||||
@@ -54,15 +54,14 @@ String File::TranslatePathKeepRelative(const String& filename) {
|
||||
),
|
||||
AttachString);
|
||||
if (RuntimeOption::SafeFileAccess) {
|
||||
const vector<string> &allowedDirectories =
|
||||
VirtualHost::GetAllowedDirectories();
|
||||
auto const& allowedDirectories = VirtualHost::GetAllowedDirectories();
|
||||
auto it = std::upper_bound(allowedDirectories.begin(),
|
||||
allowedDirectories.end(), canonicalized,
|
||||
[](const String& val, const string& dir) {
|
||||
[](const String& val, const std::string& dir) {
|
||||
return strcmp(val.c_str(), dir.c_str()) < 0;
|
||||
});
|
||||
if (it != allowedDirectories.begin()) {
|
||||
const string& dir = *--it;
|
||||
const std::string& dir = *--it;
|
||||
if (dir.size() <= canonicalized.size() &&
|
||||
!strncmp(dir.c_str(), canonicalized.c_str(), dir.size())) {
|
||||
return canonicalized;
|
||||
@@ -166,6 +165,7 @@ void File::sweep() {
|
||||
// resources it might have allocated.
|
||||
assert(!valid());
|
||||
free(m_buffer);
|
||||
using std::string;
|
||||
m_name.~string();
|
||||
m_mode.~string();
|
||||
}
|
||||
|
||||
@@ -14,6 +14,9 @@
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
#include "hphp/runtime/base/intercept.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "hphp/runtime/base/request-local.h"
|
||||
#include "hphp/runtime/base/array-init.h"
|
||||
#include "hphp/runtime/base/array-iterator.h"
|
||||
@@ -77,13 +80,13 @@ static Mutex s_mutex;
|
||||
* The vector contains a list of maybeIntercepted flags for functions
|
||||
* with this name.
|
||||
*/
|
||||
typedef StringIMap<std::pair<bool,vector<char*>>> RegisteredFlagsMap;
|
||||
typedef StringIMap<std::pair<bool,std::vector<char*>>> RegisteredFlagsMap;
|
||||
|
||||
static RegisteredFlagsMap s_registered_flags;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static void flag_maybe_intercepted(vector<char*> &flags) {
|
||||
static void flag_maybe_intercepted(std::vector<char*> &flags) {
|
||||
for (auto flag : flags) {
|
||||
*flag = 1;
|
||||
}
|
||||
@@ -175,7 +178,7 @@ void unregister_intercept_flag(const String& name, char *flag) {
|
||||
RegisteredFlagsMap::iterator iter =
|
||||
s_registered_flags.find(name);
|
||||
if (iter != s_registered_flags.end()) {
|
||||
vector<char*> &flags = iter->second.second;
|
||||
std::vector<char*> &flags = iter->second.second;
|
||||
for (int i = flags.size(); i--; ) {
|
||||
if (flag == flags[i]) {
|
||||
flags.erase(flags.begin() + i);
|
||||
|
||||
@@ -13,8 +13,10 @@
|
||||
| license@php.net so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
#include "hphp/runtime/base/libevent-http-client.h"
|
||||
|
||||
#include "folly/Conv.h"
|
||||
|
||||
#include "hphp/runtime/server/server-stats.h"
|
||||
#include "hphp/runtime/base/runtime-option.h"
|
||||
#include "hphp/util/compression.h"
|
||||
@@ -48,22 +50,22 @@ namespace HPHP {
|
||||
// connection pooling
|
||||
|
||||
static std::string get_hash(const std::string &address, int port) {
|
||||
string hash = address;
|
||||
std::string hash = address;
|
||||
if (port != 80) {
|
||||
hash += ':';
|
||||
hash += lexical_cast<string>(port);
|
||||
hash += folly::to<std::string>(port);
|
||||
}
|
||||
return hash;
|
||||
}
|
||||
|
||||
ReadWriteMutex LibEventHttpClient::ConnectionPoolMutex;
|
||||
std::map<std::string, int> LibEventHttpClient::ConnectionPoolConfig;
|
||||
std::map<std::string,int> LibEventHttpClient::ConnectionPoolConfig;
|
||||
std::map<std::string,std::vector<LibEventHttpClientPtr>>
|
||||
LibEventHttpClient::ConnectionPool;
|
||||
|
||||
void LibEventHttpClient::SetCache(const std::string &address, int port,
|
||||
int maxConnection) {
|
||||
string hash = get_hash(address, port);
|
||||
auto const hash = get_hash(address, port);
|
||||
|
||||
WriteLock lock(ConnectionPoolMutex);
|
||||
if (maxConnection > 0) {
|
||||
@@ -75,13 +77,12 @@ void LibEventHttpClient::SetCache(const std::string &address, int port,
|
||||
|
||||
LibEventHttpClientPtr LibEventHttpClient::Get(const std::string &address,
|
||||
int port) {
|
||||
string hash = get_hash(address, port);
|
||||
auto const hash = get_hash(address, port);
|
||||
|
||||
int maxConnection = 0;
|
||||
{
|
||||
ReadLock lock(ConnectionPoolMutex);
|
||||
std::map<string, int>::const_iterator iter =
|
||||
ConnectionPoolConfig.find(hash);
|
||||
auto iter = ConnectionPoolConfig.find(hash);
|
||||
if (iter == ConnectionPoolConfig.end()) {
|
||||
// not configured to cache
|
||||
ServerStats::Log("evhttp.skip", 1);
|
||||
@@ -177,8 +178,8 @@ bool LibEventHttpClient::send(const std::string &url,
|
||||
for (unsigned int i = 0; i < headers.size(); i++) {
|
||||
const std::string &header = headers[i];
|
||||
size_t pos = header.find(':');
|
||||
if (pos != string::npos && header[pos + 1] == ' ') {
|
||||
string name = header.substr(0, pos);
|
||||
if (pos != std::string::npos && header[pos + 1] == ' ') {
|
||||
std::string name = header.substr(0, pos);
|
||||
if (strcasecmp(name.c_str(), "Connection") == 0) {
|
||||
keepalive = false;
|
||||
} else if (strcasecmp(name.c_str(), "Host") == 0) {
|
||||
@@ -290,7 +291,7 @@ void LibEventHttpClient::onRequestCompleted(evhttp_request* request) {
|
||||
// with the value 'gzip' means we treat it as gzip.
|
||||
gzip = true;
|
||||
}
|
||||
m_responseHeaders.push_back(string(p->key) + ": " + p->value);
|
||||
m_responseHeaders.push_back(std::string(p->key) + ": " + p->value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
|
||||
#include <evhttp.h>
|
||||
|
||||
#include "hphp/util/base.h"
|
||||
#include "hphp/util/async-func.h"
|
||||
#include "hphp/util/lock.h"
|
||||
|
||||
|
||||
@@ -170,12 +170,12 @@ bool MemFile::rewind() {
|
||||
}
|
||||
|
||||
int64_t MemFile::writeImpl(const char *buffer, int64_t length) {
|
||||
throw FatalErrorException((string("cannot write a mem stream: ") +
|
||||
throw FatalErrorException((std::string("cannot write a mem stream: ") +
|
||||
m_name).c_str());
|
||||
}
|
||||
|
||||
bool MemFile::flush() {
|
||||
throw FatalErrorException((string("cannot flush a mem stream: ") +
|
||||
throw FatalErrorException((std::string("cannot flush a mem stream: ") +
|
||||
m_name).c_str());
|
||||
}
|
||||
|
||||
@@ -188,7 +188,7 @@ void MemFile::unzip() {
|
||||
int len = m_len;
|
||||
char *data = gzdecode(m_data, len);
|
||||
if (data == nullptr) {
|
||||
throw FatalErrorException((string("cannot unzip mem stream: ") +
|
||||
throw FatalErrorException((std::string("cannot unzip mem stream: ") +
|
||||
m_name).c_str());
|
||||
}
|
||||
m_data = data;
|
||||
|
||||
@@ -13,11 +13,15 @@
|
||||
| license@php.net so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
#include "hphp/runtime/base/plain-file.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "hphp/runtime/base/complex-types.h"
|
||||
#include "hphp/runtime/base/request-local.h"
|
||||
#include <unistd.h>
|
||||
|
||||
namespace HPHP {
|
||||
|
||||
|
||||
@@ -448,9 +448,9 @@ static void pcre_log_error(const char *func, int line, int pcre_code,
|
||||
const char *escapedPattern;
|
||||
const char *escapedSubject;
|
||||
const char *escapedRepl;
|
||||
string p(pattern, pattern_size);
|
||||
string s(subject, subject_size);
|
||||
string r(repl, repl_size);
|
||||
std::string p(pattern, pattern_size);
|
||||
std::string s(subject, subject_size);
|
||||
std::string r(repl, repl_size);
|
||||
escapedPattern = Logger::EscapeString(p);
|
||||
escapedSubject = Logger::EscapeString(s);
|
||||
escapedRepl = Logger::EscapeString(r);
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
#ifndef incl_HPHP_PROGRAM_FUNCTIONS_H_
|
||||
#define incl_HPHP_PROGRAM_FUNCTIONS_H_
|
||||
|
||||
#include "hphp/util/base.h"
|
||||
#include "hphp/runtime/base/types.h"
|
||||
|
||||
// Needed for compatibility with oniguruma-5.9.4+
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
#include "folly/String.h"
|
||||
#include "folly/Hash.h"
|
||||
|
||||
#include "hphp/util/base.h"
|
||||
#include "hphp/util/maphuge.h"
|
||||
#include "hphp/util/mutex.h"
|
||||
#include "hphp/util/lock.h"
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
#include <cstdarg>
|
||||
#include <string>
|
||||
|
||||
#include "hphp/util/base.h"
|
||||
#include "hphp/runtime/base/datatype.h"
|
||||
|
||||
namespace HPHP {
|
||||
|
||||
@@ -19,6 +19,9 @@
|
||||
#include <cstdint>
|
||||
#include <limits>
|
||||
|
||||
#include <sys/time.h>
|
||||
#include <sys/resource.h>
|
||||
|
||||
#include "folly/String.h"
|
||||
|
||||
#include "hphp/util/hdf.h"
|
||||
@@ -437,6 +440,7 @@ static const size_t kJitGlobalDataDef = RuntimeOption::EvalJitASize >> 2;
|
||||
inline size_t maxUsageDef() {
|
||||
return RuntimeOption::EvalJitASize;
|
||||
}
|
||||
using std::string;
|
||||
#define F(type, name, def) \
|
||||
type RuntimeOption::Eval ## name = type(def);
|
||||
EVALFLAGS();
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
|
||||
#include <boost/container/flat_set.hpp>
|
||||
|
||||
#include "hphp/util/base.h"
|
||||
#include "hphp/util/hash-map-typedefs.h"
|
||||
#include "hphp/util/functional.h"
|
||||
|
||||
@@ -395,12 +394,12 @@ public:
|
||||
F(bool, ProfileBC, false) \
|
||||
F(bool, ProfileHeapAcrossRequests, false) \
|
||||
F(bool, ProfileHWEnable, true) \
|
||||
F(string, ProfileHWEvents, string("")) \
|
||||
F(string, ProfileHWEvents, std::string("")) \
|
||||
F(bool, JitAlwaysInterpOne, false) \
|
||||
F(uint32_t, JitMaxTranslations, 12) \
|
||||
F(uint64_t, JitGlobalTranslationLimit, -1) \
|
||||
F(bool, JitTrampolines, true) \
|
||||
F(string, JitProfilePath, string("")) \
|
||||
F(string, JitProfilePath, std::string("")) \
|
||||
F(bool, JitTypePrediction, true) \
|
||||
F(int32_t, JitStressTypePredPercent, 0) \
|
||||
F(uint32_t, JitWarmupRequests, kDefaultWarmupRequests) \
|
||||
@@ -472,6 +471,9 @@ public:
|
||||
F(bool, DecRefUseScratch, false) \
|
||||
/* */
|
||||
|
||||
private:
|
||||
using string = std::string;
|
||||
public:
|
||||
#define F(type, name, unused) \
|
||||
static type Eval ## name;
|
||||
EVALFLAGS()
|
||||
|
||||
@@ -16,6 +16,9 @@
|
||||
|
||||
#include <pcre.h>
|
||||
|
||||
#include <sstream>
|
||||
#include <fstream>
|
||||
|
||||
#include "hphp/runtime/base/shared-store-stats.h"
|
||||
#include "hphp/runtime/base/runtime-option.h"
|
||||
|
||||
@@ -120,8 +123,8 @@ static void normalizeKey(const char *key, char *normalizedKey, size_t outlen) {
|
||||
// normalizedKey, with no longer than outlen, may not null terminated
|
||||
// if outlen is too small
|
||||
|
||||
vector<std::string> &specialPrefix = RuntimeOption::APCSizeSpecialPrefix;
|
||||
vector<std::string> &prefixReplace = RuntimeOption::APCSizePrefixReplace;
|
||||
std::vector<std::string> &specialPrefix = RuntimeOption::APCSizeSpecialPrefix;
|
||||
std::vector<std::string> &prefixReplace = RuntimeOption::APCSizePrefixReplace;
|
||||
for (unsigned int i = 0; i < specialPrefix.size(); i++) {
|
||||
const char *prefix = specialPrefix[i].c_str();
|
||||
if (strncmp(key, prefix, specialPrefix[i].length()) == 0) {
|
||||
@@ -129,8 +132,8 @@ static void normalizeKey(const char *key, char *normalizedKey, size_t outlen) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
vector<std::string> &specialMiddle = RuntimeOption::APCSizeSpecialMiddle;
|
||||
vector<std::string> &middleReplace = RuntimeOption::APCSizeMiddleReplace;
|
||||
std::vector<std::string> &specialMiddle = RuntimeOption::APCSizeSpecialMiddle;
|
||||
std::vector<std::string> &middleReplace = RuntimeOption::APCSizeMiddleReplace;
|
||||
for (unsigned int i = 0; i < specialMiddle.size(); i++) {
|
||||
const char *middle = specialMiddle[i].c_str();
|
||||
if (strstr(key, middle) != nullptr) {
|
||||
@@ -257,8 +260,8 @@ SharedStoreStats::StatsMap SharedStoreStats::s_statsMap,
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// Helpers for reporting and global aggregation
|
||||
|
||||
string SharedStoreStats::report_basic() {
|
||||
ostringstream out;
|
||||
std::string SharedStoreStats::report_basic() {
|
||||
std::ostringstream out;
|
||||
out << "{\n";
|
||||
writeEntryInt(out, "Key_Count", s_keyCount, false, 1, true);
|
||||
writeEntryInt(out, "Size_Total", s_keySize + s_dataTotalSize, false, 1, true);
|
||||
@@ -276,8 +279,8 @@ string SharedStoreStats::report_basic() {
|
||||
return out.str();
|
||||
}
|
||||
|
||||
string SharedStoreStats::report_basic_flat() {
|
||||
ostringstream out;
|
||||
std::string SharedStoreStats::report_basic_flat() {
|
||||
std::ostringstream out;
|
||||
out << "{ " << "\"hphp.apc.size_total\":" << s_keySize + s_dataTotalSize
|
||||
<< ", " << "\"hphp.apc.key_count\":" << s_keyCount
|
||||
<< ", " << "\"hphp.apc.size_key\":" << s_keySize
|
||||
@@ -294,8 +297,8 @@ string SharedStoreStats::report_basic_flat() {
|
||||
return out.str();
|
||||
}
|
||||
|
||||
string SharedStoreStats::report_keys() {
|
||||
ostringstream out;
|
||||
std::string SharedStoreStats::report_keys() {
|
||||
std::ostringstream out;
|
||||
ReadLock l(s_rwlock);
|
||||
StatsMap::iterator iter;
|
||||
for (iter = s_statsMap.begin(); iter != s_statsMap.end(); ++iter) {
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
#ifndef incl_HPHP_CPP_BASE_SHARED_SHARED_STRING_H_
|
||||
#define incl_HPHP_CPP_BASE_SHARED_SHARED_STRING_H_
|
||||
|
||||
#include "hphp/util/base.h"
|
||||
#include "hphp/runtime/base/smart-ptr.h"
|
||||
#include <tbb/concurrent_hash_map.h>
|
||||
#include <tbb/atomic.h>
|
||||
|
||||
@@ -34,7 +34,8 @@ void SimpleCounter::requestInit() {
|
||||
m_stacks.clear();
|
||||
}
|
||||
|
||||
bool SimpleCounter::Comparer::operator()(const string &s1, const string &s2) {
|
||||
bool SimpleCounter::Comparer::operator()(const std::string &s1,
|
||||
const std::string &s2) {
|
||||
return m_map[s1] > m_map[s2];
|
||||
}
|
||||
|
||||
@@ -48,15 +49,15 @@ void SimpleCounter::requestShutdown() {
|
||||
fprintf(stderr, "%s : %d\n", it->first.c_str(), it->second);
|
||||
if (SampleStackCount > 0) {
|
||||
CounterMap cm;
|
||||
vector<string> &stackVec = m_stacks[it->first];
|
||||
std::vector<std::string> &stackVec = m_stacks[it->first];
|
||||
for (size_t i = 0; i < stackVec.size(); i++) {
|
||||
cm[stackVec[i]]++;
|
||||
}
|
||||
vector<string> unique;
|
||||
std::vector<std::string> unique;
|
||||
for (CounterMap::const_iterator jt = cm.begin(); jt != cm.end(); ++jt) {
|
||||
unique.push_back(jt->first);
|
||||
}
|
||||
sort(unique.begin(), unique.end(), Comparer(cm));
|
||||
std::sort(unique.begin(), unique.end(), Comparer(cm));
|
||||
for (size_t i = 0; i < unique.size(); i++) {
|
||||
fprintf(stderr, "Stack #%d: %d/%d\n",
|
||||
(int)(i + 1), cm[unique[i]], (int)stackVec.size());
|
||||
@@ -67,12 +68,12 @@ void SimpleCounter::requestShutdown() {
|
||||
}
|
||||
}
|
||||
|
||||
void SimpleCounter::Count(const string &name) {
|
||||
void SimpleCounter::Count(const std::string &name) {
|
||||
if (Enabled) {
|
||||
int count = ++s_counter->m_counters[name];
|
||||
if (SampleStackCount > 0) {
|
||||
assert(StackTrace::Enabled);
|
||||
vector<string> &stackVec = s_counter->m_stacks[name];
|
||||
std::vector<std::string> &stackVec = s_counter->m_stacks[name];
|
||||
if ((int)stackVec.size() < SampleStackCount ||
|
||||
f_rand(0, count - 1) < SampleStackCount) {
|
||||
StackTrace st;
|
||||
|
||||
@@ -16,12 +16,13 @@
|
||||
#ifndef incl_HPHP_SIMPLE_COUNTER_H_
|
||||
#define incl_HPHP_SIMPLE_COUNTER_H_
|
||||
|
||||
#include "hphp/runtime/base/request-local.h"
|
||||
#include "hphp/util/stack-trace.h"
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "hphp/runtime/base/request-local.h"
|
||||
#include "hphp/util/stack-trace.h"
|
||||
|
||||
// #define ENABLE_SIMPLE_COUNTER 1
|
||||
|
||||
namespace HPHP {
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
#define incl_HPHP_SMART_PTR_H_
|
||||
|
||||
#include <boost/static_assert.hpp>
|
||||
#include "hphp/util/base.h"
|
||||
#include "hphp/runtime/base/exceptions.h"
|
||||
#include "hphp/runtime/base/countable.h"
|
||||
#include <utility>
|
||||
|
||||
@@ -239,7 +239,7 @@ bool SSLSocket::onAccept() {
|
||||
|
||||
bool SSLSocket::handleError(int64_t nr_bytes, bool is_init) {
|
||||
char esbuf[512];
|
||||
string ebuf;
|
||||
std::string ebuf;
|
||||
unsigned long ecode;
|
||||
|
||||
bool retry = true;
|
||||
|
||||
@@ -21,9 +21,12 @@
|
||||
#include <sys/inotify.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <tbb/concurrent_hash_map.h>
|
||||
|
||||
#include "hphp/util/base.h"
|
||||
#include "hphp/util/lock.h"
|
||||
#include "hphp/runtime/base/smart-ptr.h"
|
||||
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
#include "hphp/runtime/base/stats.h"
|
||||
|
||||
#include "hphp/util/base.h"
|
||||
#include "hphp/util/data-block.h"
|
||||
#include "hphp/runtime/vm/jit/translator-x64.h"
|
||||
|
||||
|
||||
@@ -13,8 +13,10 @@
|
||||
| license@php.net so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
#include "hphp/runtime/base/stream-wrapper.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "hphp/runtime/base/stream-wrapper-registry.h"
|
||||
|
||||
namespace HPHP { namespace Stream {
|
||||
|
||||
@@ -23,6 +23,8 @@
|
||||
|
||||
#include <boost/noncopyable.hpp>
|
||||
|
||||
struct stat;
|
||||
|
||||
namespace HPHP {
|
||||
|
||||
class Directory;
|
||||
|
||||
@@ -357,7 +357,7 @@ void StringData::dump() const {
|
||||
for (uint32_t i = 0; i < s.len; i++) {
|
||||
char ch = s.ptr[i];
|
||||
if (isprint(ch)) {
|
||||
std::cout << ch;
|
||||
printf("%c", ch);
|
||||
} else {
|
||||
printf("\\x%02x", ch);
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ Variant StringUtil::Explode(const String& input, const String& delimiter,
|
||||
} else if (limit < 0) {
|
||||
int pos = input.find(delimiter);
|
||||
if (pos >= 0) {
|
||||
vector<int> positions;
|
||||
std::vector<int> positions;
|
||||
int len = delimiter.size();
|
||||
int pos0 = 0;
|
||||
int found = 0;
|
||||
|
||||
@@ -17,8 +17,6 @@
|
||||
#ifndef incl_HPHP_SWEEPABLE_H_
|
||||
#define incl_HPHP_SWEEPABLE_H_
|
||||
|
||||
#include "hphp/util/base.h"
|
||||
|
||||
namespace HPHP {
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
@@ -35,8 +35,8 @@ TempFile::TempFile(bool autoDelete /* = true */) : m_autoDelete(autoDelete) {
|
||||
return;
|
||||
}
|
||||
m_fd = fd;
|
||||
m_name = string(path);
|
||||
m_rawName = string(path);
|
||||
m_name = std::string(path);
|
||||
m_rawName = std::string(path);
|
||||
}
|
||||
|
||||
TempFile::~TempFile() {
|
||||
@@ -44,7 +44,7 @@ TempFile::~TempFile() {
|
||||
}
|
||||
|
||||
bool TempFile::open(const String& filename, const String& mode) {
|
||||
throw FatalErrorException((string("cannot open a temp file ") +
|
||||
throw FatalErrorException((std::string("cannot open a temp file ") +
|
||||
m_name).c_str());
|
||||
}
|
||||
|
||||
|
||||
@@ -13,6 +13,14 @@
|
||||
| license@php.net so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
#include <atomic>
|
||||
|
||||
#include <sys/time.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/resource.h>
|
||||
#include <signal.h>
|
||||
|
||||
#include "hphp/runtime/base/types.h"
|
||||
#include "hphp/runtime/base/hphp-system.h"
|
||||
#include "hphp/runtime/base/code-coverage.h"
|
||||
@@ -21,9 +29,6 @@
|
||||
#include "hphp/util/alloc.h"
|
||||
#include "folly/String.h"
|
||||
|
||||
#include <atomic>
|
||||
#include <sys/mman.h>
|
||||
|
||||
using std::map;
|
||||
|
||||
namespace HPHP {
|
||||
|
||||
@@ -13,12 +13,16 @@
|
||||
| license@php.net so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
#include "hphp/runtime/base/timestamp.h"
|
||||
|
||||
#include <sys/time.h>
|
||||
extern "C" {
|
||||
#include <timelib.h>
|
||||
}
|
||||
|
||||
#include "hphp/runtime/base/complex-types.h"
|
||||
#include "hphp/runtime/base/datetime.h"
|
||||
#include "hphp/runtime/base/array-init.h"
|
||||
#include <timelib.h>
|
||||
|
||||
namespace HPHP {
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
|
||||
#include "folly/ScopeGuard.h"
|
||||
|
||||
#include "hphp/runtime/base/strings.h"
|
||||
#include "hphp/runtime/base/runtime-error.h"
|
||||
#include "hphp/runtime/base/tv-conversions.h"
|
||||
|
||||
|
||||
@@ -177,7 +177,7 @@ Array Array::diffImpl(CArrRef array, bool by_key, bool by_value, bool match,
|
||||
key_cmp_function = SortRegularAscending;
|
||||
}
|
||||
|
||||
vector<int> perm1;
|
||||
std::vector<int> perm1;
|
||||
SortData opaque1;
|
||||
int bottom = 0;
|
||||
int top = array.size();
|
||||
@@ -824,7 +824,7 @@ static int multi_compare_func(const void *n1, const void *n2, const void *op) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void Array::SortImpl(vector<int> &indices, CArrRef source,
|
||||
void Array::SortImpl(std::vector<int> &indices, CArrRef source,
|
||||
Array::SortData &opaque, Array::PFUNC_CMP cmp_func,
|
||||
bool by_key, const void *data /* = NULL */) {
|
||||
assert(cmp_func);
|
||||
@@ -854,7 +854,7 @@ void Array::sort(PFUNC_CMP cmp_func, bool by_key, bool renumber,
|
||||
const void *data /* = NULL */) {
|
||||
Array sorted = Array::Create();
|
||||
SortData opaque;
|
||||
vector<int> indices;
|
||||
std::vector<int> indices;
|
||||
SortImpl(indices, *this, opaque, cmp_func, by_key, data);
|
||||
int count = size();
|
||||
for (int i = 0; i < count; i++) {
|
||||
|
||||
@@ -17,15 +17,6 @@
|
||||
#ifndef incl_HPHP_TYPES_H_
|
||||
#define incl_HPHP_TYPES_H_
|
||||
|
||||
#include "hphp/util/base.h"
|
||||
#include "hphp/runtime/base/datatype.h"
|
||||
#include "hphp/util/thread-local.h"
|
||||
#include "hphp/util/mutex.h"
|
||||
#include "hphp/util/functional.h"
|
||||
#include "hphp/runtime/base/macros.h"
|
||||
#include "hphp/runtime/base/memory-manager.h"
|
||||
#include "hphp/util/hash-map-typedefs.h"
|
||||
|
||||
#include <boost/intrusive_ptr.hpp>
|
||||
|
||||
#include <stdint.h>
|
||||
@@ -33,6 +24,16 @@
|
||||
#include <limits>
|
||||
#include <type_traits>
|
||||
#include <vector>
|
||||
#include <stack>
|
||||
#include <list>
|
||||
|
||||
#include "hphp/util/thread-local.h"
|
||||
#include "hphp/util/mutex.h"
|
||||
#include "hphp/util/functional.h"
|
||||
#include "hphp/util/hash-map-typedefs.h"
|
||||
#include "hphp/runtime/base/datatype.h"
|
||||
#include "hphp/runtime/base/macros.h"
|
||||
#include "hphp/runtime/base/memory-manager.h"
|
||||
|
||||
namespace HPHP {
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -63,7 +63,7 @@ bool UrlFile::open(const String& input_url, const String& mode) {
|
||||
if (!m_headers.empty()) {
|
||||
pHeaders = &requestHeaders;
|
||||
for (ArrayIter iter(m_headers); iter; ++iter) {
|
||||
requestHeaders[string(iter.first().toString().data())].
|
||||
requestHeaders[std::string(iter.first().toString().data())].
|
||||
push_back(iter.second().toString().data());
|
||||
}
|
||||
}
|
||||
@@ -81,7 +81,7 @@ bool UrlFile::open(const String& input_url, const String& mode) {
|
||||
}
|
||||
|
||||
int code;
|
||||
vector<String> responseHeaders;
|
||||
std::vector<String> responseHeaders;
|
||||
if (m_get) {
|
||||
code = http.get(url.c_str(), m_response, pHeaders, &responseHeaders);
|
||||
} else {
|
||||
@@ -110,13 +110,13 @@ bool UrlFile::open(const String& input_url, const String& mode) {
|
||||
|
||||
int64_t UrlFile::writeImpl(const char *buffer, int64_t length) {
|
||||
assert(m_len != -1);
|
||||
throw FatalErrorException((string("cannot write a url stream: ") +
|
||||
throw FatalErrorException((std::string("cannot write a url stream: ") +
|
||||
m_name).c_str());
|
||||
}
|
||||
|
||||
bool UrlFile::flush() {
|
||||
assert(m_len != -1);
|
||||
throw FatalErrorException((string("cannot flush a url stream: ") +
|
||||
throw FatalErrorException((std::string("cannot flush a url stream: ") +
|
||||
m_name).c_str());
|
||||
}
|
||||
|
||||
|
||||
@@ -13,8 +13,16 @@
|
||||
| license@php.net so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
#include "hphp/runtime/base/user-file.h"
|
||||
|
||||
#include <cstdio>
|
||||
#include <cassert>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/file.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "hphp/runtime/base/complex-types.h"
|
||||
#include "hphp/runtime/base/array-init.h"
|
||||
#include "hphp/runtime/base/runtime-error.h"
|
||||
|
||||
@@ -20,6 +20,8 @@
|
||||
#include "hphp/runtime/base/file.h"
|
||||
#include "hphp/runtime/base/user-fs-node.h"
|
||||
|
||||
struct stat;
|
||||
|
||||
namespace HPHP {
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
@@ -18,7 +18,11 @@
|
||||
#ifndef incl_HPHP_ZEND_MATH_H_
|
||||
#define incl_HPHP_ZEND_MATH_H_
|
||||
|
||||
#include "hphp/util/base.h"
|
||||
#include <cstdint>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <cstdio>
|
||||
#include <cmath>
|
||||
|
||||
namespace HPHP {
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
@@ -61,7 +65,7 @@ inline double php_math_round(double value, int places,
|
||||
}
|
||||
|
||||
int precision_places = 14 - floor(log10(fabs(value)));
|
||||
float f1 = pow(10.0, (double)abs(places));
|
||||
float f1 = pow(10.0, (double)std::abs(places));
|
||||
|
||||
/* If the decimal precision guaranteed by FP arithmetic is higher than
|
||||
* the requested places BUT is small enough to make sure a non-zero value
|
||||
|
||||
@@ -107,8 +107,8 @@ void ZendPack::pack(CVarRef val, int size, int *map, char *output) {
|
||||
|
||||
Variant ZendPack::pack(const String& fmt, CArrRef argv) {
|
||||
/* Preprocess format into formatcodes and formatargs */
|
||||
vector<char> formatcodes;
|
||||
vector<int> formatargs;
|
||||
std::vector<char> formatcodes;
|
||||
std::vector<int> formatargs;
|
||||
int argc = argv.size();
|
||||
|
||||
const char *format = fmt.c_str();
|
||||
|
||||
@@ -15,9 +15,11 @@
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
#include <sys/time.h>
|
||||
#include <openssl/rand.h>
|
||||
|
||||
#include "hphp/runtime/base/zend-math.h"
|
||||
#include "hphp/util/thread-local.h"
|
||||
#include <openssl/rand.h>
|
||||
|
||||
namespace HPHP {
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
#ifndef incl_HPHP_ZEND_STRING_H_
|
||||
#define incl_HPHP_ZEND_STRING_H_
|
||||
|
||||
#include "hphp/util/base.h"
|
||||
#include "hphp/zend/zend-string.h"
|
||||
#include "hphp/runtime/base/complex-types.h"
|
||||
#include "hphp/runtime/base/string-buffer.h"
|
||||
|
||||
@@ -18,8 +18,6 @@
|
||||
#ifndef incl_HPHP_ZEND_URL_H_
|
||||
#define incl_HPHP_ZEND_URL_H_
|
||||
|
||||
#include "hphp/util/base.h"
|
||||
|
||||
namespace HPHP {
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
@@ -13,9 +13,10 @@
|
||||
| license@php.net so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
// force tests to run
|
||||
|
||||
#include "hphp/runtime/debugger/break_point.h"
|
||||
|
||||
#include <boost/lexical_cast.hpp>
|
||||
|
||||
#include "hphp/runtime/debugger/debugger.h"
|
||||
#include "hphp/runtime/debugger/debugger_proxy.h"
|
||||
#include "hphp/runtime/debugger/debugger_thrift_buffer.h"
|
||||
@@ -27,6 +28,10 @@
|
||||
#include "hphp/runtime/base/comparisons.h"
|
||||
|
||||
namespace HPHP { namespace Eval {
|
||||
|
||||
using std::string;
|
||||
using boost::lexical_cast;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
TRACE_SET_MOD(debugger);
|
||||
@@ -41,7 +46,7 @@ int InterruptSite::getFileLen() const {
|
||||
|
||||
std::string InterruptSite::desc() const {
|
||||
TRACE(2, "InterruptSite::desc\n");
|
||||
string ret;
|
||||
std::string ret;
|
||||
if (m_error.isNull()) {
|
||||
ret = "Break";
|
||||
} else if (m_error.isObject()) {
|
||||
@@ -65,7 +70,7 @@ std::string InterruptSite::desc() const {
|
||||
string file = getFile();
|
||||
int line0 = getLine0();
|
||||
if (line0) {
|
||||
ret += " on line " + lexical_cast<string>(line0);
|
||||
ret += " on line " + boost::lexical_cast<std::string>(line0);
|
||||
if (!file.empty()) {
|
||||
ret += " of " + file;
|
||||
}
|
||||
|
||||
@@ -308,7 +308,7 @@ void CmdBreak::processStatusChange(DebuggerClient &client) {
|
||||
return processList(client);
|
||||
}
|
||||
|
||||
string snum = client.argValue(2);
|
||||
std::string snum = client.argValue(2);
|
||||
if (!DebuggerClient::IsValidNumber(snum)) {
|
||||
client.error("'[b]reak [c]lear|[t]oggle' needs an {index} argument.");
|
||||
client.tutorial(
|
||||
@@ -499,7 +499,7 @@ void CmdBreak::onClient(DebuggerClient &client) {
|
||||
return;
|
||||
}
|
||||
|
||||
string currentFile;
|
||||
std::string currentFile;
|
||||
int currentLine = 0;
|
||||
BreakPointInfoPtr loc = client.getCurrentLocation();
|
||||
if (loc) {
|
||||
@@ -533,7 +533,7 @@ void CmdBreak::onClient(DebuggerClient &client) {
|
||||
}
|
||||
|
||||
if (interrupt >= 0) {
|
||||
string url;
|
||||
std::string url;
|
||||
if (!client.arg(index + 1, "if") && !client.arg(index + 1, "&&")) {
|
||||
url = client.argValue(++index);
|
||||
}
|
||||
|
||||
@@ -38,9 +38,9 @@ void CmdExtended::list(DebuggerClient &client) {
|
||||
}
|
||||
}
|
||||
|
||||
static string format_unique_prefix(const std::string &cmd,
|
||||
const std::string &prev,
|
||||
const std::string &next) {
|
||||
static std::string format_unique_prefix(const std::string &cmd,
|
||||
const std::string &prev,
|
||||
const std::string &next) {
|
||||
for (unsigned int i = 1; i < cmd.size(); i++) {
|
||||
if (strncasecmp(cmd.c_str(), prev.c_str(), i) &&
|
||||
strncasecmp(cmd.c_str(), next.c_str(), i)) {
|
||||
@@ -53,8 +53,8 @@ static string format_unique_prefix(const std::string &cmd,
|
||||
void CmdExtended::helpImpl(DebuggerClient &client, const char *name) {
|
||||
const char *cmd = "{cmd} {arg1} {arg2} ...";
|
||||
const char *help = "invoke specified command";
|
||||
client.helpCmds((string(name) + " " + cmd).c_str(), help,
|
||||
(string(name) + cmd).c_str(), help,
|
||||
client.helpCmds((std::string(name) + " " + cmd).c_str(), help,
|
||||
(std::string(name) + cmd).c_str(), help,
|
||||
nullptr);
|
||||
|
||||
const ExtendedCommandMap &cmds = getCommandMap();
|
||||
@@ -62,7 +62,7 @@ void CmdExtended::helpImpl(DebuggerClient &client, const char *name) {
|
||||
client.help("%s", "");
|
||||
client.help("where {cmd} can be:");
|
||||
client.help("%s", "");
|
||||
vector<string> vcmds;
|
||||
std::vector<std::string> vcmds;
|
||||
for (ExtendedCommandMap::const_iterator iter = cmds.begin();
|
||||
iter != cmds.end(); ++iter) {
|
||||
vcmds.push_back(iter->first);
|
||||
|
||||
@@ -47,7 +47,7 @@ void CmdExtension::list(DebuggerClient &client) {
|
||||
} else {
|
||||
// This is cheating, assuming server has same list of extensions.
|
||||
Array exts = Extension::GetLoadedExtensions();
|
||||
vector<std::string> items;
|
||||
std::vector<std::string> items;
|
||||
for (ArrayIter iter(exts); iter; ++iter) {
|
||||
items.push_back(iter.second().toString()->toCPPString());
|
||||
}
|
||||
@@ -98,7 +98,7 @@ bool CmdExtension::processList(DebuggerProxy &proxy) {
|
||||
assert(ext);
|
||||
if (ext) {
|
||||
int support = ext->debuggerSupport();
|
||||
string line;
|
||||
std::string line;
|
||||
line += (support & IDebuggable::SupportInfo) ? "Yes " : " ";
|
||||
line += (support & IDebuggable::SupportDump) ? "Yes " : " ";
|
||||
line += (support & IDebuggable::SupportVerb) ? "Yes " : " ";
|
||||
@@ -128,7 +128,7 @@ bool CmdExtension::onServer(DebuggerProxy &proxy) {
|
||||
return processList(proxy);
|
||||
}
|
||||
|
||||
string name = m_args[1];
|
||||
std::string name = m_args[1];
|
||||
Extension *ext = Extension::GetExtension(name);
|
||||
if (ext) {
|
||||
if (m_args.size() == 2) {
|
||||
@@ -148,7 +148,7 @@ bool CmdExtension::onServer(DebuggerProxy &proxy) {
|
||||
}
|
||||
} else {
|
||||
if (ext->debuggerSupport() & IDebuggable::SupportVerb) {
|
||||
string verb = m_args[2];
|
||||
std::string verb = m_args[2];
|
||||
std::vector<std::string> args;
|
||||
if (m_args.size() > 3) {
|
||||
args.insert(args.end(), m_args.begin() + 3, m_args.end());
|
||||
|
||||
@@ -50,7 +50,7 @@ void CmdFlowControl::onClient(DebuggerClient &client) {
|
||||
}
|
||||
|
||||
if (client.argCount() == 1) {
|
||||
string snum = client.argValue(1);
|
||||
std::string snum = client.argValue(1);
|
||||
if (!DebuggerClient::IsValidNumber(snum)) {
|
||||
client.error("Count needs to be a number.");
|
||||
return;
|
||||
|
||||
@@ -297,7 +297,7 @@ void CmdHelp::onClient(DebuggerClient &client) {
|
||||
}
|
||||
|
||||
bool CmdHelp::processTutorial(DebuggerClient &client) {
|
||||
string mode = client.argValue(2);
|
||||
std::string mode = client.argValue(2);
|
||||
if (mode == "off") {
|
||||
client.setTutorial(-1);
|
||||
} else if (mode == "on") {
|
||||
|
||||
@@ -28,6 +28,8 @@
|
||||
namespace HPHP { namespace Eval {
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
using std::string;
|
||||
|
||||
TRACE_SET_MOD(debugger);
|
||||
|
||||
const StaticString
|
||||
@@ -88,7 +90,7 @@ void CmdInfo::recvImpl(DebuggerThriftBuffer &thrift) {
|
||||
if (i < DebuggerClient::AutoCompleteCount) {
|
||||
thrift.read(m_acLiveLists[i]);
|
||||
} else {
|
||||
vector<std::string> future;
|
||||
std::vector<std::string> future;
|
||||
thrift.read(future);
|
||||
}
|
||||
}
|
||||
@@ -133,7 +135,7 @@ bool CmdInfo::parseZeroArg(DebuggerClient &client) {
|
||||
return !m_symbol.empty();
|
||||
}
|
||||
|
||||
void CmdInfo::parseOneArg(DebuggerClient &client, string &subsymbol) {
|
||||
void CmdInfo::parseOneArg(DebuggerClient &client, std::string &subsymbol) {
|
||||
assert(client.argCount() == 1);
|
||||
string symbol = client.argValue(1);
|
||||
size_t pos = symbol.find("::");
|
||||
@@ -153,7 +155,7 @@ void CmdInfo::parseOneArg(DebuggerClient &client, string &subsymbol) {
|
||||
void CmdInfo::onClient(DebuggerClient &client) {
|
||||
if (DebuggerCommand::displayedHelp(client)) return;
|
||||
|
||||
string subsymbol;
|
||||
std::string subsymbol;
|
||||
|
||||
if (client.argCount() == 0) {
|
||||
if (!parseZeroArg(client)) {
|
||||
@@ -254,7 +256,7 @@ bool CmdInfo::onServer(DebuggerProxy &proxy) {
|
||||
|
||||
Array variables = g_vmContext->getLocalDefinedVariables(0);
|
||||
variables += CmdVariable::GetGlobalVariables();
|
||||
vector<std::string> &vars =
|
||||
std::vector<std::string> &vars =
|
||||
m_acLiveLists[DebuggerClient::AutoCompleteVariables];
|
||||
vars.reserve(variables.size());
|
||||
for (ArrayIter iter(variables); iter; ++iter) {
|
||||
|
||||
@@ -13,8 +13,10 @@
|
||||
| license@php.net so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
#include "hphp/runtime/debugger/cmd/cmd_interrupt.h"
|
||||
|
||||
#include <boost/lexical_cast.hpp>
|
||||
|
||||
#include "hphp/runtime/debugger/cmd/cmd_break.h"
|
||||
#include "hphp/runtime/debugger/cmd/cmd_print.h"
|
||||
#include "hphp/runtime/base/array-init.h"
|
||||
@@ -298,12 +300,12 @@ bool CmdInterrupt::shouldBreak(DebuggerProxy &proxy,
|
||||
}
|
||||
|
||||
std::string CmdInterrupt::getFileLine() const {
|
||||
string ret;
|
||||
std::string ret;
|
||||
if (m_site) {
|
||||
if (m_site->getFile()) {
|
||||
ret = m_site->getFile();
|
||||
}
|
||||
ret += ":" + lexical_cast<string>(m_site->getLine0());
|
||||
ret += ":" + boost::lexical_cast<std::string>(m_site->getLine0());
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -13,8 +13,12 @@
|
||||
| license@php.net so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
#include "hphp/runtime/debugger/cmd/cmd_list.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "hphp/runtime/debugger/cmd/cmd_info.h"
|
||||
#include "hphp/runtime/base/file.h"
|
||||
#include "hphp/runtime/ext/ext_file.h"
|
||||
@@ -120,7 +124,7 @@ void CmdList::getListLocation(DebuggerClient &client, int &lineFocus0,
|
||||
void CmdList::listEvalCode(DebuggerClient &client) {
|
||||
assert(m_file.empty());
|
||||
|
||||
string evalCode = client.getCode();
|
||||
std::string evalCode = client.getCode();
|
||||
if (evalCode.empty()) {
|
||||
client.error("There is no current source file.");
|
||||
} else {
|
||||
@@ -172,7 +176,7 @@ bool CmdList::listFunctionOrClass(DebuggerClient &client) {
|
||||
assert(client.argCount() == 1);
|
||||
auto cmdInfo = std::make_shared<CmdInfo>();
|
||||
DebuggerCommandPtr deleter(cmdInfo);
|
||||
string subsymbol;
|
||||
std::string subsymbol;
|
||||
cmdInfo->parseOneArg(client, subsymbol);
|
||||
auto cmd = client.xend<CmdInfo>(cmdInfo.get());
|
||||
Array info = cmd->getInfo();
|
||||
@@ -219,7 +223,7 @@ void CmdList::onClient(DebuggerClient &client) {
|
||||
int line = 0;
|
||||
m_line1 = m_line2 = 0;
|
||||
if (client.argCount() == 1) {
|
||||
string arg = client.argValue(1);
|
||||
std::string arg = client.argValue(1);
|
||||
if (DebuggerClient::IsValidNumber(arg)) {
|
||||
line = atoi(arg.c_str());
|
||||
if (line <= 0) {
|
||||
@@ -229,14 +233,14 @@ void CmdList::onClient(DebuggerClient &client) {
|
||||
}
|
||||
m_line1 = line - DebuggerClient::CodeBlockSize/2;
|
||||
m_line2 = m_line1 + DebuggerClient::CodeBlockSize;
|
||||
} else if (arg.find("::") != string::npos) {
|
||||
} else if (arg.find("::") != std::string::npos) {
|
||||
if (!listFunctionOrClass(client)) {
|
||||
client.error("Unable to read specified method.");
|
||||
}
|
||||
return;
|
||||
} else {
|
||||
size_t pos = arg.find(':');
|
||||
if (pos != string::npos) {
|
||||
if (pos != std::string::npos) {
|
||||
m_file = arg.substr(0, pos);
|
||||
if (m_file.empty()) {
|
||||
client.error("File name cannot be empty.");
|
||||
@@ -246,9 +250,9 @@ void CmdList::onClient(DebuggerClient &client) {
|
||||
arg = arg.substr(pos + 1);
|
||||
}
|
||||
pos = arg.find('-');
|
||||
if (pos != string::npos) {
|
||||
string line1 = arg.substr(0, pos);
|
||||
string line2 = arg.substr(pos + 1);
|
||||
if (pos != std::string::npos) {
|
||||
std::string line1 = arg.substr(0, pos);
|
||||
std::string line2 = arg.substr(pos + 1);
|
||||
if (!DebuggerClient::IsValidNumber(line1) ||
|
||||
!DebuggerClient::IsValidNumber(line2)) {
|
||||
if (m_file.empty()) {
|
||||
|
||||
@@ -138,7 +138,7 @@ bool CmdMachine::AttachSandbox(DebuggerClient &client,
|
||||
const char *user /* = NULL */,
|
||||
const char *name /* = NULL */,
|
||||
bool force /* = false */) {
|
||||
string login;
|
||||
std::string login;
|
||||
if (user == nullptr) {
|
||||
user = client.getCurrentUser().c_str();
|
||||
}
|
||||
@@ -217,10 +217,10 @@ void CmdMachine::onClient(DebuggerClient &client) {
|
||||
help(client);
|
||||
return;
|
||||
}
|
||||
string host = client.argValue(2);
|
||||
std::string host = client.argValue(2);
|
||||
int port = 0;
|
||||
size_t pos = host.find(":");
|
||||
if (pos != string::npos) {
|
||||
if (pos != std::string::npos) {
|
||||
if (!DebuggerClient::IsValidNumber(host.substr(pos + 1))) {
|
||||
client.error("Port needs to be a number");
|
||||
help(client);
|
||||
@@ -263,7 +263,7 @@ void CmdMachine::onClient(DebuggerClient &client) {
|
||||
if (client.arg(1, "attach")) {
|
||||
DSandboxInfoPtr sandbox;
|
||||
|
||||
string snum = client.argValue(2);
|
||||
std::string snum = client.argValue(2);
|
||||
if (DebuggerClient::IsValidNumber(snum)) {
|
||||
int num = atoi(snum.c_str());
|
||||
sandbox = client.getSandbox(num);
|
||||
|
||||
@@ -82,7 +82,7 @@ void CmdMacro::onClient(DebuggerClient &client) {
|
||||
} else if (client.arg(1, "list")) {
|
||||
processList(client);
|
||||
} else if (client.arg(1, "clear")) {
|
||||
string snum = client.argValue(2);
|
||||
std::string snum = client.argValue(2);
|
||||
if (!DebuggerClient::IsValidNumber(snum)) {
|
||||
client.error("'& [c]lear' needs an {index} argument.");
|
||||
client.tutorial(
|
||||
|
||||
@@ -32,17 +32,17 @@ const char *CmdPrint::Formats[] = {
|
||||
std::string CmdPrint::FormatResult(const char *format, CVarRef ret) {
|
||||
if (format == nullptr) {
|
||||
String sret = DebuggerClient::FormatVariable(ret, -1);
|
||||
return string(sret.data(), sret.size());
|
||||
return std::string(sret.data(), sret.size());
|
||||
}
|
||||
|
||||
if (strcmp(format, "r") == 0) {
|
||||
String sret = DebuggerClient::FormatVariable(ret, -1, 'r');
|
||||
return string(sret.data(), sret.size());
|
||||
return std::string(sret.data(), sret.size());
|
||||
}
|
||||
|
||||
if (strcmp(format, "v") == 0) {
|
||||
String sret = DebuggerClient::FormatVariable(ret, -1, 'v');
|
||||
return string(sret.data(), sret.size());
|
||||
return std::string(sret.data(), sret.size());
|
||||
}
|
||||
|
||||
if (strcmp(format, "dec") == 0 ||
|
||||
@@ -251,7 +251,7 @@ void CmdPrint::processClear(DebuggerClient &client) {
|
||||
return;
|
||||
}
|
||||
|
||||
string snum = client.argValue(2);
|
||||
std::string snum = client.argValue(2);
|
||||
if (!DebuggerClient::IsValidNumber(snum)) {
|
||||
client.error("'[p]rint [c]lear' needs an {index} argument.");
|
||||
client.tutorial(
|
||||
|
||||
@@ -130,7 +130,7 @@ void CmdThread::onClient(DebuggerClient &client) {
|
||||
client.info("Thread is running in exclusive mode now. All other threads "
|
||||
"will not break, even when they hit breakpoints.");
|
||||
} else {
|
||||
string snum = client.argValue(1);
|
||||
std::string snum = client.argValue(1);
|
||||
if (!DebuggerClient::IsValidNumber(snum)) {
|
||||
client.error("'[t]hread {index}' needs a numeric argument.");
|
||||
client.tutorial(
|
||||
|
||||
@@ -37,7 +37,7 @@ void CmdUp::help(DebuggerClient &client) {
|
||||
|
||||
int CmdUp::ParseNumber(DebuggerClient &client) {
|
||||
if (client.argCount() == 1) {
|
||||
string snum = client.argValue(1);
|
||||
std::string snum = client.argValue(1);
|
||||
if (!DebuggerClient::IsValidNumber(snum)) {
|
||||
client.error("Please specify a number.");
|
||||
client.tutorial(
|
||||
|
||||
@@ -131,7 +131,7 @@ void CmdWhere::onClient(DebuggerClient &client) {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
string snum = client.argValue(argBase);
|
||||
std::string snum = client.argValue(argBase);
|
||||
int num = atoi(snum.c_str());
|
||||
if (snum[0] == '-') {
|
||||
snum = snum.substr(1);
|
||||
|
||||
@@ -46,7 +46,7 @@ void CmdZend::onClient(DebuggerClient &client) {
|
||||
if (!code.empty()) {
|
||||
const std::string zendExe = client.getZendExecutable();
|
||||
client.info("Executing last PHP block with \"%s\"...", zendExe.c_str());
|
||||
string out;
|
||||
std::string out;
|
||||
Process::Exec(zendExe.c_str(), nullptr, code.c_str(), out, &out, true);
|
||||
client.print(out);
|
||||
return;
|
||||
|
||||
@@ -23,6 +23,8 @@
|
||||
namespace HPHP { namespace Eval {
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
using std::string;
|
||||
|
||||
TRACE_SET_MOD(debugger);
|
||||
|
||||
const std::string &DSandboxInfo::id() const {
|
||||
@@ -35,7 +37,7 @@ const std::string &DSandboxInfo::id() const {
|
||||
|
||||
const std::string DSandboxInfo::desc() const {
|
||||
TRACE(2, "DSandboxInfo::desc\n");
|
||||
string ret = m_user + "'s " + m_name + " sandbox";
|
||||
std::string ret = m_user + "'s " + m_name + " sandbox";
|
||||
if (!m_path.empty()) {
|
||||
ret += " at " + m_path;
|
||||
}
|
||||
@@ -56,7 +58,7 @@ void DSandboxInfo::set(const std::string &id) {
|
||||
m_name.clear();
|
||||
m_path.clear();
|
||||
if (!id.empty()) {
|
||||
vector<string> tokens;
|
||||
std::vector<std::string> tokens;
|
||||
Util::split('\t', id.c_str(), tokens);
|
||||
if (tokens.size() == 2) {
|
||||
m_user = tokens[0];
|
||||
@@ -131,7 +133,7 @@ std::string DFunctionInfo::getName() const {
|
||||
|
||||
std::string DFunctionInfo::site(std::string &preposition) const {
|
||||
TRACE(2, "DFunctionInfo::site\n");
|
||||
string ret;
|
||||
std::string ret;
|
||||
preposition = "at ";
|
||||
if (!m_class.empty()) {
|
||||
if (!m_namespace.empty()) {
|
||||
@@ -160,7 +162,7 @@ std::string DFunctionInfo::site(std::string &preposition) const {
|
||||
|
||||
std::string DFunctionInfo::desc(const BreakPointInfo *bpi) const {
|
||||
TRACE(2, "DFunctionInfo::desc\n");
|
||||
string ret;
|
||||
std::string ret;
|
||||
if (!m_class.empty()) {
|
||||
string cls;
|
||||
if (!m_namespace.empty()) {
|
||||
@@ -189,7 +191,7 @@ std::string DFunctionInfo::desc(const BreakPointInfo *bpi) const {
|
||||
|
||||
std::string Macro::desc(const char *indent) {
|
||||
TRACE(2, "Macro::desc\n");
|
||||
string ret;
|
||||
std::string ret;
|
||||
for (unsigned int i = 0; i < m_cmds.size(); i++) {
|
||||
if (indent) ret += indent;
|
||||
ret += m_cmds[i];
|
||||
@@ -491,7 +493,7 @@ String highlight_php(const String& source, int line /* = 0 */,
|
||||
Scanner scanner(source.data(), source.size(),
|
||||
Scanner::AllowShortTags | Scanner::ReturnAllTokens);
|
||||
ScannerToken tok1, tok2;
|
||||
std::vector<std::pair<int, string> > ahead_tokens;
|
||||
std::vector<std::pair<int, std::string> > ahead_tokens;
|
||||
Location loc1, loc2;
|
||||
|
||||
const char *colorComment = nullptr, *endComment = nullptr;
|
||||
|
||||
@@ -13,8 +13,11 @@
|
||||
| license@php.net so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
#include "hphp/runtime/debugger/debugger_client.h"
|
||||
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include <signal.h>
|
||||
|
||||
#include "hphp/runtime/debugger/debugger_command.h"
|
||||
#include "hphp/runtime/debugger/cmd/all.h"
|
||||
#include "hphp/runtime/base/complex-types.h"
|
||||
@@ -52,6 +55,8 @@ namespace HPHP { namespace Eval {
|
||||
|
||||
TRACE_SET_MOD(debugger);
|
||||
|
||||
using std::string;
|
||||
|
||||
static boost::scoped_ptr<DebuggerClient> debugger_client;
|
||||
|
||||
static String wordwrap(const String& str, int width /* = 75 */,
|
||||
@@ -392,7 +397,7 @@ String DebuggerClient::FormatInfoVec(const IDebuggable::InfoVec &info,
|
||||
StringBuffer sb;
|
||||
for (unsigned int i = 0; i < info.size(); i++) {
|
||||
if (ItemNameColor) sb.append(ItemNameColor);
|
||||
string name = info[i].first;
|
||||
std::string name = info[i].first;
|
||||
name += ": ";
|
||||
sb.append(name.substr(0, maxlen + 4));
|
||||
if (ItemNameColor) sb.append(ANSI_COLOR_END);
|
||||
@@ -1077,7 +1082,7 @@ DebuggerCommandPtr DebuggerClient::eventLoop(EventLoopKind loopKind,
|
||||
throw DebuggerProtocolException();
|
||||
}
|
||||
m_sigCount = 0;
|
||||
auto intr = dynamic_pointer_cast<CmdInterrupt>(cmd);
|
||||
auto intr = std::dynamic_pointer_cast<CmdInterrupt>(cmd);
|
||||
Debugger::UsageLogInterrupt("terminal", getSandboxId(), *intr.get());
|
||||
cmd->onClient(*this);
|
||||
|
||||
@@ -2351,7 +2356,7 @@ void DebuggerClient::saveConfig() {
|
||||
|
||||
void DebuggerClient::defineColors() {
|
||||
TRACE(2, "DebuggerClient::defineColors\n");
|
||||
vector<string> names;
|
||||
std::vector<std::string> names;
|
||||
get_supported_colors(names);
|
||||
Hdf support = m_config["Color"]["SupportedNames"];
|
||||
for (unsigned int i = 0; i < names.size(); i++) {
|
||||
|
||||
@@ -13,8 +13,10 @@
|
||||
| license@php.net so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
#include "hphp/runtime/debugger/debugger_command.h"
|
||||
|
||||
#include <poll.h>
|
||||
|
||||
#include "hphp/runtime/debugger/debugger.h"
|
||||
#include "hphp/runtime/debugger/cmd/all.h"
|
||||
#include "hphp/util/logger.h"
|
||||
@@ -96,7 +98,7 @@ bool DebuggerCommand::Receive(DebuggerThriftBuffer &thrift,
|
||||
}
|
||||
|
||||
int32_t type;
|
||||
string clsname;
|
||||
std::string clsname;
|
||||
try {
|
||||
thrift.reset(true);
|
||||
thrift.read(type);
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "hphp/util/base.h"
|
||||
#include "hphp/runtime/debugger/debugger_thrift_buffer.h"
|
||||
#include "hphp/runtime/debugger/debugger_client.h"
|
||||
|
||||
|
||||
@@ -14,6 +14,9 @@
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
#include "hphp/runtime/debugger/debugger_proxy.h"
|
||||
|
||||
#include <boost/lexical_cast.hpp>
|
||||
|
||||
#include "hphp/runtime/debugger/cmd/cmd_interrupt.h"
|
||||
#include "hphp/runtime/debugger/cmd/cmd_flow_control.h"
|
||||
#include "hphp/runtime/debugger/cmd/cmd_signal.h"
|
||||
@@ -440,7 +443,7 @@ void DebuggerProxy::pollSignal() {
|
||||
break;
|
||||
}
|
||||
|
||||
auto sig = dynamic_pointer_cast<CmdSignal>(res);
|
||||
auto sig = std::dynamic_pointer_cast<CmdSignal>(res);
|
||||
if (!sig) {
|
||||
TRACE_RB(2, "DebuggerProxy::pollSignal: "
|
||||
"bad response from signal polling: %d", res->getType());
|
||||
@@ -678,9 +681,9 @@ void DebuggerProxy::processInterrupt(CmdInterrupt &cmd) {
|
||||
if (res) {
|
||||
TRACE_RB(2, "Proxy got cmd type %d\n", res->getType());
|
||||
Debugger::UsageLog("server", getSandboxId(),
|
||||
boost::lexical_cast<string>(res->getType()));
|
||||
boost::lexical_cast<std::string>(res->getType()));
|
||||
// Any control flow command gets installed here and we continue execution.
|
||||
m_flow = dynamic_pointer_cast<CmdFlowControl>(res);
|
||||
m_flow = std::dynamic_pointer_cast<CmdFlowControl>(res);
|
||||
if (m_flow) {
|
||||
m_flow->onSetup(*this, cmd);
|
||||
if (!m_flow->complete()) {
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include "hphp/util/base.h"
|
||||
#include "hphp/util/synchronizable.h"
|
||||
#include "hphp/util/async-func.h"
|
||||
#include "hphp/runtime/base/socket.h"
|
||||
|
||||
@@ -13,8 +13,10 @@
|
||||
| license@php.net so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
#include "hphp/runtime/debugger/debugger_server.h"
|
||||
|
||||
#include <poll.h>
|
||||
|
||||
#include "hphp/runtime/debugger/debugger_client.h"
|
||||
#include "hphp/runtime/debugger/debugger.h"
|
||||
#include "hphp/runtime/base/runtime-option.h"
|
||||
|
||||
@@ -81,7 +81,7 @@ void DummySandbox::run() {
|
||||
CLISession hphpSession;
|
||||
|
||||
DSandboxInfo sandbox = m_proxy->getSandbox();
|
||||
string msg;
|
||||
std::string msg;
|
||||
if (sandbox.valid()) {
|
||||
GlobalVariables *g = get_global_variables();
|
||||
SourceRootInfo sri(sandbox.m_user, sandbox.m_name);
|
||||
@@ -103,7 +103,7 @@ void DummySandbox::run() {
|
||||
getcwd(cwd, sizeof(cwd));
|
||||
Logger::Info("Start loading startup doc '%s', pwd = '%s'",
|
||||
doc.c_str(), cwd);
|
||||
bool error; string errorMsg;
|
||||
bool error; std::string errorMsg;
|
||||
bool ret = hphp_invoke(g_context.getNoCheck(), doc, false, null_array,
|
||||
uninit_null(), "", "", error, errorMsg, true,
|
||||
false, true);
|
||||
@@ -158,7 +158,7 @@ void DummySandbox::notifySignal(int signum) {
|
||||
|
||||
std::string DummySandbox::getStartupDoc(const DSandboxInfo &sandbox) {
|
||||
TRACE(2, "DummySandbox::getStartupDoc\n");
|
||||
string path;
|
||||
std::string path;
|
||||
if (!m_startupFile.empty()) {
|
||||
// if relative path, prepend directory
|
||||
if (m_startupFile[0] != '/' && m_startupFile[0] != '~') {
|
||||
@@ -174,9 +174,9 @@ std::string DummySandbox::getStartupDoc(const DSandboxInfo &sandbox) {
|
||||
|
||||
// resolving home directory
|
||||
if (path[0] == '~') {
|
||||
string user, home;
|
||||
std::string user, home;
|
||||
size_t pos = path.find('/');
|
||||
if (pos == string::npos) pos = path.size();
|
||||
if (pos == std::string::npos) pos = path.size();
|
||||
if (pos > 1) {
|
||||
user = path.substr(1, pos - 1);
|
||||
}
|
||||
|
||||
@@ -42,9 +42,8 @@ Array f_apache_request_headers() {
|
||||
HeaderMap headers;
|
||||
transport->getHeaders(headers);
|
||||
Array ret;
|
||||
for (HeaderMap::const_iterator iter = headers.begin();
|
||||
iter != headers.end(); ++iter) {
|
||||
const vector<string> &values = iter->second;
|
||||
for (auto iter = headers.begin(); iter != headers.end(); ++iter) {
|
||||
const auto& values = iter->second;
|
||||
ret.set(String(iter->first), String(values.back()));
|
||||
}
|
||||
return ret;
|
||||
@@ -58,9 +57,8 @@ Array f_apache_response_headers() {
|
||||
HeaderMap headers;
|
||||
transport->getResponseHeaders(headers);
|
||||
Array ret;
|
||||
for (HeaderMap::const_iterator iter = headers.begin();
|
||||
iter != headers.end(); ++iter) {
|
||||
const vector<string> &values = iter->second;
|
||||
for (auto iter = headers.begin(); iter != headers.end(); ++iter) {
|
||||
const auto& values = iter->second;
|
||||
ret.set(String(iter->first), String(values.back()));
|
||||
}
|
||||
return ret;
|
||||
|
||||
@@ -14,14 +14,18 @@
|
||||
| license@php.net so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
#include "hphp/runtime/ext/ext_apc.h"
|
||||
|
||||
#include <fstream>
|
||||
|
||||
#include <dlfcn.h>
|
||||
#include <sys/time.h> // gettimeofday
|
||||
|
||||
#include "hphp/runtime/ext/ext_variable.h"
|
||||
#include "hphp/runtime/ext/ext_fb.h"
|
||||
#include "hphp/runtime/base/runtime-option.h"
|
||||
#include "hphp/util/async-job.h"
|
||||
#include "hphp/util/timer.h"
|
||||
#include <dlfcn.h>
|
||||
#include "hphp/runtime/base/program-functions.h"
|
||||
#include "hphp/runtime/base/builtin-functions.h"
|
||||
#include "hphp/runtime/base/variable-serializer.h"
|
||||
@@ -47,7 +51,7 @@ void apcExtension::moduleLoad(Hdf config) {
|
||||
PrimeLibrary = apc["PrimeLibrary"].getString();
|
||||
LoadThread = apc["LoadThread"].getInt16(2);
|
||||
apc["CompletionKeys"].get(CompletionKeys);
|
||||
string tblType = apc["TableType"].getString("concurrent");
|
||||
std::string tblType = apc["TableType"].getString("concurrent");
|
||||
if (strcasecmp(tblType.c_str(), "concurrent") == 0) {
|
||||
TableType = TableTypes::ConcurrentTable;
|
||||
} else {
|
||||
@@ -591,7 +595,7 @@ void const_load_impl(struct cache_info *info,
|
||||
{
|
||||
int count = count_items(thrifts, 4);
|
||||
if (count) {
|
||||
vector<KeyValuePair> vars(count);
|
||||
std::vector<KeyValuePair> vars(count);
|
||||
const char **p = thrifts;
|
||||
for (int i = 0; i < count; i++, p += 4) {
|
||||
String key(*p, (int)(int64_t)*(p+1), CopyString);
|
||||
@@ -635,7 +639,7 @@ void apc_load_impl(struct cache_info *info,
|
||||
{
|
||||
int count = count_items(int_keys, 2);
|
||||
if (count) {
|
||||
vector<KeyValuePair> vars(count);
|
||||
std::vector<KeyValuePair> vars(count);
|
||||
const char **k = int_keys;
|
||||
long long*v = int_values;
|
||||
for (int i = 0; i < count; i++, k += 2) {
|
||||
@@ -650,7 +654,7 @@ void apc_load_impl(struct cache_info *info,
|
||||
{
|
||||
int count = count_items(char_keys, 2);
|
||||
if (count) {
|
||||
vector<KeyValuePair> vars(count);
|
||||
std::vector<KeyValuePair> vars(count);
|
||||
const char **k = char_keys;
|
||||
char *v = char_values;
|
||||
for (int i = 0; i < count; i++, k += 2) {
|
||||
@@ -671,7 +675,7 @@ void apc_load_impl(struct cache_info *info,
|
||||
{
|
||||
int count = count_items(strings, 4);
|
||||
if (count) {
|
||||
vector<KeyValuePair> vars(count);
|
||||
std::vector<KeyValuePair> vars(count);
|
||||
const char **p = strings;
|
||||
for (int i = 0; i < count; i++, p += 4) {
|
||||
auto& item = vars[i];
|
||||
@@ -687,7 +691,7 @@ void apc_load_impl(struct cache_info *info,
|
||||
{
|
||||
int count = count_items(objects, 4);
|
||||
if (count) {
|
||||
vector<KeyValuePair> vars(count);
|
||||
std::vector<KeyValuePair> vars(count);
|
||||
const char **p = objects;
|
||||
for (int i = 0; i < count; i++, p += 4) {
|
||||
auto& item = vars[i];
|
||||
@@ -702,7 +706,7 @@ void apc_load_impl(struct cache_info *info,
|
||||
{
|
||||
int count = count_items(thrifts, 4);
|
||||
if (count) {
|
||||
vector<KeyValuePair> vars(count);
|
||||
std::vector<KeyValuePair> vars(count);
|
||||
const char **p = thrifts;
|
||||
for (int i = 0; i < count; i++, p += 4) {
|
||||
auto& item = vars[i];
|
||||
@@ -722,7 +726,7 @@ void apc_load_impl(struct cache_info *info,
|
||||
{
|
||||
int count = count_items(others, 4);
|
||||
if (count) {
|
||||
vector<KeyValuePair> vars(count);
|
||||
std::vector<KeyValuePair> vars(count);
|
||||
const char **p = others;
|
||||
for (int i = 0; i < count; i++, p += 4) {
|
||||
auto& item = vars[i];
|
||||
@@ -901,7 +905,7 @@ void apc_load_impl_compressed
|
||||
int count = int_lens[0];
|
||||
int len = int_lens[1];
|
||||
if (count) {
|
||||
vector<KeyValuePair> vars(count);
|
||||
std::vector<KeyValuePair> vars(count);
|
||||
char *keys = gzdecode(int_keys, len);
|
||||
if (keys == NULL) throw Exception("bad compressed apc archive.");
|
||||
ScopedMem holder(keys);
|
||||
@@ -922,7 +926,7 @@ void apc_load_impl_compressed
|
||||
int count = char_lens[0];
|
||||
int len = char_lens[1];
|
||||
if (count) {
|
||||
vector<KeyValuePair> vars(count);
|
||||
std::vector<KeyValuePair> vars(count);
|
||||
char *keys = gzdecode(char_keys, len);
|
||||
if (keys == NULL) throw Exception("bad compressed apc archive.");
|
||||
ScopedMem holder(keys);
|
||||
@@ -949,7 +953,7 @@ void apc_load_impl_compressed
|
||||
int count = string_lens[0] / 2;
|
||||
int len = string_lens[1];
|
||||
if (count) {
|
||||
vector<KeyValuePair> vars(count);
|
||||
std::vector<KeyValuePair> vars(count);
|
||||
char *decoded = gzdecode(strings, len);
|
||||
if (decoded == NULL) throw Exception("bad compressed apc archive.");
|
||||
ScopedMem holder(decoded);
|
||||
@@ -973,7 +977,7 @@ void apc_load_impl_compressed
|
||||
int count = object_lens[0] / 2;
|
||||
int len = object_lens[1];
|
||||
if (count) {
|
||||
vector<KeyValuePair> vars(count);
|
||||
std::vector<KeyValuePair> vars(count);
|
||||
char *decoded = gzdecode(objects, len);
|
||||
if (decoded == NULL) throw Exception("bad compressed APC archive.");
|
||||
ScopedMem holder(decoded);
|
||||
@@ -995,7 +999,7 @@ void apc_load_impl_compressed
|
||||
int count = thrift_lens[0] / 2;
|
||||
int len = thrift_lens[1];
|
||||
if (count) {
|
||||
vector<KeyValuePair> vars(count);
|
||||
std::vector<KeyValuePair> vars(count);
|
||||
char *decoded = gzdecode(thrifts, len);
|
||||
if (decoded == NULL) throw Exception("bad compressed apc archive.");
|
||||
ScopedMem holder(decoded);
|
||||
@@ -1022,7 +1026,7 @@ void apc_load_impl_compressed
|
||||
int count = other_lens[0] / 2;
|
||||
int len = other_lens[1];
|
||||
if (count) {
|
||||
vector<KeyValuePair> vars(count);
|
||||
std::vector<KeyValuePair> vars(count);
|
||||
char *decoded = gzdecode(others, len);
|
||||
if (decoded == NULL) throw Exception("bad compressed apc archive.");
|
||||
ScopedMem holder(decoded);
|
||||
@@ -1111,13 +1115,13 @@ int apc_rfc1867_progress(apc_rfc1867_data *rfc1867ApcData,
|
||||
len = RFC1867_TRACKING_KEY_MAXLEN;
|
||||
}
|
||||
rfc1867ApcData->tracking_key =
|
||||
string(RuntimeOption::Rfc1867Prefix.c_str(), len);
|
||||
std::string(RuntimeOption::Rfc1867Prefix.c_str(), len);
|
||||
len = strlen(*data->value);
|
||||
int rem = RFC1867_TRACKING_KEY_MAXLEN -
|
||||
rfc1867ApcData->tracking_key.size();
|
||||
if (len > rem) len = rem;
|
||||
rfc1867ApcData->tracking_key +=
|
||||
string(*data->value, len);
|
||||
std::string(*data->value, len);
|
||||
rfc1867ApcData->bytes_processed = data->post_bytes_processed;
|
||||
}
|
||||
/* Facebook: Temporary fix for a bug in PHP's rfc1867 code,
|
||||
@@ -1136,11 +1140,11 @@ int apc_rfc1867_progress(apc_rfc1867_data *rfc1867ApcData,
|
||||
rfc1867ApcData->bytes_processed = data->post_bytes_processed;
|
||||
int len = strlen(*data->filename);
|
||||
if (len > RFC1867_FILENAME_MAXLEN) len = RFC1867_FILENAME_MAXLEN;
|
||||
rfc1867ApcData->filename = string(*data->filename, len);
|
||||
rfc1867ApcData->filename = std::string(*data->filename, len);
|
||||
rfc1867ApcData->temp_filename = NULL;
|
||||
len = strlen(data->name);
|
||||
if (len > RFC1867_NAME_MAXLEN) len = RFC1867_NAME_MAXLEN;
|
||||
rfc1867ApcData->name = string(data->name, len);
|
||||
rfc1867ApcData->name = std::string(data->name, len);
|
||||
ArrayInit track(6);
|
||||
track.set(s_total, rfc1867ApcData->content_length);
|
||||
track.set(s_current, rfc1867ApcData->bytes_processed);
|
||||
|
||||
@@ -74,7 +74,8 @@ Variant f_bzopen(CVarRef filename, const String& mode) {
|
||||
int stream_mode_len = stream_mode.length();
|
||||
|
||||
if (stream_mode_len != 1 &&
|
||||
!(stream_mode_len == 2 && stream_mode.find('b') != string::npos)) {
|
||||
!(stream_mode_len == 2 &&
|
||||
stream_mode.find('b') != std::string::npos)) {
|
||||
raise_warning("cannot use stream opened in mode '%s'", stream_mode.c_str());
|
||||
return false;
|
||||
} else if (stream_mode_len == 1 &&
|
||||
|
||||
@@ -40,6 +40,9 @@
|
||||
namespace HPHP {
|
||||
IMPLEMENT_DEFAULT_EXTENSION(curl);
|
||||
|
||||
using std::string;
|
||||
using std::vector;
|
||||
|
||||
const StaticString
|
||||
s_exception("exception"),
|
||||
s_previous("previous");
|
||||
@@ -74,9 +77,9 @@ private:
|
||||
|
||||
class ToFree {
|
||||
public:
|
||||
vector<char*> str;
|
||||
vector<curl_httppost*> post;
|
||||
vector<curl_slist*> slist;
|
||||
std::vector<char*> str;
|
||||
std::vector<curl_httppost*> post;
|
||||
std::vector<curl_slist*> slist;
|
||||
|
||||
~ToFree() {
|
||||
for (unsigned int i = 0; i < str.size(); i++) {
|
||||
@@ -1400,7 +1403,7 @@ IMPLEMENT_OBJECT_ALLOCATION(LibEventHttpHandle)
|
||||
static LibEventHttpClientPtr prepare_client
|
||||
(const String& url, const String& data, CArrRef headers, int timeout,
|
||||
bool async, bool post) {
|
||||
string sUrl = url.data();
|
||||
std::string sUrl = url.data();
|
||||
if (sUrl.size() < 7 || sUrl.substr(0, 7) != "http://") {
|
||||
raise_warning("Invalid URL: %s", sUrl.c_str());
|
||||
return LibEventHttpClientPtr();
|
||||
@@ -1409,7 +1412,7 @@ static LibEventHttpClientPtr prepare_client
|
||||
// parsing server address
|
||||
size_t pos = sUrl.find('/', 7);
|
||||
string path;
|
||||
if (pos == string::npos) {
|
||||
if (pos == std::string::npos) {
|
||||
pos = sUrl.length();
|
||||
path = "/";
|
||||
} else if (pos == 7) {
|
||||
@@ -1436,7 +1439,7 @@ static LibEventHttpClientPtr prepare_client
|
||||
return client;
|
||||
}
|
||||
|
||||
vector<string> sheaders;
|
||||
std::vector<std::string> sheaders;
|
||||
for (ArrayIter iter(headers); iter; ++iter) {
|
||||
sheaders.push_back(iter.second().toString().data());
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ static void php_libxml_internal_error_handler(int error_type, void *ctx,
|
||||
static void php_libxml_internal_error_handler(int error_type, void *ctx,
|
||||
const char *fmt,
|
||||
va_list ap) {
|
||||
string msg;
|
||||
std::string msg;
|
||||
Util::string_vsnprintf(msg, fmt, ap);
|
||||
|
||||
/* remove any trailing \n */
|
||||
@@ -237,7 +237,7 @@ static void php_dom_throw_error(dom_exception_code error_code,
|
||||
Object e(SystemLib::AllocDOMExceptionObject(error_message, 0));
|
||||
throw e;
|
||||
}
|
||||
raise_warning(string(error_message));
|
||||
raise_warning(std::string(error_message));
|
||||
}
|
||||
|
||||
static bool dom_has_feature(const char *feature, const char *version) {
|
||||
|
||||
@@ -14,8 +14,10 @@
|
||||
| license@php.net so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
#include "hphp/runtime/ext/ext_error.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include "hphp/runtime/base/exceptions.h"
|
||||
#include "hphp/runtime/base/string-buffer.h"
|
||||
#include "hphp/runtime/ext/ext_file.h"
|
||||
|
||||
@@ -14,27 +14,32 @@
|
||||
| license@php.net so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
#include "hphp/runtime/ext/ext_fb.h"
|
||||
|
||||
#include <fstream>
|
||||
|
||||
#include <netinet/in.h>
|
||||
|
||||
#include <unicode/uchar.h>
|
||||
#include <unicode/utf8.h>
|
||||
|
||||
#include "folly/String.h"
|
||||
|
||||
#include "hphp/util/db-conn.h"
|
||||
#include "hphp/util/logger.h"
|
||||
#include "hphp/runtime/base/code-coverage.h"
|
||||
#include "hphp/runtime/base/externals.h"
|
||||
#include "hphp/runtime/base/file-repository.h"
|
||||
#include "hphp/runtime/base/intercept.h"
|
||||
#include "hphp/runtime/base/runtime-option.h"
|
||||
#include "hphp/runtime/base/stat-cache.h"
|
||||
#include "hphp/runtime/base/string-buffer.h"
|
||||
#include "hphp/runtime/base/string-util.h"
|
||||
#include "hphp/runtime/ext/ext_function.h"
|
||||
#include "hphp/runtime/ext/ext_mysql.h"
|
||||
#include "hphp/runtime/ext/FBSerialize.h"
|
||||
#include "hphp/runtime/ext/VariantController.h"
|
||||
#include "hphp/util/db-conn.h"
|
||||
#include "hphp/util/logger.h"
|
||||
#include "hphp/runtime/base/stat-cache.h"
|
||||
#include "folly/String.h"
|
||||
#include <netinet/in.h>
|
||||
#include "hphp/runtime/base/externals.h"
|
||||
#include "hphp/runtime/base/string-util.h"
|
||||
#include "hphp/runtime/base/string-buffer.h"
|
||||
#include "hphp/runtime/base/code-coverage.h"
|
||||
#include "hphp/runtime/base/runtime-option.h"
|
||||
#include "hphp/runtime/base/intercept.h"
|
||||
#include "hphp/runtime/vm/unwind.h"
|
||||
#include <unicode/uchar.h>
|
||||
#include <unicode/utf8.h>
|
||||
#include "hphp/runtime/base/file-repository.h"
|
||||
|
||||
#include "hphp/parser/parser.h"
|
||||
|
||||
@@ -752,11 +757,11 @@ Array f_fb_parallel_query(CArrRef sql_map, int max_thread /* = 50 */,
|
||||
for (ArrayIter iter(sql_map); iter; ++iter) {
|
||||
Array data = iter.second().toArray();
|
||||
if (!data.empty()) {
|
||||
std::vector< std::pair<string, string> > sessionVariables;
|
||||
std::vector< std::pair<std::string, std::string> > sessionVariables;
|
||||
if (data.exists(s_session_variable)) {
|
||||
Array sv = data[s_session_variable].toArray();
|
||||
for (ArrayIter svIter(sv); svIter; ++svIter) {
|
||||
sessionVariables.push_back(std::pair<string, string>(
|
||||
sessionVariables.push_back(std::pair<std::string,std::string>(
|
||||
svIter.first().toString().data(),
|
||||
svIter.second().toString().data()));
|
||||
}
|
||||
|
||||
@@ -14,8 +14,10 @@
|
||||
| license@php.net so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
#include "hphp/runtime/ext/ext_function.h"
|
||||
|
||||
#include <boost/lexical_cast.hpp>
|
||||
|
||||
#include "hphp/runtime/ext/ext_json.h"
|
||||
#include "hphp/runtime/ext/ext_class.h"
|
||||
#include "hphp/runtime/ext/ext_closure.h"
|
||||
@@ -33,6 +35,7 @@ namespace HPHP {
|
||||
|
||||
using HPHP::JIT::CallerFrame;
|
||||
using HPHP::JIT::EagerCallerFrame;
|
||||
using std::string;
|
||||
|
||||
const StaticString
|
||||
s_internal("internal"),
|
||||
@@ -179,7 +182,7 @@ Variant f_call_user_func_rpc(int _argc, const String& host, int port,
|
||||
const String& auth,
|
||||
int timeout, CVarRef function,
|
||||
CArrRef _argv /* = null_array */) {
|
||||
string shost = host.data();
|
||||
std::string shost = host.data();
|
||||
if (!RuntimeOption::DebuggerRpcHostDomain.empty()) {
|
||||
unsigned int pos = shost.find(RuntimeOption::DebuggerRpcHostDomain);
|
||||
if (pos != shost.length() - RuntimeOption::DebuggerRpcHostDomain.size()) {
|
||||
@@ -187,17 +190,17 @@ Variant f_call_user_func_rpc(int _argc, const String& host, int port,
|
||||
}
|
||||
}
|
||||
|
||||
string url = "http://";
|
||||
std::string url = "http://";
|
||||
url += shost;
|
||||
url += ":";
|
||||
url += lexical_cast<string>(port);
|
||||
url += boost::lexical_cast<std::string>(port);
|
||||
url += "/call_user_func_serialized?auth=";
|
||||
url += auth.data();
|
||||
|
||||
Array blob = make_map_array(s_func, function, s_args, _argv);
|
||||
String message = f_serialize(blob);
|
||||
|
||||
vector<string> headers;
|
||||
std::vector<string> headers;
|
||||
LibEventHttpClientPtr http = LibEventHttpClient::Get(shost, port);
|
||||
if (!http->send(url, headers, timeout < 0 ? 0 : timeout, false,
|
||||
message.data(), message.size())) {
|
||||
|
||||
@@ -29,6 +29,9 @@
|
||||
#include "hphp/runtime/base/variable-serializer.h"
|
||||
#include "hphp/runtime/ext/ext_function.h"
|
||||
|
||||
#include <sys/time.h>
|
||||
#include <sys/resource.h>
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
#include <sys/resource.h>
|
||||
#include <sys/param.h>
|
||||
@@ -72,6 +75,10 @@ namespace HPHP {
|
||||
|
||||
IMPLEMENT_DEFAULT_EXTENSION(hotprofiler);
|
||||
IMPLEMENT_DEFAULT_EXTENSION(xhprof);
|
||||
|
||||
using std::vector;
|
||||
using std::string;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// helpers
|
||||
|
||||
|
||||
@@ -147,7 +147,7 @@ public:
|
||||
Transliterator::createInstance(basicIDAccent, UTRANS_FORWARD, status);
|
||||
|
||||
if (U_FAILURE(status)) {
|
||||
raise_warning(string(u_errorName(status)));
|
||||
raise_warning(std::string(u_errorName(status)));
|
||||
//m_tl should be NULL if createInstance fails but better safe than sorry.
|
||||
m_tl = NULL;
|
||||
m_tl_accent = NULL;
|
||||
|
||||
@@ -1360,8 +1360,8 @@ Variant f_imap_open(const String& mailbox, const String& username,
|
||||
mail_parameters(NIL, SET_MAXLOGINTRIALS, (void *) retries);
|
||||
}
|
||||
|
||||
IMAPG(user) = string(username.data(), username.size());
|
||||
IMAPG(password) = string(password.data(), password.size());
|
||||
IMAPG(user) = std::string(username.data(), username.size());
|
||||
IMAPG(password) = std::string(password.data(), password.size());
|
||||
|
||||
MAILSTREAM *stream = mail_open(NIL, (char*)filename.data(), options);
|
||||
if (stream == NIL) {
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace HPHP {
|
||||
* from the beginning.
|
||||
*/
|
||||
static String php_trim(const String& str) {
|
||||
string s(str.c_str());
|
||||
std::string s(str.c_str());
|
||||
unsigned int l = s.length();
|
||||
while (l > 0 && isspace((unsigned char)s[l - 1])) {
|
||||
l--;
|
||||
|
||||
@@ -342,9 +342,9 @@ Variant c_Memcached::t_fetchall() {
|
||||
|
||||
bool c_Memcached::getMultiImpl(const String& server_key, CArrRef keys,
|
||||
bool enableCas, Array *returnValue) {
|
||||
vector<const char*> keysCopy;
|
||||
std::vector<const char*> keysCopy;
|
||||
keysCopy.reserve(keys.size());
|
||||
vector<size_t> keysLengthCopy;
|
||||
std::vector<size_t> keysLengthCopy;
|
||||
keysLengthCopy.reserve(keys.size());
|
||||
for (ArrayIter iter(keys); iter; ++iter) {
|
||||
Variant vKey = iter.second();
|
||||
@@ -480,7 +480,7 @@ bool c_Memcached::setOperationImpl(SetOperation op, const String& server_key,
|
||||
return false;
|
||||
}
|
||||
|
||||
vector<char> payload; uint32_t flags;
|
||||
std::vector<char> payload; uint32_t flags;
|
||||
toPayload(value, payload, flags);
|
||||
|
||||
const String& myServerKey = server_key.empty() ? key : server_key;
|
||||
@@ -502,7 +502,7 @@ bool c_Memcached::t_casbykey(double cas_token, const String& server_key, const S
|
||||
return false;
|
||||
}
|
||||
|
||||
vector<char> payload; uint32_t flags;
|
||||
std::vector<char> payload; uint32_t flags;
|
||||
toPayload(value, payload, flags);
|
||||
|
||||
const String& myServerKey = server_key.empty() ? key : server_key;
|
||||
@@ -917,7 +917,7 @@ bool c_Memcached::handleError(memcached_return status) {
|
||||
}
|
||||
}
|
||||
|
||||
void c_Memcached::toPayload(CVarRef value, vector<char> &payload,
|
||||
void c_Memcached::toPayload(CVarRef value, std::vector<char> &payload,
|
||||
uint32_t &flags) {
|
||||
String encoded;
|
||||
if (value.isString() || value.isNumeric()) {
|
||||
@@ -965,7 +965,7 @@ bool c_Memcached::toObject(Variant& value, const memcached_result_st &result) {
|
||||
String decompPayload;
|
||||
if (flags & MEMC_VAL_COMPRESSED) {
|
||||
bool done = false;
|
||||
vector<char> buffer;
|
||||
std::vector<char> buffer;
|
||||
unsigned long bufferSize;
|
||||
for (int factor = 1; !done && factor <= 16; ++factor) {
|
||||
bufferSize = payloadLength * (1 << factor) + 1;
|
||||
@@ -1022,7 +1022,7 @@ memcached_return c_Memcached::doCacheCallback(CVarRef callback, const String& ke
|
||||
return MEMCACHED_NOTFOUND;
|
||||
}
|
||||
|
||||
vector<char> payload; uint32_t flags;
|
||||
std::vector<char> payload; uint32_t flags;
|
||||
toPayload(value, payload, flags);
|
||||
return memcached_set(&m_impl->memcached, key.c_str(), key.length(),
|
||||
payload.data(), payload.size(), 0, flags);
|
||||
|
||||
@@ -16,29 +16,35 @@
|
||||
*/
|
||||
#include "hphp/runtime/ext/ext_mysql.h"
|
||||
|
||||
#include "folly/ScopeGuard.h"
|
||||
#include <boost/lexical_cast.hpp>
|
||||
|
||||
#include <netinet/in.h>
|
||||
#include <netdb.h>
|
||||
#include <poll.h>
|
||||
|
||||
#include "folly/ScopeGuard.h"
|
||||
#include "folly/String.h"
|
||||
|
||||
#include "hphp/runtime/ext/ext_preg.h"
|
||||
#include "hphp/runtime/ext/ext_network.h"
|
||||
#include "hphp/runtime/ext/mysql_stats.h"
|
||||
#include "hphp/runtime/base/socket.h"
|
||||
#include "hphp/runtime/base/runtime-option.h"
|
||||
#include "hphp/runtime/server/server-stats.h"
|
||||
#include "hphp/runtime/base/request-local.h"
|
||||
#include "hphp/runtime/base/extended-logger.h"
|
||||
#include "hphp/runtime/vm/jit/translator-inline.h"
|
||||
#include "hphp/util/network.h"
|
||||
#include "hphp/util/timer.h"
|
||||
#include "hphp/util/db-mysql.h"
|
||||
#include "folly/String.h"
|
||||
#include <netinet/in.h>
|
||||
#include <netdb.h>
|
||||
|
||||
#include "hphp/runtime/base/extended-logger.h"
|
||||
#include "hphp/runtime/base/request-local.h"
|
||||
#include "hphp/runtime/base/runtime-option.h"
|
||||
#include "hphp/runtime/base/socket.h"
|
||||
#include "hphp/runtime/ext/ext_network.h"
|
||||
#include "hphp/runtime/ext/ext_preg.h"
|
||||
#include "hphp/runtime/ext/mysql_stats.h"
|
||||
#include "hphp/runtime/server/server-stats.h"
|
||||
#include "hphp/runtime/vm/jit/translator-inline.h"
|
||||
#include "hphp/system/systemlib.h"
|
||||
|
||||
namespace HPHP {
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
using std::string;
|
||||
|
||||
bool mysqlExtension::ReadOnly = false;
|
||||
#ifdef FACEBOOK
|
||||
bool mysqlExtension::Localize = false;
|
||||
@@ -549,7 +555,7 @@ static Variant php_mysql_do_connect(String server, String username,
|
||||
int port;
|
||||
|
||||
auto slash_pos = server.find('/');
|
||||
if (slash_pos != string::npos) {
|
||||
if (slash_pos != std::string::npos) {
|
||||
socket = server.substr(slash_pos);
|
||||
server = server.substr(0, slash_pos - 1);
|
||||
}
|
||||
|
||||
@@ -1004,7 +1004,7 @@ Array f_headers_list() {
|
||||
transport->getResponseHeaders(headers);
|
||||
for (HeaderMap::const_iterator iter = headers.begin();
|
||||
iter != headers.end(); ++iter) {
|
||||
const vector<string> &values = iter->second;
|
||||
const std::vector<std::string> &values = iter->second;
|
||||
for (unsigned int i = 0; i < values.size(); i++) {
|
||||
ret.append(String(iter->first + ": " + values[i]));
|
||||
}
|
||||
|
||||
@@ -492,7 +492,7 @@ static void add_assoc_name_entry(Array &ret, const char *key,
|
||||
}
|
||||
|
||||
static const char *read_string(CArrRef args, const String& key, const char *def,
|
||||
vector<String> &strings) {
|
||||
std::vector<String> &strings) {
|
||||
if (args.exists(key)) {
|
||||
String value = args[key].toString();
|
||||
strings.push_back(value);
|
||||
@@ -562,7 +562,8 @@ const StaticString
|
||||
s_encrypt_key("encrypt_key");
|
||||
|
||||
static bool php_openssl_parse_config(struct php_x509_request *req,
|
||||
CArrRef args, vector<String> &strings) {
|
||||
CArrRef args,
|
||||
std::vector<String> &strings) {
|
||||
req->config_filename =
|
||||
read_string(args, s_config, default_ssl_conf_filename, strings);
|
||||
req->section_name =
|
||||
@@ -972,7 +973,7 @@ Variant f_openssl_csr_new(CArrRef dn, VRefParam privkey,
|
||||
|
||||
Resource okey;
|
||||
X509_REQ *csr = NULL;
|
||||
vector<String> strings;
|
||||
std::vector<String> strings;
|
||||
if (php_openssl_parse_config(&req, configargs.toArray(), strings)) {
|
||||
/* Generate or use a private key */
|
||||
if (!privkey.isNull()) {
|
||||
@@ -1057,7 +1058,7 @@ Variant f_openssl_csr_sign(CVarRef csr, CVarRef cacert, CVarRef priv_key,
|
||||
struct php_x509_request req;
|
||||
memset(&req, 0, sizeof(req));
|
||||
Variant ret = false;
|
||||
vector<String> strings;
|
||||
std::vector<String> strings;
|
||||
if (!php_openssl_parse_config(&req, configargs.toArray(), strings)) {
|
||||
goto cleanup;
|
||||
}
|
||||
@@ -1626,7 +1627,7 @@ static bool openssl_pkey_export_impl(CVarRef key, BIO *bio_out,
|
||||
|
||||
struct php_x509_request req;
|
||||
memset(&req, 0, sizeof(req));
|
||||
vector<String> strings;
|
||||
std::vector<String> strings;
|
||||
bool ret = false;
|
||||
if (php_openssl_parse_config(&req, configargs.toArray(), strings)) {
|
||||
const EVP_CIPHER *cipher;
|
||||
@@ -1812,7 +1813,7 @@ Resource f_openssl_pkey_new(CVarRef configargs /* = null_variant */) {
|
||||
memset(&req, 0, sizeof(req));
|
||||
|
||||
Resource ret;
|
||||
vector<String> strings;
|
||||
std::vector<String> strings;
|
||||
if (php_openssl_parse_config(&req, configargs.toArray(), strings) &&
|
||||
req.generatePrivateKey()) {
|
||||
ret = Resource(new Key(req.priv_key));
|
||||
@@ -1990,7 +1991,7 @@ Variant f_openssl_seal(const String& data, VRefParam sealed_data, VRefParam env_
|
||||
int *eksl = (int*)malloc(nkeys * sizeof(*eksl));
|
||||
unsigned char **eks = (unsigned char **)malloc(nkeys * sizeof(*eks));
|
||||
memset(eks, 0, sizeof(*eks) * nkeys);
|
||||
vector<Resource> holder;
|
||||
std::vector<Resource> holder;
|
||||
|
||||
/* get the public keys we are using to seal this data */
|
||||
bool ret = true;
|
||||
|
||||
Alguns arquivos não foram exibidos porque demasiados arquivos foram alterados neste diff Mostrar Mais
Referência em uma Nova Issue
Bloquear um usuário