Litstr must die, episode V.
Removed the litstr overloads of Array::rvalAt, rvalAtRef, lval, lvalPtr, lvalAt, and set. The main one left to do is operator[]. Fixed a bug in f_get_html_translation_table() where we were copying the null terminator of what should be a one-character string, thus creating a two-character string with s[1] == 0. (cc @jdelong) In class Extension, store a String for the name instead of const char*. cc @sgolemon
Esse commit está contido em:
@@ -51,8 +51,9 @@ static inline bool useCounters() {
|
||||
|
||||
class HardwareCounterImpl {
|
||||
public:
|
||||
HardwareCounterImpl(int type, unsigned long config, StringData* desc = nullptr)
|
||||
: m_desc(desc), m_err(0), m_fd(-1) {
|
||||
HardwareCounterImpl(int type, unsigned long config,
|
||||
const char* desc = nullptr)
|
||||
: m_desc(desc ? desc : ""), m_err(0), m_fd(-1) {
|
||||
memset (&pe, 0, sizeof (struct perf_event_attr));
|
||||
pe.type = type;
|
||||
pe.size = sizeof (struct perf_event_attr);
|
||||
@@ -130,7 +131,7 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
StringData* m_desc;
|
||||
StaticString m_desc;
|
||||
int m_err;
|
||||
private:
|
||||
int m_fd;
|
||||
@@ -326,8 +327,7 @@ bool HardwareCounter::addPerfEvent(char *event) {
|
||||
Logger::Warning("failed to find perf event: %s", event);
|
||||
return false;
|
||||
}
|
||||
hwc = new HardwareCounterImpl(
|
||||
type, config, StringData::GetStaticString(event));
|
||||
hwc = new HardwareCounterImpl(type, config, event);
|
||||
if (hwc->m_err) {
|
||||
Logger::Warning("failed to set perf event: %s", event);
|
||||
delete hwc;
|
||||
@@ -348,7 +348,7 @@ bool HardwareCounter::addPerfEvent(char *event) {
|
||||
bool HardwareCounter::eventExists(char *event) {
|
||||
// hopefully m_counters set is small, so a linear scan does not hurt
|
||||
for(unsigned i = 0; i < m_counters.size(); i++) {
|
||||
if (!strcmp(event, m_counters[i]->m_desc->data())) {
|
||||
if (!strcmp(event, m_counters[i]->m_desc.c_str())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -400,7 +400,7 @@ void HardwareCounter::getPerfEvents(Array& ret) {
|
||||
ret.set(s_stores, getStoreCount());
|
||||
}
|
||||
for (unsigned i = 0; i < m_counters.size(); i++) {
|
||||
ret.set(m_counters[i]->m_desc->data(), m_counters[i]->read());
|
||||
ret.set(m_counters[i]->m_desc, m_counters[i]->read());
|
||||
}
|
||||
if (m_pseudoEvents) {
|
||||
TranslatorX64::Get()->getPerfCounters(ret);
|
||||
|
||||
@@ -131,7 +131,15 @@ static const StaticString s_tm_mon("tm_mon");
|
||||
static const StaticString s_tm_year("tm_year");
|
||||
static const StaticString s_tm_wday("tm_wday");
|
||||
static const StaticString s_tm_yday("tm_yday");
|
||||
static const StaticString s_tm_isdst("tm_isdst");
|
||||
static const StaticString s_unparsed("unparsed");
|
||||
static const StaticString s_seconds("seconds");
|
||||
static const StaticString s_minutes("minutes");
|
||||
static const StaticString s_hours("hours");
|
||||
static const StaticString s_mday("mday");
|
||||
static const StaticString s_wday("wday");
|
||||
static const StaticString s_mon("mon");
|
||||
static const StaticString s_yday("yday");
|
||||
|
||||
#define PHP_DATE_PARSE_DATE_SET_TIME_ELEMENT(name, elem) \
|
||||
if ((int)parsed_time->elem == -99999) { \
|
||||
@@ -677,31 +685,31 @@ Array DateTime::toArray(ArrayFormat format) const {
|
||||
bool error;
|
||||
switch (format) {
|
||||
case TimeMap:
|
||||
ret.set("seconds", second());
|
||||
ret.set("minutes", minute());
|
||||
ret.set("hours", hour());
|
||||
ret.set("mday", day());
|
||||
ret.set("wday", dow());
|
||||
ret.set("mon", month());
|
||||
ret.set("year", year());
|
||||
ret.set("yday", doy());
|
||||
ret.set("weekday", weekdayName());
|
||||
ret.set("month", monthName());
|
||||
ret.set(s_seconds, second());
|
||||
ret.set(s_minutes, minute());
|
||||
ret.set(s_hours, hour());
|
||||
ret.set(s_mday, day());
|
||||
ret.set(s_wday, dow());
|
||||
ret.set(s_mon, month());
|
||||
ret.set(s_year, year());
|
||||
ret.set(s_yday, doy());
|
||||
ret.set(s_weekday, weekdayName());
|
||||
ret.set(s_month, monthName());
|
||||
ret.set(0, toTimeStamp(error));
|
||||
break;
|
||||
case TmMap:
|
||||
{
|
||||
struct tm tm;
|
||||
toTm(tm);
|
||||
ret.set("tm_sec", tm.tm_sec);
|
||||
ret.set("tm_min", tm.tm_min);
|
||||
ret.set("tm_hour", tm.tm_hour);
|
||||
ret.set("tm_mday", tm.tm_mday);
|
||||
ret.set("tm_mon", tm.tm_mon);
|
||||
ret.set("tm_year", tm.tm_year);
|
||||
ret.set("tm_wday", tm.tm_wday);
|
||||
ret.set("tm_yday", tm.tm_yday);
|
||||
ret.set("tm_isdst", tm.tm_isdst);
|
||||
ret.set(s_tm_sec, tm.tm_sec);
|
||||
ret.set(s_tm_min, tm.tm_min);
|
||||
ret.set(s_tm_hour, tm.tm_hour);
|
||||
ret.set(s_tm_mday, tm.tm_mday);
|
||||
ret.set(s_tm_mon, tm.tm_mon);
|
||||
ret.set(s_tm_year, tm.tm_year);
|
||||
ret.set(s_tm_wday, tm.tm_wday);
|
||||
ret.set(s_tm_yday, tm.tm_yday);
|
||||
ret.set(s_tm_isdst, tm.tm_isdst);
|
||||
}
|
||||
break;
|
||||
case TmVector:
|
||||
|
||||
@@ -159,6 +159,14 @@ Array TimeZone::GetNames() {
|
||||
static const StaticString s_dst("dst");
|
||||
static const StaticString s_offset("offset");
|
||||
static const StaticString s_timezone_id("timezone_id");
|
||||
static const StaticString s_ts("ts");
|
||||
static const StaticString s_time("time");
|
||||
static const StaticString s_isdst("isdst");
|
||||
static const StaticString s_abbr("abbr");
|
||||
static const StaticString s_country_code("country_code");
|
||||
static const StaticString s_latitude("latitude");
|
||||
static const StaticString s_longitude("longitude");
|
||||
static const StaticString s_comments("comments");
|
||||
|
||||
Array TimeZone::GetAbbreviations() {
|
||||
Array ret;
|
||||
@@ -172,7 +180,7 @@ Array TimeZone::GetAbbreviations() {
|
||||
} else {
|
||||
element.set(s_timezone_id, uninit_null());
|
||||
}
|
||||
ret.lvalAt(entry->name).append(element.create());
|
||||
ret.lvalAt(String(entry->name)).append(element.create());
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@@ -244,14 +252,13 @@ Array TimeZone::transitions() const {
|
||||
ttinfo &offset = m_tzi->type[index];
|
||||
const char *abbr = m_tzi->timezone_abbr + offset.abbr_idx;
|
||||
|
||||
Array element;
|
||||
element.set("ts", timestamp);
|
||||
element.set("time", dt.toString(DateTime::ISO8601));
|
||||
element.set("offset", offset.offset);
|
||||
element.set("isdst", (bool)offset.isdst);
|
||||
element.set("abbr", String(abbr, CopyString));
|
||||
|
||||
ret.append(element);
|
||||
ArrayInit element(5);
|
||||
element.set(s_ts, timestamp);
|
||||
element.set(s_time, dt.toString(DateTime::ISO8601));
|
||||
element.set(s_offset, offset.offset);
|
||||
element.set(s_isdst, (bool)offset.isdst);
|
||||
element.set(s_abbr, String(abbr, CopyString));
|
||||
ret.append(element.create());
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
@@ -262,10 +269,10 @@ Array TimeZone::getLocation() const {
|
||||
if (!m_tzi) return ret;
|
||||
|
||||
#ifdef TIMELIB_HAVE_TZLOCATION
|
||||
ret.set("country_code", String(m_tzi->location.country_code, CopyString));
|
||||
ret.set("latitude", m_tzi->location.latitude);
|
||||
ret.set("longitude", m_tzi->location.longitude);
|
||||
ret.set("comments", String(m_tzi->location.comments, CopyString));
|
||||
ret.set(s_country_code, String(m_tzi->location.country_code, CopyString));
|
||||
ret.set(s_latitude, m_tzi->location.latitude);
|
||||
ret.set(s_longitude, m_tzi->location.longitude);
|
||||
ret.set(s_comments, String(m_tzi->location.comments, CopyString));
|
||||
#else
|
||||
throw NotImplementedException("timelib version too old");
|
||||
#endif
|
||||
|
||||
@@ -475,12 +475,6 @@ class Array : protected SmartPtr<ArrayData> {
|
||||
|
||||
//litstr overloads
|
||||
const Variant operator[](litstr key) const;
|
||||
Variant rvalAt(litstr key, ACCESSPARAMS_DECL) const;
|
||||
CVarRef rvalAtRef(litstr key, ACCESSPARAMS_DECL) const;
|
||||
Variant &lval(litstr key);
|
||||
Variant *lvalPtr(litstr key, bool forWrite, bool create);
|
||||
Variant &lvalAt(litstr key, ACCESSPARAMS_DECL);
|
||||
CVarRef set(litstr key, CVarRef v, bool isKey = false);
|
||||
|
||||
private:
|
||||
// helpers
|
||||
|
||||
@@ -69,6 +69,9 @@ public:
|
||||
static String FromChar(char ch) {
|
||||
return StringData::GetStaticString(ch);
|
||||
}
|
||||
static String FromCStr(const char* str) {
|
||||
return StringData::GetStaticString(str);
|
||||
}
|
||||
|
||||
static const StringData *ConvertInteger(int64_t n) ATTRIBUTE_COLD;
|
||||
static const StringData *GetIntegerStringData(int64_t n) {
|
||||
|
||||
@@ -14,14 +14,14 @@
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
#ifndef incl_HPHP_VARIANT_H_
|
||||
#define incl_HPHP_VARIANT_H_
|
||||
|
||||
#ifndef incl_HPHP_INSIDE_HPHP_COMPLEX_TYPES_H_
|
||||
#error Directly including 'type_variant.h' is prohibited. \
|
||||
Include 'complex_types.h' instead.
|
||||
#endif
|
||||
|
||||
#ifndef incl_HPHP_VARIANT_H_
|
||||
#define incl_HPHP_VARIANT_H_
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
#include <util/trace.h>
|
||||
@@ -1499,24 +1499,6 @@ inline Variant uninit_null() {
|
||||
inline const Variant Array::operator[](litstr key) const {
|
||||
return (*this)[String(key)];
|
||||
}
|
||||
inline Variant Array::rvalAt(litstr key, ACCESSPARAMS_IMPL) const {
|
||||
return rvalAt(String(key), flags);
|
||||
}
|
||||
inline CVarRef Array::rvalAtRef(litstr key, ACCESSPARAMS_IMPL) const {
|
||||
return rvalAtRef(String(key), flags);
|
||||
}
|
||||
inline Variant& Array::lval(litstr key) {
|
||||
return lval(String(key));
|
||||
}
|
||||
inline Variant* Array::lvalPtr(litstr key, bool forWrite, bool create) {
|
||||
return lvalPtr(String(key), forWrite, create);
|
||||
}
|
||||
inline Variant& Array::lvalAt(litstr key, ACCESSPARAMS_IMPL) {
|
||||
return lvalAt(String(key), flags);
|
||||
}
|
||||
inline CVarRef Array::set(litstr key, CVarRef v, bool isKey) {
|
||||
return set(String(key), v, isKey);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
}
|
||||
|
||||
@@ -416,6 +416,24 @@ bool CmdBreak::onClient(DebuggerClient *client) {
|
||||
return true;
|
||||
}
|
||||
|
||||
static const StaticString s_id("id");
|
||||
static const StaticString s_state("state");
|
||||
static const StaticString s_is_exception("is_exception");
|
||||
static const StaticString s_exception_class("exception_class");
|
||||
static const StaticString s_file("file");
|
||||
static const StaticString s_line1("line1");
|
||||
static const StaticString s_line2("line2");
|
||||
static const StaticString s_namespace("namespace");
|
||||
static const StaticString s_func("func");
|
||||
static const StaticString s_class("class");
|
||||
static const StaticString s_url("url");
|
||||
static const StaticString s_use_regex("use_regex");
|
||||
static const StaticString s_clause_type("clause_type");
|
||||
static const StaticString s_clause("clause");
|
||||
static const StaticString s_if("if");
|
||||
static const StaticString s_ampamp("ampamp");
|
||||
static const StaticString s_desc("desc");
|
||||
|
||||
void CmdBreak::setClientOutput(DebuggerClient *client) {
|
||||
// Output an array of current breakpoints including exceptions
|
||||
client->setOutputType(DebuggerClient::OTValues);
|
||||
@@ -424,25 +442,25 @@ void CmdBreak::setClientOutput(DebuggerClient *client) {
|
||||
for (int i = 0; i < (int)m_breakpoints->size(); i++) {
|
||||
BreakPointInfoPtr bpi = m_breakpoints->at(i);
|
||||
Array breakpoint;
|
||||
breakpoint.set("id", bpi->index());
|
||||
breakpoint.set("state", bpi->state(false));
|
||||
breakpoint.set(s_id, bpi->index());
|
||||
breakpoint.set(s_state, bpi->state(false));
|
||||
if (bpi->m_interrupt == ExceptionThrown) {
|
||||
breakpoint.set("is_exception", true);
|
||||
breakpoint.set("exception_class", bpi->getExceptionClass());
|
||||
breakpoint.set(s_is_exception, true);
|
||||
breakpoint.set(s_exception_class, bpi->getExceptionClass());
|
||||
} else {
|
||||
breakpoint.set("is_exception", false);
|
||||
breakpoint.set("file", bpi->m_file);
|
||||
breakpoint.set("line1", bpi->m_line1);
|
||||
breakpoint.set("line2", bpi->m_line2);
|
||||
breakpoint.set("namespace", bpi->getNamespace());
|
||||
breakpoint.set("func", bpi->getFunction());
|
||||
breakpoint.set("class", bpi->getClass());
|
||||
breakpoint.set(s_is_exception, false);
|
||||
breakpoint.set(s_file, bpi->m_file);
|
||||
breakpoint.set(s_line1, bpi->m_line1);
|
||||
breakpoint.set(s_line2, bpi->m_line2);
|
||||
breakpoint.set(s_namespace, bpi->getNamespace());
|
||||
breakpoint.set(s_func, bpi->getFunction());
|
||||
breakpoint.set(s_class, bpi->getClass());
|
||||
}
|
||||
breakpoint.set("url", bpi->m_url);
|
||||
breakpoint.set("use_regex", bpi->m_regex);
|
||||
breakpoint.set("clause_type", bpi->m_check ? "if" : "&&");
|
||||
breakpoint.set("clause", bpi->m_clause);
|
||||
breakpoint.set("desc", bpi->desc());
|
||||
breakpoint.set(s_url, bpi->m_url);
|
||||
breakpoint.set(s_use_regex, bpi->m_regex);
|
||||
breakpoint.set(s_clause_type, bpi->m_check ? s_if : s_ampamp);
|
||||
breakpoint.set(s_clause, bpi->m_clause);
|
||||
breakpoint.set(s_desc, bpi->desc());
|
||||
values.append(breakpoint);
|
||||
}
|
||||
client->setOTValues(values);
|
||||
|
||||
@@ -148,16 +148,23 @@ bool CmdConfig::onClient(DebuggerClient *client) {
|
||||
return true;
|
||||
}
|
||||
|
||||
static const StaticString s_BypassAccessCheck("BypassAccessCheck");
|
||||
static const StaticString s_LogFile("LogFile");
|
||||
static const StaticString s_PrintLevel("PrintLevel");
|
||||
static const StaticString s_SmallStep("SmallStep");
|
||||
static const StaticString s_StackArgs("StackArgs");
|
||||
static const StaticString s_ApiModeSerialize("ApiModeSerialize");
|
||||
|
||||
void CmdConfig::setClientOutput(DebuggerClient *client) {
|
||||
client->setOutputType(DebuggerClient::OTValues);
|
||||
Array values;
|
||||
ArrayInit values(6);
|
||||
values.set("BypassAccessCheck", client->getDebuggerBypassCheck());
|
||||
values.set("LogFile", client->getLogFile());
|
||||
values.set("PrintLevel", client->getDebuggerPrintLevel());
|
||||
values.set("SmallStep", client->getDebuggerSmallStep());
|
||||
values.set("StackArgs", client->getDebuggerStackArgs());
|
||||
values.set("ApiModeSerialize", client->getDebuggerClientApiModeSerialize());
|
||||
client->setOTValues(values);
|
||||
client->setOTValues(values.create());
|
||||
}
|
||||
|
||||
void CmdConfig::listVars(DebuggerClient *client) {
|
||||
|
||||
@@ -54,12 +54,15 @@ void CmdEval::handleReply(DebuggerClient *client) {
|
||||
client->print(m_output);
|
||||
}
|
||||
|
||||
static const StaticString s_body("body");
|
||||
static const StaticString s_value("value");
|
||||
|
||||
void CmdEval::setClientOutput(DebuggerClient *client) {
|
||||
client->setOutputType(DebuggerClient::OTValues);
|
||||
Array values;
|
||||
ArrayInit values(2);
|
||||
values.set("body", m_body);
|
||||
values.set("value", m_output);
|
||||
client->setOTValues(values);
|
||||
client->setOTValues(values.create());
|
||||
}
|
||||
|
||||
bool CmdEval::onServer(DebuggerProxy *proxy) {
|
||||
|
||||
@@ -108,6 +108,15 @@ bool CmdInstrument::onClient(DebuggerClient *client) {
|
||||
return true;
|
||||
}
|
||||
|
||||
static const StaticString s_valid("valid");
|
||||
static const StaticString s_desc("desc");
|
||||
static const StaticString s_type("type");
|
||||
static const StaticString s_file_line("file_line");
|
||||
static const StaticString s_file("file");
|
||||
static const StaticString s_line("line");
|
||||
static const StaticString s_func_entry("func_entry");
|
||||
static const StaticString s_func("func");
|
||||
|
||||
void CmdInstrument::setClientOutput(DebuggerClient *client) {
|
||||
// Output all instrumentation point info
|
||||
client->setOutputType(DebuggerClient::OTValues);
|
||||
@@ -116,15 +125,15 @@ void CmdInstrument::setClientOutput(DebuggerClient *client) {
|
||||
for (unsigned int i = 0; i < ips->size(); i++) {
|
||||
InstPointInfoPtr ipi = (*ips)[i];
|
||||
Array instpoint;
|
||||
instpoint.set("valid", ipi->m_valid);
|
||||
instpoint.set("desc", ipi->m_desc);
|
||||
instpoint.set(s_valid, ipi->m_valid);
|
||||
instpoint.set(s_desc, ipi->m_desc);
|
||||
if (ipi->m_locType == InstPointInfo::LocFileLine) {
|
||||
instpoint.set("type", "file_line");
|
||||
instpoint.set("file", ipi->m_file);
|
||||
instpoint.set("line", ipi->m_line);
|
||||
instpoint.set(s_type, s_file_line);
|
||||
instpoint.set(s_file, ipi->m_file);
|
||||
instpoint.set(s_line, ipi->m_line);
|
||||
} else if (ipi->m_locType == InstPointInfo::LocFuncEntry) {
|
||||
instpoint.set("type", "func_entry");
|
||||
instpoint.set("func", ipi->m_func);
|
||||
instpoint.set(s_type, s_func_entry);
|
||||
instpoint.set(s_func, ipi->m_func);
|
||||
}
|
||||
values.append(instpoint);
|
||||
}
|
||||
|
||||
@@ -254,19 +254,23 @@ bool CmdInterrupt::onClient(DebuggerClient *client) {
|
||||
return true;
|
||||
}
|
||||
|
||||
static const StaticString s_format("format");
|
||||
static const StaticString s_php("php");
|
||||
static const StaticString s_value("value");
|
||||
|
||||
void CmdInterrupt::setClientOutput(DebuggerClient *client) {
|
||||
client->setOutputType(DebuggerClient::OTCodeLoc);
|
||||
client->setOTFileLine(m_bpi->m_file, m_bpi->m_line1);
|
||||
Array values;
|
||||
DebuggerClient::WatchPtrVec &watches = client->getWatches();
|
||||
for (int i = 0; i < (int)watches.size(); i++) {
|
||||
Array watch;
|
||||
watch.set("format", watches[i]->first);
|
||||
watch.set("php", watches[i]->second);
|
||||
ArrayInit watch(3);
|
||||
watch.set(s_format, watches[i]->first);
|
||||
watch.set(s_php, watches[i]->second);
|
||||
Variant v = CmdPrint().processWatch(client, watches[i]->first,
|
||||
watches[i]->second);
|
||||
watch.set("value", CmdPrint::FormatResult(watches[i]->first, v));
|
||||
values.append(watch);
|
||||
watch.set(s_value, CmdPrint::FormatResult(watches[i]->first, v));
|
||||
values.append(watch.create());
|
||||
}
|
||||
client->setOTValues(values);
|
||||
}
|
||||
|
||||
@@ -340,6 +340,12 @@ bool CmdPrint::onClient(DebuggerClient *client) {
|
||||
return true;
|
||||
}
|
||||
|
||||
static const StaticString s_format("format");
|
||||
static const StaticString s_php("php");
|
||||
static const StaticString s_body("body");
|
||||
static const StaticString s_value_serialize("value_serialize");
|
||||
static const StaticString s_value("value");
|
||||
|
||||
void CmdPrint::setClientOutput(DebuggerClient *client) {
|
||||
client->setOutputType(DebuggerClient::OTValues);
|
||||
Array values;
|
||||
@@ -347,19 +353,19 @@ void CmdPrint::setClientOutput(DebuggerClient *client) {
|
||||
// Manipulating the watch list, output the current list
|
||||
DebuggerClient::WatchPtrVec &watches = client->getWatches();
|
||||
for (int i = 0; i < (int)watches.size(); i++) {
|
||||
Array watch;
|
||||
watch.set("format", watches[i]->first);
|
||||
watch.set("php", watches[i]->second);
|
||||
values.append(watch);
|
||||
ArrayInit watch(2);
|
||||
watch.set(s_format, watches[i]->first);
|
||||
watch.set(s_php, watches[i]->second);
|
||||
values.append(watch.create());
|
||||
}
|
||||
} else {
|
||||
// Just print an expression, do similar output as eval
|
||||
values.set("body", m_body);
|
||||
values.set(s_body, m_body);
|
||||
if (client->getDebuggerClientApiModeSerialize()) {
|
||||
values.set("value_serialize",
|
||||
values.set(s_value_serialize,
|
||||
DebuggerClient::FormatVariable(m_ret, 200));
|
||||
} else {
|
||||
values.set("value", m_ret);
|
||||
values.set(s_value, m_ret);
|
||||
}
|
||||
}
|
||||
client->setOTValues(values);
|
||||
|
||||
@@ -1156,33 +1156,45 @@ String DebuggerClient::getPrintString() {
|
||||
return s;
|
||||
}
|
||||
|
||||
static const StaticString s_output_type("output_type");
|
||||
static const StaticString s_file("file");
|
||||
static const StaticString s_line_no("line_no");
|
||||
static const StaticString s_watch_values("watch_values");
|
||||
static const StaticString s_stacktrace("stacktrace");
|
||||
static const StaticString s_frame("frame");
|
||||
static const StaticString s_values("values");
|
||||
static const StaticString s_text("text");
|
||||
static const StaticString s_invalid("invalid");
|
||||
static const StaticString s_cmd("cmd");
|
||||
static const StaticString s_code_loc("code_loc");
|
||||
|
||||
Array DebuggerClient::getOutputArray() {
|
||||
TRACE(2, "DebuggerClient::getOutputArray\n");
|
||||
Array ret;
|
||||
switch (m_outputType) {
|
||||
case OTCodeLoc:
|
||||
ret.set("output_type", "code_loc");
|
||||
ret.set("file", m_otFile);
|
||||
ret.set("line_no", m_otLineNo);
|
||||
ret.set("watch_values", m_otValues);
|
||||
ret.set(s_output_type, s_code_loc);
|
||||
ret.set(s_file, m_otFile);
|
||||
ret.set(s_line_no, m_otLineNo);
|
||||
ret.set(s_watch_values, m_otValues);
|
||||
break;
|
||||
case OTStacktrace:
|
||||
ret.set("output_type", "stacktrace");
|
||||
ret.set("stacktrace", m_stacktrace);
|
||||
ret.set("frame", m_frame);
|
||||
ret.set(s_output_type, s_stacktrace);
|
||||
ret.set(s_stacktrace, m_stacktrace);
|
||||
ret.set(s_frame, m_frame);
|
||||
break;
|
||||
case OTValues:
|
||||
ret.set("output_type", "values");
|
||||
ret.set("values", m_otValues);
|
||||
ret.set(s_output_type, s_values);
|
||||
ret.set(s_values, m_otValues);
|
||||
break;
|
||||
case OTText:
|
||||
ret.set("output_type", "text");
|
||||
ret.set(s_output_type, s_text);
|
||||
break;
|
||||
default:
|
||||
ret.set("output_type", "invalid");
|
||||
ret.set(s_output_type, s_invalid);
|
||||
}
|
||||
ret.set("cmd", m_command);
|
||||
ret.set("text", getPrintString());
|
||||
ret.set(s_cmd, m_command);
|
||||
ret.set(s_text, getPrintString());
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -2083,7 +2095,6 @@ static const StaticString s_args("args");
|
||||
static const StaticString s_namespace("namespace");
|
||||
static const StaticString s_class("class");
|
||||
static const StaticString s_function("function");
|
||||
static const StaticString s_file("file");
|
||||
static const StaticString s_line("line");
|
||||
|
||||
void DebuggerClient::printFrame(int index, CArrRef frame) {
|
||||
|
||||
@@ -5335,24 +5335,39 @@ typedef struct {
|
||||
#define FOUND_WINXP (1<<SECTION_WINXP)
|
||||
#define FOUND_MAKERNOTE (1<<SECTION_MAKERNOTE)
|
||||
|
||||
static char *exif_get_sectionname(int section) {
|
||||
static const StaticString s_FILE("FILE");
|
||||
static const StaticString s_COMPUTED("COMPUTED");
|
||||
static const StaticString s_ANY_TAG("ANY_TAG");
|
||||
static const StaticString s_IFD0("IFD0");
|
||||
static const StaticString s_THUMBNAIL("THUMBNAIL");
|
||||
static const StaticString s_COMMENT("COMMENT");
|
||||
static const StaticString s_APP0("APP0");
|
||||
static const StaticString s_EXIF("EXIF");
|
||||
static const StaticString s_FPIX("FPIX");
|
||||
static const StaticString s_GPS("GPS");
|
||||
static const StaticString s_INTEROP("INTEROP");
|
||||
static const StaticString s_APP12("APP12");
|
||||
static const StaticString s_WINXP("WINXP");
|
||||
static const StaticString s_MAKERNOTE("MAKERNOTE");
|
||||
|
||||
static String exif_get_sectionname(int section) {
|
||||
switch(section) {
|
||||
case SECTION_FILE: return "FILE";
|
||||
case SECTION_COMPUTED: return "COMPUTED";
|
||||
case SECTION_ANY_TAG: return "ANY_TAG";
|
||||
case SECTION_IFD0: return "IFD0";
|
||||
case SECTION_THUMBNAIL: return "THUMBNAIL";
|
||||
case SECTION_COMMENT: return "COMMENT";
|
||||
case SECTION_APP0: return "APP0";
|
||||
case SECTION_EXIF: return "EXIF";
|
||||
case SECTION_FPIX: return "FPIX";
|
||||
case SECTION_GPS: return "GPS";
|
||||
case SECTION_INTEROP: return "INTEROP";
|
||||
case SECTION_APP12: return "APP12";
|
||||
case SECTION_WINXP: return "WINXP";
|
||||
case SECTION_MAKERNOTE: return "MAKERNOTE";
|
||||
case SECTION_FILE: return s_FILE;
|
||||
case SECTION_COMPUTED: return s_COMPUTED;
|
||||
case SECTION_ANY_TAG: return s_ANY_TAG;
|
||||
case SECTION_IFD0: return s_IFD0;
|
||||
case SECTION_THUMBNAIL: return s_THUMBNAIL;
|
||||
case SECTION_COMMENT: return s_COMMENT;
|
||||
case SECTION_APP0: return s_APP0;
|
||||
case SECTION_EXIF: return s_EXIF;
|
||||
case SECTION_FPIX: return s_FPIX;
|
||||
case SECTION_GPS: return s_GPS;
|
||||
case SECTION_INTEROP: return s_INTEROP;
|
||||
case SECTION_APP12: return s_APP12;
|
||||
case SECTION_WINXP: return s_WINXP;
|
||||
case SECTION_MAKERNOTE: return s_MAKERNOTE;
|
||||
}
|
||||
return "";
|
||||
return empty_string;
|
||||
}
|
||||
|
||||
static tag_table_type exif_get_tag_table(int section) {
|
||||
@@ -5381,7 +5396,7 @@ static char *exif_get_sectionlist(int sectionlist) {
|
||||
char *sections;
|
||||
|
||||
for(i=0; i<SECTION_COUNT; i++) {
|
||||
ml += strlen(exif_get_sectionname(i))+2;
|
||||
ml += exif_get_sectionname(i).size() + 2;
|
||||
}
|
||||
sections = (char *)IM_MALLOC(ml + 1);
|
||||
CHECK_ALLOC_R(sections, ml + 1, NULL);
|
||||
@@ -5389,7 +5404,7 @@ static char *exif_get_sectionlist(int sectionlist) {
|
||||
len = 0;
|
||||
for(i=0; i<SECTION_COUNT; i++) {
|
||||
if (sectionlist&(1<<i)) {
|
||||
snprintf(sections+len, ml-len, "%s, ", exif_get_sectionname(i));
|
||||
snprintf(sections+len, ml-len, "%s, ", exif_get_sectionname(i).c_str());
|
||||
len = strlen(sections);
|
||||
}
|
||||
}
|
||||
@@ -7799,7 +7814,7 @@ Variant f_exif_read_data(CStrRef filename,
|
||||
}
|
||||
}
|
||||
for (i=0; i<SECTION_COUNT; i++) {
|
||||
snprintf(tmp, sizeof(tmp), ",%s,", exif_get_sectionname(i));
|
||||
snprintf(tmp, sizeof(tmp), ",%s,", exif_get_sectionname(i).c_str());
|
||||
if (strstr(sections_str, tmp)) {
|
||||
sections_needed |= 1<<i;
|
||||
}
|
||||
|
||||
@@ -2980,6 +2980,11 @@ int64_t c_PDOStatement::t_columncount() {
|
||||
return m_stmt->column_count;
|
||||
}
|
||||
|
||||
static const StaticString s_name("name");
|
||||
static const StaticString s_len("len");
|
||||
static const StaticString s_precision("precision");
|
||||
static const StaticString s_pdo_type("pdo_type");
|
||||
|
||||
Variant c_PDOStatement::t_getcolumnmeta(int64_t column) {
|
||||
if (column < 0) {
|
||||
pdo_raise_impl_error(m_stmt->dbh, m_stmt, "42P10",
|
||||
@@ -3002,12 +3007,12 @@ Variant c_PDOStatement::t_getcolumnmeta(int64_t column) {
|
||||
|
||||
/* add stock items */
|
||||
PDOColumn *col = m_stmt->columns[column].toObject().getTyped<PDOColumn>();
|
||||
ret.set("name", col->name);
|
||||
ret.set("len", (int64_t)col->maxlen); /* FIXME: unsigned ? */
|
||||
ret.set("precision", (int64_t)col->precision);
|
||||
ret.set(s_name, col->name);
|
||||
ret.set(s_len, (int64_t)col->maxlen); /* FIXME: unsigned ? */
|
||||
ret.set(s_precision, (int64_t)col->precision);
|
||||
if (col->param_type != PDO_PARAM_ZVAL) {
|
||||
// if param_type is PDO_PARAM_ZVAL the driver has to provide correct data
|
||||
ret.set("pdo_type", (int64_t)col->param_type);
|
||||
ret.set(s_pdo_type, (int64_t)col->param_type);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -1121,7 +1121,6 @@ static const StaticString s_ampsemi("&");
|
||||
|
||||
Array f_get_html_translation_table(int table /* = 0 */, int quote_style /* = k_ENT_COMPAT */) {
|
||||
static entity_charset charset = determine_charset(nullptr); // get default one
|
||||
char ind[2]; ind[1] = 0;
|
||||
|
||||
assert(charset != entity_charset_enum::cs_unknown);
|
||||
|
||||
@@ -1146,9 +1145,9 @@ Array f_get_html_translation_table(int table /* = 0 */, int quote_style /* = k_E
|
||||
if (em.table[i] == NULL)
|
||||
continue;
|
||||
/* what about wide chars here ?? */
|
||||
ind[0] = i + em.basechar;
|
||||
snprintf(buffer, sizeof(buffer), "&%s;", em.table[i]);
|
||||
ret.set(ind, String(buffer, CopyString));
|
||||
ret.set(String::FromChar(i + em.basechar),
|
||||
String(buffer, CopyString));
|
||||
}
|
||||
}
|
||||
/* fall thru */
|
||||
@@ -1159,8 +1158,8 @@ Array f_get_html_translation_table(int table /* = 0 */, int quote_style /* = k_E
|
||||
(quote_style & basic_entities[j].flags) == 0)
|
||||
continue;
|
||||
|
||||
ind[0] = (unsigned char)basic_entities[j].charcode;
|
||||
ret.set(String(ind, 2, CopyString), basic_entities[j].entity);
|
||||
ret.set(String::FromChar(basic_entities[j].charcode),
|
||||
basic_entities[j].entity);
|
||||
}
|
||||
ret.set(s_amp, s_ampsemi);
|
||||
break;
|
||||
|
||||
@@ -368,6 +368,9 @@ static const StaticString s_tag("tag");
|
||||
static const StaticString s_close("close");
|
||||
static const StaticString s_level("level");
|
||||
static const StaticString s_value("value");
|
||||
static const StaticString s_cdata("cdata");
|
||||
static const StaticString s_open("open");
|
||||
static const StaticString s_attributes("attributes");
|
||||
|
||||
void _xml_endElementHandler(void *userData, const XML_Char *name) {
|
||||
XmlParser *parser = (XmlParser *)userData;
|
||||
@@ -476,11 +479,11 @@ void _xml_characterDataHandler(void *userData, const XML_Char *s, int len) {
|
||||
tag = Array::Create();
|
||||
_xml_add_to_info(parser, parser->ltags[parser->level-1] +
|
||||
parser->toffset);
|
||||
tag.set("tag", String(parser->ltags[parser->level-1] +
|
||||
tag.set(s_tag, String(parser->ltags[parser->level-1] +
|
||||
parser->toffset, CopyString));
|
||||
tag.set("value", String(decoded_value, AttachString));
|
||||
tag.set("type", "cdata");
|
||||
tag.set("level", parser->level);
|
||||
tag.set(s_value, String(decoded_value, AttachString));
|
||||
tag.set(s_type, s_cdata);
|
||||
tag.set(s_level, parser->level);
|
||||
parser->data.append(tag);
|
||||
}
|
||||
} else {
|
||||
@@ -537,9 +540,9 @@ void _xml_startElementHandler(void *userData, const XML_Char *name, const XML_Ch
|
||||
|
||||
_xml_add_to_info(parser,((char *) tag_name) + parser->toffset);
|
||||
|
||||
tag.set("tag",String(((char *)tag_name)+parser->toffset,CopyString));
|
||||
tag.set("type","open");
|
||||
tag.set("level",parser->level);
|
||||
tag.set(s_tag,String(((char *)tag_name)+parser->toffset,CopyString));
|
||||
tag.set(s_type, s_open);
|
||||
tag.set(s_level, parser->level);
|
||||
|
||||
parser->ltags[parser->level-1] = strdup(tag_name);
|
||||
parser->lastwasopen = 1;
|
||||
@@ -558,7 +561,7 @@ void _xml_startElementHandler(void *userData, const XML_Char *name, const XML_Ch
|
||||
}
|
||||
|
||||
if (atcnt) {
|
||||
tag.set("attributes",atr);
|
||||
tag.set(s_attributes,atr);
|
||||
}
|
||||
parser->data.append(tag);
|
||||
parser->ctag.assignRef(parser->data.getArrayData()->endRef());
|
||||
|
||||
@@ -38,7 +38,8 @@ static ExtensionUninitializer s_extension_uninitializer;
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Extension::Extension(litstr name, const char *version /* = "" */)
|
||||
: m_name(name), m_version(version ? version : "") {
|
||||
: m_name(StringData::GetStaticString(name))
|
||||
, m_version(version ? version : "") {
|
||||
if (s_registered_extensions == NULL) {
|
||||
s_registered_extensions = new ExtensionMap();
|
||||
}
|
||||
@@ -51,7 +52,7 @@ void Extension::LoadModules(Hdf hdf) {
|
||||
assert(s_registered_extensions);
|
||||
for (ExtensionMap::const_iterator iter = s_registered_extensions->begin();
|
||||
iter != s_registered_extensions->end(); ++iter) {
|
||||
iter->second->moduleLoad(hdf["Extensions"][iter->second->m_name]);
|
||||
iter->second->moduleLoad(hdf["Extensions"][iter->second->m_name.c_str()]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ public:
|
||||
static void ShutdownModules();
|
||||
static bool ModulesInitialised();
|
||||
public:
|
||||
Extension(litstr name, const char *version = "");
|
||||
explicit Extension(litstr name, const char *version = "");
|
||||
virtual ~Extension() {}
|
||||
|
||||
const char *getVersion() const { return m_version.c_str();}
|
||||
@@ -79,7 +79,7 @@ public:
|
||||
virtual void moduleShutdown() {}
|
||||
|
||||
private:
|
||||
const char *m_name;
|
||||
const String m_name;
|
||||
std::string m_version;
|
||||
};
|
||||
|
||||
|
||||
@@ -11962,7 +11962,8 @@ TranslatorX64::getPerfCounters(Array& ret) {
|
||||
// Until Perflab can automatically scale the values we give it to
|
||||
// an appropriate range, we have to fudge these numbers so they
|
||||
// look more like reasonable hardware counter values.
|
||||
ret.set(kPerfCounterNames[i], s_perfCounters[i] * 1000);
|
||||
ret.set(String::FromCStr(kPerfCounterNames[i]),
|
||||
s_perfCounters[i] * 1000);
|
||||
}
|
||||
|
||||
if (RuntimeOption::EnableInstructionCounts) {
|
||||
@@ -11972,7 +11973,7 @@ TranslatorX64::getPerfCounters(Array& ret) {
|
||||
begin += STATS_PER_OPCODE) {
|
||||
count += Stats::tl_counters[Stats::StatCounter(begin)];
|
||||
}
|
||||
ret.set(name, count);
|
||||
ret.set(String::FromCStr(name), count);
|
||||
};
|
||||
|
||||
doCounts(Stats::Instr_TranslLowInvalid + STATS_PER_OPCODE,
|
||||
|
||||
@@ -217,6 +217,13 @@ bool TestCppBase::TestString() {
|
||||
return Count(true);
|
||||
}
|
||||
|
||||
static const StaticString s_n0("n0");
|
||||
static const StaticString s_n1("n1");
|
||||
static const StaticString s_n2("n2");
|
||||
static const StaticString s_A("A");
|
||||
static const StaticString s_name("name");
|
||||
static const StaticString s_1("1");
|
||||
|
||||
bool TestCppBase::TestArray() {
|
||||
// Array::Create(), Array constructors and informational
|
||||
{
|
||||
@@ -316,12 +323,6 @@ bool TestCppBase::TestArray() {
|
||||
VERIFY(arr1.toString() == "Array");
|
||||
}
|
||||
|
||||
static const StaticString s_n1("n1");
|
||||
static const StaticString s_n2("n2");
|
||||
static const StaticString s_A("A");
|
||||
static const StaticString s_name("name");
|
||||
static const StaticString s_1("1");
|
||||
|
||||
// offset
|
||||
{
|
||||
Array arr;
|
||||
@@ -380,7 +381,7 @@ bool TestCppBase::TestArray() {
|
||||
}
|
||||
{
|
||||
Array arr;
|
||||
arr.lvalAt("1") = 10;
|
||||
arr.lvalAt(s_1) = 10;
|
||||
VS(arr[1], 10);
|
||||
VS(arr[1.5], 10);
|
||||
VS(arr[Variant(1.5)], 10);
|
||||
@@ -478,7 +479,7 @@ bool TestCppBase::TestArray() {
|
||||
}
|
||||
{
|
||||
Array arr;
|
||||
arr.lvalAt("1") = "value";
|
||||
arr.lvalAt(s_1) = "value";
|
||||
VERIFY(arr.exists(1));
|
||||
VERIFY(arr.exists(1.5));
|
||||
VERIFY(arr.exists(s_1));
|
||||
@@ -574,8 +575,8 @@ bool TestCppBase::TestArray() {
|
||||
}
|
||||
{
|
||||
Array arr;
|
||||
lval(arr.lvalAt("name")).lvalAt(0) = 1.2;
|
||||
VS(arr, CREATE_MAP1("name", CREATE_VECTOR1(1.2)));
|
||||
lval(arr.lvalAt(s_name)).lvalAt(0) = 1.2;
|
||||
VS(arr, CREATE_MAP1(s_name, CREATE_VECTOR1(1.2)));
|
||||
}
|
||||
{
|
||||
Array arr = Array::Create();
|
||||
@@ -584,8 +585,8 @@ bool TestCppBase::TestArray() {
|
||||
}
|
||||
{
|
||||
Array arr = Array::Create();
|
||||
lval(arr.lvalAt("name")).lvalAt(0) = 1.2;
|
||||
VS(arr, CREATE_MAP1("name", CREATE_VECTOR1(1.2)));
|
||||
lval(arr.lvalAt(s_name)).lvalAt(0) = 1.2;
|
||||
VS(arr, CREATE_MAP1(s_name, CREATE_VECTOR1(1.2)));
|
||||
}
|
||||
{
|
||||
Array arr = Array::Create("test");
|
||||
@@ -594,8 +595,8 @@ bool TestCppBase::TestArray() {
|
||||
}
|
||||
{
|
||||
Array arr = Array::Create("test");
|
||||
lval(arr.lvalAt("name")).lvalAt(0) = 1.2;
|
||||
VS(arr, CREATE_MAP2(0, "test", "name", CREATE_VECTOR1(1.2)));
|
||||
lval(arr.lvalAt(s_name)).lvalAt(0) = 1.2;
|
||||
VS(arr, CREATE_MAP2(0, "test", s_name, CREATE_VECTOR1(1.2)));
|
||||
}
|
||||
{
|
||||
Array arr = Array::Create();
|
||||
@@ -687,7 +688,7 @@ bool TestCppBase::TestVariant() {
|
||||
}
|
||||
{
|
||||
Variant v;
|
||||
v.lvalAt("1") = "test";
|
||||
v.lvalAt(s_1) = "test";
|
||||
VS(v[1], "test");
|
||||
VS(v[1.5], "test");
|
||||
VS(v[Variant(1.5)], "test");
|
||||
@@ -707,38 +708,38 @@ bool TestCppBase::TestVariant() {
|
||||
// membership
|
||||
{
|
||||
Variant v;
|
||||
v.lvalAt("n0") = "v0";
|
||||
v.lvalAt("n1") = "v1";
|
||||
v.remove("n1");
|
||||
VS(v, CREATE_MAP1("n0", "v0"));
|
||||
v.lvalAt(s_n0) = "v0";
|
||||
v.lvalAt(s_n1) = "v1";
|
||||
v.remove(s_n1);
|
||||
VS(v, CREATE_MAP1(s_n0, "v0"));
|
||||
v.append("v2");
|
||||
VS(v, CREATE_MAP2("n0", "v0", 0, "v2"));
|
||||
VS(v, CREATE_MAP2(s_n0, "v0", 0, "v2"));
|
||||
}
|
||||
{
|
||||
Variant v;
|
||||
v.lvalAt("n0") = "v0";
|
||||
v.lvalAt(s_n0) = "v0";
|
||||
v.lvalAt(1) = "v1";
|
||||
v.remove(Variant(1.5));
|
||||
VS(v, CREATE_MAP1("n0", "v0"));
|
||||
}
|
||||
{
|
||||
Variant v;
|
||||
v.lvalAt("n0") = "v0";
|
||||
v.lvalAt(s_n0) = "v0";
|
||||
v.lvalAt(1) = "v1";
|
||||
v.remove(Variant("1"));
|
||||
VS(v, CREATE_MAP1("n0", "v0"));
|
||||
}
|
||||
{
|
||||
Variant v;
|
||||
v.lvalAt("n0") = "v0";
|
||||
v.lvalAt(s_n0) = "v0";
|
||||
v.lvalAt(1) = "v1";
|
||||
v.remove("1");
|
||||
VS(v, CREATE_MAP1("n0", "v0"));
|
||||
}
|
||||
{
|
||||
Variant v;
|
||||
v.lvalAt("n0") = "v0";
|
||||
v.lvalAt("") = "v1";
|
||||
v.lvalAt(s_n0) = "v0";
|
||||
v.lvalAt(empty_string) = "v1";
|
||||
v.remove(Variant());
|
||||
VS(v, CREATE_MAP1("n0", "v0"));
|
||||
}
|
||||
@@ -800,8 +801,8 @@ bool TestCppBase::TestVariant() {
|
||||
}
|
||||
{
|
||||
Variant arr;
|
||||
lval(arr.lvalAt("name")).lvalAt(0) = 1.2;
|
||||
VS(arr, CREATE_MAP1("name", CREATE_VECTOR1(1.2)));
|
||||
lval(arr.lvalAt(s_name)).lvalAt(0) = 1.2;
|
||||
VS(arr, CREATE_MAP1(s_name, CREATE_VECTOR1(1.2)));
|
||||
}
|
||||
{
|
||||
Variant arr = Array::Create();
|
||||
@@ -810,8 +811,8 @@ bool TestCppBase::TestVariant() {
|
||||
}
|
||||
{
|
||||
Variant arr = Array::Create();
|
||||
lval(arr.lvalAt("name")).lvalAt(0) = 1.2;
|
||||
VS(arr, CREATE_MAP1("name", CREATE_VECTOR1(1.2)));
|
||||
lval(arr.lvalAt(s_name)).lvalAt(0) = 1.2;
|
||||
VS(arr, CREATE_MAP1(s_name, CREATE_VECTOR1(1.2)));
|
||||
}
|
||||
{
|
||||
Variant arr = Array::Create("test");
|
||||
@@ -820,8 +821,8 @@ bool TestCppBase::TestVariant() {
|
||||
}
|
||||
{
|
||||
Variant arr = Array::Create("test");
|
||||
lval(arr.lvalAt("name")).lvalAt(0) = 1.2;
|
||||
VS(arr, CREATE_MAP2(0, "test", "name", CREATE_VECTOR1(1.2)));
|
||||
lval(arr.lvalAt(s_name)).lvalAt(0) = 1.2;
|
||||
VS(arr, CREATE_MAP2(0, "test", s_name, CREATE_VECTOR1(1.2)));
|
||||
}
|
||||
|
||||
return Count(true);
|
||||
|
||||
@@ -113,6 +113,7 @@ static const StaticString s_a("a");
|
||||
static const StaticString s_q("q");
|
||||
static const StaticString s_ts("ts");
|
||||
static const StaticString s_TestString("TestString");
|
||||
static const StaticString s_start_time("start_time");
|
||||
|
||||
bool TestExtApc::test_apc_store() {
|
||||
Array complexMap = CREATE_MAP2("a",
|
||||
@@ -135,7 +136,7 @@ bool TestExtApc::test_apc_store() {
|
||||
// Make sure it doesn't change the shared value.
|
||||
Array complexMapFetched = f_apc_fetch("complexMap");
|
||||
VERIFY(complexMapFetched.exists(s_a));
|
||||
complexMapFetched.set("q",0);
|
||||
complexMapFetched.set(s_q,0);
|
||||
VERIFY(complexMapFetched.exists(s_q));
|
||||
VS(f_apc_fetch("complexMap"), complexMap);
|
||||
|
||||
@@ -203,7 +204,7 @@ bool TestExtApc::test_apc_compile_file() {
|
||||
|
||||
bool TestExtApc::test_apc_cache_info() {
|
||||
Array ci = f_apc_cache_info();
|
||||
VS(ci.rvalAt("start_time"), start_time());
|
||||
VS(ci.rvalAt(s_start_time), start_time());
|
||||
return Count(true);
|
||||
}
|
||||
|
||||
|
||||
@@ -511,13 +511,20 @@ bool TestExtFile::test_parse_hdf_file() {
|
||||
return Count(true);
|
||||
}
|
||||
|
||||
static const StaticString s_bool("bool");
|
||||
static const StaticString s_string("string");
|
||||
static const StaticString s_text("text");
|
||||
static const StaticString s_num("num");
|
||||
static const StaticString s_arr("arr");
|
||||
static const StaticString s_anothertext("anothertext");
|
||||
|
||||
bool TestExtFile::test_parse_hdf_string() {
|
||||
Array hdf;
|
||||
hdf.set("bool", false);
|
||||
hdf.set("string", "text");
|
||||
hdf.set("num", 12345);
|
||||
Array arr = CREATE_MAP3("bool", false, "string", "anothertext", "num", 6789);
|
||||
hdf.set("arr", arr);
|
||||
hdf.set(s_bool, false);
|
||||
hdf.set(s_string, s_text);
|
||||
hdf.set(s_num, 12345);
|
||||
Array arr = CREATE_MAP3(s_bool, false, s_string, s_anothertext, s_num, 6789);
|
||||
hdf.set(s_arr, arr);
|
||||
|
||||
VS(f_parse_hdf_string("bool = false\n"
|
||||
"string = text\n"
|
||||
@@ -537,11 +544,11 @@ bool TestExtFile::test_write_hdf_file() {
|
||||
|
||||
bool TestExtFile::test_write_hdf_string() {
|
||||
Array hdf;
|
||||
hdf.set("bool", false);
|
||||
hdf.set("string", "text");
|
||||
hdf.set("num", 12345);
|
||||
Array arr = CREATE_MAP3("bool", false, "string", "anothertext", "num", 6789);
|
||||
hdf.set("arr", arr);
|
||||
hdf.set(s_bool, false);
|
||||
hdf.set(s_string, s_text);
|
||||
hdf.set(s_num, 12345);
|
||||
Array arr = CREATE_MAP3(s_bool, false, s_string, s_anothertext, s_num, 6789);
|
||||
hdf.set(s_arr, arr);
|
||||
|
||||
String str = f_write_hdf_string(hdf);
|
||||
VS(str,
|
||||
|
||||
@@ -39,16 +39,18 @@ bool TestExtIconv::RunTests(const std::string &which) {
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static const StaticString s_scheme("scheme");
|
||||
|
||||
bool TestExtIconv::test_iconv_mime_encode() {
|
||||
Array preferences = CREATE_MAP4("input-charset", "ISO-8859-1",
|
||||
"output-charset", "UTF-8",
|
||||
"line-length", 76,
|
||||
"line-break-chars", "\n");
|
||||
preferences.set("scheme", "Q");
|
||||
preferences.set(s_scheme, "Q");
|
||||
VS(f_iconv_mime_encode("Subject", "Pr\xDC""fung Pr\xDC""fung", preferences),
|
||||
"Subject: =?UTF-8?Q?Pr=C3=9Cfung=20Pr=C3=9Cfung?=");
|
||||
|
||||
preferences.set("scheme", "B");
|
||||
preferences.set(s_scheme, "B");
|
||||
VS(f_iconv_mime_encode("Subject", "Pr\xDC""fung Pr\xDC""fung", preferences),
|
||||
"Subject: =?UTF-8?B?UHLDnGZ1bmcgUHLDnGZ1bmc=?=");
|
||||
|
||||
|
||||
@@ -176,6 +176,10 @@ bool TestExtImagesprite::test_clear() {
|
||||
|
||||
return Count(true);
|
||||
}
|
||||
|
||||
static const StaticString s_width("width");
|
||||
static const StaticString s_height("height");
|
||||
|
||||
bool TestExtImagesprite::test_loadDims() {
|
||||
sprite->t_addfile("test/images/php.gif");
|
||||
sprite->t_loaddims(true);
|
||||
@@ -185,8 +189,8 @@ bool TestExtImagesprite::test_loadDims() {
|
||||
|
||||
sprite->t_clear();
|
||||
Array dims = Array::Create();
|
||||
dims.set("width", 1);
|
||||
dims.set("height", 1);
|
||||
dims.set(s_width, 1);
|
||||
dims.set(s_height, 1);
|
||||
sprite->t_addfile("test/images/php.gif", dims);
|
||||
sprite->t_loaddims(true);
|
||||
VS(sprite->m_image_data["test/images/php.gif"]->m_width, 1);
|
||||
@@ -220,8 +224,8 @@ bool TestExtImagesprite::test_loadImages() {
|
||||
|
||||
sprite->t_clear();
|
||||
Array dims = Array::Create();
|
||||
dims.set("width", 1);
|
||||
dims.set("height", 1);
|
||||
dims.set(s_width, 1);
|
||||
dims.set(s_height, 1);
|
||||
sprite->t_addfile("test/images/php.gif", dims);
|
||||
sprite->t_loadimages(true);
|
||||
VS(sprite->m_image_data["test/images/php.gif"]->m_width, 120);
|
||||
@@ -269,14 +273,14 @@ bool TestExtImagesprite::test_map() {
|
||||
map["images"].toArray()["test/images/php.gif"].toArray()
|
||||
["y"].toInt32(),
|
||||
0);
|
||||
VS(map["width"].toInt32(), 121);
|
||||
VS(map["height"].toInt32(), 68);
|
||||
VS(map[s_width].toInt32(), 121);
|
||||
VS(map[s_height].toInt32(), 68);
|
||||
VS(sprite->m_current, true);
|
||||
|
||||
sprite->t_clear();
|
||||
Array dims = Array::Create();
|
||||
dims.set("width", 1);
|
||||
dims.set("height", 1);
|
||||
dims.set(s_width, 1);
|
||||
dims.set(s_height, 1);
|
||||
sprite->t_addfile("test/images/php.gif", dims);
|
||||
VS(sprite->m_current, false);
|
||||
map = sprite->t_mapping();
|
||||
|
||||
Referência em uma Nova Issue
Bloquear um usuário