diff options
author | Dennis Kasprzyk <onestone@opencompositing.org> | 2008-07-25 23:54:30 +0200 |
---|---|---|
committer | Dennis kasprzyk <onestone@opencompositing.org> | 2008-07-25 23:54:30 +0200 |
commit | 0e942665257980878d6271cbcad4647d04204093 (patch) | |
tree | 83ca2da9686e90a5f257a360e5a15e4158165907 /src | |
parent | 83e50fca60fb85aff79e4b6118ad57361caa6a8a (diff) | |
download | unity-window-decorator-0e942665257980878d6271cbcad4647d04204093.tar.gz unity-window-decorator-0e942665257980878d6271cbcad4647d04204093.tar.bz2 |
Switch to c++ and compile with a basic set of plugins.
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile.am | 36 | ||||
-rw-r--r-- | src/action.cpp (renamed from src/action.c) | 0 | ||||
-rw-r--r-- | src/core.cpp (renamed from src/core.c) | 2 | ||||
-rw-r--r-- | src/cursor.cpp (renamed from src/cursor.c) | 4 | ||||
-rw-r--r-- | src/display.cpp (renamed from src/display.c) | 22 | ||||
-rw-r--r-- | src/event.cpp (renamed from src/event.c) | 8 | ||||
-rw-r--r-- | src/fragment.cpp (renamed from src/fragment.c) | 34 | ||||
-rw-r--r-- | src/main.cpp (renamed from src/main.c) | 4 | ||||
-rw-r--r-- | src/match.cpp (renamed from src/match.c) | 36 | ||||
-rw-r--r-- | src/matrix.cpp (renamed from src/matrix.c) | 0 | ||||
-rw-r--r-- | src/metadata.cpp (renamed from src/metadata.c) | 12 | ||||
-rw-r--r-- | src/object.cpp (renamed from src/object.c) | 0 | ||||
-rw-r--r-- | src/option.cpp (renamed from src/option.c) | 4 | ||||
-rw-r--r-- | src/paint.cpp (renamed from src/paint.c) | 6 | ||||
-rw-r--r-- | src/plugin.cpp (renamed from src/plugin.c) | 18 | ||||
-rw-r--r-- | src/privates.cpp (renamed from src/privates.c) | 0 | ||||
-rw-r--r-- | src/screen.cpp (renamed from src/screen.c) | 40 | ||||
-rw-r--r-- | src/session.cpp (renamed from src/session.c) | 4 | ||||
-rw-r--r-- | src/texture.cpp (renamed from src/texture.c) | 10 | ||||
-rw-r--r-- | src/window.cpp (renamed from src/window.c) | 136 |
20 files changed, 188 insertions, 188 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index 683d695..ee74639 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -12,21 +12,21 @@ bin_PROGRAMS = compiz compiz_LDADD = @COMPIZ_LIBS@ @GL_LIBS@ -lm compiz_LDFLAGS = -export-dynamic compiz_SOURCES = \ - main.c \ - privates.c \ - object.c \ - core.c \ - texture.c \ - display.c \ - screen.c \ - window.c \ - event.c \ - paint.c \ - option.c \ - plugin.c \ - session.c \ - fragment.c \ - matrix.c \ - cursor.c \ - match.c \ - metadata.c + main.cpp \ + privates.cpp \ + object.cpp \ + core.cpp \ + texture.cpp \ + display.cpp \ + screen.cpp \ + window.cpp \ + event.cpp \ + paint.cpp \ + option.cpp \ + plugin.cpp \ + session.cpp \ + fragment.cpp \ + matrix.cpp \ + cursor.cpp \ + match.cpp \ + metadata.cpp diff --git a/src/action.c b/src/action.cpp index ebcd37e..ebcd37e 100644 --- a/src/action.c +++ b/src/action.cpp diff --git a/src/core.c b/src/core.cpp index a79854b..5e6f893 100644 --- a/src/core.c +++ b/src/core.cpp @@ -253,7 +253,7 @@ addFileWatch (const char *path, { CompFileWatch *fileWatch; - fileWatch = malloc (sizeof (CompFileWatch)); + fileWatch = (CompFileWatch *) malloc (sizeof (CompFileWatch)); if (!fileWatch) return 0; diff --git a/src/cursor.c b/src/cursor.cpp index 559a285..baca1c3 100644 --- a/src/cursor.c +++ b/src/cursor.cpp @@ -40,7 +40,7 @@ addCursor (CompScreen *s) { CompCursor *c; - c = malloc (sizeof (CompCursor)); + c = (CompCursor *) malloc (sizeof (CompCursor)); if (c) { c->screen = s; @@ -127,7 +127,7 @@ updateCursor (CompCursor *c, if (!image) return; - cursorImage = malloc (sizeof (CompCursorImage)); + cursorImage = (CompCursorImage *) malloc (sizeof (CompCursorImage)); if (!cursorImage) { XFree (image); diff --git a/src/display.c b/src/display.cpp index 10cde37..09223fb 100644 --- a/src/display.c +++ b/src/display.cpp @@ -780,7 +780,7 @@ setAudibleBell (CompDisplay *display, static Bool pingTimeout (void *closure) { - CompDisplay *d = closure; + CompDisplay *d = (CompDisplay *) closure; CompScreen *s; CompWindow *w; XEvent ev; @@ -946,7 +946,7 @@ updatePlugins (CompDisplay *d) if (nPop) { - pop = malloc (sizeof (CompPlugin *) * nPop); + pop = (CompPlugin **) malloc (sizeof (CompPlugin *) * nPop); if (!pop) { (*core.setOptionForPlugin) (&d->base, "core", o->name, &d->plugin); @@ -995,7 +995,7 @@ updatePlugins (CompDisplay *d) { CompOptionValue *value; - value = realloc (d->plugin.list.value, sizeof (CompOptionValue) * + value = (CompOptionValue *) realloc (d->plugin.list.value, sizeof (CompOptionValue) * (d->plugin.list.nValue + 1)); if (value) { @@ -1055,7 +1055,7 @@ compAddTimeout (int minTime, { CompTimeout *timeout; - timeout = malloc (sizeof (CompTimeout)); + timeout = (CompTimeout *) malloc (sizeof (CompTimeout)); if (!timeout) return 0; @@ -1110,7 +1110,7 @@ compAddWatchFd (int fd, { CompWatchFd *watchFd; - watchFd = malloc (sizeof (CompWatchFd)); + watchFd = (CompWatchFd *) malloc (sizeof (CompWatchFd)); if (!watchFd) return 0; @@ -1127,7 +1127,7 @@ compAddWatchFd (int fd, core.nWatchFds++; - core.watchPollFds = realloc (core.watchPollFds, + core.watchPollFds = (struct pollfd *) realloc (core.watchPollFds, core.nWatchFds * sizeof (struct pollfd)); core.watchPollFds[core.nWatchFds - 1].fd = fd; @@ -2002,13 +2002,13 @@ addDisplay (const char *name) int xkbOpcode; int firstScreen, lastScreen; - d = malloc (sizeof (CompDisplay)); + d = (CompDisplay *) malloc (sizeof (CompDisplay)); if (!d) return FALSE; if (displayPrivateLen) { - privates = malloc (displayPrivateLen * sizeof (CompPrivate)); + privates = (CompPrivate *) malloc (displayPrivateLen * sizeof (CompPrivate)); if (!privates) { free (d); @@ -2043,7 +2043,7 @@ addDisplay (const char *name) d->plugin.list.type = CompOptionTypeString; d->plugin.list.nValue = 1; - d->plugin.list.value = malloc (sizeof (CompOptionValue)); + d->plugin.list.value = (CompOptionValue *) malloc (sizeof (CompOptionValue)); if (!d->plugin.list.value) { free (d); @@ -2075,7 +2075,7 @@ addDisplay (const char *name) return FALSE; } - d->connection = XGetXCBConnection (dpy); + // d->connection = XGetXCBConnection (dpy); if (!compInitDisplayOptionsFromMetadata (d, &coreMetadata, @@ -2984,7 +2984,7 @@ readImageFromFile (CompDisplay *display, { char *path; - path = malloc (strlen (home) + strlen (HOME_IMAGEDIR) + 2); + path = (char *) malloc (strlen (home) + strlen (HOME_IMAGEDIR) + 2); if (path) { sprintf (path, "%s/%s", home, HOME_IMAGEDIR); diff --git a/src/event.c b/src/event.cpp index 31055b0..ea4e781 100644 --- a/src/event.c +++ b/src/event.cpp @@ -184,7 +184,7 @@ moveInputFocusToOtherWindow (CompWindow *w) static Bool autoRaiseTimeout (void *closure) { - CompDisplay *display = closure; + CompDisplay *display = (CompDisplay *) closure; CompWindow *w = findWindowAtDisplay (display, display->activeWindow); if (display->autoRaiseWindow == display->activeWindow || @@ -765,7 +765,7 @@ triggerEdgeEnter (CompDisplay *d, if (delay > 0) { - delayedSettings = malloc (sizeof (CompDelayedEdgeSettings)); + delayedSettings = (CompDelayedEdgeSettings *) malloc (sizeof (CompDelayedEdgeSettings)); if (delayedSettings) { delayedSettings->d = d; @@ -1255,7 +1255,7 @@ handleEvent (CompDisplay *d, if (s->nExpose == s->sizeExpose) { - s->exposeRects = realloc (s->exposeRects, + s->exposeRects = (XRectangle *) realloc (s->exposeRects, (s->sizeExpose + more) * sizeof (XRectangle)); s->sizeExpose += more; @@ -2234,7 +2234,7 @@ handleEvent (CompDisplay *d, { if (w->nDamage == w->sizeDamage) { - w->damageRects = realloc (w->damageRects, + w->damageRects = (XRectangle *) realloc (w->damageRects, (w->sizeDamage + 1) * sizeof (XRectangle)); w->sizeDamage += 1; diff --git a/src/fragment.c b/src/fragment.cpp index dda806c..99c38cc 100644 --- a/src/fragment.c +++ b/src/fragment.cpp @@ -516,7 +516,7 @@ addFetchOffsetVariables (CompDataOp *op, newSize = oldSize + strlen (data); - str = realloc (info->data, newSize + 1); + str = (char *) realloc (info->data, newSize + 1); if (str) { strcpy (str + oldSize, data); @@ -538,7 +538,7 @@ addData (CompDataOp *op, int oldSize = strlen (info->data); int newSize = oldSize + strlen (op->data); - str = realloc (info->data, newSize + 1); + str = (char *) realloc (info->data, newSize + 1); if (str) { strcpy (str + oldSize, op->data); @@ -559,11 +559,11 @@ buildFragmentProgram (CompScreen *s, FetchInfo info; int i; - program = malloc (sizeof (CompProgram)); + program = (CompProgram *) malloc (sizeof (CompProgram)); if (!program) return NULL; - functionList = malloc ((attrib->nFunction + 1) * sizeof (void *)); + functionList = (CompFunction **) malloc ((attrib->nFunction + 1) * sizeof (void *)); if (!functionList) { free (program); @@ -600,7 +600,7 @@ buildFragmentProgram (CompScreen *s, return NULL; } - program->signature = malloc (attrib->nFunction * sizeof (int)); + program->signature = (int *) malloc (attrib->nFunction * sizeof (int)); if (!program->signature) { free (program); @@ -692,7 +692,7 @@ createFunctionData (void) { CompFunctionData *data; - data = malloc (sizeof (CompFunctionData)); + data = (CompFunctionData *) malloc (sizeof (CompFunctionData)); if (!data) return NULL; @@ -781,7 +781,7 @@ copyData (CompHeaderOp *header, } /* allocate new memory that will fit all substitutions */ - copy = malloc (strlen (data) + count * (strlen (prefix) + 1) + 1); + copy = (char *) malloc (strlen (data) + count * (strlen (prefix) + 1) + 1); if (!copy) return NULL; @@ -840,11 +840,11 @@ copyFunctionData (CompFunctionData *dst, { int i; - dst->header = malloc (src->nHeader * sizeof (CompHeaderOp)); + dst->header = (CompHeaderOp *) malloc (src->nHeader * sizeof (CompHeaderOp)); if (!dst->header) return FALSE; - dst->body = malloc (src->nBody * sizeof (CompBodyOp)); + dst->body = (CompBodyOp *) malloc (src->nBody * sizeof (CompBodyOp)); if (!dst->body) { free (dst->header); @@ -939,7 +939,7 @@ addHeaderOpToFunctionData (CompFunctionData *data, } } - header = realloc (data->header, + header = (CompHeaderOp *) realloc (data->header, (data->nHeader + 1) * sizeof (CompHeaderOp)); if (!header) return FALSE; @@ -979,7 +979,7 @@ allocBodyOpInFunctionData (CompFunctionData *data) { CompBodyOp *body; - body = realloc (data->body, (data->nBody + 1) * sizeof (CompBodyOp)); + body = (CompBodyOp *) realloc (data->body, (data->nBody + 1) * sizeof (CompBodyOp)); if (!body) return FALSE; @@ -1044,7 +1044,7 @@ addDataOpToFunctionData (CompFunctionData *data, if (!allocBodyOpInFunctionData (data)) return FALSE; - fStr = malloc (size); + fStr = (char *) malloc (size); if (!fStr) return FALSE; @@ -1065,7 +1065,7 @@ addDataOpToFunctionData (CompFunctionData *data, else /* glibc 2.0 */ size++; /* one more than the old size */ - tmp = realloc (fStr, size); + tmp = (char *) realloc (fStr, size); if (!tmp) { free (fStr); @@ -1098,7 +1098,7 @@ addBlendOpToFunctionData (CompFunctionData *data, if (!allocBodyOpInFunctionData (data)) return FALSE; - fStr = malloc (size); + fStr = (char *) malloc (size); if (!fStr) return FALSE; @@ -1119,7 +1119,7 @@ addBlendOpToFunctionData (CompFunctionData *data, else /* glibc 2.0 */ size++; /* one more than the old size */ - tmp = realloc (fStr, size); + tmp = (char *) realloc (fStr, size); if (!tmp) { free (fStr); @@ -1157,7 +1157,7 @@ createFragmentFunction (CompScreen *s, { if (!nameBuffer) { - nameBuffer = malloc (strlen (name) + 64); + nameBuffer = (char *) malloc (strlen (name) + 64); if (!nameBuffer) return 0; @@ -1167,7 +1167,7 @@ createFragmentFunction (CompScreen *s, sprintf (nameBuffer, "%s%d", name, i++); } - function = malloc (sizeof (CompFunction)); + function = (CompFunction *) malloc (sizeof (CompFunction)); if (!function) { if (nameBuffer) diff --git a/src/main.c b/src/main.cpp index f4e3381..6ca3bb4 100644 --- a/src/main.c +++ b/src/main.cpp @@ -373,7 +373,7 @@ main (int argc, char **argv) if (refreshRateArg) { - ctx.refreshRateData = malloc (strlen (refreshRateArg) + 256); + ctx.refreshRateData = (char *) malloc (strlen (refreshRateArg) + 256); if (ctx.refreshRateData) sprintf (ctx.refreshRateData, "<min>1</min><default>%s</default>", @@ -387,7 +387,7 @@ main (int argc, char **argv) for (i = 0; i < nPlugin; i++) size += strlen (plugin[i]) + 16; - ctx.pluginData = malloc (size); + ctx.pluginData = (char *) malloc (size); if (ctx.pluginData) { char *ptr = ctx.pluginData; diff --git a/src/match.c b/src/match.cpp index 26b3eb8..935ec50 100644 --- a/src/match.c +++ b/src/match.cpp @@ -157,7 +157,7 @@ matchAddOp (CompMatch *match, if (!match->nOp) flags &= ~MATCH_OP_AND_MASK; - op = realloc (match->op, sizeof (CompMatchOp) * (match->nOp + 1)); + op = (CompMatchOp *) realloc (match->op, sizeof (CompMatchOp) * (match->nOp + 1)); if (!op) return FALSE; @@ -185,7 +185,7 @@ matchCopyOps (CompMatchOp *opDst, switch (opSrc->type) { case CompMatchOpTypeGroup: - op = malloc (sizeof (CompMatchOp) * opSrc->group.nOp); + op = (CompMatchOp *) malloc (sizeof (CompMatchOp) * opSrc->group.nOp); if (!op) { matchFiniOps (first, count); @@ -230,7 +230,7 @@ matchCopy (CompMatch *dst, { CompMatchOp *opDst; - opDst = malloc (sizeof (CompMatchOp) * src->nOp); + opDst = (CompMatchOp *) malloc (sizeof (CompMatchOp) * src->nOp); if (!opDst) return FALSE; @@ -253,7 +253,7 @@ matchAddGroup (CompMatch *match, { CompMatchOp *op, *opDst; - opDst = malloc (sizeof (CompMatchOp) * group->nOp); + opDst = (CompMatchOp *) malloc (sizeof (CompMatchOp) * group->nOp); if (!opDst) return FALSE; @@ -321,7 +321,7 @@ strndupValue (const char *str, { char *value; - value = malloc (sizeof (char) * (n + 1)); + value = (char *) malloc (sizeof (char) * (n + 1)); if (value) { int i, j; @@ -422,7 +422,7 @@ matchAddFromString (CompMatch *match, length = j - i; - value = malloc (sizeof (char) * (length + 1)); + value = (char *) malloc (sizeof (char) * (length + 1)); if (value) { CompMatch group; @@ -486,7 +486,7 @@ matchOpsToString (CompMatchOp *op, group = matchOpsToString (op->group.op, op->group.nOp); if (group) { - value = malloc (sizeof (char) * (strlen (group) + 7)); + value = (char *) malloc (sizeof (char) * (strlen (group) + 7)); if (value) sprintf (value, "%s%s(%s)%s", !str ? "" : ((op->any.flags & MATCH_OP_AND_MASK) ? @@ -498,7 +498,7 @@ matchOpsToString (CompMatchOp *op, } break; case CompMatchOpTypeExp: - value = malloc (sizeof (char) * (strlen (op->exp.value) + 5)); + value = (char *) malloc (sizeof (char) * (strlen (op->exp.value) + 5)); if (value) sprintf (value, "%s%s%s%s", !str ? "" : ((op->any.flags & MATCH_OP_AND_MASK) ? "& " : "| "), @@ -512,7 +512,7 @@ matchOpsToString (CompMatchOp *op, char *s; int valueLength = strlen (value); - s = malloc (sizeof (char) * (length + valueLength + 1)); + s = (char *) malloc (sizeof (char) * (length + valueLength + 1)); if (s) { if (str) @@ -641,35 +641,35 @@ matchEval (CompMatch *match, static Bool matchEvalTypeExp (CompDisplay *display, CompWindow *window, - CompPrivate private) + CompPrivate c_private) { - return (private.uval & window->wmType); + return (c_private.uval & window->wmType); } static Bool matchEvalStateExp (CompDisplay *display, CompWindow *window, - CompPrivate private) + CompPrivate c_private) { - return (private.uval & window->state); + return (c_private.uval & window->state); } static Bool matchEvalIdExp (CompDisplay *display, CompWindow *window, - CompPrivate private) + CompPrivate c_private) { - return (private.val == window->id); + return (c_private.val == window->id); } static Bool matchEvalOverrideRedirectExp (CompDisplay *display, CompWindow *window, - CompPrivate private) + CompPrivate c_private) { Bool overrideRedirect = window->attrib.override_redirect; - return ((private.val == 1 && overrideRedirect) || - (private.val == 0 && !overrideRedirect)); + return ((c_private.val == 1 && overrideRedirect) || + (c_private.val == 0 && !overrideRedirect)); } void diff --git a/src/matrix.c b/src/matrix.cpp index 8430f02..8430f02 100644 --- a/src/matrix.c +++ b/src/matrix.cpp diff --git a/src/metadata.c b/src/metadata.cpp index 191edaa..5e7d365 100644 --- a/src/metadata.c +++ b/src/metadata.cpp @@ -92,7 +92,7 @@ readXmlFile (const char *path, if (path) length += strlen (path) + 1; - file = malloc (length); + file = (char *) malloc (length); if (!file) return NULL; @@ -128,7 +128,7 @@ addMetadataFromFilename (CompMetadata *metadata, if (!doc) return FALSE; - d = realloc (metadata->doc, (metadata->nDoc + 1) * sizeof (xmlDoc *)); + d = (xmlDoc **) realloc (metadata->doc, (metadata->nDoc + 1) * sizeof (xmlDoc *)); if (!d) { xmlFreeDoc (doc); @@ -153,7 +153,7 @@ compAddMetadataFromFile (CompMetadata *metadata, { char *path; - path = malloc (strlen (home) + strlen (HOME_METADATADIR) + 2); + path = (char *) malloc (strlen (home) + strlen (HOME_METADATADIR) + 2); if (path) { sprintf (path, "%s/%s", home, HOME_METADATADIR); @@ -190,7 +190,7 @@ compAddMetadataFromString (CompMetadata *metadata, return FALSE; } - d = realloc (metadata->doc, (metadata->nDoc + 1) * sizeof (xmlDoc *)); + d = (xmlDoc **) realloc (metadata->doc, (metadata->nDoc + 1) * sizeof (xmlDoc *)); if (!d) { xmlFreeDoc (doc); @@ -220,7 +220,7 @@ compAddMetadataFromIO (CompMetadata *metadata, return FALSE; } - d = realloc (metadata->doc, (metadata->nDoc + 1) * sizeof (xmlDoc *)); + d = (xmlDoc **) realloc (metadata->doc, (metadata->nDoc + 1) * sizeof (xmlDoc *)); if (!d) { xmlFreeDoc (doc); @@ -755,7 +755,7 @@ initListValue (CompDisplay *d, if (xmlStrcmp (child->name, BAD_CAST "value")) continue; - value = realloc (v->list.value, + value = (CompOptionValue *) realloc (v->list.value, sizeof (CompOptionValue) * (v->list.nValue + 1)); if (value) { diff --git a/src/object.c b/src/object.cpp index e9717c6..e9717c6 100644 --- a/src/object.c +++ b/src/object.cpp diff --git a/src/option.c b/src/option.cpp index bbc15fd..1c704fc 100644 --- a/src/option.c +++ b/src/option.cpp @@ -323,7 +323,7 @@ compSetOptionList (CompOption *option, { CompOptionValue *v; - v = malloc (sizeof (CompOptionValue) * value->list.nValue); + v = (CompOptionValue *) malloc (sizeof (CompOptionValue) * value->list.nValue); if (!v) return FALSE; @@ -543,7 +543,7 @@ stringAppend (char *s, if (s) len += strlen (s); - r = malloc (len + 1); + r = (char *) malloc (len + 1); if (r) { if (s) diff --git a/src/paint.c b/src/paint.cpp index a2051fa..30b492e 100644 --- a/src/paint.c +++ b/src/paint.cpp @@ -177,7 +177,7 @@ paintBackground (CompScreen *s, s->backgroundLoaded = TRUE; } - data = malloc (sizeof (GLfloat) * nBox * 16); + data = (GLfloat *) malloc (sizeof (GLfloat) * nBox * 16); if (!data) return; @@ -643,7 +643,7 @@ moreWindowVertices (CompWindow *w, { GLfloat *vertices; - vertices = realloc (w->vertices, sizeof (GLfloat) * newSize); + vertices = (GLfloat *) realloc (w->vertices, sizeof (GLfloat) * newSize); if (!vertices) return FALSE; @@ -662,7 +662,7 @@ moreWindowIndices (CompWindow *w, { GLushort *indices; - indices = realloc (w->indices, sizeof (GLushort) * newSize); + indices = (GLushort *) realloc (w->indices, sizeof (GLushort) * newSize); if (!indices) return FALSE; diff --git a/src/plugin.c b/src/plugin.cpp index 7b7a010..d545240 100644 --- a/src/plugin.c +++ b/src/plugin.cpp @@ -62,7 +62,7 @@ coreGetObjectOptions (CompPlugin *plugin, }; RETURN_DISPATCH (object, dispTab, ARRAY_SIZE (dispTab), - (void *) (*count = 0), (plugin, object, count)); + (CompOption *) (*count = 0), (plugin, object, count)); } static Bool @@ -124,7 +124,7 @@ cloaderListPlugins (const char *path, if (path) return 0; - list = malloc (sizeof (char *)); + list = (char **) malloc (sizeof (char *)); if (!list) return 0; @@ -148,7 +148,7 @@ dlloaderLoadPlugin (CompPlugin *p, char *file; void *dlhand; - file = malloc ((path ? strlen (path) : 0) + strlen (name) + 8); + file = (char *) malloc ((path ? strlen (path) : 0) + strlen (name) + 8); if (!file) return FALSE; @@ -259,7 +259,7 @@ dlloaderListPlugins (const char *path, if (!nFile) return cList; - list = realloc (cList, (j + nFile) * sizeof (char *)); + list = (char **) realloc (cList, (j + nFile) * sizeof (char *)); if (!list) return cList; @@ -267,7 +267,7 @@ dlloaderListPlugins (const char *path, { length = strlen (nameList[i]->d_name); - name = malloc ((length - 5) * sizeof (char)); + name = (char *) malloc ((length - 5) * sizeof (char)); if (name) { strncpy (name, nameList[i]->d_name + 3, length - 6); @@ -543,7 +543,7 @@ loadPlugin (const char *name) char *home, *plugindir; Bool status; - p = malloc (sizeof (CompPlugin)); + p = (CompPlugin *) malloc (sizeof (CompPlugin)); if (!p) return 0; @@ -555,7 +555,7 @@ loadPlugin (const char *name) home = getenv ("HOME"); if (home) { - plugindir = malloc (strlen (home) + strlen (HOME_PLUGINDIR) + 3); + plugindir = (char *) malloc (strlen (home) + strlen (HOME_PLUGINDIR) + 3); if (plugindir) { sprintf (plugindir, "%s/%s", home, HOME_PLUGINDIR); @@ -654,7 +654,7 @@ availablePlugins (int *n) home = getenv ("HOME"); if (home) { - plugindir = malloc (strlen (home) + strlen (HOME_PLUGINDIR) + 3); + plugindir = (char *) malloc (strlen (home) + strlen (HOME_PLUGINDIR) + 3); if (plugindir) { sprintf (plugindir, "%s/%s", home, HOME_PLUGINDIR); @@ -677,7 +677,7 @@ availablePlugins (int *n) if (!count) return NULL; - list = malloc (count * sizeof (char *)); + list = (char **) malloc (count * sizeof (char *)); if (!list) return NULL; diff --git a/src/privates.c b/src/privates.cpp index 56baa4b..56baa4b 100644 --- a/src/privates.c +++ b/src/privates.cpp diff --git a/src/screen.c b/src/screen.cpp index 15d1fd0..c1b8594 100644 --- a/src/screen.c +++ b/src/screen.cpp @@ -186,7 +186,7 @@ setDesktopHints (CompScreen *s) size = s->nDesktop * 2 + s->nDesktop * 2 + s->nDesktop * 4 + 1; - data = malloc (sizeof (unsigned long) * size); + data = (unsigned long *) malloc (sizeof (unsigned long) * size); if (!data) return; @@ -306,7 +306,7 @@ updateOutputDevices (CompScreen *s) if (x1 < x2 && y1 < y2) { - o = realloc (output, sizeof (CompOutput) * (nOutput + 1)); + o = (CompOutput *) realloc (output, sizeof (CompOutput) * (nOutput + 1)); if (o) { o[nOutput].region.extents.x1 = x1; @@ -323,7 +323,7 @@ updateOutputDevices (CompScreen *s) /* make sure we have at least one output */ if (!nOutput) { - output = malloc (sizeof (CompOutput)); + output = (CompOutput *) malloc (sizeof (CompOutput)); if (!output) return; @@ -338,7 +338,7 @@ updateOutputDevices (CompScreen *s) /* set name, width, height and update rect pointers in all regions */ for (i = 0; i < nOutput; i++) { - output[i].name = malloc (sizeof (char) * 10); + output[i].name = (char *) malloc (sizeof (char) * 10); if (output[i].name) snprintf (output[i].name, 10, "Output %d", nOutput); @@ -448,7 +448,7 @@ detectOutputDevices (CompScreen *s) int n = s->display->nScreenInfo; value.list.nValue = n; - value.list.value = malloc (sizeof (CompOptionValue) * n); + value.list.value = (CompOptionValue *) malloc (sizeof (CompOptionValue) * n); if (!value.list.value) return; @@ -466,7 +466,7 @@ detectOutputDevices (CompScreen *s) else { value.list.nValue = 1; - value.list.value = malloc (sizeof (CompOptionValue)); + value.list.value = (CompOptionValue *) malloc (sizeof (CompOptionValue)); if (!value.list.value) return; @@ -683,7 +683,7 @@ updateStartupFeedback (CompScreen *s) static Bool startupSequenceTimeout (void *data) { - CompScreen *screen = data; + CompScreen *screen = (CompScreen *) data; CompStartupSequence *s; struct timeval now, active; double elapsed; @@ -712,7 +712,7 @@ addSequence (CompScreen *screen, { CompStartupSequence *s; - s = malloc (sizeof (CompStartupSequence)); + s = (CompStartupSequence *) malloc (sizeof (CompStartupSequence)); if (!s) return; @@ -772,7 +772,7 @@ static void compScreenSnEvent (SnMonitorEvent *event, void *userData) { - CompScreen *screen = userData; + CompScreen *screen = (CompScreen *) userData; SnStartupSequence *sequence; sequence = sn_monitor_event_get_startup_sequence (event); @@ -1637,7 +1637,7 @@ addScreen (CompDisplay *display, GLfloat light0Position[] = { -0.5f, 0.5f, -9.0f, 1.0f }; CompWindow *w; - s = malloc (sizeof (CompScreen)); + s = (CompScreen *) malloc (sizeof (CompScreen)); if (!s) return FALSE; @@ -1646,7 +1646,7 @@ addScreen (CompDisplay *display, if (display->screenPrivateLen) { - privates = malloc (display->screenPrivateLen * sizeof (CompPrivate)); + privates = (CompPrivate *) malloc (display->screenPrivateLen * sizeof (CompPrivate)); if (!privates) { free (s); @@ -2544,7 +2544,7 @@ findTopLevelWindowAtScreen (CompScreen *s, if (w->attrib.override_redirect) { /* likely a frame window */ - if (w->attrib.class == InputOnly) + if (w->attrib.c_class == InputOnly) { for (w = s->windows; w; w = w->next) if (w->frame == id) @@ -2700,7 +2700,7 @@ pushScreenGrab (CompScreen *s, if (s->grabSize <= s->maxGrab) { - s->grabs = realloc (s->grabs, sizeof (CompGrab) * (s->maxGrab + 1)); + s->grabs = (CompGrab *) realloc (s->grabs, sizeof (CompGrab) * (s->maxGrab + 1)); if (!s->grabs) return 0; @@ -2910,7 +2910,7 @@ addPassiveKeyGrab (CompScreen *s, } } - keyGrab = realloc (s->keyGrab, sizeof (CompKeyGrab) * (s->nKeyGrab + 1)); + keyGrab = (CompKeyGrab *) realloc (s->keyGrab, sizeof (CompKeyGrab) * (s->nKeyGrab + 1)); if (!keyGrab) return FALSE; @@ -2952,7 +2952,7 @@ removePassiveKeyGrab (CompScreen *s, (s->nKeyGrab - (i + 1)) * sizeof (CompKeyGrab)); s->nKeyGrab--; - s->keyGrab = realloc (s->keyGrab, + s->keyGrab = (CompKeyGrab *) realloc (s->keyGrab, sizeof (CompKeyGrab) * s->nKeyGrab); if (!(mask & CompNoMask)) @@ -2995,7 +2995,7 @@ addPassiveButtonGrab (CompScreen *s, } } - buttonGrab = realloc (s->buttonGrab, + buttonGrab = (CompButtonGrab *) realloc (s->buttonGrab, sizeof (CompButtonGrab) * (s->nButtonGrab + 1)); if (!buttonGrab) return FALSE; @@ -3030,7 +3030,7 @@ removePassiveButtonGrab (CompScreen *s, (s->nButtonGrab - (i + 1)) * sizeof (CompButtonGrab)); s->nButtonGrab--; - s->buttonGrab = realloc (s->buttonGrab, + s->buttonGrab = (CompButtonGrab *) realloc (s->buttonGrab, sizeof (CompButtonGrab) * s->nButtonGrab); } } @@ -3321,7 +3321,7 @@ updateClientListForScreen (CompScreen *s) { CompWindow **list; - list = realloc (s->clientList, + list = (CompWindow **) realloc (s->clientList, (sizeof (CompWindow *) + sizeof (Window) * 2) * n); if (!list) return; @@ -3617,7 +3617,7 @@ addGroupToScreen (CompScreen *s, { CompGroup *group; - group = malloc (sizeof (CompGroup)); + group = (CompGroup *) malloc (sizeof (CompGroup)); if (!group) return NULL; @@ -4180,7 +4180,7 @@ updateDefaultIcon (CompScreen *screen) if (!readImageFromFile (screen->display, file, &width, &height, &data)) return FALSE; - icon = malloc (sizeof (CompIcon) + width * height * sizeof (CARD32)); + icon = (CompIcon *) malloc (sizeof (CompIcon) + width * height * sizeof (CARD32)); if (!icon) { free (data); diff --git a/src/session.c b/src/session.cpp index 2ea8f85..28f60cd 100644 --- a/src/session.c +++ b/src/session.cpp @@ -60,7 +60,7 @@ setStringListProperty (SmcConn connection, prop.name = (char *) name; prop.type = SmLISTofARRAY8; - prop.vals = malloc (nValues * sizeof (SmPropValue)); + prop.vals = (SmPropValue *) malloc (nValues * sizeof (SmPropValue)); if (!prop.vals) return; @@ -87,7 +87,7 @@ setCloneRestartCommands (SmcConn connection) /* at maximum, we pass our old arguments + our new client id to the SM, so allocate for that case */ - args = malloc ((programArgc + 2) * sizeof (char *)); + args = (const char **) malloc ((programArgc + 2) * sizeof (char *)); if (!args) return; diff --git a/src/texture.c b/src/texture.cpp index 0002e03..78a838b 100644 --- a/src/texture.c +++ b/src/texture.cpp @@ -102,11 +102,11 @@ imageToTexture (CompScreen *screen, GLenum format, GLenum type) { - char *data; - int i; - GLint internalFormat; + char *data; + unsigned int i; + GLint internalFormat; - data = malloc (4 * width * height); + data = (char *) malloc (4 * width * height); if (!data) return FALSE; @@ -210,7 +210,7 @@ readImageToTexture (CompScreen *screen, &width, &height, &image)) return FALSE; - status = imageBufferToTexture (screen, texture, image, width, height); + status = imageBufferToTexture (screen, texture, (char *)image, width, height); free (image); diff --git a/src/window.c b/src/window.cpp index 78db007..378b10e 100644 --- a/src/window.c +++ b/src/window.cpp @@ -1683,7 +1683,7 @@ updateWindowStruts (CompWindow *w) unsigned long n, left; unsigned char *data; Bool hasOld, hasNew; - CompStruts old, new; + CompStruts old, c_new; #define MIN_EMPTY 76 @@ -1703,25 +1703,25 @@ updateWindowStruts (CompWindow *w) hasNew = FALSE; - new.left.x = 0; - new.left.y = 0; - new.left.width = 0; - new.left.height = w->screen->height; + c_new.left.x = 0; + c_new.left.y = 0; + c_new.left.width = 0; + c_new.left.height = w->screen->height; - new.right.x = w->screen->width; - new.right.y = 0; - new.right.width = 0; - new.right.height = w->screen->height; + c_new.right.x = w->screen->width; + c_new.right.y = 0; + c_new.right.width = 0; + c_new.right.height = w->screen->height; - new.top.x = 0; - new.top.y = 0; - new.top.width = w->screen->width; - new.top.height = 0; + c_new.top.x = 0; + c_new.top.y = 0; + c_new.top.width = w->screen->width; + c_new.top.height = 0; - new.bottom.x = 0; - new.bottom.y = w->screen->height; - new.bottom.width = w->screen->width; - new.bottom.height = 0; + c_new.bottom.x = 0; + c_new.bottom.y = w->screen->height; + c_new.bottom.width = w->screen->width; + c_new.bottom.height = 0; result = XGetWindowProperty (w->screen->display->display, w->id, w->screen->display->wmStrutPartialAtom, @@ -1741,27 +1741,27 @@ updateWindowStruts (CompWindow *w) gap = w->screen->width - struts[0] - struts[1]; gap -= MIN_EMPTY; - new.left.width = (int) struts[0] + MIN (0, gap / 2); - new.right.width = (int) struts[1] + MIN (0, gap / 2); + c_new.left.width = (int) struts[0] + MIN (0, gap / 2); + c_new.right.width = (int) struts[1] + MIN (0, gap / 2); gap = w->screen->height - struts[2] - struts[3]; gap -= MIN_EMPTY; - new.top.height = (int) struts[2] + MIN (0, gap / 2); - new.bottom.height = (int) struts[3] + MIN (0, gap / 2); + c_new.top.height = (int) struts[2] + MIN (0, gap / 2); + c_new.bottom.height = (int) struts[3] + MIN (0, gap / 2); - new.right.x = w->screen->width - new.right.width; - new.bottom.y = w->screen->height - new.bottom.height; + c_new.right.x = w->screen->width - c_new.right.width; + c_new.bottom.y = w->screen->height - c_new.bottom.height; - new.left.y = struts[4]; - new.left.height = struts[5] - new.left.y + 1; - new.right.y = struts[6]; - new.right.height = struts[7] - new.right.y + 1; + c_new.left.y = struts[4]; + c_new.left.height = struts[5] - c_new.left.y + 1; + c_new.right.y = struts[6]; + c_new.right.height = struts[7] - c_new.right.y + 1; - new.top.x = struts[8]; - new.top.width = struts[9] - new.top.x + 1; - new.bottom.x = struts[10]; - new.bottom.width = struts[11] - new.bottom.x + 1; + c_new.top.x = struts[8]; + c_new.top.width = struts[9] - c_new.top.x + 1; + c_new.bottom.x = struts[10]; + c_new.bottom.width = struts[11] - c_new.bottom.x + 1; } XFree (data); @@ -1787,20 +1787,20 @@ updateWindowStruts (CompWindow *w) gap = w->screen->width - struts[0] - struts[1]; gap -= MIN_EMPTY; - new.left.width = (int) struts[0] + MIN (0, gap / 2); - new.right.width = (int) struts[1] + MIN (0, gap / 2); + c_new.left.width = (int) struts[0] + MIN (0, gap / 2); + c_new.right.width = (int) struts[1] + MIN (0, gap / 2); gap = w->screen->height - struts[2] - struts[3]; gap -= MIN_EMPTY; - new.top.height = (int) struts[2] + MIN (0, gap / 2); - new.bottom.height = (int) struts[3] + MIN (0, gap / 2); + c_new.top.height = (int) struts[2] + MIN (0, gap / 2); + c_new.bottom.height = (int) struts[3] + MIN (0, gap / 2); - new.left.x = 0; - new.right.x = w->screen->width - new.right.width; + c_new.left.x = 0; + c_new.right.x = w->screen->width - c_new.right.width; - new.top.y = 0; - new.bottom.y = w->screen->height - new.bottom.height; + c_new.top.y = 0; + c_new.bottom.y = w->screen->height - c_new.bottom.height; } XFree (data); @@ -1821,57 +1821,57 @@ updateWindowStruts (CompWindow *w) x2 = x1 + w->screen->display->screenInfo[i].width; y2 = y1 + w->screen->display->screenInfo[i].height; - strutX1 = new.left.x; - strutX2 = strutX1 + new.left.width; + strutX1 = c_new.left.x; + strutX2 = strutX1 + c_new.left.width; if (strutX2 > x1 && strutX2 <= x2) { - new.left.x = x1; - new.left.width = strutX2 - x1; + c_new.left.x = x1; + c_new.left.width = strutX2 - x1; } - strutX1 = new.right.x; - strutX2 = strutX1 + new.right.width; + strutX1 = c_new.right.x; + strutX2 = strutX1 + c_new.right.width; if (strutX1 > x1 && strutX1 <= x2) { - new.right.x = strutX1; - new.right.width = x2 - strutX1; + c_new.right.x = strutX1; + c_new.right.width = x2 - strutX1; } - strutY1 = new.top.y; - strutY2 = strutY1 + new.top.height; + strutY1 = c_new.top.y; + strutY2 = strutY1 + c_new.top.height; if (strutY2 > y1 && strutY2 <= y2) { - new.top.y = y1; - new.top.height = strutY2 - y1; + c_new.top.y = y1; + c_new.top.height = strutY2 - y1; } - strutY1 = new.bottom.y; - strutY2 = strutY1 + new.bottom.height; + strutY1 = c_new.bottom.y; + strutY2 = strutY1 + c_new.bottom.height; if (strutY1 > y1 && strutY1 <= y2) { - new.bottom.y = strutY1; - new.bottom.height = y2 - strutY1; + c_new.bottom.y = strutY1; + c_new.bottom.height = y2 - strutY1; } } } if (hasOld != hasNew || (hasNew && hasOld && - memcmp (&new, &old, sizeof (CompStruts)))) + memcmp (&c_new, &old, sizeof (CompStruts)))) { if (hasNew) { if (!w->struts) { - w->struts = malloc (sizeof (CompStruts)); + w->struts = (CompStruts *) malloc (sizeof (CompStruts)); if (!w->struts) return FALSE; } - *w->struts = new; + *w->struts = c_new; } else { @@ -1896,7 +1896,7 @@ setDefaultWindowAttributes (XWindowAttributes *wa) wa->depth = 0; wa->visual = NULL; wa->root = None; - wa->class = InputOnly; + wa->c_class = InputOnly; wa->bit_gravity = NorthWestGravity; wa->win_gravity = NorthWestGravity; wa->backing_store = NotUseful; @@ -2039,7 +2039,7 @@ addWindow (CompScreen *screen, if (screen->windowPrivateLen) { - privates = malloc (screen->windowPrivateLen * sizeof (CompPrivate)); + privates = (CompPrivate *) malloc (screen->windowPrivateLen * sizeof (CompPrivate)); if (!privates) { destroyTexture (screen, w->texture); @@ -2126,7 +2126,7 @@ addWindow (CompScreen *screen, EMPTY_REGION (w->region); - if (w->attrib.class != InputOnly) + if (w->attrib.c_class != InputOnly) { REGION rect; @@ -2432,7 +2432,7 @@ mapWindow (CompWindow *w) if (w->struts) updateWorkareaForScreen (w->screen); - if (w->attrib.class == InputOnly) + if (w->attrib.c_class == InputOnly) return; w->unmapRefCnt = 1; @@ -2717,7 +2717,7 @@ initializeSyncCounter (CompWindow *w) static Bool syncWaitTimeout (void *closure) { - CompWindow *w = closure; + CompWindow *w = (CompWindow *) closure; w->syncWaitHandle = 0; handleSyncAlarm (w); @@ -4282,7 +4282,7 @@ static void revealAncestors (CompWindow *w, void *closure) { - CompWindow *transient = closure; + CompWindow *transient = (CompWindow *) closure; if (isAncestorTo (transient, w)) { @@ -4615,7 +4615,7 @@ static void minimizeTransients (CompWindow *w, void *closure) { - CompWindow *ancestor = closure; + CompWindow *ancestor = (CompWindow *) closure; if (w->transientFor == ancestor->id || isGroupTransient (w, ancestor->clientLeader)) @@ -4644,7 +4644,7 @@ static void unminimizeTransients (CompWindow *w, void *closure) { - CompWindow *ancestor = closure; + CompWindow *ancestor = (CompWindow *) closure; if (w->transientFor == ancestor->id || isGroupTransient (w, ancestor->clientLeader)) @@ -4975,12 +4975,12 @@ getWindowIcon (CompWindow *w, if (iw && ih) { - icon = malloc (sizeof (CompIcon) + + icon = (CompIcon *) malloc (sizeof (CompIcon) + iw * ih * sizeof (CARD32)); if (!icon) continue; - pIcon = realloc (w->icon, + pIcon = (CompIcon **) realloc (w->icon, sizeof (CompIcon *) * (w->nIcon + 1)); if (!pIcon) { |