Consolidate quoting style in printed strings.
[pspp] / src / data / sys-file-writer.c
index a761d4a29fc4e7262e1520104aa0aae0e32f4e47..f31bd99a883e395304f1819f61e388871105f63f 100644 (file)
@@ -144,8 +144,8 @@ static void put_cmp_opcode (struct sfm_writer *, uint8_t);
 static void put_cmp_number (struct sfm_writer *, double);
 static void put_cmp_string (struct sfm_writer *, const void *, size_t);
 
-bool write_error (const struct sfm_writer *);
-bool close_writer (struct sfm_writer *);
+static bool write_error (const struct sfm_writer *);
+static bool close_writer (struct sfm_writer *);
 
 /* Returns default options for writing a system file. */
 struct sfm_write_options
@@ -159,8 +159,7 @@ sfm_writer_default_options (void)
 }
 
 /* Opens the system file designated by file handle FH for writing
-   cases from dictionary D according to the given OPTS.  If
-   COMPRESS is nonzero, the system file will be compressed.
+   cases from dictionary D according to the given OPTS.
 
    No reference to D is retained, so it may be modified or
    destroyed at will after this function returns.  D is not
@@ -209,14 +208,14 @@ sfm_open_writer (struct file_handle *fh, struct dictionary *d,
     goto error;
 
   /* Create the file on disk. */
-  mode = S_IRUSR | S_IRGRP | S_IROTH;
+  mode = 0444;
   if (opts.create_writeable)
-    mode |= S_IWUSR | S_IWGRP | S_IWOTH;
+    mode |= 0222;
   w->rf = replace_file_start (fh_get_file_name (fh), "wb", mode,
                               &w->file, NULL);
   if (w->rf == NULL)
     {
-      msg (ME, _("Error opening \"%s\" for writing as a system file: %s."),
+      msg (ME, _("Error opening `%s' for writing as a system file: %s."),
            fh_get_file_name (fh), strerror (errno));
       goto error;
     }
@@ -269,10 +268,7 @@ sfm_open_writer (struct file_handle *fh, struct dictionary *d,
   write_int (w, 0);
 
   if (write_error (w))
-    {
-      close_writer (w);
-      return NULL;
-    }
+    goto error;
 
   return casewriter_create (dict_get_proto (d), &sys_file_casewriter_class, w);
 
@@ -947,7 +943,7 @@ sys_file_casewriter_destroy (struct casewriter *writer, void *w_)
 }
 
 /* Returns true if an I/O error has occurred on WRITER, false otherwise. */
-bool
+static bool
 write_error (const struct sfm_writer *writer)
 {
   return ferror (writer->file);
@@ -955,7 +951,7 @@ write_error (const struct sfm_writer *writer)
 
 /* Closes a system file after we're done with it.
    Returns true if successful, false if an I/O error occurred. */
-bool
+static bool
 close_writer (struct sfm_writer *w)
 {
   bool ok;
@@ -976,7 +972,7 @@ close_writer (struct sfm_writer *w)
       /* Seek back to the beginning and update the number of cases.
          This is just a courtesy to later readers, so there's no need
          to check return values or report errors. */
-      if (ok && w->case_cnt <= INT32_MAX && !fseek (w->file, 80, SEEK_SET))
+      if (ok && w->case_cnt <= INT32_MAX && !fseeko (w->file, 80, SEEK_SET))
         {
           write_int (w, w->case_cnt);
           clearerr (w->file);
@@ -986,7 +982,7 @@ close_writer (struct sfm_writer *w)
         ok = false;
 
       if (!ok)
-        msg (ME, _("An I/O error occurred writing system file \"%s\"."),
+        msg (ME, _("An I/O error occurred writing system file `%s'."),
              fh_get_file_name (w->fh));
 
       if (ok ? !replace_file_commit (w->rf) : !replace_file_abort (w->rf))