• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

A generic touchscreen calibration program for X.Org


Commit MetaInfo

Revisión40730129dee0b6e81747e4acc3fe158e228e58b4 (tree)
Tiempo2010-02-09 08:07:16
AutorTias Guns <tias@ulys...>
CommiterTias Guns

Log Message

strdup is not ansi C, add my_strdup function

Thanks Johan Robben for pointing this out

Cambiar Resumen

Diferencia incremental

--- a/src/main_common.hpp
+++ b/src/main_common.hpp
@@ -85,6 +85,18 @@ class WrongCalibratorException : public std::invalid_argument {
8585 std::invalid_argument(msg) {}
8686 };
8787
88+// strdup: non-ansi
89+char* my_strdup(const char* s);
90+char* my_strdup(const char* s) {
91+ size_t len = strlen(s) + 1;
92+ void* p = malloc(len);
93+
94+ if (p == NULL)
95+ return NULL;
96+
97+ return (char*) memcpy(p, s, len);
98+}
99+
88100 // all need struct XYinfo, and some the consts too
89101 #include "calibrator.cpp"
90102 #include "calibrator/calibratorXorgPrint.cpp"
@@ -92,7 +104,6 @@ class WrongCalibratorException : public std::invalid_argument {
92104 #include "calibrator/calibratorUsbtouchscreen.cpp"
93105
94106
95-
96107 /**
97108 * find a calibratable touchscreen device (using XInput)
98109 *
@@ -180,7 +191,7 @@ int find_device(const char* pre_device, bool verbose, bool list_devices,
180191 // a calibratable touschscreen
181192 found++;
182193 device_id = list->id;
183- device_name = strdup(list->name);
194+ device_name = my_strdup(list->name);
184195 device_axys.x_min = ax[0].min_value;
185196 device_axys.x_max = ax[0].max_value;
186197 device_axys.y_min = ax[1].min_value;