diff --git a/src/node.cc b/src/node.cc index 228538375f..c3167dd146 100644 --- a/src/node.cc +++ b/src/node.cc @@ -740,7 +740,7 @@ Local ErrnoException(int errorno, const char *path) { Local e; Local estring = String::NewSymbol(errno_string(errorno)); - if (!msg[0]) { + if (msg == NULL || msg[0] == '\0') { msg = strerror(errorno); } Local message = String::NewSymbol(msg); diff --git a/src/node.h b/src/node.h index 16bfec56d8..d92ae885df 100644 --- a/src/node.h +++ b/src/node.h @@ -66,6 +66,36 @@ #include "node_object_wrap.h" +// Forward-declare these functions now to stop MSVS from becoming +// terminally confused when it's done in node_internals.h +namespace node { + +NODE_EXTERN v8::Local ErrnoException(int errorno, + const char* syscall = NULL, + const char* message = NULL, + const char* path = NULL); +NODE_EXTERN v8::Local UVException(int errorno, + const char* syscall = NULL, + const char* message = NULL, + const char* path = NULL); +NODE_EXTERN v8::Handle MakeCallback( + const v8::Handle recv, + const char* method, + int argc, + v8::Handle* argv); +NODE_EXTERN v8::Handle MakeCallback( + const v8::Handle object, + const v8::Handle symbol, + int argc, + v8::Handle* argv); +NODE_EXTERN v8::Handle MakeCallback( + const v8::Handle object, + const v8::Handle callback, + int argc, + v8::Handle* argv); + +} // namespace node + #if NODE_WANT_INTERNALS # include "node_internals.h" #endif @@ -147,16 +177,6 @@ NODE_EXTERN ssize_t DecodeWrite(char *buf, v8::Local BuildStatsObject(const uv_stat_t* s); -NODE_EXTERN v8::Local ErrnoException(int errorno, - const char *syscall = NULL, - const char *msg = "", - const char *path = NULL); - -NODE_EXTERN v8::Local UVException(int errorno, - const char *syscall = NULL, - const char *msg = NULL, - const char *path = NULL); - #ifdef _WIN32 NODE_EXTERN v8::Local WinapiErrnoException(int errorno, const char *syscall = NULL, const char *msg = "", @@ -217,23 +237,6 @@ node_module_struct* get_builtin_module(const char *name); NODE_EXTERN void AtExit(void (*cb)(void* arg), void* arg = 0); NODE_EXTERN void SetErrno(uv_err_t err); -NODE_EXTERN v8::Handle -MakeCallback(const v8::Handle object, - const char* method, - int argc, - v8::Handle argv[]); - -NODE_EXTERN v8::Handle -MakeCallback(const v8::Handle object, - const v8::Handle symbol, - int argc, - v8::Handle argv[]); - -NODE_EXTERN v8::Handle -MakeCallback(const v8::Handle object, - const v8::Handle callback, - int argc, - v8::Handle argv[]); } // namespace node diff --git a/src/node_buffer.cc b/src/node_buffer.cc index 9ed92b09e7..53665bf8ca 100644 --- a/src/node_buffer.cc +++ b/src/node_buffer.cc @@ -21,7 +21,6 @@ #include "node.h" -#include "node_internals.h" #include "node_buffer.h" #include "smalloc.h" #include "string_bytes.h" diff --git a/src/node_internals.h b/src/node_internals.h index a771123919..974224022a 100644 --- a/src/node_internals.h +++ b/src/node_internals.h @@ -29,6 +29,21 @@ namespace node { +// Forward declarations from node_buffer.h. We can't include node_buffer.h +// in this file because: +// +// a) we're included early on in node.h, and +// b) node_buffer.h depends on the definition of the |encoding| enum that's +// defined further down in node.h... +namespace Buffer { + +NODE_EXTERN char* Data(v8::Handle); +NODE_EXTERN char* Data(v8::Handle); +NODE_EXTERN size_t Length(v8::Handle); +NODE_EXTERN size_t Length(v8::Handle); + +} // namespace Buffer + // Defined in node.cc extern v8::Isolate* node_isolate; @@ -177,10 +192,6 @@ inline static void ThrowErrnoException(int errorno, const char* syscall = NULL, const char* message = NULL, const char* path = NULL) { - NODE_EXTERN v8::Local ErrnoException(int errorno, - const char* syscall = NULL, - const char* message = NULL, - const char* path = NULL); v8::ThrowException(ErrnoException(errorno, syscall, message, path)); } @@ -188,10 +199,6 @@ inline static void ThrowUVException(int errorno, const char* syscall = NULL, const char* message = NULL, const char* path = NULL) { - NODE_EXTERN v8::Local UVException(int errorno, - const char* syscall = NULL, - const char* message = NULL, - const char* path = NULL); v8::ThrowException(UVException(errorno, syscall, message, path)); } @@ -309,23 +316,6 @@ inline void Cached::operator=(v8::Handle that) { CachedBase::operator=(that); } -// Forward declarations, see node.h -NODE_EXTERN v8::Handle MakeCallback( - const v8::Handle recv, - const char* method, - int argc, - v8::Handle* argv); -NODE_EXTERN v8::Handle MakeCallback( - const v8::Handle object, - const v8::Handle symbol, - int argc, - v8::Handle* argv); -NODE_EXTERN v8::Handle MakeCallback( - const v8::Handle object, - const v8::Handle callback, - int argc, - v8::Handle* argv); - template v8::Handle MakeCallback( const v8::Persistent& recv, @@ -364,15 +354,11 @@ namespace Buffer { template inline char* Data(v8::Persistent& val) { - NODE_EXTERN char* Data(v8::Handle); - NODE_EXTERN char* Data(v8::Handle); return Data(PersistentToLocal(val)); } template inline size_t Length(v8::Persistent& val) { - NODE_EXTERN size_t Length(v8::Handle); - NODE_EXTERN size_t Length(v8::Handle); return Length(PersistentToLocal(val)); } diff --git a/src/req_wrap.h b/src/req_wrap.h index 3d08444147..93db63316f 100644 --- a/src/req_wrap.h +++ b/src/req_wrap.h @@ -23,7 +23,6 @@ #define REQ_WRAP_H_ #include "queue.h" -#include "node_internals.h" namespace node {