Changeset 7044
- Timestamp:
- May 2, 2006, 1:02:29 PM (20 years ago)
- File:
-
- 1 edited
-
trunk/psLib/src/mathtypes/psVector.c (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/mathtypes/psVector.c
r7042 r7044 9 9 * @author Robert DeSonia, MHPCC 10 10 * 11 * @version $Revision: 1. 69$ $Name: not supported by cvs2svn $12 * @date $Date: 2006-05-02 2 1:48:55$11 * @version $Revision: 1.70 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2006-05-02 23:02:29 $ 13 13 * 14 14 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 206 206 207 207 output = psVectorRecycle(output, nElements, type); 208 if (nElements == 0) { 209 psWarning("Warning: psVector was copied with 0 elements!\n"); 210 return output; 211 } 208 212 output->n = nElements; 209 213 … … 333 337 case PS_TYPE_##NAME: { \ 334 338 ps##NAME temp; \ 335 ps##NAME *value = out ->data.NAME; \339 ps##NAME *value = outVector->data.NAME; \ 336 340 for (;;) { \ 337 341 if (l > 0) { \ … … 342 346 if (--ir == 0) { \ 343 347 value[0] = temp; \ 344 return out ; \348 return outVector; \ 345 349 } \ 346 350 } \ … … 372 376 } 373 377 374 psVector *out = psVectorCopy(outVector, inVector, inVector->type.type); // Copy to sort in place 375 long N = out->n; // Number of elements 378 // printf("\nbefore psVectorCopy\n"); 379 // psVector *out = psVectorCopy(outVector, inVector, inVector->type.type); // Copy to sort in place 380 outVector = psVectorCopy(outVector, inVector, inVector->type.type); 381 // printf("\nafter psVectorCopy\n"); 382 if (outVector == NULL) { 383 psError(PS_ERR_BAD_PARAMETER_NULL, true, 384 "Error in psVectorSort: psVectorCopy returned NULL vector!\n"); 385 return NULL; 386 } 387 long N = outVector->n; // Number of elements 376 388 if (N < 2) { 377 return out; 389 psError(PS_ERR_BAD_PARAMETER_VALUE, true, 390 "Error in psVectorSort: Vector has less than 2 data entries!\n"); 391 psFree(outVector); 392 // psFree(outVector); 393 // outVector = NULL; 394 return NULL; 378 395 } 379 396 long l = N >> 1; 380 397 long ir = N - 1; 381 switch (out ->type.type) {398 switch (outVector->type.type) { 382 399 PSVECTOR_SORT_CASE(U8); 383 400 PSVECTOR_SORT_CASE(U16); … … 397 414 return NULL; 398 415 } 399 return out ;416 return outVector; 400 417 } 401 418
Note:
See TracChangeset
for help on using the changeset viewer.
