1. Vinay Sajip
  2. pylauncher

Commits

Vinay Sajip  committed ddfcc49

Minor tidy-ups (no functional changes).

  • Participants
  • Parent commits 2d2020b
  • Branches default

Comments (0)

Files changed (3)

File Associator/main.c

View file
             NMLISTVIEW * p = (NMLISTVIEW *) lParam;
 
             if ((p->hdr.code == LVN_ITEMCHANGED) &&
-                (p->uNewState && LVIS_SELECTED)) {
+                (p->uNewState & LVIS_SELECTED)) {
                 hChild = GetDlgItem(hDlg, IDOK);
                 selected_index = p->iItem;
                 EnableWindow(hChild, selected_index >= 0);
         fopen_s(&log_fp, "c:\\temp\\associator.log", "w");
     }
 
+    if (!lpCmdLine) {
+        debug(L"No command line specified.\n");
+        return 0;
+    }
     if (!wcsstr(lpCmdLine, L"nocheck") &&
         associations_exist())   /* Could have been restored by uninstall. */
         return 0;

File CLILauncher/launcher.c

View file
         message, size, NULL);
 }
 
-static int
+static void
 error(int rc, wchar_t * format, ... )
 {
     va_list va;
                                      L"%s%s", check, PYTHON_EXECUTABLE);
                         attrs = GetFileAttributesW(ip->executable);
                         if (attrs == INVALID_FILE_ATTRIBUTES) {
-                            wchar_t message[MSGSIZE];
                             winerror(GetLastError(), message, MSGSIZE);
                             debug(L"locate_pythons_for_key: %s: %s",
                                   ip->executable, message);
     job = CreateJobObject(NULL, NULL);
     ok = QueryInformationJobObject(job, JobObjectExtendedLimitInformation,
                                   &info, sizeof(info), &rc);
-    if (!ok || (rc != sizeof(info)))
+    if (!ok || (rc != sizeof(info)) || !job)
         error(RC_CREATE_PROCESS, L"Job information querying failed");
     info.BasicLimitInformation.LimitFlags |= JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE |
                                              JOB_OBJECT_LIMIT_SILENT_BREAKAWAY_OK;
     char * start;
     char * shebang_alias = (char *) shebang_line;
     BOM* bom;
-    int i, j, nchars;
+    int i, j, nchars = 0;
     int header_len;
     BOOL is_virt;
     wchar_t * command;
                 if (header_len % 2 != 0) {
                     debug(L"maybe_handle_shebang: UTF-16BE, but an odd number \
 of bytes: %d\n", header_len);
-                    nchars = 0;
+                    /* nchars = 0; Not needed - initialised to 0. */
                 }
                 else {
                     for (i = header_len; i > 0; i -= 2) {
                 if ((header_len % 2) != 0) {
                     debug(L"UTF-16LE, but an odd number of bytes: %d\n",
                           header_len);
-                    nchars = 0;
+                    /* nchars = 0; Not needed - initialised to 0. */
                 }
                 else {
                     /* no actual conversion needed. */
                 if (header_len % 4 != 0) {
                     debug(L"UTF-32BE, but not divisible by 4: %d\n",
                           header_len);
-                    nchars = 0;
+                    /* nchars = 0; Not needed - initialised to 0. */
                 }
                 else {
                     for (i = header_len, j = header_len / 2; i > 0; i -= 4,
                 if (header_len % 4 != 0) {
                     debug(L"UTF-32LE, but not divisible by 4: %d\n",
                           header_len);
-                    nchars = 0;
+                    /* nchars = 0; Not needed - initialised to 0. */
                 }
                 else {
                     for (i = header_len, j = header_len / 2; i > 0; i -= 4,

File Messager/main.c

View file
                    LPWSTR lpCmdLine, int nShow)
 {
     wchar_t line[MSGSIZE];
-    wchar_t * context;
+    wchar_t * context = NULL;
     wchar_t * tokens[MAX_TOKENS];
     int i;
     UINT icon;