Coverity fixes
[sxemacs] / src / buffer.c
index 63a3a7a..0718a59 100644 (file)
@@ -687,7 +687,7 @@ even if a buffer with that name exists.
       (name, ignore))
 {
        REGISTER Lisp_Object gentemp, tem;
-       int count;
+       int count, prt;
        char number[23];
 
        CHECK_STRING(name);
@@ -704,8 +704,8 @@ even if a buffer with that name exists.
 
        count = 1;
        while (1) {
-                
-                snprintf(number, sizeof(number), "<%d>", ++count);
+                prt = snprintf(number, sizeof(number), "<%d>", ++count);
+               assert(prt>=0 && prt < sizeof(number));
                gentemp = concat2(name, build_string(number));
                if (!NILP(ignore)) {
                        tem = Fstring_equal(gentemp, ignore);
@@ -839,12 +839,12 @@ as BUFFER means use current buffer.
       (flag, buffer))
 {
        /* This function can GC */
-       struct buffer *buf = decode_buffer(buffer, 0);
+       struct buffer *buf;
 
 #ifdef CLASH_DETECTION
        /* If buffer becoming modified, lock the file.
           If buffer becoming unmodified, unlock the file.  */
-
+       buf =  decode_buffer(buffer, 0);
        Lisp_Object fn = buf->file_truename;
        if (!NILP(fn)) {
                int already = BUF_SAVE_MODIFF(buf) < BUF_MODIFF(buf);