OSDN Git Service

[Fix] #37353 プロジェクトファイルとソース修正。 / Fix project file and sources.
[hengband/hengband.git] / src / inet.c
index d5fbac7..5c52880 100644 (file)
@@ -165,7 +165,7 @@ void set_proxy(char *default_url, int default_port)
 
        /* ポート番号があるかどうかを調べ、あればproxy_portに設定。 */
        --len;
-       while (len > 0 && isdigit(s[len]))
+       while (len > 0 && isdigit((unsigned char)s[len]))
                --len;
        if (len > 0 && s[len] == ':' && s[len + 1] != '\0')
        {
@@ -211,6 +211,31 @@ int soc_write(int sd, char *buf, size_t sz)
        return sz;
 }
 
+int soc_read(int sd, char *buf, size_t sz)
+{
+#ifndef MACINTOSH
+       int nleft, nread = 0;
+
+       nleft = sz;
+
+       while (nleft > 0) {
+               int n;
+               n = recv(sd, buf + nread, nleft, 0);
+               if (n <= 0)
+                       return (nread);
+               nleft -= n;
+               nread += n;
+       }
+#else /* !MACINTOSH */
+
+       OTResult bytesSent;
+
+       OTSnd(ep, (void *)buf, sz, 0);
+
+#endif
+       return nread;
+}
+
 #if 0 /* おそらく使わない */
 int soc_write_str(int sd, char *buf)
 {