]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/urllib.qc
Remove `-Wno-double-declaration`
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / urllib.qc
index 9a5e0e7da274c8b1043f3f52ec838b03590919ad..518b207fca24bb5b63222c22d9ac80c8b43d73df 100644 (file)
@@ -1,7 +1,7 @@
 // files
 .float url_fh;
-#define URL_FH_CURL   -1
-#define URL_FH_STDOUT -2
+const float URL_FH_CURL = -1;
+const float URL_FH_STDOUT = -2;
 
 // URLs
 .string url_url;
@@ -33,7 +33,7 @@ float url_URI_Get_Callback(float id, float status, string data)
                return 0;
        if(e.url_rbuf >= 0 || e.url_wbuf >= 0)
        {
-               print(sprintf("WARNING: handle %d (%s) has already received data?!?\n", id + NUM_URL_ID, e.url_url));
+               printf("WARNING: handle %d (%s) has already received data?!?\n", id + NUM_URL_ID, e.url_url);
                return 0;
        }
 
@@ -85,7 +85,7 @@ float url_URI_Get_Callback(float id, float status, string data)
 void url_single_fopen(string url, float mode, url_ready_func rdy, entity pass)
 {
        entity e;
-       float i;
+       int i;
        if(strstrofs(url, "://", 0) >= 0)
        {
                switch(mode)
@@ -159,7 +159,7 @@ void url_single_fopen(string url, float mode, url_ready_func rdy, entity pass)
                                url_fromid[i] = e;
 
                                // make sure this slot won't be reused quickly even on map change
-                               cvar_set("_urllib_nextslot", ftos(mod(i + 1, NUM_URL_ID)));
+                               cvar_set("_urllib_nextslot", ftos((i + 1) % NUM_URL_ID));
                                break;
                }
        }
@@ -209,7 +209,7 @@ void url_single_fopen(string url, float mode, url_ready_func rdy, entity pass)
 // close a file
 void url_fclose(entity e)
 {
-       float i;
+       int i;
 
        if(e.url_fh == URL_FH_CURL)
        {
@@ -262,7 +262,7 @@ void url_fclose(entity e)
                        url_fromid[i] = e;
 
                        // make sure this slot won't be reused quickly even on map change
-                       cvar_set("_urllib_nextslot", ftos(mod(i + 1, NUM_URL_ID)));
+                       cvar_set("_urllib_nextslot", ftos((i + 1) % NUM_URL_ID));
                }
                else
                {