Bläddra i källkod

- Fix compiler warnings

decke 6 år sedan
förälder
incheckning
7272d877bc
3 ändrade filer med 7 tillägg och 5 borttagningar
  1. 1
    1
      Makefile
  2. 2
    2
      client.h
  3. 4
    2
      leveldb.c

+ 1
- 1
Makefile Visa fil

@@ -5,7 +5,7 @@
5 5
 LOCALBASE?=/usr/local
6 6
 
7 7
 # Development flags
8
-.if defined(DEBUG)
8
+.if !defined(NODEBUG)
9 9
 CFLAGS+=-g -Wall -DDEBUG
10 10
 .endif
11 11
 

+ 2
- 2
client.h Visa fil

@@ -81,8 +81,8 @@ TAILQ_HEAD(, client) clients;
81 81
 
82 82
 struct queue {
83 83
    char *queuename;
84
-   volatile int read;
85
-   volatile int write;
84
+   volatile u_int read;
85
+   volatile u_int write;
86 86
 
87 87
    TAILQ_HEAD(, client) subscribers;
88 88
    TAILQ_ENTRY(queue) entries;

+ 4
- 2
leveldb.c Visa fil

@@ -91,6 +91,8 @@ int leveldb_free(void)
91 91
     leveldb_writeoptions_destroy(woptions);
92 92
     leveldb_cache_destroy(cache);
93 93
     leveldb_env_destroy(env);
94
+
95
+    return 0;
94 96
 }
95 97
 
96 98
 
@@ -110,14 +112,14 @@ int leveldb_add_message(struct queue *queue, char *message)
110 112
     seq = atomic_fetchadd_int(&queue->write, 1);
111 113
     wb = leveldb_writebatch_create();
112 114
 
113
-    snprintf(key, sizeof(key)-1, "%s.%ld", queue->queuename, seq);
115
+    snprintf(key, sizeof(key)-1, "%s.%d", queue->queuename, seq);
114 116
     key[sizeof(key)-1] = '\0';
115 117
     leveldb_writebatch_put(wb, key, strlen(key), message, strlen(message));
116 118
 
117 119
     snprintf(key, sizeof(key)-1, "%s.write", queue->queuename);
118 120
     key[sizeof(key)-1] = '\0';
119 121
     
120
-    sprintf(value, "%s", seq);
122
+    sprintf(value, "%d", seq);
121 123
     leveldb_writebatch_put(wb, key, strlen(key), value, strlen(value));
122 124
 
123 125
     leveldb_write(db, woptions, wb, &error);

Laddar…
Avbryt
Spara