ithewei 5 роки тому
батько
коміт
d0aac41b8c
6 змінених файлів з 7 додано та 10 видалено
  1. 1 1
      Makefile
  2. 1 1
      base/hmutex.h
  3. 1 1
      base/hsocket.c
  4. 1 1
      event/nlog.c
  5. 2 5
      examples/curl.cpp
  6. 1 1
      examples/hloop_test.c

+ 1 - 1
Makefile

@@ -99,7 +99,7 @@ unittest: prepare
 	$(CXX) -g -Wall -std=c++11 -I. -Ibase            -o bin/threadpool_test   unittest/threadpool_test.cpp  -pthread
 	$(CXX) -g -Wall -std=c++11 -I. -Ibase            -o bin/objectpool_test   unittest/objectpool_test.cpp  -pthread
 	$(CXX) -g -Wall -std=c++11 -I. -Ibase            -o bin/ls                unittest/listdir_test.cpp     base/hdir.cpp base/hbase.c
-	$(CXX) -g -Wall -std=c++11 -I. -Ibase -Iutils    -o bin/ifconfig          unittest/ifconfig_test.cpp    base/ifconfig.cpp
+	$(CXX) -g -Wall -std=c++11 -I. -Ibase            -o bin/ifconfig          unittest/ifconfig_test.cpp    base/ifconfig.cpp
 	$(CC)  -g -Wall -std=c99   -I. -Ibase -Iprotocol -o bin/nslookup          unittest/nslookup_test.c      protocol/dns.c
 	$(CC)  -g -Wall -std=c99   -I. -Ibase -Iprotocol -o bin/ping              unittest/ping_test.c          protocol/icmp.c base/hsocket.c base/htime.c -DPRINT_DEBUG
 	$(CC)  -g -Wall -std=c99   -I. -Ibase -Iprotocol -o bin/ftp               unittest/ftp_test.c           protocol/ftp.c  base/hsocket.c

+ 1 - 1
base/hmutex.h

@@ -62,7 +62,7 @@ static inline void honce(honce_t* once, honce_fn fn) {
 #define hsem_init(psem, value)      *(psem) = CreateSemaphore(NULL, value, value+100000, NULL)
 #define hsem_destroy(psem)          CloseHandle(*(psem))
 #define hsem_wait(psem)             WaitForSingleObject(*(psem), INFINITE)
-#define hsem_post(psem)             ReleaseSemaphore(*(psem))
+#define hsem_post(psem)             ReleaseSemaphore(*(psem), 1, NULL)
 // true:  WAIT_OBJECT_0
 // false: WAIT_OBJECT_TIMEOUT
 #define hsem_wait_for(psem, ms)     ( WaitForSingleObject(*(psem), ms) == WAIT_OBJECT_0 )

+ 1 - 1
base/hsocket.c

@@ -47,7 +47,7 @@ int Resolver(const char* host, sockaddr_u* addr) {
 #else
     struct hostent* phe = gethostbyname(host);
     if (phe == NULL) {
-        printd("unknown host %s err:%d:%s\n", host, h_errno, hstrerror(h_errno));
+        printd("unknown host %s err:%d\n", host, h_errno);
         return -h_errno;
     }
     addr->sin.sin_family = AF_INET;

+ 1 - 1
event/nlog.c

@@ -40,7 +40,7 @@ static void on_close(hio_t* io) {
 
 static void on_read(hio_t* io, void* buf, int readbytes) {
     printd("on_read fd=%d readbytes=%d\n", hio_fd(io), readbytes);
-    printd("< %s\n", buf);
+    printd("< %s\n", (char*)buf);
     // nothing to do
 }
 

+ 2 - 5
examples/curl.cpp

@@ -1,14 +1,11 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
+#include "http_client.h"
+
 #ifdef _MSC_VER
 #include "misc/win32_getopt.h"
 #else
 #include <getopt.h>
 #endif
 
-#include "http_client.h"
-
 static int  http_version = 1;
 static int  grpc         = 0;
 static bool verbose = false;

+ 1 - 1
examples/hloop_test.c

@@ -81,7 +81,7 @@ int main() {
     // test nonblock stdin
     printf("input 'quit' to quit loop\n");
     char buf[64];
-    hread(loop, STDIN_FILENO, buf, sizeof(buf), on_stdin);
+    hread(loop, 0, buf, sizeof(buf), on_stdin);
 
     // test custom_events
     for (int i = 0; i < 10; ++i) {