1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-11-15 17:47:09 +00:00

"Port" nvidia code to c++

This commit is contained in:
Pavel Labath 2010-01-06 20:57:13 +01:00
parent 9b46a61ae6
commit d61c545973
2 changed files with 5 additions and 4 deletions

View File

@ -142,7 +142,7 @@ if(BUILD_LUA)
endif(BUILD_LUA)
if(BUILD_NVIDIA)
set(nvidia nvidia.c)
set(nvidia nvidia.cc)
set(optional_sources ${optional_sources} ${nvidia})
endif(BUILD_NVIDIA)

View File

@ -1,5 +1,5 @@
/* -*- mode: c; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: t -*-
* vim: ts=4 sw=4 noet ai cindent syntax=c
* vim: ts=4 sw=4 noet ai cindent syntax=cpp
*
* Conky, a system monitor, based on torsmo
*
@ -74,7 +74,8 @@ int set_nvidia_type(struct text_object *obj, const char *arg)
{
struct nvidia_s *nvs;
nvs = obj->data.opaque = malloc(sizeof(struct nvidia_s));
obj->data.opaque = malloc(sizeof(struct nvidia_s));
nvs = static_cast<nvidia_s *>(obj->data.opaque);
memset(nvs, 0, sizeof(struct nvidia_s));
switch(arg[0]) {
@ -109,7 +110,7 @@ int set_nvidia_type(struct text_object *obj, const char *arg)
void print_nvidia_value(struct text_object *obj, char *p, int p_max_size)
{
int value;
struct nvidia_s *nvs = obj->data.opaque;
struct nvidia_s *nvs = static_cast<nvidia_s *>(obj->data.opaque);
if (!nvs ||
(value = get_nvidia_value(nvs->type, display)) == -1) {