Compare commits

..

No commits in common. "24fdd20eec25f045b7868db95e6598d470252c91" and "db3e2379b9bbf6551f406c63b8f656162f870f52" have entirely different histories.

3 changed files with 8 additions and 12 deletions

View File

@ -16,13 +16,10 @@ else()
message(WARNING ">> IPO disabled. You will not get the best performance.")
endif()
if(WIN32)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
endif()
if(MSVC)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /utf-8 /jumptablerdata /GS-")
add_compile_options(/wd4267 /wd4244)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /Ox")
@ -57,7 +54,7 @@ endif()
# PK_IS_MAIN determines whether the project is being used from root
# or if it is added as a dependency (through add_subdirectory for example).
if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
if ("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
set(PK_IS_MAIN TRUE)
option(PK_BUILD_SHARED_LIB "Build shared library" OFF)
option(PK_BUILD_STATIC_LIB "Build static library" OFF)

View File

@ -8,7 +8,6 @@
#if PY_SYS_PLATFORM == 0
#include <direct.h>
#include <io.h>
int platform_chdir(const char* path) { return _chdir(path); }
@ -245,4 +244,4 @@ void pk__add_module_sys() {
py_newstr(py_emplacedict(mod, py_name("platform")), PY_SYS_PLATFORM_STRING);
py_newstr(py_emplacedict(mod, py_name("version")), PK_VERSION);
py_newlist(py_emplacedict(mod, py_name("argv")));
}
}

View File

@ -80,13 +80,13 @@ static void pkl__emit_int(PickleObject* buf, py_i64 val) {
pkl__emit_op(buf, PKL_INT_0 + val);
return;
}
if(INT8_MIN <= val && val <= INT8_MAX) {
if((int8_t)val == val) {
pkl__emit_op(buf, PKL_INT8);
PickleObject__write_bytes(buf, &val, 1);
} else if(INT16_MIN <= val && val <= INT16_MAX) {
} else if((int16_t)val == val) {
pkl__emit_op(buf, PKL_INT16);
PickleObject__write_bytes(buf, &val, 2);
} else if(INT32_MIN <= val && val <= INT32_MAX) {
} else if((int32_t)val == val) {
pkl__emit_op(buf, PKL_INT32);
PickleObject__write_bytes(buf, &val, 4);
} else {
@ -680,7 +680,7 @@ bool py_pickle_loads_body(const unsigned char* p, int memo_length, c11_smallmap_
int dict_length = pkl__read_int(&p);
for(int i = 0; i < dict_length; i++) {
py_StackRef value = py_peek(-1);
c11_sv field = {(const char*)p, strlen((const char*)p)};
c11_sv field = {(const char*)p, strlen((const char*)p)};
NameDict__set(dict, py_namev(field), *value);
py_pop();
p += field.size + 1;
@ -728,4 +728,4 @@ static bool PickleObject__py_submit(PickleObject* self, py_OutRef out) {
return true;
}
#undef UNALIGNED_READ
#undef UNALIGNED_READ