some bug fixes

This commit is contained in:
David Renshaw 2014-05-10 21:42:23 -04:00
parent 85e2c8e90f
commit ecc7c55a6e

View file

@ -42,8 +42,6 @@
#include <fcntl.h> #include <fcntl.h>
#include <errno.h> #include <errno.h>
#include <string>
#if HAVE_CONFIG_H #if HAVE_CONFIG_H
#include "config.h" #include "config.h"
#endif #endif
@ -167,7 +165,7 @@ kj::String safeIdentifier(kj::StringPtr identifier) {
} }
kj::String spaces(int n) { kj::String spaces(int n) {
return kj::str(std::string(n * 2, ' ')); return kj::str(kj::repeat(' ', n * 2));
} }
// ======================================================================================= // =======================================================================================
@ -918,11 +916,11 @@ private:
spaces(indent), " public ", type, ".Reader get", titleCase, "() {\n", spaces(indent), " public ", type, ".Reader get", titleCase, "() {\n",
(kind == FieldKind::LIST ? (kind == FieldKind::LIST ?
kj::strTree(spaces(indent), kj::strTree(spaces(indent),
" return new ", type, ".Reader.new(_reader.getPointerField(", " return new ", type, ".Reader(_reader.getPointerField(",
offset, ").getList(), ", elementReaderType, ".factory);\n") : offset, ").getList(), ", elementReaderType, ".factory);\n") :
(kind == FieldKind::BLOB ? (kind == FieldKind::BLOB ?
kj::strTree(spaces(indent), " return _reader.getPointerField(", kj::strTree(spaces(indent), " return _reader.getPointerField(",
offset,".getText());\n") : offset,").getText();\n") :
kj::strTree(spaces(indent), "Struct\n"))), // XXX kj::strTree(spaces(indent), "Struct\n"))), // XXX
spaces(indent), " }\n", spaces(indent), " }\n",
"\n"), "\n"),
@ -1515,9 +1513,9 @@ private:
return FileText { return FileText {
kj::strTree( kj::strTree(
"// Generated by Cap'n Proto compiler, DO NOT EDIT\n" "// Generated by Cap'n Proto compiler, DO NOT EDIT\n"
"// source: ", baseName(displayName), "\n" "// source: ", baseName(displayName), "\n",
"\n" "\n",
"import capnp;\n", //"import capnp;\n",
hasInterfaces ? kj::strTree("#include <capnp/capability.h>\n") : kj::strTree(), hasInterfaces ? kj::strTree("#include <capnp/capability.h>\n") : kj::strTree(),
"\n", "\n",
KJ_MAP(path, includes) { KJ_MAP(path, includes) {