📄 string.cpp
字号:
#include "string.h"
#include "log.h"
int CString::Hash() {
int hash = 0;
for(int i = 0; i < len; i++)
hash += (int)data[i] * (473 + i);
return hash;
}
void CString::EnsureAllocated(int new_size) {
if(own_data) {
if(size >= new_size)
return;
size += new_size;
int mod = size % STRING_GRANULARITY;
if(mod)
size += STRING_GRANULARITY - mod;
data = (char *)realloc(data, size);
} else
g_CLog.Log(LOG_SYSTEM, "EnsureAllocated: Tried to resize CString without local storage\n");
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -