From 4d18998a8cca4def19017de5bc55dafcbc4ac784 Mon Sep 17 00:00:00 2001 From: div0 Date: Wed, 27 Feb 2008 13:59:27 +0000 Subject: [PATCH] make DB use DP_QC_URI_ESCAPE git-svn-id: svn://svn.icculus.org/nexuiz/trunk@3444 f962a42d-fe04-0410-a3ab-8c8b0445ebaa --- data/qcsrc/common/util.qc | 7 +++++-- data/qcsrc/server/ctf.qc | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/data/qcsrc/common/util.qc b/data/qcsrc/common/util.qc index b97454caf..6bdb52f86 100644 --- a/data/qcsrc/common/util.qc +++ b/data/qcsrc/common/util.qc @@ -286,7 +286,7 @@ float db_load(string pFilename) { n = tokenizebyseparator(l, "\\"); for(j = 2; j < n; j += 2) - db_put(db, argv(j-1), argv(j)); + db_put(db, uri_unescape(argv(j-1)), uri_unescape(argv(j))); } } fclose(fh); @@ -318,13 +318,16 @@ void db_close(float db) string db_get(float db, string pKey) { float h; + pKey = uri_escape(pKey); h = mod(crc16(FALSE, pKey), DB_BUCKETS); - return infoget(bufstr_get(db, h), pKey); + return uri_unescape(infoget(bufstr_get(db, h), pKey)); } void db_put(float db, string pKey, string pValue) { float h; + pKey = uri_escape(pKey); + pValue = uri_escape(pValue); h = mod(crc16(FALSE, pKey), DB_BUCKETS); bufstr_set(db, h, infoadd(bufstr_get(db, h), pKey, pValue)); } diff --git a/data/qcsrc/server/ctf.qc b/data/qcsrc/server/ctf.qc index 4e529f1f8..7299499d9 100644 --- a/data/qcsrc/server/ctf.qc +++ b/data/qcsrc/server/ctf.qc @@ -251,11 +251,11 @@ void() FlagTouch = s = ftos_decimals(t, 2); s0 = ftos_decimals(flagcaptimerecord, 2); h0 = db_get(ServerProgsDB, strcat(GetMapname(), "/captimerecord/netname")); - h1 = strreplace("\\", "\xDC", other.netname); // h1: current netname, escaped for DB (\ is 5C, other \ is DC) + h1 = other.netname; if(h0 == h1) h0 = "his"; else - h0 = strcat(strreplace("\xDC", "\\", h0), "^7's"); // h0: display text for previous netname + h0 = strcat(h0, "^7's"); // h0: display text for previous netname if (flagcaptimerecord == 0) { bprint(other.netname, "^7 captured the ", other.flagcarried.netname, " in ", s, " seconds\n"); -- 2.39.2