dtfile: resolve 19 compiler warnings.
authorPeter Howkins <flibble@users.sf.net>
Fri, 9 Jan 2015 16:16:53 +0000 (16:16 +0000)
committerPeter Howkins <flibble@users.sf.net>
Fri, 9 Jan 2015 16:16:53 +0000 (16:16 +0000)
cde/programs/dtfile/ChangeDirP.c
cde/programs/dtfile/FileMgr.c
cde/programs/dtfile/FileOp.c
cde/programs/dtfile/Trash.c

index 6073083a0b179227e368e1b8c18cd7a66e7ee430..34052db90edb8fca89e51be525dc372f43e1f240 100644 (file)
@@ -792,7 +792,7 @@ GetStatusMsg(
        file_mgr_data->busy_status == busy_readdir)
    {
       if (file_mgr_data->busy_detail == 0)
-         sprintf (buf, (GETMESSAGE(3,5, "Reading ...")));
+         sprintf (buf, "%s", (GETMESSAGE(3,5, "Reading ...")));
       else if (file_mgr_data->busy_detail == 1)
         sprintf (buf, (GETMESSAGE(3,11, "%d Item(s)...")),
                  file_mgr_data->busy_detail);
index 303d8ce0810799fdbe3b78b68e777633a3bf9d42..84ab324848aa76699cbf34466d38fa78f63f3491 100644 (file)
@@ -5074,7 +5074,7 @@ ShowChangeDirField (
 
    if (w)
    {
-      if((int)client_data == FM_POPUP)
+      if((intptr_t) client_data == FM_POPUP)
          mbar = XtParent(w);
       else
          mbar = XmGetPostedFromWidget(XtParent(w));
index 85dc39465da4fa3374b7308bc04c67bd633d0447..6f7f9323f164eb734a6c6cc05ccaee840e460afb 100644 (file)
@@ -460,7 +460,7 @@ FileOpError(
         char *message1,
         char *message2 )
 {
-  int pipe_fd = (int)w;   /* @@@ Hack! @@@
+  int pipe_fd = (int) (intptr_t) w;   /* @@@ Hack! @@@
                              In the background process we call FileManip with
                              the file descriptor for the pipe instead of a
                              widget id.  We rely on the fact that FileManip
@@ -950,11 +950,11 @@ FileMoveCopyProcess(
       else
       {
         if (strncmp(directory, desktop_dir, strlen(desktop_dir)) == 0)
-            return_val = FileManip((Widget)pipe_s2m, mode, from, to,
+            return_val = FileManip((Widget) (intptr_t) pipe_s2m, mode, from, to,
                                     isContainer,
                                     FileOpError, True, DESKTOP);
         else
-            return_val = FileManip((Widget)pipe_s2m, mode, from, to,
+            return_val = FileManip((Widget) (intptr_t) pipe_s2m, mode, from, to,
                                     isContainer,
                                     FileOpError, True, NOT_DESKTOP);
         XtFree( (char *) from );
@@ -1155,11 +1155,11 @@ FileMoveCopyProcess(
                 case PIPEMSG_MERGE:
 
                     if (strncmp(directory, desktop_dir, strlen(desktop_dir)) == 0)
-                      return_val = FileManip((Widget)pipe_s2m, MERGE_DIR, from,
+                      return_val = FileManip((Widget) (intptr_t) pipe_s2m, MERGE_DIR, from,
                                              to, isContainer,
                                              FileOpError, True, DESKTOP);
                     else
-                      return_val = FileManip((Widget)pipe_s2m, MERGE_DIR, from,
+                      return_val = FileManip((Widget) (intptr_t) pipe_s2m, MERGE_DIR, from,
                                              to, isContainer,
                                              FileOpError, True, NOT_DESKTOP);
                     break;
@@ -1197,7 +1197,7 @@ FileMoveCopyProcess(
                     break;
                 default:
                     if (strncmp(directory, desktop_dir, strlen(desktop_dir)) == 0)
-                      return_val = FileManip((Widget)pipe_s2m, mode, from, to,
+                      return_val = FileManip((Widget) (intptr_t) pipe_s2m, mode, from, to,
                                              isContainer,FileOpError, True,
                                              DESKTOP);
                     else
@@ -1222,14 +1222,14 @@ FileMoveCopyProcess(
                             strcat(toFile, "/");
                             strcat(toFile, newFile);
 
-                            return_val = FileManip((Widget)pipe_s2m, mode, from,
+                            return_val = FileManip((Widget) (intptr_t) pipe_s2m, mode, from,
                                                    toFile, False, FileOpError,
                                                    True, NOT_DESKTOP);
                             XtFree(path);
                             XtFree(toFile);
                         }
                         else
-                            return_val = FileManip((Widget)pipe_s2m, mode, from,
+                            return_val = FileManip((Widget) (intptr_t) pipe_s2m, mode, from,
                                                    to, isContainer, FileOpError,
                                                    True, NOT_DESKTOP);
                     }
@@ -1377,7 +1377,7 @@ FileMoveCopyProcessDesktop(
       }
       else
       {
-        return_val = FileManip((Widget)pipe_s2m, mode, from, to, TRUE,
+        return_val = FileManip((Widget) (intptr_t) pipe_s2m, mode, from, to, TRUE,
                                FileOpError, True, DESKTOP);
         XtFree (from);
         from = NULL;
@@ -2455,7 +2455,7 @@ ChangeIconNameProcess(
      XtFree(new_name);
      return 1;
    }
-   success = FileManip((Widget)pipe_fd, MOVE_FILE, old_full_name, full_name, TRUE,
+   success = FileManip((Widget) (intptr_t) pipe_fd, MOVE_FILE, old_full_name, full_name, TRUE,
                        FileOpError, True, NOT_DESKTOP);
    XtFree( old_full_name );
    /* send a 'done' msg through the pipe */
index 09df7b735c862028b0270176976c890e3b636640..b49c66ba6fc3b1417e16639716932d6c929d622d 100644 (file)
@@ -704,10 +704,14 @@ WriteTrashEntries( void )
 
       /* Remove the original information file, and move the new one */
       (void) fclose(newFile);
-      (void) chown(NewTrashInfoFileName, getuid(), getgid());
+      if(-1 == chown(NewTrashInfoFileName, getuid(), getgid())) {
+         return( False );      
+      }
       (void) remove(TrashInfoFileName);
       (void) rename(NewTrashInfoFileName, TrashInfoFileName);
-      (void) chown(TrashInfoFileName, getuid(), getgid());
+      if(-1 == chown(TrashInfoFileName, getuid(), getgid())) {
+         return( False );      
+      }
       return( True );
    }
    else
@@ -2830,7 +2834,7 @@ MoveToTrashProcess(
       to = CreateTrashFilename(baseName, TRUE);
 
       /* move file to the trash directory */
-      success = FileManip((Widget)pipe_fd, MOVE_FILE, path, to, TRUE,
+      success = FileManip((Widget) (intptr_t) pipe_fd, MOVE_FILE, path, to, TRUE,
                           FileOpError, True, TRASH_DIRECTORY);
       if (success)
       {
@@ -3366,7 +3370,12 @@ MoveToTrash(
 #endif /* SUN_PERF */
 
    /* create a pipe */
-   pipe(pipe_fd);
+   if(-1 == pipe(pipe_fd)) {
+       fprintf(stderr,
+               "%s:  pipe failed error %d=%s\n",
+               pname, errno, strerror(errno));
+       return;
+   }
 
    /* fork the process that does the actual work */
    pid = fork();
@@ -3512,7 +3521,7 @@ RestoreProcess(
       if (to != NULL)
       {
 
-         status = RestoreObject((Widget)pipe_fd, MOVE_FILE, from,to,
+         status = RestoreObject((Widget) (intptr_t) pipe_fd, MOVE_FILE, from,to,
                        TRUE, FileOpError, False, NOT_DESKTOP,CheckedAlready);
          /* restore was successful */
          if(status == (int) True)
@@ -3756,7 +3765,12 @@ RestoreFromTrash(
    cb_data->msg = msg;
 
    /* create a pipe */
-   pipe(pipe_fd);
+   if(-1 == pipe(pipe_fd)) {
+       fprintf(stderr,
+               "%s: pipe failed, error %d=%s\n",
+               pname, errno, strerror(errno));
+       return;
+   }
 
    /* fork the process that does the actual work */
    pid = fork();
@@ -4076,7 +4090,12 @@ EmptyTrash(
    cb_data->msg = msg;
 
    /* create a pipe */
-   pipe(pipe_fd);
+   if(-1 == pipe(pipe_fd)) {
+       fprintf(stderr,
+               "%s: pipe failed, error %d=%s\n",
+               pname, errno, strerror(errno));
+       return;
+   }
 
    /* fork the process that does the actual work */
    pid = fork();