diff options
author | Tor Norbye <tnorbye@google.com> | 2013-08-07 11:11:08 -0700 |
---|---|---|
committer | Tor Norbye <tnorbye@google.com> | 2013-08-07 11:11:08 -0700 |
commit | 6739a8f0977b70ddc8a8283b169902da3f2eecb3 (patch) | |
tree | 5c5573c2ac01544f02d9318671aa558769726289 /native | |
parent | c1ace1f7e1e49c81bb4b75377c99f07be340abfe (diff) | |
download | idea-6739a8f0977b70ddc8a8283b169902da3f2eecb3.tar.gz |
Snapshot af729d01433bb5bbd6ca93c0fdf9778b36d624ce from master branch of git://git.jetbrains.org/idea/community.git
Change-Id: I214dd066d0d27444a26166c0eae1a5aaf3705d49
Diffstat (limited to 'native')
-rw-r--r-- | native/WinLauncher/WinLauncher/WinLauncher.cpp | 11 | ||||
-rw-r--r-- | native/WinLauncher/WinLauncher/WinLauncher.rc | bin | 8954 -> 9018 bytes | |||
-rw-r--r-- | native/WinLauncher/WinLauncher/WinLauncher.vcxproj | 2 | ||||
-rw-r--r-- | native/fsNotifier/linux/fsnotifier.h | 2 | ||||
-rw-r--r-- | native/fsNotifier/linux/inotify.c | 16 | ||||
-rw-r--r-- | native/fsNotifier/linux/main.c | 31 |
6 files changed, 39 insertions, 23 deletions
diff --git a/native/WinLauncher/WinLauncher/WinLauncher.cpp b/native/WinLauncher/WinLauncher/WinLauncher.cpp index 3176ee2131ba..66d515ffd567 100644 --- a/native/WinLauncher/WinLauncher/WinLauncher.cpp +++ b/native/WinLauncher/WinLauncher/WinLauncher.cpp @@ -372,17 +372,20 @@ bool LoadVMOptions() bool LoadJVMLibrary() { std::string dllName(jvmPath); - std::string serverDllName = dllName + "\\bin\\server\\jvm.dll"; - std::string clientDllName = dllName + "\\bin\\client\\jvm.dll"; + std::string binDir = dllName + "\\bin"; + std::string serverDllName = binDir + "\\server\\jvm.dll"; + std::string clientDllName = binDir + "\\client\\jvm.dll"; if ((bServerJVM && FileExists(serverDllName)) || !FileExists(clientDllName)) { - hJVM = LoadLibraryA(serverDllName.c_str()); + dllName = serverDllName; } else { - hJVM = LoadLibraryA(clientDllName.c_str()); + dllName = clientDllName; } + SetCurrentDirectoryA(binDir.c_str()); // ensure that we can find msvcr100.dll which is located in jre/bin directory + hJVM = LoadLibraryA(dllName.c_str()); if (hJVM) { pCreateJavaVM = (JNI_createJavaVM) GetProcAddress(hJVM, "JNI_CreateJavaVM"); diff --git a/native/WinLauncher/WinLauncher/WinLauncher.rc b/native/WinLauncher/WinLauncher/WinLauncher.rc Binary files differindex d734507ab0ea..463b099cfefe 100644 --- a/native/WinLauncher/WinLauncher/WinLauncher.rc +++ b/native/WinLauncher/WinLauncher/WinLauncher.rc diff --git a/native/WinLauncher/WinLauncher/WinLauncher.vcxproj b/native/WinLauncher/WinLauncher/WinLauncher.vcxproj index 598b5bf49298..398515e2c841 100644 --- a/native/WinLauncher/WinLauncher/WinLauncher.vcxproj +++ b/native/WinLauncher/WinLauncher/WinLauncher.vcxproj @@ -110,6 +110,7 @@ <FunctionLevelLinking>true</FunctionLevelLinking> <IntrinsicFunctions>true</IntrinsicFunctions> <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> </ClCompile> <Link> <SubSystem>Windows</SubSystem> @@ -126,6 +127,7 @@ <FunctionLevelLinking>true</FunctionLevelLinking> <IntrinsicFunctions>true</IntrinsicFunctions> <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> </ClCompile> <Link> <SubSystem>Windows</SubSystem> diff --git a/native/fsNotifier/linux/fsnotifier.h b/native/fsNotifier/linux/fsnotifier.h index 0bcfaa5f9644..087246e98644 100644 --- a/native/fsNotifier/linux/fsnotifier.h +++ b/native/fsNotifier/linux/fsnotifier.h @@ -67,7 +67,7 @@ enum { }; bool init_inotify(); -void set_inotify_callback(void (* callback)(char*, int)); +void set_inotify_callback(void (* callback)(const char*, int)); int get_inotify_fd(); int watch(const char* root, array* mounts); void unwatch(int id); diff --git a/native/fsNotifier/linux/inotify.c b/native/fsNotifier/linux/inotify.c index 77536dc3dcba..713d09c54a38 100644 --- a/native/fsNotifier/linux/inotify.c +++ b/native/fsNotifier/linux/inotify.c @@ -50,7 +50,7 @@ static int inotify_fd = -1; static int watch_count = 0; static table* watches; static bool limit_reached = false; -static void (* callback)(char*, int) = NULL; +static void (* callback)(const char*, int) = NULL; #define EVENT_SIZE (sizeof(struct inotify_event)) #define EVENT_BUF_LEN (2048 * (EVENT_SIZE + 16)) @@ -112,7 +112,7 @@ static void read_watch_descriptors_count() { } -inline void set_inotify_callback(void (* _callback)(char*, int)) { +inline void set_inotify_callback(void (* _callback)(const char*, int)) { callback = _callback; } @@ -346,15 +346,19 @@ static bool process_inotify_event(struct inotify_event* event) { bool is_dir = (event->mask & IN_ISDIR) == IN_ISDIR; userlog(LOG_DEBUG, "inotify: wd=%d mask=%d dir=%d name=%s", event->wd, event->mask & (~IN_ISDIR), is_dir, node->path); - memcpy(path_buf, node->path, node->path_len + 1); int path_len = node->path_len; + memcpy(path_buf, node->path, path_len + 1); if (event->len > 0) { - path_buf[node->path_len] = '/'; + path_buf[path_len] = '/'; int name_len = strlen(event->name); memcpy(path_buf + path_len + 1, event->name, name_len + 1); path_len += name_len + 1; } + if (callback != NULL) { + (*callback)(path_buf, event->mask); + } + if (is_dir && event->mask & (IN_CREATE | IN_MOVED_TO)) { int result = walk_tree(path_len, node, true, NULL); if (result < 0 && result != ERR_IGNORE && result != ERR_CONTINUE) { @@ -373,10 +377,6 @@ static bool process_inotify_event(struct inotify_event* event) { } } - if (callback != NULL) { - (*callback)(path_buf, event->mask); - } - return true; } diff --git a/native/fsNotifier/linux/main.c b/native/fsNotifier/linux/main.c index 3cd65e28fc54..95a22b415683 100644 --- a/native/fsNotifier/linux/main.c +++ b/native/fsNotifier/linux/main.c @@ -36,7 +36,7 @@ #define LOG_ENV_ERROR "error" #define LOG_ENV_OFF "off" -#define VERSION "20130617.1935" +#define VERSION "20130715.1353" #define VERSION_MSG "fsnotifier " VERSION "\n" #define USAGE_MSG \ @@ -79,11 +79,11 @@ static bool update_roots(array* new_roots); static void unregister_roots(); static bool register_roots(array* new_roots, array* unwatchable, array* mounts); static array* unwatchable_mounts(); -static void inotify_callback(char* path, int event); -static void report_event(char* event, char* path); +static void inotify_callback(const char* path, int event); +static void report_event(const char* event, const char* path); static void output(const char* format, ...); static void check_missing_roots(); -static void check_root_removal(char*); +static void check_root_removal(const char*); int main(int argc, char** argv) { @@ -434,7 +434,7 @@ static array* unwatchable_mounts() { } -static void inotify_callback(char* path, int event) { +static void inotify_callback(const char* path, int event) { if (event & (IN_CREATE | IN_MOVED_TO)) { report_event("CREATE", path); report_event("CHANGE", path); @@ -457,21 +457,32 @@ static void inotify_callback(char* path, int event) { } } -static void report_event(char* event, char* path) { +static void report_event(const char* event, const char* path) { userlog(LOG_DEBUG, "%s: %s", event, path); - int len = strlen(path); - for (char* p = path; *p != '\0'; p++) { +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wincompatible-pointer-types" + char* copy = path, *p; + for (p = copy; *p != '\0'; ++p) { if (*p == '\n') { + if (copy == path) { + copy = strdup(path); + p = copy + (p - path); + } *p = '\0'; } } +#pragma clang diagnostic pop fputs(event, stdout); fputc('\n', stdout); - fwrite(path, len, 1, stdout); + fwrite(copy, (p - copy), 1, stdout); fputc('\n', stdout); + if (copy != path) { + free(copy); + } + fflush(stdout); } @@ -506,7 +517,7 @@ static void check_missing_roots() { } } -static void check_root_removal(char* path) { +static void check_root_removal(const char* path) { for (int i=0; i<array_size(roots); i++) { watch_root* root = array_get(roots, i); if (root->id >= 0 && strcmp(path, UNFLATTEN(root->path)) == 0) { |