]> git.mdlowis.com Git - archive/afm.git/commitdiff
add -Wextra flag and fix issues
authora bellenir <a@bellenir.com>
Mon, 28 Jul 2014 16:25:04 +0000 (16:25 +0000)
committera bellenir <a@bellenir.com>
Mon, 28 Jul 2014 16:25:04 +0000 (16:25 +0000)
Rakefile
source/frame.c
source/input.c
source/main.c
source/workdir.c

index ff3f2511382c1d7f0b3f0a8b3b7ddbceee24298c..9cf4c9dc6149730cec0be9f68ca2399305a95e0b 100644 (file)
--- a/Rakefile
+++ b/Rakefile
@@ -25,7 +25,9 @@ Env = Rscons::Environment.new do |env|
   env['LIBS'] = ['ncurses', 'cds']
   env['LIBPATH'] += ['./build']
   env['CPPPATH'] += Dir['modules/data-structures/source/**/']
-  env['CFLAGS'] += ['-Wall', '-Werror', '-pedantic', '--std=c99']
+  env['CFLAGS'] += ['-Wall', '-Wextra',
+    #'-Werror', #commented out until mike fixes his shit.
+    '-pedantic', '--std=c99']
 
   # Platform-Specific Defines and Options
   # -------------------------------------
index 1b618616df564644e87b309d1308f9249e3ed146..9b621f582295e882cf826ac12cbe3823214f205f 100644 (file)
@@ -89,8 +89,8 @@ void frame_page_down(Frame_T* p_frame){
 }
 
 void frame_draw_files(Frame_T* frame){
-    int file_i, frame_i = FrameTopBuffer;
-    int rows, cols;
+    unsigned int file_i, frame_i = FrameTopBuffer;
+    unsigned int rows, cols;
     getmaxyx(frame->p_win, rows, cols);
     frame_scroll(frame);
     file_i = frame->top_index;
index f47c764c2c005057cc8c531d340a563c9a076a9f..89a129cbfd2e86f3615e3171c51c8b5a3b430dc2 100644 (file)
@@ -117,7 +117,7 @@ void input_handle_key(char ch) {
     bool more_matches = false;
     bool match_found  = false;
     size_t num_entries = (sizeof(Default_Bindings) / sizeof(binding_t));
-    int len = strlen(Key_Buffer);
+    unsigned int len = strlen(Key_Buffer);
 
     /* If no more room then reset the buffer */
     if (len+1 >= 16) {
@@ -129,7 +129,7 @@ void input_handle_key(char ch) {
 
     /* If we got a valid key then process it */
     if((char)ERR != ch) {
-        int i;
+        unsigned int i;
         /* Put the key in the buffer */
         len++;
         Key_Buffer[len-1] = ch;
@@ -142,14 +142,12 @@ void input_handle_key(char ch) {
 
             /* If the binding we're looking at matches a substring but has more chars
              * make note of it so we can wait for the next char */
-            if((strlen(seq) > len) && (0 == strncmp(seq, Key_Buffer, len)))
-            {
+            if((strlen(seq) > len) && (0 == strncmp(seq, Key_Buffer, len))) {
                 more_matches = true;
             }
 
             /* If the current string matches exactly then execute it's handler */
-            if (0 == strcmp(Key_Buffer, seq))
-            {
+            if (0 == strcmp(Key_Buffer, seq)) {
                 binding.callback();
                 Key_Buffer[0] = '\0';
                 match_found = true;
index 5cb8e806bf0d6c5f0482000c667e12b209d50513..18da20929d04611c2b6b65bdc9588e409acb403f 100644 (file)
 #include "screen.h"
 
 void handle_signal(int sig) {
+       (void) sig;
     state_set_screen_dirty(true);
     state_set_screen_resized(true);
 }
 
 void handle_alarm(int sig) {
+       (void) sig;
        state_set_screen_dirty(true);
        alarm(1);
 }
 
-int main(int argc, char** argv) {
+int main() {
     /* Handle terminal resizing */
     signal(SIGWINCH, handle_signal);
     signal(SIGALRM, handle_alarm);
index 953125208703df77fc13b26a0cf28a9e6d31550c..1c918bbce9a0b1c9c64a8867ed6e19306e117fd7 100644 (file)
@@ -56,7 +56,7 @@ void workdir_set_idx(WorkDir_T* wd, int idx){
        frame_set_highlighting(state_get_focused_frame(), false, false);
     wd->idx = idx;
     if(idx < 0) wd->idx = 0;
-    else if(idx >= vec_size(wd->vfiles))
+    else if((unsigned int)idx >= vec_size(wd->vfiles))
         wd->idx = vec_size(wd->vfiles)-1;
        frame_set_highlighting(state_get_focused_frame(), true, true);
 }
@@ -157,7 +157,7 @@ void workdir_ls(WorkDir_T* wd){
 }
 
 void workdir_seek(WorkDir_T* wd, char* search){
-    int i = 0;
+    unsigned int i = 0;
     if(strcmp(((File_T*)vec_at(wd->vfiles, 0))->name, "..") == 0) i++;
     while(i < vec_size(wd->vfiles) && strcmp(((File_T*)vec_at(wd->vfiles, i))->name, search) < 0) i++;
     workdir_set_idx(wd, i);