Fix -Werror=format-security issues
This commit is contained in:
parent
e910b39751
commit
3733d24a90
|
@ -45,15 +45,17 @@ set(PLUGIN_INSTALL LIBRARY DESTINATION ${PLUGIN_INSTALL_DIR} RUNTIME DESTINATION
|
||||||
include(CheckCCompilerFlag)
|
include(CheckCCompilerFlag)
|
||||||
|
|
||||||
macro(AddCFlagIfSupported flag)
|
macro(AddCFlagIfSupported flag)
|
||||||
CHECK_C_COMPILER_FLAG(${flag} COMPILER_SUPPORTS${flag})
|
string(REGEX REPLACE "[^a-z^A-Z^_^0-9]+" "_" flag_name ${flag})
|
||||||
if(${COMPILER_SUPPORTS${flag}})
|
CHECK_C_COMPILER_FLAG(${flag} COMPILER_SUPPORTS${flag_name})
|
||||||
|
if(${COMPILER_SUPPORTS${flag_name}})
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${flag}")
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${flag}")
|
||||||
endif()
|
endif()
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
macro(AddValaCFlagIfSupported flag)
|
macro(AddValaCFlagIfSupported flag)
|
||||||
CHECK_C_COMPILER_FLAG(${flag} COMPILER_SUPPORTS${flag})
|
string(REGEX REPLACE "[^a-z^A-Z^_^0-9]+" "_" flag_name ${flag})
|
||||||
if(${COMPILER_SUPPORTS${flag}})
|
CHECK_C_COMPILER_FLAG(${flag} COMPILER_SUPPORTS${flag_name})
|
||||||
|
if(${COMPILER_SUPPORTS${flag_name}})
|
||||||
set(VALA_CFLAGS "${VALA_CFLAGS} ${flag}")
|
set(VALA_CFLAGS "${VALA_CFLAGS} ${flag}")
|
||||||
endif()
|
endif()
|
||||||
endmacro()
|
endmacro()
|
||||||
|
@ -62,8 +64,12 @@ if("Ninja" STREQUAL ${CMAKE_GENERATOR})
|
||||||
AddCFlagIfSupported(-fdiagnostics-color COMPILER_SUPPORTS_fdiagnistics-color)
|
AddCFlagIfSupported(-fdiagnostics-color COMPILER_SUPPORTS_fdiagnistics-color)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
AddCFlagIfSupported(-Wall)
|
||||||
|
AddCFlagIfSupported(-Werror=format-security)
|
||||||
|
|
||||||
AddValaCFlagIfSupported(-Wno-deprecated-declarations)
|
AddValaCFlagIfSupported(-Wno-deprecated-declarations)
|
||||||
AddValaCFlagIfSupported(-Wno-incompatible-pointer-types)
|
AddValaCFlagIfSupported(-Wno-incompatible-pointer-types)
|
||||||
|
AddValaCFlagIfSupported(-Wno-pointer-sign)
|
||||||
AddValaCFlagIfSupported(-Wno-int-conversion)
|
AddValaCFlagIfSupported(-Wno-int-conversion)
|
||||||
AddValaCFlagIfSupported(-Wno-discarded-qualifiers)
|
AddValaCFlagIfSupported(-Wno-discarded-qualifiers)
|
||||||
AddValaCFlagIfSupported(-Wno-unused-but-set-variable)
|
AddValaCFlagIfSupported(-Wno-unused-but-set-variable)
|
||||||
|
|
8
configure
vendored
8
configure
vendored
|
@ -151,13 +151,17 @@ else
|
||||||
exit 5
|
exit 5
|
||||||
fi
|
fi
|
||||||
res=$(git clone "$url" "$path" 2>&1)
|
res=$(git clone "$url" "$path" 2>&1)
|
||||||
if ! [ $? -eq 0 ] || ! [ -x $git ]; then
|
if ! [ $? -eq 0 ] || ! [ -d $path ]; then
|
||||||
echo "Failed retrieving missing files: $res"
|
echo "Failed retrieving missing files: $res"
|
||||||
exit 5
|
exit 5
|
||||||
fi
|
fi
|
||||||
if [[ "$branch" != "" ]]; then
|
if [[ "$branch" != "" ]]; then
|
||||||
pushd "$path" > /dev/null
|
pushd "$path" > /dev/null
|
||||||
git checkout "$branch" 2>/dev/null
|
res=$(git checkout "$branch" 2>&1)
|
||||||
|
if ! [ $? -eq 0 ]; then
|
||||||
|
echo "Failed retrieving missing files: $res"
|
||||||
|
exit 5
|
||||||
|
fi
|
||||||
popd > /dev/null
|
popd > /dev/null
|
||||||
fi
|
fi
|
||||||
echo "Submodule path '$path': checked out '$branch' (via git clone)"
|
echo "Submodule path '$path': checked out '$branch' (via git clone)"
|
||||||
|
|
|
@ -10,7 +10,7 @@ public class Dino.Application : Gtk.Application {
|
||||||
|
|
||||||
public Application() throws Error {
|
public Application() throws Error {
|
||||||
if (DirUtils.create_with_parents(get_storage_dir(), 0700) == -1) {
|
if (DirUtils.create_with_parents(get_storage_dir(), 0700) == -1) {
|
||||||
throw new Error(-1, 0, @"Could not create storage dir \"$(get_storage_dir())\": $(FileUtils.error_from_errno(errno))");
|
throw new Error(-1, 0, "Could not create storage dir \"%s\": %s", get_storage_dir(), FileUtils.error_from_errno(errno).to_string());
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: Legacy import
|
// FIXME: Legacy import
|
||||||
|
|
|
@ -59,7 +59,7 @@ public class Loader : Object {
|
||||||
if (module != null) break;
|
if (module != null) break;
|
||||||
}
|
}
|
||||||
if (module == null) {
|
if (module == null) {
|
||||||
throw new Error (-1, 1, Module.error ().replace(path, name));
|
throw new Error (-1, 1, "%s", Module.error ().replace(path, name));
|
||||||
}
|
}
|
||||||
|
|
||||||
void* function;
|
void* function;
|
||||||
|
|
|
@ -506,7 +506,7 @@ namespace GPG {
|
||||||
|
|
||||||
private void throw_if_error(GPGError.Error error) throws GLib.Error {
|
private void throw_if_error(GPGError.Error error) throws GLib.Error {
|
||||||
if (error.code != GPGError.ErrorCode.NO_ERROR) {
|
if (error.code != GPGError.ErrorCode.NO_ERROR) {
|
||||||
throw new GLib.Error(-1, error.code, error.to_string());
|
throw new GLib.Error(-1, error.code, "%s", error.to_string());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,7 @@ namespace Signal {
|
||||||
[CCode (cname = "signal_throw_gerror_by_code_", cheader_filename = "signal_protocol.h")]
|
[CCode (cname = "signal_throw_gerror_by_code_", cheader_filename = "signal_protocol.h")]
|
||||||
private int throw_by_code(int code, string? message = null) throws GLib.Error {
|
private int throw_by_code(int code, string? message = null) throws GLib.Error {
|
||||||
if (code < 0 && code > MIN_ERROR_CODE) {
|
if (code < 0 && code > MIN_ERROR_CODE) {
|
||||||
throw new GLib.Error(-1, code, @"$(message ?? "Signal error"): $((ErrorCode)code)");
|
throw new GLib.Error(-1, code, "%s: %s", message ?? "Signal error", ((ErrorCode)code).to_string());
|
||||||
}
|
}
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue